/* W-079 title screen and start menu. Era I palette; the scene is a canvas cropped like a phone cover. */
#title{position:absolute;inset:0;z-index:30;display:flex;flex-direction:column;justify-content:space-between;background:#1b2436;color:#f3e6c4;overflow:hidden;opacity:0;transition:opacity .45s ease}
#title.ready{opacity:1}
/* The page opens on the title (designer, 2026-09-23): the game is not shown under it — only the title's night
   backdrop while the title loads and fades in. index.html starts #game .booting; the title lifts it as it leaves, and
   main.js at once when there is no title. Dialogs and toasts the title itself opens stay visible. */
#game.booting{background:#1b2436}
#game.booting>:is(#hud,#battle-view,#screen,#overlay){visibility:hidden}
#title.leaving{opacity:0;pointer-events:none}
/* D-124: an era intro opens on this table — only the words, the menu and the shade leave, and they fade over the
   intro as it starts: the title sits above the intro, and once the intro's first frame (this same table) is drawn,
   the title's own table and backing go (.handed), so the push-in begins under the fading words */
#title.leaving-words{pointer-events:none;z-index:31}
#title.leaving-words :is(.title-mark,.title-panel,.title-shade){opacity:0;transition:opacity .6s ease-out}
#title.leaving-words.handed{background:transparent}
#title.leaving-words.handed .title-stage{visibility:hidden}
#title .title-stage{position:absolute;inset:0}
#title .cinematic{position:absolute;inset:0;display:block;width:100%;height:100%;padding:0;border:0;background:#1b2436;cursor:default}
#title .cinematic canvas{display:block;width:100%;height:100%;object-fit:cover;object-position:50% 50%}/* centred, as main.js fits the era intro, so the two frames coincide */
#title .cinematic:focus-visible{outline:2px solid #e7c873;outline-offset:-2px}
#title .title-shade{position:absolute;inset:0;pointer-events:none;background:linear-gradient(to bottom,#10172a8c 0,#10172a00 26%,#10172a00 56%,#0c1210d9 84%,#0c1210f2 100%)}
/* The wordmark is sized by the game's column (cqi), not the window: on a laptop the column is narrower than the window. */
#title,#boot{container-type:inline-size}
#title .title-mark,#boot .title-mark{position:relative;text-align:center;padding:calc(var(--safe-top,env(safe-area-inset-top)) + 44px) 16px 0}
/* v0.9 (W-095): placeholder name TD-ERAS in a carved Cinzel wordmark, a local file subset to the wordmark's letters (re-subset if the name changes). */
@font-face{font-family:"TD Wordmark";src:url(/assets/fonts/cinzel-decorative-900-wordmark.woff2) format("woff2");font-weight:900;font-display:block}
#title .title-mark h1,#boot .title-mark h1{margin:0;font-family:"TD Wordmark","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;font-size:clamp(32px,14cqi,64px);font-weight:900;letter-spacing:.08em;line-height:1;white-space:nowrap;color:#f1d58f;background:linear-gradient(180deg,#fff3c4 0%,#f1d58f 38%,#c8923f 62%,#f4d98e 100%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;filter:drop-shadow(0 2px 0 #5b3a1c) drop-shadow(0 4px 14px #0b1020d0)}
/* v0.8: the era theme recolours headings inside #game (style.css, :is(h1,…){color:var(--ink)}); the wordmark keeps its gold in every era. */
#game :is(#title,#boot) .title-mark h1{color:#f1d58f}
#title .title-mark p,#boot .title-mark p{margin:10px 0 0;font-size:12px;letter-spacing:.22em;text-transform:uppercase;color:#e6d8b6;text-shadow:0 1px 6px #0b1020}
#title .title-panel{position:relative;padding:0 16px calc(var(--safe-bottom,env(safe-area-inset-bottom)) + 30px)}
#title .title-actions{display:flex;flex-direction:column;gap:9px}
#title .title-menu{max-width:300px;margin:0 auto}
#title .title-menu button{min-height:50px;font-size:var(--fs-xl);width:100%}
#title .title-run-siege{display:block;font-size:var(--fs-xs);font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.8}
#title .title-card{max-width:340px;margin:0 auto;padding:16px;background:#e6d7af url('/assets/ui/parchment.svg') center/100% 100%;border:3px solid #716043;color:#34412e;box-shadow:0 10px 40px #0a0f08c0;max-height:70dvh;overflow:auto}
#title .title-card h2{margin:0 0 8px;font-size:var(--fs-3xl)}
#title .title-card p{margin:0 0 12px;font-size:var(--fs-sm);color:#5d5c45}
#title .title-card .small-button{justify-content:flex-start;font-size:var(--fs-base);color:#34412e;text-decoration:none}
#title .title-card .small-button span{margin-left:auto;font-size:var(--fs-xs)}
#title .title-card .build-version{margin:10px 0 0;text-align:center;font-size:var(--fs-xs);color:#6f6a50}
/* W-101 loading screen (index.html #boot, src/boot.js): the title's night backdrop with the wordmark in the title's
   own place and a slim gold bar where the menu will be. It sits over the title while that loads, then fades as the
   title fades in beneath it, so only the scene appears around the words. */
