* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2c3a1c; color: #2a1d12;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(30,18,6,.38) 100%); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.hand { font-family: "Segoe Print", "Bradley Hand", "Noteworthy", "Chalkboard SE", "Comic Neue", cursive; }

/* ---- paper tags and the day stamp ---- */
#hud { position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.tag { position: relative; min-width: 76px; height: 50px; padding: 6px 12px 6px 26px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(170deg, #f3e3bd, #e2cc98); border-radius: 4px 12px 12px 4px; box-shadow: 0 3px 6px rgba(0,0,0,.35), inset 0 0 12px rgba(150,110,50,.25);
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%); }
#catchTag { transform: rotate(2deg); } #netTag { transform: rotate(-2deg); }
.tag .hole { position: absolute; left: 10px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #5a4224; box-shadow: inset 0 1px 2px #000; }
.tag small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #6b5030; }
.tag b { font-size: 22px; line-height: 1; color: #2a1d12; }
.tag.bump { animation: bump .45s; }
@keyframes bump { 30% { transform: scale(1.18) rotate(-4deg); } }
.stamp { border: 2.5px solid rgba(160,40,30,.8); color: rgba(160,40,30,.85); border-radius: 6px; padding: 3px 9px; text-align: center; transform: rotate(-3deg);
  font-family: "Courier New", monospace; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; background: rgba(250,240,215,.55);
  -webkit-mask: radial-gradient(circle at 30% 40%, #000 60%, rgba(0,0,0,.75) 100%); }
.stamp small { display: block; font-size: 9px; letter-spacing: .12em; }
#day { margin-top: 4px; }

/* ---- tool toggle by the thumb ---- */
#tool { position: fixed; right: calc(env(safe-area-inset-right) + 14px); bottom: calc(env(safe-area-inset-bottom) + 14px); width: 150px; height: 74px; border: 0; border-radius: 38px; padding: 6px;
  display: flex; gap: 6px; background: linear-gradient(180deg, #7a4b28, #55311a); box-shadow: 0 5px 10px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,220,180,.35);
  outline: 2px dashed rgba(240,200,140,.45); outline-offset: -6px; }
#tool .slot { flex: 1; border-radius: 30px; display: grid; place-items: center; transition: transform .15s, background .15s, box-shadow .15s; background: rgba(0,0,0,.18); }
#tool .slot svg { width: 40px; height: 40px; opacity: .45; transition: opacity .15s; }
#tool[data-tool=shears] .shears, #tool[data-tool=net] .net { background: linear-gradient(180deg, #f3e3bd, #dcc28a); box-shadow: 0 2px 4px rgba(0,0,0,.4); transform: translateY(-2px); }
#tool[data-tool=shears] .shears svg, #tool[data-tool=net] .net svg { opacity: 1; }
#tool em { position: absolute; top: -22px; right: 18px; font-style: normal; font-size: 12px; color: #fff6e0; text-shadow: 0 1px 3px #000; letter-spacing: .06em; }
#tool.nudge { animation: nudge 1s infinite; }
@keyframes nudge { 50% { transform: translateY(-4px); box-shadow: 0 0 0 6px rgba(255,230,150,.5), 0 5px 10px rgba(0,0,0,.45); } }
body.fine #tool em::after { content: " · Space"; opacity: .7; }

.leather-btn { position: fixed; left: calc(env(safe-area-inset-left) + 14px); bottom: calc(env(safe-area-inset-bottom) + 14px); width: 64px; height: 74px; border: 0; padding: 0;
  border-radius: 6px 10px 10px 6px; background: linear-gradient(90deg, #4a2a16 0 12%, #7a4426 14%, #8a5030 60%, #6a3a1e); box-shadow: 0 5px 10px rgba(0,0,0,.45), inset 0 0 0 3px rgba(0,0,0,.15);
  outline: 1.5px dashed rgba(240,200,140,.5); outline-offset: -7px; }
.leather-btn .book::after { content: "❦"; font-size: 26px; color: #e8c88a; text-shadow: 0 -1px 0 rgba(0,0,0,.5); }
.leather-btn.bump { animation: bump .5s; }
.mini { min-width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(40,26,12,.55); color: #fff3d8; font-size: 18px; }
#mute { position: fixed; left: calc(env(safe-area-inset-left) + 90px); bottom: calc(env(safe-area-inset-bottom) + 28px); }

#hint { position: fixed; left: 50%; bottom: var(--hint-bottom, 104px); transform: translateX(-50%) rotate(-.6deg); width: min(360px, calc(100vw - 28px)); max-height: 80px; overflow: hidden; padding: 7px 12px;
  background: linear-gradient(170deg, #fbf3dc, #efe0b8); box-shadow: 0 4px 10px rgba(0,0,0,.35); border-radius: 3px; font-size: 14px; line-height: 1.3; text-align: center; pointer-events: none; }
#hint b { color: #7a3b14; }

/* ---- catch cards ---- */
#cards { position: fixed; inset: 0; pointer-events: none; }
.card { position: absolute; width: 150px; padding: 10px 10px 8px; background: linear-gradient(170deg, #fbf3dc, #ecdcb2); border-radius: 4px; box-shadow: 0 8px 20px rgba(0,0,0,.4);
  text-align: center; transform: translate(-50%, -100%) scale(.2); opacity: 0; transition: transform .45s cubic-bezier(.2,1.6,.4,1), opacity .2s, left .6s ease-in, top .6s ease-in; }
.card.in { transform: translate(-50%, -100%) scale(1) rotate(-3deg); opacity: 1; }
.card.out { transform: translate(-50%, -50%) scale(.15) rotate(-20deg); opacity: .0; transition: transform .6s ease-in, opacity .6s ease-in, left .6s ease-in, top .6s ease-in; }
.card img { width: 110px; height: 90px; object-fit: contain; }
.card h4 { margin: 0; font-size: 15px; }
.card .new { position: absolute; top: 6px; right: -6px; transform: rotate(12deg); font-size: 10px; padding: 2px 5px; }
.card.rare { background: linear-gradient(170deg, #fff6d8, #f0d78a); box-shadow: 0 0 0 3px #e2b33c, 0 8px 24px rgba(0,0,0,.45); }
.float { position: absolute; transform: translate(-50%, -100%); color: #fff6e0; font-weight: 700; text-shadow: 0 1px 4px #000; animation: rise 1.4s forwards; white-space: nowrap; }
@keyframes rise { to { transform: translate(-50%, -260%); opacity: 0; } }

/* ---- result sheet ---- */
#sheet { position: fixed; inset: 0; display: grid; place-items: end center; padding: 12px; background: rgba(20,12,4,.35); }
#sheet .paper { position: relative; width: min(420px, 100%); max-height: calc(100% - 20px); overflow: auto; padding: 22px 20px 14px; border-radius: 6px; text-align: center;
  background: radial-gradient(ellipse at 30% 20%, #fdf7e6, #efe0b8 80%); box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: up .5s cubic-bezier(.2,1.2,.4,1); }
@keyframes up { from { transform: translateY(110%); } }
#sheet h2 { margin: 4px 0 2px; font-size: 26px; }
#sScore { margin: 0 0 8px; font-size: 18px; }
#sCreatures { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 10px; }
#sCreatures img { width: 56px; height: 56px; }
#sNote { margin: 8px 0; font-size: 14px; color: #5a4024; }
.stamp.big { position: absolute; top: 14px; right: 14px; font-size: 12px; transform: rotate(8deg); }
.btns { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.btn { min-height: 46px; border-radius: 8px; border: 1.5px solid #6b4a2a; background: #f6ead0; font-size: 16px; }
.btn.primary { background: linear-gradient(180deg, #7a4b28, #55311a); color: #fff3d8; border-color: #3a2010; }
.foot { margin: 12px 0 0; font-size: 13px; }
.foot a { color: #6b4020; }

/* ---- the field journal ---- */
#journal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,12,4,.55); padding: 10px; }
/* flat 2D on purpose: iOS Safari drops the page out of 3D-transformed books (round one's journal showed blank there) */
.book { position: relative; width: min(420px, 94vw); height: min(640px, calc(100vh - 40px)); height: min(640px, calc(100dvh - 40px)); }
.pages { position: absolute; inset: 0; display: flex; flex-direction: column; border-radius: 4px 10px 10px 4px; background: #5a2f18; padding: 10px 10px 0 6px; box-shadow: 0 16px 40px rgba(0,0,0,.6); }
#page { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 2px 6px 6px 2px; padding: 14px 14px 10px 22px; touch-action: pan-y;
  background: radial-gradient(ellipse at 70% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(90deg, rgba(90,60,20,.25), transparent 6%), #efe2bf;
  box-shadow: inset 0 0 30px rgba(140,100,40,.35); transform-origin: left center; }
.cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: 4px 12px 12px 4px;
  background: radial-gradient(ellipse at 40% 30%, #8e5532, #5a2f18 75%), #6a381c; box-shadow: inset 0 0 0 10px rgba(0,0,0,.12), inset 0 0 40px rgba(0,0,0,.5);
  outline: 2px dashed rgba(230,190,130,.55); outline-offset: -16px; transform-origin: left center; transition: transform .7s cubic-bezier(.5,0,.3,1), filter .7s, visibility 0s .7s; }
#journal.open .cover { transform: scaleX(0); filter: brightness(.45); visibility: hidden; pointer-events: none; }
.emboss { font-size: 34px; color: #e8c88a; text-shadow: 0 -1px 0 rgba(0,0,0,.6), 0 1px 0 rgba(255,220,160,.25); letter-spacing: .05em; }
.cover .sub { font-size: 14px; color: #c9a46a; letter-spacing: .3em; text-transform: uppercase; }
.strap { position: absolute; right: -6px; top: 46%; width: 50px; height: 34px; border-radius: 6px 0 0 6px; background: #3f200e; box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.jnav { flex: none; height: 56px; display: flex; align-items: center; justify-content: center; gap: 22px; }
.jnav .mini { background: rgba(250,230,190,.16); font-size: 24px; }
.jnav .mini:disabled { opacity: .3; }
#jFolio { min-width: 60px; text-align: center; color: #e8c88a; font-size: 15px; letter-spacing: .08em; }
#jClose { position: absolute; top: -8px; right: -8px; background: #3f200e; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
#page h3 { margin: 0 0 2px; font-size: 22px; }
#page .lede { margin: 0 0 10px; font-size: 13px; color: #6b5030; }
.entries { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px 10px; }
.entry { position: relative; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 4px 2px 6px; border-bottom: 1px dashed rgba(90,60,30,.3); text-align: center; }
.entry img { flex: 1; min-height: 0; width: 100%; max-height: 150px; object-fit: contain; }
.entry h5 { margin: 0; font-size: 14px; }
.entry p { margin: 2px 0 0; font-size: 11.5px; line-height: 1.25; color: #4a3420; }
.entry .seen { position: absolute; top: 4px; right: 0; font-size: 9px; padding: 1px 4px; transform: rotate(10deg); }
.entry .count { position: absolute; top: 4px; left: 2px; font-size: 12px; color: #6b5030; }
.entry .press { position: absolute; left: 4px; top: 24px; width: 18px; height: 34px; opacity: .6; background: linear-gradient(80deg, transparent 45%, #6a8a3a 46% 54%, transparent 55%); transform: rotate(-20deg); }
.entry.unknown h5 { color: rgba(60,40,20,.45); }
.stats { flex: none; margin: 10px 0 0; font-size: 13px; color: #4a3420; }

@media (min-width: 900px) {
  #tool { right: 32px; bottom: 32px; } .leather-btn { left: 32px; bottom: 32px; } #mute { left: 108px; bottom: 46px; }
  #hud { left: 32px; right: 32px; top: 24px; }
  #hint { left: 32px; bottom: 130px; transform: rotate(-1deg); width: min(300px, 24vw); max-height: none; padding: 10px 14px; font-size: 15px; text-align: left; } /* in the margin, off the field */
}
