/* Layout: header, pan-and-zoom picture, find tray. One deliberate night-greenhouse look. */
@font-face { font-family: "Cinzel GK"; src: url("fonts/cinzel-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Crimson GK"; src: url("fonts/crimson-pro-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Crimson GK"; src: url("fonts/crimson-pro-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --night: #1d2419;
  --leaf: #2f3b27;
  --parchment: #f3e9d0;
  --gold: #e2b04a;
  --ink: #221c12;
  --head: "Cinzel GK", "Cinzel", Georgia, serif;
  --body: "Crimson GK", "Crimson Pro", Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--night); color: var(--parchment); font: 17px/1.35 var(--body); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

#game { height: 100%; display: flex; flex-direction: column; position: relative; }

#bar { display: flex; align-items: center; gap: 8px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.title { flex: 1; min-width: 0; }
h1 { font: 700 clamp(15px, 4.4vw, 22px)/1.15 var(--head); margin: 0; }
#count { margin: 0; color: var(--gold); font-variant-numeric: tabular-nums; }

button { font: 600 17px/1.1 var(--body); color: var(--parchment); background: var(--leaf); border: 2px solid #55674a; border-radius: 999px; min-height: 44px; padding: 8px 16px; cursor: pointer; touch-action: manipulation; }
button.round { width: 44px; padding: 0; font-size: 24px; }
button.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

#stage { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; cursor: grab; background: #131810; }
#world { position: absolute; left: 0; top: 0; width: 2400px; height: 1792px; transform-origin: 0 0; }
#scene { display: block; width: 2400px; height: 1792px; max-width: none; pointer-events: none; -webkit-touch-callout: none; }
#hidden, #marks { position: absolute; inset: 0; pointer-events: none; }

.thing { position: absolute; overflow: hidden; }
.thing img { display: block; width: 100%; max-width: none; filter: sepia(.12) saturate(.92) brightness(.97); }
.thing.flip img { transform: scaleX(-1); }
.thing.found { overflow: visible; animation: pop .5s ease-out; z-index: 2; }
.thing.found img { filter: drop-shadow(0 0 6px var(--gold)) drop-shadow(0 0 14px var(--gold)); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.7); } 100% { transform: scale(1); } }

.ring { position: absolute; border-radius: 50%; border: 10px dashed var(--gold); box-shadow: 0 0 0 6px rgba(34, 28, 18, .55); animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); } }
.miss { position: absolute; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; border: 6px solid #fff; animation: fade .5s ease-out forwards; }
@keyframes fade { from { opacity: .9; transform: scale(.4); } to { opacity: 0; transform: scale(1.3); } }

#toast { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 18px; text-align: center; font-weight: 600; font-size: 19px; color: var(--ink); background: var(--parchment); border: 3px solid var(--gold); border-radius: 18px; opacity: 0; transition: opacity .25s; pointer-events: none; }
#toast.show { opacity: 1; }

#tray { list-style: none; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding-block: 8px 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#tray button { width: 100%; height: 54px; padding: 4px; border-radius: 12px; background: var(--parchment); border-color: var(--parchment); position: relative; display: grid; place-items: center; }
#tray img { max-width: 100%; max-height: 42px; }
#tray .done { background: var(--leaf); border-color: var(--gold); }
#tray .done img { opacity: .35; }
#tray .done::after { content: "\2713"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; color: var(--gold); text-shadow: 0 0 4px #000; }
@media (min-width: 760px) { #tray { grid-template-columns: repeat(11, minmax(0, 1fr)); } }

.cover { position: absolute; inset: 0; z-index: 5; display: flex; overflow: auto; padding: 16px max(16px, env(safe-area-inset-left, 0px)); background: rgba(19, 24, 16, .86); }
.card { margin: auto; width: 100%; max-width: 440px; padding: 22px 20px; text-align: center; color: var(--ink); background: var(--parchment); border: 4px solid var(--gold); border-radius: 22px; }
.card h2 { font: 700 26px/1.15 var(--head); margin: 0 0 8px; text-wrap: balance; }
.card p { margin: 8px 0; font-size: 19px; }
.card .how { font-weight: 600; }
.card .safety { font-size: 16px; margin-top: 14px; }
.faces { list-style: none; display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 6px 0; padding: 0; }
.faces img { height: 92px; width: auto; }
.choices { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
button.big { flex: 1 1 160px; min-height: 60px; font-size: 20px; }
button.big small { display: block; font-size: 15px; font-weight: 400; }

@media (prefers-reduced-motion: reduce) { .thing.found, .ring, .miss { animation: none; } .miss { opacity: .6; } }

.card .back { margin: 10px 0 0; font-size: 18px; }
.card .back a { color: var(--ink); font-weight: 600; display: inline-block; padding: 8px 12px; }