#boot{position:absolute;inset:0;z-index:40;display:flex;flex-direction:column;justify-content:space-between;background:#1b2436;color:#f3e6c4;transition:opacity .45s ease}
#boot.done{opacity:0;pointer-events:none}
/* Once the title's scene is built (held on its first frame, words and menu hidden) it shows through, shaded where the
   wordmark and the bar sit; when loading is done the shade fades and the camera starts from that same frame. */
#game:has(>#title.ready)>#boot{background:linear-gradient(to bottom,#1b2436e6 0,#1b243685 34%,#1b243666 58%,#141b2af2 88%,#141b2afa 100%)}
#title.waiting :is(.title-mark,.title-panel){visibility:hidden}
#boot .boot-panel{width:100%;max-width:332px;margin:0 auto;padding:0 16px calc(var(--safe-bottom,env(safe-area-inset-bottom)) + 48px);box-sizing:border-box}
#boot .boot-meter{height:3px;border-radius:2px;background:#f1d58f24;overflow:hidden}
#boot .boot-fill{height:100%;background:linear-gradient(90deg,#b07a33,#f4d98e);transform:scaleX(0);transform-origin:left center;transition:transform .3s ease-out}
#boot .boot-line{display:flex;justify-content:space-between;gap:12px;margin:11px 0 0;font-size:11px;letter-spacing:.2em;text-transform:uppercase;color:#e6d8b6b8}
#boot .boot-percent{font-variant-numeric:tabular-nums}
#boot .boot-actions{display:flex;flex-direction:column;gap:9px;margin-top:18px}#boot .boot-actions[hidden]{display:none}
#boot .boot-actions button{min-height:50px;font-size:16px;width:100%}
#boot.failed .boot-fill{background:#8f7a52}
#boot.failed .boot-line{text-transform:none;letter-spacing:.02em;font-size:13px;color:#f3e6c4}
#boot.failed .boot-percent{display:none}
@media(prefers-reduced-motion:reduce){#title{transition:none}}
/* W-109: the parchment settings card takes the light secondary face (the dark global one is for buttons on the scene). */
#title .title-card{--b2-face:linear-gradient(#f4eacd,#e0d1a8);--b2-rim:#a3854f;--b2-ink:#34412e}
/* W-151 (#54) (the designer, 2026-10-17: "if you rolad from title screen from 3rd era the title color there is also
   off"): the title sits inside #game, so reloading into an Era III run dressed it in Era III's interface: style.css's
   light ink and teal buttons, neon.css's HUD face, cyan glows and rims. Its parchment cards lost their headings. The
   title keeps its own look in every era (Eras II and IV only tint its headings in their own dark inks). */
#game[data-era="3"] :is(#title,#boot){--muted:#696b54;--card-focus:#497985}
#game[data-era="3"] :is(#title,#boot) .title-mark h1{font-family:"TD Wordmark","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;font-weight:900;letter-spacing:.08em;text-shadow:none}
#game[data-era="3"] #title :is(h2,h3,.primary,.menu-tab){font-family:inherit;text-shadow:none}
#game[data-era="3"] #title .title-card h2{color:inherit;font-weight:750;letter-spacing:normal}
#game[data-era="3"] #title .menu-group h3{color:var(--muted);font-weight:750;letter-spacing:.14em}
#game[data-era="3"] #title .menu-tab{font-weight:650;letter-spacing:normal}
#game[data-era="3"] #title .menu-tab[aria-selected="true"]{box-shadow:inset 0 0 0 1px var(--b2-rim),0 1px 2px #0003}
#game[data-era="3"] #title .primary{font-weight:750;letter-spacing:.01em;text-shadow:0 1px 1px #0007}
#game[data-era="3"] #title .primary:hover:not(:disabled){filter:brightness(1.1);box-shadow:inset 0 0 0 2px var(--b1-rim),inset 0 4px 0 1px #ffffff1f,inset 0 -3px 0 1px #0000002e,0 2px 0 #0000004d,0 0 12px var(--b1-glow)}
#game[data-era="3"] #title :is(.secondary,.small-button){border-color:var(--b2-rim);background:var(--b2-face);box-shadow:inset 0 1px 0 #ffffff26,0 1px 0 #00000026}
#game[data-era="3"] #title .menu-rows{border-color:var(--b2-rim);box-shadow:inset 0 1px 0 #ffffff26,0 1px 0 #00000026}
#game[data-era="3"] #title .menu-rows>.small-button{background:transparent;box-shadow:none}
#game[data-era="3"] #title .menu-rows>.small-button+.small-button{border-top-color:color-mix(in srgb,var(--b2-rim) 50%,transparent)}
#game[data-era="3"] #title .menu-rows.tiles>.small-button{background:var(--b2-face)}
#game[data-era="3"] #title .volume-row input[type=range]{accent-color:#8a6a2f}
/* W-195 / #169: Design A, the Terraces. The menu labels sit beside their things on the board.
   Saved runs frame their era in full and keep the actions in a compact dock. */
#title.terraces{background:radial-gradient(ellipse at 50% 65%,#566b77 0,#283949 53%,#172334 100%)}
#title.terraces .title-stage canvas{display:block;width:100%;height:100%}
#title.terraces .title-shade{background:linear-gradient(#17233488,transparent 25%,transparent 85%,#17233455)}
#title.terraces .title-mark{pointer-events:none;padding-top:calc(var(--safe-top,env(safe-area-inset-top)) + 26px);z-index:2}
#title.terraces .title-mark h1{font-size:clamp(32px,13cqi,62px)}
#title.terraces .title-mark p{font-size:11px;letter-spacing:.17em}
#title.terraces .title-panel,#title.terraces .title-menu,#title .title-seals{position:absolute;inset:0;padding:0;margin:0;max-width:none;pointer-events:none}
/* #187 (the designer, 2026-11-08: "The era titles should be the same kind of 3D pills that we Implemented for the menu
   options"): each era's name is a menu pill, not a hit target, standing over its own board's gate (title-terraces.js
   eraAnchors), its numeral in the era's colour. */
#title .title-seals .era-pill{position:absolute;transform:translate(-50%,calc(-100% - 7px));display:inline-flex;align-items:center;gap:6px;padding:5px 12px 5px 9px;border:1px solid #c9a95f;border-radius:999px;background:#1e1a12e0;color:#f7e9be;font-size:12px;font-weight:700;letter-spacing:.04em;line-height:1.1;white-space:nowrap;box-shadow:inset 0 1px #f4dca033,0 3px 10px #0a0f1880;text-shadow:0 1px 2px #0008}
#title .title-seals .era-pill::after{content:"";position:absolute;left:50%;bottom:-5px;width:8px;height:8px;margin-left:-5px;background:#1e1a12;border:solid #c9a95f;border-width:0 1px 1px 0;transform:rotate(45deg)}
#title .title-seals .era-pill b{font-family:Georgia,serif;font-size:14px;color:var(--era-ink,#e9cf8a)}
#title .title-seals .era-pill[data-era="2"]{--era-ink:#e4b667}
#title .title-seals .era-pill[data-era="3"]{--era-ink:#f07ab6}
#title .title-seals .era-pill[data-era="4"]{--era-ink:#b9a9ec}
#title.terraces .title-card{position:absolute;bottom:calc(var(--safe-bottom,env(safe-area-inset-bottom)) + 24px);left:50%;transform:translateX(-50%);width:calc(100% - 32px);box-sizing:border-box;max-height:calc(100% - var(--safe-top,env(safe-area-inset-top)) - 180px);pointer-events:auto}
#title.terraces.title-dialog .title-shade{background:#0b142477}
#title.terraces.title-dialog .title-seals,#title.terraces.saved-board .title-seals,#title.terraces.no-board .title-seals{visibility:hidden}
#title.terraces.leaving-words .title-seals{opacity:0;transition:opacity .6s}
#title.terraces.leaving-words :is(.title-menu,.title-card){pointer-events:none}
#title.terraces .siege-pick{margin:12px 0}
#title.terraces .siege-body{max-height:240px;overflow:auto}
#title.terraces .siege-chips{flex-wrap:wrap}
#title.terraces{padding:0;gap:0}
#title.terraces .title-mark{width:100%;max-width:none;box-sizing:border-box;margin:0}
#title.terraces .title-panel{width:100%;max-width:none;box-sizing:border-box}
/* v0.23 (the designer, 2026-11-08: "Rather than the Bulky buttons … pill titles that float over the 3D objects"): each
   option is a small pill, its icon and word, standing over its thing (title-scene.js places it every frame): New conquest
   over the Hermit, Continue over the gate, Gallery over the trophy hall, Settings over the cog. A tail points down at it;
   an invisible margin keeps the tap target finger-sized. A saved run's board has no hall or cog: its Gallery and
   Settings sit in the bottom corners. */
#title.terraces .title-menu .title-pill{position:absolute;left:50%;top:80%;transform:translate(-50%,calc(-100% - 7px));display:inline-flex;align-items:center;gap:6px;width:auto;min-height:0;margin:0;padding:6px 13px 6px 10px;border:1px solid #c9a95f;border-radius:999px;background:#1e1a12e0;color:#f7e9be;font-size:13px;font-weight:700;letter-spacing:.02em;line-height:1.1;white-space:nowrap;pointer-events:auto;box-shadow:0 3px 10px #0a0f1880;text-shadow:0 1px 2px #0008}
#title.terraces .title-menu .title-pill::before{content:"";position:absolute;inset:-9px -6px}
#title.terraces .title-menu .title-pill::after{content:"";position:absolute;left:50%;bottom:-5px;width:8px;height:8px;margin-left:-5px;background:inherit;border:solid #c9a95f;border-width:0 1px 1px 0;transform:rotate(45deg)}
#title.terraces .title-menu .title-pill .ui-icon{width:16px;height:16px;flex:none;color:#e9cf8a}
#title.terraces .title-menu :is([data-title=new],[data-title=continue]){padding:7px 15px 7px 12px;font-size:15px;border-color:#ecd08a;background:linear-gradient(#a57a39,#6e4c24);box-shadow:inset 0 1px #f4dca066,0 3px 12px #0a0f18a0}
#title.terraces .title-menu :is([data-title=new],[data-title=continue])::after{background:#6e4c24;border-color:#ecd08a}
#title.terraces.has-save .title-menu [data-title=new]{padding:6px 13px 6px 10px;font-size:13px;border-color:#c9a95f;background:#1e1a12e0;box-shadow:0 3px 10px #0a0f1880}
#title.terraces.has-save .title-menu [data-title=new]::after{background:#1e1a12;border-color:#c9a95f}
#title.terraces .title-menu .title-pill:hover{filter:brightness(1.12)}
#title.terraces .title-menu .title-pill:focus-visible{outline:2px solid #ffe4a1;outline-offset:3px}
#title.terraces .title-menu .title-run-siege{font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.8}
#title.terraces.saved-board .title-menu :is([data-title=gallery],[data-title=settings]){top:auto;bottom:calc(var(--safe-bottom,env(safe-area-inset-bottom)) + 22px);transform:translate(-50%,0)}
#title.terraces.saved-board .title-menu [data-title=gallery]{left:24%}
#title.terraces.saved-board .title-menu [data-title=settings]{left:76%}
#title.terraces.saved-board .title-menu :is([data-title=gallery],[data-title=settings])::after{display:none}
/* #188: on the run's board New conquest hangs just behind the Hermit, under him, its tail up */
#title.terraces.saved-board .title-menu [data-title=new]{transform:translate(-50%,9px)}
#title.terraces.saved-board .title-menu [data-title=new]::after{bottom:auto;top:-5px;border-width:1px 0 0 1px}
/* #188: the pills step aside while the camera moves between the run's board and the Terraces */
#title.terraces.moving :is(.title-menu,.title-seals){opacity:0;pointer-events:none;transition:opacity .2s}
/* pulled out: Back to my run stands in for the run's era's name pill, on that era's board */
#title.terraces.pulled[data-run-era="1"] .title-seals [data-era="1"],#title.terraces.pulled[data-run-era="2"] .title-seals [data-era="2"],#title.terraces.pulled[data-run-era="3"] .title-seals [data-era="3"],#title.terraces.pulled[data-run-era="4"] .title-seals [data-era="4"]{visibility:hidden}
#title.terraces .title-menu [data-title=back-run]{padding:7px 15px 7px 12px;font-size:14px;border-color:#ecd08a}
/* No board (the scene failed to load): the pills in a plain dock. */
#title.terraces.no-board .title-menu{inset:auto 18px calc(var(--safe-bottom,env(safe-area-inset-bottom)) + 24px);max-width:360px;margin:0 auto;display:flex;flex-wrap:wrap;justify-content:center;gap:10px}
#title.terraces.no-board .title-menu .title-pill{position:static;transform:none}
#title.terraces.no-board .title-menu .title-pill::after{display:none}
/* v0.23 (W-196): the fly-over's stop symbols, the map's own pins (map3d.css .m3-pin), over the title's canvas */
#title .title-kinds{position:absolute;inset:0;pointer-events:none;z-index:1;isolation:isolate;overflow:hidden}
