@font-face { font-family: 'Shrikhand'; src: url(fonts/shrikhand.woff2) format('woff2'); font-display: block; }
@font-face { font-family: 'DM Mono'; font-weight: 400; src: url(fonts/dmmono-400.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'DM Mono'; font-weight: 500; src: url(fonts/dmmono-500.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Serif'; font-style: normal; src: url(fonts/instrument.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; src: url(fonts/instrument-italic.woff2) format('woff2'); font-display: swap; }

:root {
  --paper: #fffaf0;
  --ink: #1b1b1b;
  --pink: #ff5d8f;
  --mint: #b8fff3;
  --gold: #ffd166;
  --neon: #e2ff3d;
  --night: #120c1f;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .9, .25, 1.15);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--ink); overscroll-behavior: none; }
body { font-family: 'Instrument Serif', Georgia, serif; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; cursor: pointer; }

#c { position: fixed; inset: 0; display: block; touch-action: none; cursor: default; }
#c:active { cursor: grabbing; }

#grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .16; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.2 -0.1'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
#grain::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(10, 5, 20, .55) 100%); mix-blend-mode: multiply; opacity: 1.6; }

/* --- HUD ---------------------------------------------------------------- */
#hud { position: fixed; top: calc(var(--safe-t) + 12px); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; z-index: 5; pointer-events: none; }
#place { display: flex; flex-direction: row; align-items: center; gap: 10px; max-width: calc(100vw - 140px); padding: 9px 14px 10px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--pink); pointer-events: auto; opacity: 0; transform: translateY(calc(-100% - 40px)) rotate(-1deg); transition: opacity .3s, transform .75s cubic-bezier(.34, 1.7, .5, 1); }
#place.show { opacity: 1; transform: translateY(0) rotate(-1deg); }
/* leaving through an eye: it dips, then flies up off the top */
#place.leaving { transition: opacity .35s .2s, transform .5s cubic-bezier(.6, -.6, .75, .45); }
#place-name { font-family: 'Shrikhand', serif; font-size: 20.5px; line-height: 1.05; letter-spacing: .2px; }
#place-depth { font-family: 'DM Mono', monospace; font-size: 14px; text-transform: lowercase; opacity: .7; }
#buttons { position: relative; display: flex; gap: 8px; pointer-events: auto; }
/* the sound button's popover: same card as the name plate, a switch per row */
#sound-pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 8; width: 222px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; padding: 5px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--pink); opacity: 0; pointer-events: none; transform: translateY(-6px) scale(.92); transform-origin: top right; transition: opacity .18s, transform .3s cubic-bezier(.34, 1.6, .5, 1); }
#sound-pop.show { opacity: 1; pointer-events: auto; transform: none; }
.snd-row { background: none; border: 0; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 9px 9px 9px 10px; font: 500 15px/1 'DM Mono', monospace; color: var(--ink); border-radius: 9px; white-space: nowrap; transition: background .15s; }
.snd-row:hover { background: rgba(27, 27, 27, .06); }
.snd-row .sw { position: relative; flex: none; width: 36px; height: 21px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; transition: background .2s; }
.snd-row .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); transition: transform .25s cubic-bezier(.34, 1.6, .5, 1), background .2s; }
.snd-row.on .sw { background: var(--ink); }
.snd-row.on .sw::after { transform: translateX(15px); background: var(--paper); }
/* above the camera buttons and the tips line while it's open */
#hud:has(#sound-pop.show) { z-index: 8; }
/* the player: wide enough for the longest song name, with the buttons centered underneath */
.snd-row.track { flex-direction: column; gap: 9px; padding-top: 10px; padding-bottom: 6px; }
.snd-row.track:hover { background: none; }
.snd-row.track .track-n { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.track-nav { display: flex; gap: 10px; align-items: center; }
.snd-row.track.one .track-nav [data-step] { visibility: hidden; }
.track-nav .play .i-play { display: none; }
.track-nav .play.paused .i-play { display: block; }
.track-nav .play.paused .i-pause { display: none; }
.track-nav .tip-nav { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink); background: #fff; font: 16px/1 'DM Mono', monospace; display: grid; place-items: center; transition: transform .12s var(--ease); }
.track-nav .tip-nav:active { transform: scale(.9); }
.round { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper); display: grid; place-items: center; box-shadow: 2px 2px 0 var(--ink); transition: transform .15s var(--ease), box-shadow .15s; }
.round:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.badge { position: absolute; top: -3px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--pink); color: #fff; font: 500 9.5px/14px 'DM Mono', monospace; line-height: 13px; border: 1.5px solid var(--ink); transition: transform .3s var(--ease); }
#btn-sound .off { display: none; }
#btn-sound.off .off { display: block; }
#btn-sound.off .on { display: none; }
#btn-gallery { position: fixed; right: 12px; top: calc(var(--safe-t) + 70px); z-index: 5; }
#btn-snap { position: fixed; right: 66px; top: calc(var(--safe-t) + 70px); z-index: 5; }
/* the hand: it swells when it's over something touchable, and squeezes while you hold */
/* the cursor everywhere (mice only): a little white dot; over anything you can click it becomes a
   pointing finger, and while you drag something the hand closes around it */
/* the browser's own cursor only hides once ours has appeared (after the mouse first moves) */
@media (pointer: fine) { html.cc, html.cc body, html.cc body * { cursor: none !important; } }
#hand { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; width: 0; height: 0; opacity: 0; transition: opacity .15s; filter: drop-shadow(1px 2px 0 rgba(27, 27, 27, .35)); }
#hand.show { opacity: 1; }
#hand .dot { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: #fffaf0; border: 1.6px solid #1b1b1b; box-sizing: border-box; transition: scale .18s var(--ease), opacity .12s; }
#hand svg { position: absolute; display: block; opacity: 0; scale: .5; transition: opacity .12s, scale .22s cubic-bezier(.2, 1.6, .4, 1); }
#hand svg.point { left: -9px; top: -2px; transform-origin: 30% 8%; }
#hand svg.grab { left: -12px; top: -9px; transform-origin: 40% 30%; }
/* over a text box: an I-beam in the same style */
#hand svg.ibeam { left: -7px; top: -13px; transform-origin: 50% 50%; }
#hand.text .dot { opacity: 0; scale: .4; }
#hand.text svg.ibeam { opacity: 1; scale: 1; }
#hand.grabbing .dot, #hand.finger .dot { opacity: 0; scale: .4; }
#hand.finger svg.point { opacity: 1; scale: 1.05; }
#hand.finger.hold svg.point { scale: .92; }
/* dragging something: the fingers close around it */
#hand.grabbing svg.grab { opacity: 1; scale: 1; }
#flash { position: fixed; inset: 0; z-index: 30; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
/* tips: the lightbulb (bottom right) switches them on and off; a tip is a card that points at its thing */
#btn-tips { position: fixed; right: 12px; bottom: calc(var(--safe-b, 0px) + 14px); z-index: 6; width: auto; padding: 0 16px 0 12px; border-radius: 999px; display: flex; align-items: center; gap: 7px; font: 700 13px/1 'DM Mono', monospace; letter-spacing: .3px; background: var(--neon); transition: background .2s, transform .15s var(--ease), box-shadow .15s; }
#btn-tips svg { transition: opacity .2s, transform .18s var(--ease); }
#btn-tips.off { background: var(--paper); }
#btn-tips.off svg { opacity: .35; }
#btn-tips.off .tips-label { opacity: .6; }
#tipcard { position: fixed; left: 0; top: 0; z-index: 7; width: max-content; max-width: min(250px, calc(100vw - 24px)); padding: 8px 28px 9px 10px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--pink); font: 12.5px/1.35 'DM Mono', monospace; color: var(--ink); opacity: 0; pointer-events: none; transform: translateY(6px) scale(.94); transition: opacity .25s, transform .35s cubic-bezier(.34, 1.6, .5, 1); }
#tipcard.show { opacity: 1; pointer-events: auto; transform: none; }
#tipcard b { font-weight: 700; }
#tipcard .tip-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; color: var(--ink); opacity: .6; transition: opacity .15s, transform .15s var(--ease); }
#tipcard .tip-x:hover { opacity: 1; transform: scale(1.12); }
/* the little pointer: on the bottom edge when the card sits above its thing, on top when below */
#tipcard .tail { position: absolute; left: var(--tx, 50%); bottom: -7px; width: 12px; height: 12px; margin-left: -6px; background: var(--paper); border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg); }
#tipcard.below .tail { bottom: auto; top: -7px; transform: rotate(225deg); }
#tipcard.right .tail { left: auto; right: -7px; bottom: auto; top: var(--ty, 50%); margin: -6px 0 0; transform: rotate(-45deg); }
#tipring { position: fixed; left: 0; top: 0; z-index: 6; border-radius: 50%; border: 2.5px solid var(--neon); box-shadow: 0 0 12px var(--neon); pointer-events: none; opacity: 0; transition: opacity .3s; }
#tipring.show { opacity: 1; animation: tipring 1.6s ease-in-out infinite; }
@keyframes tipring { 0%, 100% { scale: .9; } 50% { scale: 1.12; } }
/* narrow screens: the chat fills the bottom, so the switch sits under the top buttons */
@media (max-width: 860px) { #btn-tips { bottom: auto; top: calc(var(--safe-t) + 126px); } }

/* --- narration: a text adventure that scrolls over the world --------------- */
#chat { position: fixed; left: 12px; bottom: calc(var(--safe-b) + 14px + var(--kb, 0px)); width: min(520px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 8px; z-index: 6; pointer-events: none; }
#narration { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; pointer-events: none; }
.line { max-width: 100%; font-family: 'DM Mono', monospace; font-size: 18.5px; letter-spacing: .2px; line-height: 1.35; color: var(--ink); padding: 8px 14px 9px; border-radius: 18px; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--gold); opacity: 0; transform: translateY(10px); transition: opacity .6s, transform .6s var(--ease), filter .7s; text-wrap: pretty; }
.line.in { opacity: 1; transform: none; }
.line.out { opacity: 0; transform: translateY(-6px); filter: blur(4px); }
.line.big { font-family: 'Shrikhand', serif; font-size: 38px; line-height: 1.1; background: none; border: none; box-shadow: none; color: var(--paper); text-shadow: 2px 2px 0 var(--pink), 0 0 30px rgba(0,0,0,.4); padding: 0 2px; }
.line.roots { font-style: italic; }
.line.you { align-self: flex-end; }
.line.quiet { font-style: italic; }

/* --- whisper bar ------------------------------------------------------ */
#whisper { position: relative; width: 100%; pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; background: rgba(4, 30, 26, .78); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1.5px solid rgba(184, 255, 243, .45); border-radius: 26px; z-index: 6; transition: border-color .3s, box-shadow .3s, background .3s; }
#whisper:focus-within { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(184, 255, 243, .15), 0 0 40px rgba(184, 255, 243, .25); }
#whisper.to-creature { background: rgba(60, 10, 35, .8); border-color: rgba(255, 93, 143, .7); }
.whisper-glyph { color: var(--mint); opacity: .85; flex: none; }
#whisper-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--paper); font: italic 25px/1.2 'Instrument Serif', serif; padding: 8px 0; user-select: text; -webkit-user-select: text; }
#whisper-input::placeholder { color: rgba(184, 255, 243, .6); }
/* fills the field's height, with corners that follow the field's (26px outside, 6px in) */
#whisper .send { width: 50px; align-self: stretch; min-height: 38px; border-radius: 20px; border: 0; background: var(--mint); color: #04201b; display: grid; place-items: center; flex: none; }
#whisper.to-creature .send { background: var(--pink); color: #fff; }

/* --- nameplate ----------------------------------------------------------- */
#nameplate { position: fixed; left: 0; top: 0; z-index: 7; max-width: min(320px, calc(100vw - 20px)); padding: 10px 12px 11px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--pink); opacity: 0; pointer-events: none; transition: opacity .25s; }
#nameplate.show { opacity: 1; pointer-events: auto; }
.np-name { font-family: 'Shrikhand', serif; font-size: 20.5px; line-height: 1.1; }
.np-sub { font: 14px/1.35 'DM Mono', monospace; margin-top: 3px; opacity: .75; }
.np-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip { font: 500 15px/1 'DM Mono', monospace; padding: 8px 10px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; transition: transform .12s var(--ease); }
.chip:active { transform: scale(.94); }
.chip.talk { background: #ffe1ea; }
.chip.dive { background: var(--ink); color: var(--paper); }
.chip.dive-eye { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1.5px solid var(--ink); background: #fff; color: var(--ink); display: grid; place-items: center; transition: transform .2s var(--ease); }
.chip.dive-eye:active { transform: scale(.88); }

/* --- toast ---------------------------------------------------------------- */
#toast { position: fixed; top: calc(var(--safe-t) + 70px); left: 50%; z-index: 8; display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 8px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 18px; box-shadow: 4px 4px 0 var(--gold); transform: translate(-50%, -30px) scale(.9); opacity: 0; pointer-events: none; transition: opacity .4s, transform .5s var(--ease); max-width: calc(100vw - 24px); }
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast-portrait { flex: none; background: radial-gradient(circle at 50% 60%, #ffeef3, #fff6dc); border-radius: 12px; }
.toast-kicker { font: 500 13px/1 'DM Mono', monospace; text-transform: uppercase; letter-spacing: .8px; color: var(--pink); }
.toast-name { font-family: 'Shrikhand', serif; font-size: 23px; line-height: 1.1; margin-top: 3px; }
.toast-latin { font: 13px/1.3 'DM Mono', monospace; opacity: .7; }

/* --- panels: source + guide --------------------------------------------------- */
#scrim { position: fixed; inset: 0; z-index: 9; background: rgba(10, 5, 20, .35); opacity: 0; pointer-events: none; transition: opacity .3s; }
#scrim.show { opacity: 1; pointer-events: auto; }
.panel { position: fixed; z-index: 10; background: var(--paper); border: 1.5px solid var(--ink); display: flex; flex-direction: column; transition: transform .5s var(--ease); }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1.5px dashed rgba(27, 27, 27, .3); }
.panel-title { font-family: 'Shrikhand', serif; font-size: 25.5px; }
@media (min-width: 760px) {
  .panel { top: 12px; right: 12px; bottom: 12px; width: 420px; border-radius: 18px; box-shadow: 5px 5px 0 var(--pink); transform: translateX(calc(100% + 30px)); }
  .panel.open { transform: none; }
}
@media (max-width: 759px) {
  .panel { left: 0; right: 0; bottom: 0; max-height: 72vh; border-radius: 20px 20px 0 0; border-bottom: 0; box-shadow: 0 -4px 0 var(--pink); transform: translateY(105%); padding-bottom: var(--safe-b); }
  .panel.open { transform: none; }
}
.code-body, #guide-body, #gallery-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 24px; }
.code-body { font: 17px/1.75 'DM Mono', monospace; }
.code-body .ln { white-space: pre-wrap; word-break: break-word; }
.code-body .cm { color: #8a7f74; }
.code-body .cm i { font-style: italic; }
.code-body .kw { color: #c2185b; font-weight: 500; }
.code-body .id { color: #1e5bea; }
.code-body .key { color: #2a7a5c; }
.code-body .str { color: #b4590a; }
.code-body .val { font: 500 17px/1.2 'DM Mono', monospace; border: 1.5px solid var(--ink); background: #fff; border-radius: 8px; padding: 3px 8px; margin: 2px 0; box-shadow: 2px 2px 0 var(--gold); transition: transform .12s var(--ease), box-shadow .12s; }
.code-body .val:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--gold); }
.code-body .swatch i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--ink); margin-right: 6px; vertical-align: -1px; }
.code-body .peek { font: 15px 'DM Mono', monospace; border: 0; background: none; text-decoration: underline; color: #1e5bea; }
.code-body .mod { margin-top: 8px; }
.code-body pre.code { display: none; margin: 6px 0 10px; padding: 10px; background: #1b1530; color: #d9f7ee; border-radius: 10px; font: 14.5px/1.5 'DM Mono', monospace; white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow: auto; user-select: text; -webkit-user-select: text; }
.code-body pre.code.open { display: block; }

.guide-stats { font: 15.5px/1.5 'DM Mono', monospace; margin-bottom: 12px; }
.guide-stats b { font-weight: 500; color: var(--pink); }
.guide-empty { font: 15px/1.4 'DM Mono', monospace; opacity: .7; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; border: 1.5px solid var(--ink); border-radius: 14px; background: #fff; transition: transform .15s var(--ease); }
.card:active { transform: scale(.95); }
.card.made { background: #fff3f7; box-shadow: 2px 2px 0 var(--pink); }
.card.shiny { background: linear-gradient(135deg, #fff6d6, #ffe3f3, #e8f6ff); box-shadow: 2px 2px 0 var(--gold); }
.card-name { font-size: 20px; line-height: 1.1; text-align: center; }
.card-meta { display: block; font: 13px 'DM Mono', monospace; opacity: .6; margin-top: 3px; }
.fav-title.detail-variants { margin-top: 22px; }
.back { margin-bottom: 10px; }
.detail { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.detail-portrait { background: radial-gradient(circle at 50% 60%, #ffeef3, #fff6dc); border-radius: 20px; border: 1.5px solid var(--ink); }
.detail-name { font-family: 'Shrikhand', serif; font-size: 28px; line-height: 1.1; margin-top: 8px; }
.detail-latin { font: 14.5px/1.4 'DM Mono', monospace; opacity: .7; }
.detail p { font: 15px/1.45 'DM Mono', monospace; margin: 10px 0 0; text-wrap: pretty; }
.detail-temp { opacity: .8; }
.detail-meta { font: 14.5px/1.6 'DM Mono', monospace; opacity: .65; margin-top: 12px; }

/* --- title + waking up --------------------------------------------------------- */
#title { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #2a1748 0%, var(--night) 70%); color: var(--paper); text-align: center; cursor: pointer; transition: opacity .5s; }
#title.gone { opacity: 0; pointer-events: none; }
#title .title-inner { opacity: 0; transition: opacity .6s ease; }
#title.ready .title-inner { opacity: 1; }
.title-inner { padding: 24px; }
.wordmark { font-family: 'Shrikhand', serif; font-weight: 400; font-size: clamp(48px, 13.5vw, 150px); line-height: .9; margin: 0; padding: 0 .14em .06em; letter-spacing: -1px; background: linear-gradient(100deg, #ff9ec4, #ffd166 45%, #7cf2d0 80%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(4px 5px 0 #ff5d8f); animation: wobble 6s ease-in-out infinite; }
.wordmark .i { position: relative; display: inline-block; background: linear-gradient(100deg, #a6eab2, #7cf2d0); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.wordmark .eye { position: absolute; left: 50%; top: -.06em; width: .34em; height: .34em; margin-left: -.17em; border-radius: 50%; background: #fffaf0; display: grid; place-items: center; overflow: hidden; animation: blink 5s infinite; box-shadow: 0 0 0 .025em #1b1b1b; }
.wordmark .pupil { width: .17em; height: .17em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0 12%, #1b1b1b 14% 46%, #2a9d8f 48% 100%); transition: transform .15s ease-out; }
.tag { font-family: 'DM Mono', monospace; font-size: clamp(15px, 3.8vw, 19px); margin: 18px 0 0; opacity: .9; }
/* the way in: one big button (nothing else on the title screen starts the game) */
.enter { margin-top: 42px; padding: 16px 34px 18px; font: 26px/1 'Shrikhand', serif; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; box-shadow: 5px 6px 0 var(--pink); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.enter:hover { transform: translate(-2px, -2px) scale(1.04); box-shadow: 8px 9px 0 var(--pink); }
.enter:active { transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--pink); }
.enter.loading { opacity: .55; filter: grayscale(1); transform: none; box-shadow: 5px 6px 0 var(--pink); pointer-events: none; transition: opacity .3s, filter .3s; }
.fine { font-family: 'DM Mono', monospace; font-size: 14px; opacity: .55; margin-top: 26px; display: flex; justify-content: center; align-items: center; gap: 7px; }
@keyframes wobble { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.03); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }

#lids { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.lid { position: absolute; left: -10%; right: -10%; height: 52%; background: #07040d; }
.lid.top { top: 0; border-radius: 0 0 50% 50% / 0 0 22% 22%; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.lid.bottom { bottom: 0; border-radius: 50% 50% 0 0 / 22% 22% 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.6); }
#lids.opening .lid.top { animation: lidTop 1.4s cubic-bezier(.5, 0, .2, 1) forwards; }
#lids.opening .lid.bottom { animation: lidBottom 1.4s cubic-bezier(.5, 0, .2, 1) forwards; }
@keyframes lidTop { 0% { transform: translateY(0); } 30% { transform: translateY(-45%); } 45% { transform: translateY(-10%); } 100% { transform: translateY(-115%); } }
@keyframes lidBottom { 0% { transform: translateY(0); } 30% { transform: translateY(45%); } 45% { transform: translateY(10%); } 100% { transform: translateY(115%); } }

@media (max-width: 640px) {
  .line { font-size: 14px; padding: 6px 10px 7px; }
  #whisper-input { font-size: 17px; }
  .line.big { font-size: 26px; }
  #place-name { font-size: 16px; }
  #place-depth { font-size: 12px; }
  .np-name { font-size: 17px; }
  .np-sub { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark { animation: none; }
}


#suggest { display: none; flex-wrap: wrap; gap: 6px; justify-content: flex-start; pointer-events: auto; animation: rise-in .3s var(--ease); }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
#suggest.show { display: flex; }
/* talking to a creature: a note above the box saying who you're talking to */
#talk-to { align-self: flex-start; max-width: 100%; padding: 7px 14px 8px; font: 15px/1.3 'DM Mono', monospace; color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink); border-radius: 999px; box-shadow: 3px 3px 0 var(--mint); opacity: 0; transform: translateY(8px); max-height: 0; padding-top: 0; padding-bottom: 0; border-width: 0; overflow: hidden; transition: opacity .25s, transform .3s var(--ease), max-height .3s var(--ease), padding .3s var(--ease); }
#talk-to.show { opacity: 1; transform: none; max-height: 60px; padding-top: 7px; padding-bottom: 8px; border-width: 1.5px; }
.chip.suggestion { background: rgba(4, 30, 26, .85); color: var(--mint); border-color: rgba(184, 255, 243, .5); font-size: 15.5px; }
@media (min-width: 641px) {
  #toast { top: calc(var(--safe-t) + 70px); left: auto; right: 12px; transform: translateY(-20px) scale(.9); }
  #toast.show { transform: none; }
}
#btn-source { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--ink); background: #fff; display: grid; place-items: center; color: var(--ink); margin-left: -4px; transition: transform .2s var(--ease); }
#btn-source:active { transform: scale(.88); }
#btn-rise { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--ink); background: #fff; display: grid; place-items: center; color: var(--ink); margin-left: -4px; transition: transform .2s var(--ease); }
#btn-rise:active { transform: scale(.88); }
/* the world renders on a WebGL canvas (#c3d) under the 2D canvas, which only carries overlays */
#c { z-index: 1; }
#c3d { z-index: 0; }

.place-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#btn-fav { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--ink); background: #fff; font-size: 20px; line-height: 1; display: grid; place-items: center; color: var(--ink); transition: transform .2s var(--ease), background .2s; }
#btn-fav.on { background: var(--gold); }
#btn-fav:active { transform: scale(.88); }
#btn-fav.pop { animation: favpop .5s var(--ease); }
@keyframes favpop { 40% { transform: scale(1.35) rotate(-12deg); } }
#blink { position: fixed; inset: 0; z-index: 25; pointer-events: none; background: #07040d; opacity: 0; transition: opacity .45s ease; }
#blink.shut { opacity: 1; }
.fav-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.fav-list .chip { font-size: 14px; background: #fff3c4; }
.fav-title { font: 500 15px 'DM Mono', monospace; margin: 0 0 8px; }

.laws-list { margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
/* the name gets the whole top line; its buttons sit in a row underneath, all the same height */
.law-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; padding: 10px 12px; border: 1.5px solid var(--ink); border-radius: 12px; background: #fff; }
.law-row.off { opacity: .5; }
.law-row .law-name { flex: 1 1 100%; min-width: 0; font-size: 21px; line-height: 1.2; }
.law-row .law-meta { display: block; font: 13px 'DM Mono', monospace; opacity: .6; margin-top: 3px; }
.law-row .chip { height: 30px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 5px; padding: 0 10px; font-size: 11.5px; }
.law-row .chip.del { background: #ffe1e1; margin-left: auto; }

.guide-tabs { display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap; position: sticky; top: -12px; background: var(--paper); padding: 8px 0; z-index: 1; }
.guide-tabs .tab { font: 500 13px 'DM Mono', monospace; padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; transition: background .2s, color .2s, transform .12s var(--ease); }
.guide-tabs .tab.on { background: var(--ink); color: var(--paper); }
.guide-tabs .tab .n { font-size: 10px; opacity: .55; margin-left: 3px; vertical-align: 1px; }
.snap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.snap-grid img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; border: 1.5px solid var(--ink); box-shadow: 2px 2px 0 var(--pink); cursor: zoom-in; transition: transform .15s var(--ease); }
.snap-grid img:hover { transform: rotate(-1deg) scale(1.02); }
/* a snap, big: dims the world and fills most of the screen */
#snap-modal { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; background: rgba(20, 5, 31, .82); opacity: 0; pointer-events: none; transition: opacity .3s; }
#snap-modal.open { opacity: 1; pointer-events: auto; }
#snap-modal img { max-width: min(1400px, 100%); max-height: calc(100% - 70px); border-radius: 18px; border: 2px solid var(--ink); box-shadow: 5px 6px 0 var(--pink); transform: scale(.94); transition: transform .35s var(--ease); }
#snap-modal.open img { transform: scale(1); }
#snap-modal .snap-acts { display: flex; gap: 8px; align-items: center; background: var(--paper); padding: 6px 8px 6px 14px; border-radius: 999px; border: 1.5px solid var(--ink); }
#snap-modal a.chip { text-decoration: none; color: inherit; }
#snap-modal .snap-meta { font: 13px 'DM Mono', monospace; opacity: .65; margin-right: 6px; }
.guide-tabs .tab:active { transform: scale(.94); }
.guide-tab-body { animation: rise-in .25s var(--ease); }

#moment { position: fixed; top: calc(var(--safe-t) + 92px); left: 50%; z-index: 12; width: min(560px, calc(100vw - 28px)); padding: 16px 22px 18px; text-align: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 22px; box-shadow: 5px 6px 0 var(--pink); transform: translate(-50%, -140%) rotate(-1.5deg); opacity: 0; transition: transform .7s var(--ease), opacity .4s; pointer-events: none; }
#moment.show { transform: translate(-50%, 0) rotate(-1.5deg); opacity: 1; pointer-events: auto; }
#moment .m-kicker { font: 500 12px 'DM Mono', monospace; letter-spacing: 1.5px; text-transform: uppercase; color: var(--pink); }
#moment .m-title { font-family: 'Shrikhand', serif; font-size: 34px; line-height: 1.05; margin: 4px 0 6px; }
#moment .m-sub { font: 15px/1.4 'DM Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { #moment .m-title { font-size: 26px; } #moment .m-sub { font-size: 12.5px; } }

.card { position: relative; }
.card-star { position: absolute; top: 3px; right: 6px; font-size: 26px; line-height: 1; color: var(--gold); text-shadow: 0 0 0 var(--ink); cursor: pointer; transition: transform .15s var(--ease); }
.card-star:hover { transform: scale(1.25); }
.card.keeper { cursor: grab; touch-action: none; }
.keeper-row { display: flex; gap: 6px; margin-top: 4px; }
.keeper-row .chip { min-width: 34px; font-size: 15px; }
.keeper-row .chip.add { background: var(--mint); }
.chip.fav { color: #b8860b; font-family: 'Apple Symbols', 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'DejaVu Sans', system-ui, sans-serif; font-size: 24px; line-height: 1; padding: 2px 10px 4px; }
.card-star, .keeper-row .chip:not(.add) { font-family: 'Apple Symbols', 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'DejaVu Sans', system-ui, sans-serif; }
.detail .chip.fav { font-size: 17px; padding: 6px 12px; }
.law-row .chip.fav { padding: 0 8px; }
.drag-ghost { position: fixed; left: 0; top: 0; width: 96px; height: 96px; z-index: 30; pointer-events: none; filter: drop-shadow(4px 6px 0 rgba(0,0,0,.25)); transition: none; }
#guide.dragging { opacity: .35; transition: opacity .2s; }
.law-group-note { font: 13.5px/1.4 'DM Mono', monospace; opacity: .7; margin: -2px 0 8px; }
.laws-list + .fav-title { margin-top: 18px; }
.card.species { cursor: grab; touch-action: pan-y; }
.card-add { position: absolute; top: 4px; left: 5px; min-width: 0; padding: 3px 8px 4px; font-size: 16px; background: var(--mint); }
.star-ico { display: inline-block; vertical-align: -0.18em; transition: transform .18s var(--ease); }
.chip.fav { display: inline-flex; align-items: center; gap: 4px; }
.chip.dice { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.dice-ico { display: inline-block; transition: transform .18s var(--ease); }
.chip.dice:hover .dice-ico { transform: rotate(-14deg) scale(1.1); }
.chip.dice:active .dice-ico { transform: rotate(90deg) scale(.9); }
.chip.fav:hover .star-ico, .card-star:hover .star-ico, #btn-fav:hover .star-ico { transform: scale(1.15) rotate(-8deg); }
.chip.fav:active .star-ico, #btn-fav:active .star-ico { transform: scale(.9); }
.card-star { line-height: 0; }

/* every icon button gets the same little hover lift the star has */
.round svg, #btn-rise svg, #btn-source svg, .chip.dive-eye svg, #whisper .send svg { transition: transform .18s var(--ease); }
@media (hover: hover) {
  .round:hover svg, #btn-rise:hover svg, #btn-source:hover svg, .chip.dive-eye:hover svg, #whisper .send:hover svg { transform: scale(1.15) rotate(-8deg); }
}
