/* MDT Evolve: a nature documentary's look. Serif titles, dark glass panels, the teal accent. */
:root { --acc: #3fc1b0; --acc2: #9ff0e2; --gold: #e2c27a; --ink: #eaf6f2; --mut: #9fb8b2; --glass: rgba(6, 22, 26, .72); --line: rgba(160, 240, 225, .16); --red: #ff7a64;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif; --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #04141a; color: var(--ink); font-family: var(--sans); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; }
.hidden, [hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--mut); }
#buildTag { position: fixed; right: calc(4px + var(--sr)); bottom: calc(2px + var(--sb)); font: 600 9px/1 var(--sans); color: rgba(255,255,255,.35); z-index: 3000; pointer-events: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,0,.45)); z-index: 2; }
#hurtFx { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: 0; background: radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(190, 30, 20, .55)); transition: opacity .25s; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 40%, #0d3a3a, #04141a 70%); transition: opacity .6s; }
#loading.gone { opacity: 0; pointer-events: none; }
.ld { text-align: center; width: min(320px, 80vw); }
.tKick { font: 800 12px/1 var(--sans); letter-spacing: .5em; color: var(--acc); margin-left: .5em; }
.ldLogo, .tLogo { font: italic 600 64px/1 var(--serif); margin: 6px 0 18px; letter-spacing: .02em; color: #f3fbf8; text-shadow: 0 4px 30px rgba(63, 193, 176, .35); }
.ldBar { height: 3px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.ldBar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width .3s; }
#ldTxt { font: 500 14px/1.5 var(--sans); color: var(--mut); }
.ldBtn, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 22px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-weight: 700; font-size: 15px; margin-top: 10px; }
.btn.gold, .ldBtn { background: linear-gradient(180deg, #5fd8c6, #2a9e8f); color: #032623; border: 0; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; margin: 0; }
.btn:disabled { opacity: .45; }
.ldAbout { position: absolute; bottom: calc(18px + var(--sb)); left: 0; right: 0; text-align: center; color: var(--mut); font-size: 13px; }
a { color: var(--acc2); }

/* ---------- title ---------- */
#title { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; padding: calc(var(--mdts-h, 52px) + 14px) calc(18px + var(--sr)) calc(12px + var(--sb)) calc(18px + var(--sl)); background: linear-gradient(180deg, rgba(4,20,26,.5), rgba(4,20,26,.12) 36%, rgba(4,20,26,.05) 46%, rgba(4,20,26,.82) 78%); }
.tPane { flex: 1; display: flex; flex-direction: column; justify-content: space-between; max-width: 460px; width: 100%; margin: 0 auto; }
.tLock { text-align: center; margin-top: 4vh; }
.tSub { font: italic 500 20px/1.3 var(--serif); color: #e2f2ee; margin: -6px 0 0; text-shadow: 0 1px 4px rgba(0,0,0,.7), 0 2px 14px rgba(0,0,0,.6); }
.tMenu { display: flex; flex-direction: column; gap: 10px; }
.tBtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: left; }
.tBtn span { font: 700 18px/1.2 var(--sans); }
.tBtn em { font: 500 13px/1.3 var(--sans); color: var(--mut); font-style: normal; }
.tBtn.prime { background: linear-gradient(180deg, rgba(63,193,176,.32), rgba(20,90,84,.55)); border-color: rgba(120, 240, 220, .45); }
.tTiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tTile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 64px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: left; }
.tTile svg { width: 20px; height: 20px; fill: none; stroke: var(--acc2); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tTile span { font: 700 14px/1.2 var(--sans); }
.tTile em { font: 500 11px/1.2 var(--sans); color: var(--mut); font-style: normal; }
.tGuest { background: none; border: 0; color: var(--mut); font-size: 13px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; }
.tPanel { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.tPanel h2 { font: italic 600 28px/1.1 var(--serif); margin: 0 0 6px; }
.tPanel p { font-size: 14px; line-height: 1.45; margin: 0 0 12px; }
input { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--ink); font-size: 16px; outline: none; -webkit-user-select: text; user-select: text; }
input:focus { border-color: var(--acc); }
.btns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.tFoot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--mut); max-width: 460px; width: 100%; margin: 10px auto 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hb { position: absolute; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; }
.hb svg { width: 22px; height: 22px; fill: var(--ink); }
#menuBtn { top: calc(10px + var(--st)); left: calc(10px + var(--sl)); }
#card { position: absolute; top: calc(10px + var(--st)); left: calc(62px + var(--sl)); width: min(190px, 46vw); padding: 7px 10px 8px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none !important; }
.cTop { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.cTop b { font: italic 600 15px/1.1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cTop span { font: 700 11px/1 var(--sans); color: var(--acc2); white-space: nowrap; }
.cForm { font: 600 11px/1.3 var(--sans); color: var(--mut); margin: 2px 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: flex; flex-direction: column; gap: 3px; }
.bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 50%; border-radius: 3px; transition: width .2s; }
.bar.hp i { background: linear-gradient(90deg, #ff6a55, #ff9a6a); }
.bar.en i { background: linear-gradient(90deg, #e2c27a, #f4e2a0); }
.bar.o2 i { background: linear-gradient(90deg, #6ac8ff, #b2e6ff); }
.bar.hy i { background: linear-gradient(90deg, #4aa0d0, #7ad0f0); }
.cAge { display: flex; justify-content: space-between; margin-top: 5px; font: 600 10px/1 var(--sans); color: var(--mut); }
#dnaBtn { position: absolute; top: calc(10px + var(--st)); right: calc(10px + var(--sr)); min-width: 64px; height: 52px; padding: 0 10px; border-radius: 16px; border: 1px solid rgba(120,240,220,.5); background: linear-gradient(180deg, rgba(63,193,176,.4), rgba(10,60,56,.75)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#dnaBtn svg { position: absolute; left: 6px; top: 6px; width: 14px; height: 14px; fill: none; stroke: var(--acc2); stroke-width: 2; opacity: .8; }
#dnaBtn b { font: 800 18px/1 var(--sans); }
#dnaBtn em { font: 700 9px/1 var(--sans); letter-spacing: .14em; color: var(--acc2); font-style: normal; margin-top: 3px; }
#dnaBtn.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(63,193,176,.25); } }
#goal { position: absolute; top: calc(70px + var(--st)); right: calc(10px + var(--sr)); width: min(178px, 44vw); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none !important; }
#goalList { width: 100%; padding: 7px 9px; border-radius: 12px; background: rgba(4,18,22,.55); border: 1px solid var(--line); font: 600 10.5px/1.35 var(--sans); color: #cfe6e0; }
#goalList div { display: flex; justify-content: space-between; gap: 6px; }
#goalList div.done { color: var(--acc2); }
#goalList div.done span::before { content: '✓ '; }
#goalList em { font-style: normal; color: var(--mut); white-space: nowrap; }
#advBtn { pointer-events: auto; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 0; background: linear-gradient(180deg, #f2d48a, #c99a3a); color: #2a1a02; font: 800 13px/1.1 var(--sans); box-shadow: 0 4px 20px rgba(226,194,122,.35); animation: pulse 1.6s infinite; }
#warn { position: absolute; top: calc(100px + var(--st)); left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: 12px; background: rgba(120, 20, 10, .75); border: 1px solid rgba(255,140,120,.5); font: 700 12px/1.2 var(--sans); white-space: nowrap; pointer-events: none !important; }
#caption { position: absolute; left: 50%; top: calc(196px + var(--st)); transform: translateX(-50%); width: min(92vw, 520px); text-align: center; font: italic 500 18px/1.35 var(--serif); color: #f4fbf8; text-shadow: 0 2px 10px rgba(0,0,0,.85), 0 0 2px rgba(0,0,0,.9); opacity: 0; transition: opacity .8s; pointer-events: none !important; }
#caption.on { opacity: 1; }
#toasts { position: absolute; left: calc(10px + var(--sl)); top: calc(134px + var(--st)); max-width: 54vw; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none !important; }
.toast { padding: 5px 10px; border-radius: 11px; background: rgba(4,18,22,.8); border: 1px solid var(--line); font: 700 11.5px/1.2 var(--sans); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: tIn .25s ease-out; }
.toast.dna { color: var(--acc2); }
.toast.bad { color: #ffb4a4; border-color: rgba(255,120,100,.4); }
@keyframes tIn { from { opacity: 0; transform: translateY(-6px); } }
#eventBar { position: absolute; left: calc(10px + var(--sl)); right: calc(10px + var(--sr)); top: calc(114px + var(--st)); box-sizing: border-box; padding: 6px 10px; border-radius: 12px; background: rgba(60, 20, 10, .75); border: 1px solid rgba(255,160,120,.45); font: 700 11px/1.2 var(--sans); text-align: center; pointer-events: none !important; }
#eventBar b { display: block; font: italic 600 14px/1.1 var(--serif); }
#eventBar i { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); margin-top: 4px; overflow: hidden; }
#eventBar u { display: block; height: 100%; width: 0; background: #ffb070; text-decoration: none; }
body[data-phase="play"] #goal { top: calc(70px + var(--st)); }
body.event #goal { top: calc(168px + var(--st)); }
body.event #caption { top: calc(240px + var(--st)); }

/* the action buttons: bottom right, clear of the safe area, the stick bottom left */
#controls { position: fixed; right: calc(12px + var(--sr)); bottom: calc(16px + var(--sb)); z-index: 12; width: 190px; height: 190px; }
.ab { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; touch-action: none; }
.ab svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ab span { font: 700 9.5px/1 var(--sans); letter-spacing: .02em; }
.ab.big { width: 84px; height: 84px; right: 0; bottom: 0; background: linear-gradient(180deg, rgba(63,193,176,.42), rgba(10,60,56,.78)); border-color: rgba(120,240,220,.5); }
.ab.big svg { width: 30px; height: 30px; }
#dashBtn { right: 94px; bottom: 4px; }
#reBtn { right: 82px; bottom: 76px; }
#abBtn { right: 8px; bottom: 98px; }
.ab.off { opacity: .4; }
.ab.ready { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(226,194,122,.25); }
.ab:active { transform: scale(.94); }
#reBtn.ready span { color: var(--gold); }

/* ---------- the documentary card ---------- */
#card2 { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px calc(22px + var(--sr)) calc(24px + var(--sb)) calc(22px + var(--sl)); background: radial-gradient(ellipse at 50% 50%, rgba(2,12,14,.9), rgba(2,8,10,.97)); animation: fadeIn .8s ease-out; }
body.carded #toasts, body.carded #caption { visibility: hidden; }
@keyframes fadeIn { from { opacity: 0; } }
.c2In { max-width: 440px; text-align: center; }
.c2In em { display: block; font: 800 11px/1 var(--sans); letter-spacing: .35em; color: var(--acc); font-style: normal; margin-bottom: 12px; text-transform: uppercase; }
.c2In h2 { font: italic 600 40px/1.05 var(--serif); margin: 0 0 14px; }
.c2In p { font: 500 19px/1.45 var(--serif); color: #dbece7; margin: 0 0 16px; }
#c2Odds { font: 700 14px/1.4 var(--sans); color: var(--gold); margin-bottom: 8px; }
#c2Odds small { display: block; font-weight: 500; color: var(--mut); font-size: 12px; }
.c2In .btns { justify-content: center; }

/* ---------- sheets ---------- */
#sheet { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.45); }
.shIn { width: 100%; max-width: 560px; height: min(86dvh, 820px); display: flex; flex-direction: column; background: linear-gradient(180deg, #0a2329, #061519); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 0 0 var(--sb); animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.shIn header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.shIn h2 { font: italic 600 26px/1.1 var(--serif); margin: 0; }
.x { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 24px; line-height: 1; }
#shTabs { display: flex; gap: 6px; padding: 4px 14px 8px; overflow-x: auto; scrollbar-width: none; }
#shTabs::-webkit-scrollbar { display: none; }
#shTabs button { flex: none; min-height: 36px; padding: 0 13px; border-radius: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.04); font: 700 13px/1 var(--sans); color: var(--mut); }
#shTabs button.on { background: rgba(63,193,176,.25); color: var(--ink); border-color: rgba(120,240,220,.5); }
#shBody { flex: 1; overflow-y: auto; padding: 4px 14px 16px; -webkit-overflow-scrolling: touch; -webkit-user-select: text; user-select: text; }
#shFoot { padding: 8px 14px 10px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 700 14px/1.2 var(--sans); }
#shFoot:empty { display: none; }
.dnaPill { display: inline-flex; align-items: baseline; gap: 4px; color: var(--acc2); }
.dnaPill b { font-size: 20px; color: var(--ink); }
.sec { font: 800 11px/1 var(--sans); letter-spacing: .14em; color: var(--acc); text-transform: uppercase; margin: 16px 2px 8px; }
.tc { border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px; margin-bottom: 8px; background: rgba(255,255,255,.025); }
.tc.can { border-color: rgba(120,240,220,.38); background: rgba(63,193,176,.07); }
.tc.lock { opacity: .62; }
.tc.own { border-color: rgba(226,194,122,.35); }
.tcH { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tcH b { font: 700 15px/1.2 var(--sans); }
.tcH small { font: 600 11px/1 var(--sans); color: var(--mut); }
.dots { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.15); }
.dots i.on { background: var(--gold); }
.tc p { font: 500 13px/1.4 var(--sans); color: #c6dbd5; margin: 5px 0 6px; }
.tcN { font: 600 12px/1.35 var(--sans); color: var(--acc2); }
.tcW { font: 600 12px/1.3 var(--sans); color: var(--mut); }
.fx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.fx span { font: 700 10.5px/1 var(--sans); padding: 4px 7px; border-radius: 9px; background: rgba(255,255,255,.07); }
.fx span.up { color: #9ff0c0; }
.fx span.dn { color: #ffb0a0; }
.buy { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 0; background: linear-gradient(180deg, #5fd8c6, #2a9e8f); color: #032623; font: 800 13px/1 var(--sans); white-space: nowrap; }
.buy:disabled { background: rgba(255,255,255,.1); color: var(--mut); }
.path { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font: 600 12px/1.3 var(--sans); color: var(--mut); margin-bottom: 6px; }
.path b { color: var(--ink); }
.path i { font-style: normal; color: var(--acc); }
.sk { display: grid; grid-template-columns: 1fr 120px 30px; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: 1px solid rgba(255,255,255,.05); font: 600 13px/1.2 var(--sans); }
.sk .bar { height: 6px; }
.sk .bar i { background: linear-gradient(90deg, var(--acc), var(--acc2)); }
.sk em { font-style: normal; text-align: right; color: var(--acc2); }
.cx { border-bottom: 1px solid rgba(255,255,255,.06); padding: 10px 2px; }
.cx b { font: italic 600 19px/1.15 var(--serif); }
.cx small { display: block; color: var(--acc); font: 700 11px/1.3 var(--sans); margin: 2px 0 4px; }
.cx ul { margin: 4px 0 0; padding-left: 18px; font: 500 13.5px/1.45 var(--sans); color: #d2e5df; }
.cx.lockd b { color: var(--mut); font-style: normal; font-family: var(--sans); font-size: 14px; }
.lin { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 13px; }
.lin b { color: var(--acc2); font-weight: 800; }
.lin span { color: var(--mut); }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.05); font: 600 14px/1.25 var(--sans); }
.row.me { color: var(--gold); }
.row em { font-style: normal; color: var(--mut); font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.seg button { min-height: 34px; padding: 0 11px; border-radius: 17px; border: 1px solid var(--line); background: transparent; font: 700 12px/1 var(--sans); color: var(--mut); }
.seg button.on { color: var(--ink); background: rgba(63,193,176,.22); }
.mxcBox { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(226,194,122,.1); border: 1px solid rgba(226,194,122,.3); font-size: 13px; margin: 10px 0; text-align: left; }
.mxcBox span { flex: 1; }
.howp { font: 500 14px/1.5 var(--sans); color: #d2e5df; }
.howp b { color: var(--ink); }

/* sign in */
.screen { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); padding: 16px; }
.cardS { width: 100%; max-width: 380px; background: #0a2329; border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.cardS h2 { font: italic 600 28px/1.1 var(--serif); margin: 0 0 6px; }
.cardS p { font-size: 13px; line-height: 1.45; }
.cardS form { display: flex; flex-direction: column; gap: 8px; }
.err { color: #ffb0a0; font-size: 13px; min-height: 16px; }
.link { background: none; border: 0; color: var(--acc2); font-size: 14px; min-height: 40px; }

@media (min-width: 900px) { #controls { transform: scale(1.05); transform-origin: bottom right; } #caption { font-size: 22px; } }
@media (max-height: 520px) {
  #caption { top: calc(64px + var(--st)); font-size: 16px; width: min(60vw, 520px); }
  #toasts { bottom: calc(110px + var(--sb)); }
  #goal { top: calc(68px + var(--st)); width: min(200px, 30vw); }
  #hint { bottom: calc(110px + var(--sb)); }
  /* the title on a phone on its side: the logo on the left, the menu on the right, scrolling if it must */
  #title { overflow-y: auto; padding-top: calc(var(--mdts-h, 52px) + 8px); }
  .tPane { flex-direction: row; align-items: center; gap: 24px; max-width: 820px; }
  .tLock { margin: 0; flex: 1; }
  .ldLogo, .tLogo { font-size: 48px; margin: 4px 0 8px; }
  .tSub { font-size: 16px; }
  .tMenu, .tPanel { flex: 1.2; }
  .tBtn { padding: 10px 14px; }
  .tTiles { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .tTile { min-height: 54px; }
  .tTile em { display: none; }
  .tFoot { margin-top: 4px; }
  .shIn { height: 94dvh; }
}

/* the whole tree, and first-time hints */
details.tree summary { min-height: 44px; display: flex; align-items: center; font: 700 14px/1 var(--sans); color: var(--acc2); cursor: pointer; }
.treeL { border-left: 1px solid var(--line); margin: 4px 0 10px 4px; }
.tn { display: flex; justify-content: space-between; gap: 8px; padding-top: 4px; padding-bottom: 4px; font: 600 12.5px/1.25 var(--sans); color: #8aa39d; border-bottom: 1px solid rgba(255,255,255,.03); }
.tn span { font-size: 10.5px; color: #5f7a74; white-space: nowrap; }
.tn.mine b { color: var(--gold); }
.tn.next b { color: var(--acc2); }
#hint { position: absolute; left: 50%; bottom: calc(220px + var(--sb)); transform: translateX(-50%) translateY(8px); width: min(86vw, 360px); padding: 10px 14px; border-radius: 14px; background: rgba(226,194,122,.95); color: #2a1a02; font: 700 13.5px/1.35 var(--sans); text-align: center; opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none !important; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
#hint.on { opacity: 1; transform: translateX(-50%) translateY(0); }
body.carded #hint { visibility: hidden; }

#flash { position: fixed; inset: 0; pointer-events: none; z-index: 55; background: #fff6e0; opacity: 0; }
#flash.go { animation: flash 2.2s ease-out; }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: .95; } 100% { opacity: 0; } }

/* the radial Tree of Life */
.radial { position: relative; margin: 6px -6px 4px; }
.rSvg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.rSvg .ring { fill: none; stroke: rgba(160,240,225,.07); stroke-width: 33; }
.rSvg .ring.odd { stroke: rgba(160,240,225,.035); }
.rSvg .br { stroke: rgba(170,210,200,.28); stroke-width: 1.6; fill: none; }
.rSvg .br.next { stroke: rgba(120,240,220,.7); stroke-width: 2.4; }
.rSvg .br.mine { stroke: #e2c27a; stroke-width: 4; }
.rSvg .nd { fill: #6f8c86; }
.rSvg .nd.next { fill: #5fe0cc; }
.rSvg .nd.mine { fill: #f2d48a; }
.rSvg .nd.on { stroke: #fff; stroke-width: 3; }
.rSvg .lb { fill: #f2d48a; font: 700 22px Inter, sans-serif; paint-order: stroke; stroke: #061519; stroke-width: 5px; }
.rSvg .eraLb { fill: #7fa59d; font: 600 18px Inter, sans-serif; text-anchor: middle; }
.rTip { text-align: center; font: 700 13px/1.3 var(--sans); color: var(--acc2); min-height: 20px; margin-top: 2px; }

#fade { position: fixed; inset: 0; pointer-events: none; z-index: 40; background: #04141a; opacity: 0; transition: opacity .9s ease; }
#fade.on { opacity: 1; }

/* the compass chip: where the land is (when you can breathe air) or the vent (when you live on its chemistry) */
#compass { position: absolute; left: calc(62px + var(--sl)); top: calc(100px + var(--st)); display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 7px; border-radius: 14px; background: rgba(4,18,22,.7); border: 1px solid var(--line); font: 700 11.5px/1 var(--sans); color: #cfe6e0; pointer-events: none !important; }
#compass i { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; font-style: normal; color: var(--gold); font-size: 15px; transition: transform .2s; }
body.event #compass { display: none; }

.cx.pic { display: grid; grid-template-columns: 1fr 84px; grid-template-areas: 'b img' 's img' 'u u'; column-gap: 8px; }
.cx.pic img { grid-area: img; width: 84px; height: 84px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, rgba(63,193,176,.22), rgba(4,20,26,.6)); }
.cx.pic b { grid-area: b; align-self: end; } .cx.pic small { grid-area: s; } .cx.pic ul { grid-area: u; }
.tc .fPic { float: right; width: 72px; height: 72px; margin: -2px -2px 4px 8px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, rgba(63,193,176,.22), rgba(4,20,26,.6)); }
.mePic { display: block; width: 128px; height: 128px; margin: 0 auto 4px; border-radius: 18px; background: radial-gradient(circle at 50% 40%, rgba(63,193,176,.25), rgba(4,20,26,.5)); }
.lPic { float: right; width: 40px; height: 40px; border-radius: 8px; margin-left: 6px; background: rgba(63,193,176,.1); }
.starPic { display: block; width: 150px; height: 150px; margin: -6px auto 0; }
.starCap { display: block; font: 700 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin: -2px 0 12px; }
.tEra { font: 600 11px/1.4 var(--sans); letter-spacing: .08em; color: rgba(232,246,242,.9); margin: 10px 0 0; text-shadow: 0 1px 3px rgba(0,0,0,.8), 0 1px 10px rgba(0,0,0,.6); transition: opacity .6s; }
.cTop b.long { font-size: 12.5px; }
/* the extinction bar: a full-width row under the status card on a phone held upright (the goals, toasts and caption
   move down for it), at the top between the cards when sideways */
body.evt #toasts { top: calc(168px + var(--st)); }
@media (orientation: landscape) and (max-height: 520px) { #eventBar { left: 50%; right: auto; top: calc(10px + var(--st)); transform: translateX(-50%); width: min(60vw, 260px); } body.event #goal { top: calc(124px + var(--st)); } body.event #caption { top: calc(214px + var(--st)); } body.evt #toasts { top: calc(134px + var(--st)); } }

/* ---------- Race Through Time (2.12) ---------- */
.tBtn.race { border-color: rgba(226,194,122,.45); background: linear-gradient(180deg, rgba(226,194,122,.2), rgba(70,50,14,.5)); }
.tBtn.race span::before { content: '⏱ '; }
#title.racePick .tLock { display: none; }
#title.racePick .tPane { justify-content: flex-start; min-height: 0; }
#tRace { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
body.racing #caption { top: calc(236px + var(--st)); }
#tRace > p { margin-bottom: 8px; font-size: 13px; }
.raceList { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; flex: 1; margin: 0 -4px; padding: 0 4px; }
.rGoal { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1px 10px; min-height: 50px; padding: 7px 12px; border-radius: 13px; border: 1px solid var(--line); background: rgba(255,255,255,.04); text-align: left; }
.rGoal b { font: 700 15px/1.2 var(--sans); }
.rGoal span { grid-column: 1; font: 500 11.5px/1.25 var(--sans); color: var(--mut); }
.rGoal em { grid-column: 2; grid-row: 1 / span 2; font: 700 12px/1.2 var(--sans); color: var(--gold); font-style: normal; white-space: nowrap; }
.rGoal.on { border-color: var(--gold); background: rgba(226,194,122,.14); box-shadow: inset 0 0 0 1px rgba(226,194,122,.35); }
.raceAny { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font: 600 12px/1.2 var(--sans); color: var(--mut); }
.raceAny select, .goalSel { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4,18,22,.9); color: var(--ink); font: 600 16px/1 var(--sans); }
.goalSel { margin-bottom: 8px; }
.raceSel { margin-top: 8px; font: 500 13px/1.35 var(--sans); color: #d8ece7; }
.raceSel b { color: var(--gold); }
#tRace .btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
#tRace .btns .btn { flex: 1 1 auto; }
#raceBox { width: 100%; padding: 7px 9px 8px; border-radius: 12px; background: rgba(4,18,22,.62); border: 1px solid rgba(226,194,122,.4); display: flex; flex-direction: column; gap: 3px; }
#rcT { font: 800 22px/1 var(--sans); font-variant-numeric: tabular-nums; color: #fff4d6; letter-spacing: .02em; }
#rcG { font: italic 600 14px/1.1 var(--serif); color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#raceBox .rcBar { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); overflow: hidden; margin: 2px 0; }
#rcF { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c99a3a, #f2d48a); text-decoration: none; transition: width .4s; }
#rcN { font: 600 10.5px/1.3 var(--sans); color: #cfe6e0; }
#raceGo { pointer-events: auto; min-height: 44px; max-width: 100%; padding: 6px 14px; border-radius: 22px; border: 1px solid rgba(226,194,122,.4); background: rgba(40,30,10,.72); color: #f2e2b8; font: 800 12.5px/1.2 var(--sans); text-align: center; }
#raceGo.go { border: 0; background: linear-gradient(180deg, #f2d48a, #c99a3a); color: #2a1a02; box-shadow: 0 4px 20px rgba(226,194,122,.35); animation: pulse 1.6s infinite; }
#raceGo.wait { opacity: .9; }
.route { display: flex; flex-direction: column; gap: 4px; }
.rs { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.rs > b { font: 800 12px/1 var(--sans); color: var(--mut); text-align: center; }
.rs span { display: block; font: 700 14px/1.2 var(--sans); }
.rs small { font: 500 11px/1.25 var(--sans); color: var(--mut); }
.rs.done { opacity: .62; } .rs.done > b { color: var(--acc2); }
.rs.next, .rs.pend { border-color: var(--gold); background: rgba(226,194,122,.1); } .rs.next > b, .rs.pend > b { color: var(--gold); }
#c2Odds small { display: block; margin-top: 6px; }
