:root {
  --ink: #efe8da;
  --dim: #8f88a0;
  --glow: #f3c77a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05040a; color: var(--ink); font-family: var(--serif); overflow: hidden; -webkit-tap-highlight-color: transparent; touch-action: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

#mast { position: fixed; top: 0; left: 0; right: 0; padding: max(18px, env(safe-area-inset-top)) 22px 0; pointer-events: none; z-index: 3; }
.mark { pointer-events: auto; display: inline-block; margin-right: 100px; color: var(--ink); text-decoration: none; font-size: 21px; letter-spacing: 0.32em; font-variant: small-caps; opacity: 0.85; mix-blend-mode: screen; }
#voice { margin: 8px 0 0; max-width: min(30em, calc(100vw - 150px)); font-style: italic; color: var(--dim); font-size: 15px; line-height: 1.45; transition: opacity 1.4s ease; min-height: 2.9em; text-shadow: 0 0 12px #05040a; }

.hud { position: fixed; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); text-align: center; pointer-events: none; z-index: 3; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.clock { font-family: var(--mono); font-size: 13px; letter-spacing: 0.18em; color: var(--glow); opacity: 0.75; text-shadow: 0 0 14px rgba(243, 199, 122, 0.6); }
.caption { font-size: 14px; color: var(--dim); font-style: italic; transition: opacity 1s; min-height: 1.3em; text-shadow: 0 0 10px #05040a; padding: 0 16px; }

.corner { position: fixed; right: 16px; top: max(16px, env(safe-area-inset-top)); display: flex; gap: 8px; z-index: 4; }
.chip { font: inherit; font-size: 16px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(239, 232, 218, 0.16); background: rgba(12, 10, 22, 0.5); color: var(--dim); cursor: pointer; backdrop-filter: blur(4px); }
.chip.on { color: var(--glow); border-color: rgba(243, 199, 122, 0.5); }

.say { position: fixed; left: -9999px; top: 0; opacity: 0; width: 10px; font-size: 16px; }

.typing { position: fixed; left: 50%; top: 50%; transform: translate(-50%, 70px); font-size: clamp(18px, 3vw, 26px); color: var(--ink); text-shadow: 0 0 18px rgba(243, 199, 122, 0.7), 0 0 4px #05040a; pointer-events: none; z-index: 2; white-space: pre; }
.typing:not(:empty)::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 3px; vertical-align: -0.12em; background: var(--glow); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.words { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.word { position: absolute; transform: translate(-50%, -50%) scale(0.9); max-width: min(26em, 80vw); text-align: center; font-size: clamp(17px, 2.6vw, 25px); line-height: 1.3; color: var(--ink); opacity: 0; filter: blur(6px); text-shadow: 0 0 22px rgba(243, 199, 122, 0.55), 0 0 4px #05040a; transition: opacity 1.2s ease, filter 1.2s ease, transform 8s cubic-bezier(.2,.7,.3,1); }
.word.in { opacity: 1; filter: blur(0); transform: translate(-50%, -50%) scale(1); }
.word.out { opacity: 0; filter: blur(8px); transform: translate(-50%, -260%) scale(1.06); transition: opacity 3.5s ease, filter 3.5s ease, transform 7s ease-out; }

.card { position: fixed; z-index: 5; min-width: 220px; max-width: min(300px, calc(100vw - 24px)); background: rgba(14, 12, 26, 0.86); border: 1px solid rgba(239, 232, 218, 0.14); border-radius: 16px; padding: 14px 16px; backdrop-filter: blur(8px); font-size: 15px; line-height: 1.4; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.card .dim { color: var(--dim); font-size: 13px; }
.card .count { font-family: var(--mono); font-size: 22px; color: var(--glow); margin: 4px 0; }
.card .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.card button { font: inherit; font-size: 14px; border-radius: 999px; padding: 7px 14px; border: 1px solid rgba(243, 199, 122, 0.45); background: rgba(243, 199, 122, 0.1); color: var(--ink); cursor: pointer; }
.build { position: fixed; left: 10px; bottom: 6px; font-family: var(--mono); font-size: 10px; color: rgba(143, 136, 160, 0.3); pointer-events: none; z-index: 1; }
.hint { animation-delay: 0s; position: fixed; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: clamp(20px, 3.4vw, 30px); letter-spacing: 0.2em; color: var(--ink); text-shadow: 0 0 24px rgba(243, 199, 122, 0.8); pointer-events: none; z-index: 2; animation: breathe 2.8s ease-in-out infinite; transition: opacity 0.8s; }
.hint.gone { opacity: 0 !important; animation: none; }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.95; } }
.clock { font-size: 14px; }
#gl, #ui { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { cursor: crosshair; touch-action: none; z-index: 1; }
.reveal { position: fixed; left: 0; right: 0; bottom: max(8%, 64px); text-align: center; pointer-events: none; z-index: 2; opacity: 0; transition: opacity 1.4s ease; padding: 0 20px; }
.reveal.show { opacity: 1; }
.reveal .pre { display: block; font-style: italic; color: var(--dim); font-size: clamp(14px, 2vw, 17px); letter-spacing: 0.06em; text-shadow: 0 0 14px #030208; }
.reveal .name { display: block; margin-top: 6px; font-size: clamp(26px, 5vw, 46px); letter-spacing: 0.04em; color: var(--ink); opacity: 0; filter: blur(10px); transform: translateY(8px); transition: opacity 1.6s ease, filter 1.6s ease, transform 2.2s cubic-bezier(.2,.7,.3,1); text-shadow: 0 0 30px rgba(243, 199, 122, 0.55), 0 0 6px #030208; }
.reveal.named .name { opacity: 1; filter: blur(0); transform: none; }
.reveal .pre::after { content: " —"; }
@media (max-width: 520px) { .clock { letter-spacing: 0.06em; font-size: 12px; padding: 0 14px; } }
.reveal .key { display: block; margin-top: 8px; font-size: 13px; letter-spacing: 0.22em; opacity: 0; transition: opacity 2s ease 0.8s; }
.reveal.named .key { opacity: 0.85; }
#hud, #reveal, #caption, #gathering { display: none !important; }
#voice { opacity: 0; }
.hint { letter-spacing: 0.08em; padding: 0 24px; }
.card { min-width: 0; padding: 10px; }
.card .acts { margin-top: 0; }
.hint:not(.gone) { animation: hintIn 2.2s ease 2.2s both, breathe 2.8s ease-in-out 4.4s infinite; }
@keyframes hintIn { from { opacity: 0; filter: blur(8px); } to { opacity: 0.8; filter: blur(0); } }
