/* TITANIC SURVIVAL - the MDT look (near-black glass, gold for the main
   actions) with an Edwardian serif for titles; brass and ivory accents */
:root {
  --ink: #f4efe4; --mute: #aab0b8; --faint: #6a7078; --bg: #04060a; --glass: rgba(8, 11, 16, 0.88); --glass2: rgba(20, 24, 30, 0.8);
  --line: rgba(220, 230, 255, 0.1); --line2: rgba(220, 230, 255, 0.2);
  --gold: #e8c26a; --gold2: #ffdc90; --goldInk: #2a1c04; --acc: #d8b26a; --ice: #bfe3f2; --good: #46e39a; --bad: #ff6a6a; --warn: #ffb15a;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif; --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { flex: none; }
#buildTag { position: fixed; right: 6px; bottom: calc(4px + var(--safe-b)); font: 10px system-ui, sans-serif; color: rgba(255, 255, 255, 0.35); z-index: 95; pointer-events: none; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.kick { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--acc); }
h2 { font: 700 24px/1.15 var(--serif); margin: 4px 0 6px; }
h3 { font: 700 17px/1.2 var(--serif); margin: 18px 0 4px; color: var(--gold2); }
p { margin: 6px 0; }

/* --- screen effects: vignette, under water, the cold */
#vignette { position: fixed; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55)); }
#underwater { position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0; transition: opacity 0.4s; background: radial-gradient(ellipse at 50% 30%, rgba(20, 60, 70, 0.55), rgba(0, 10, 14, 0.92)); }
#frost { position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(200, 230, 255, 0.35) 85%, rgba(230, 245, 255, 0.6)); }
body.dark #vignette { background: radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(0, 0, 0, 0.8)); }

/* --- loading */
#loading { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: radial-gradient(circle at 50% 42%, #10161f, var(--bg) 68%); transition: opacity 0.5s; }
#loading.gone { opacity: 0; pointer-events: none; }
.ld { text-align: center; width: 290px; }
.ld b { display: block; font: 800 34px var(--serif); letter-spacing: 5px; background: linear-gradient(180deg, #fff6d8, #e8c26a 55%, #b8862e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld b em { display: block; font-style: italic; font-size: 0.6em; letter-spacing: 9px; }
.ld .bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); margin: 16px 0 10px; overflow: hidden; }
.ld .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ice), var(--gold)); transition: width 0.3s; }
.ld span { color: var(--mute); font-size: 13.5px; }

/* --- buttons */
.btn { flex: 1; min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.07); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: transform 0.12s, background 0.2s; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, #c99a40); border-color: rgba(255, 230, 160, 0.7); color: var(--goldInk); box-shadow: 0 6px 20px rgba(232, 194, 106, 0.2); }
.btn.big { min-height: 54px; font-size: 17px; }
.btn.sm { flex: none; min-height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 106, 106, 0.16); border-color: rgba(255, 106, 106, 0.5); color: #ffb8b8; }
.btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.link { background: none; border: 0; color: var(--gold); padding: 10px 0; font-weight: 600; }
.err { color: var(--bad); min-height: 18px; font-size: 13px; margin: 4px 0; }
.card input:not([type=range]) { width: 100%; height: 48px; border-radius: 13px; border: 1px solid var(--line2); background: rgba(0, 0, 0, 0.35); color: var(--ink); padding: 0 14px; font: inherit; margin-bottom: 8px; }
form { margin: 0; }

/* --- the title card */
#title { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: flex-start; padding: calc(var(--mdts-h, 52px) + 20px) 6vw calc(24px + var(--safe-b)); background: linear-gradient(90deg, rgba(4, 6, 10, 0.92), rgba(4, 6, 10, 0.5) 46%, rgba(4, 6, 10, 0) 72%); }
.tCard { max-width: 480px; }
.tKick { font-size: 12px; font-weight: 800; letter-spacing: 2.4px; text-transform: uppercase; color: var(--ice); }
.tLogo { margin: 6px 0 8px; font: 800 clamp(48px, 10vw, 86px)/0.92 var(--serif); letter-spacing: 7px; background: linear-gradient(180deg, #fff6d8, #e8c26a 55%, #b8862e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 22px rgba(232, 194, 106, 0.25)); }
.tLogo em { display: block; font-style: italic; font-size: 0.42em; letter-spacing: 0.5em; margin-top: 6px; }
.tDate { font: italic 600 15px var(--serif); color: var(--ice); margin: 0 0 8px; }
.tTag { font-size: 16px; color: #e2e6ea; margin: 0 0 14px; }
.tStats { color: var(--mute); font-size: 13.5px; }
.tStats b { color: var(--gold); }
.tLinks { display: flex; gap: 2px 16px; flex-wrap: wrap; }
#title .btns { max-width: 360px; }
@media (max-width: 640px) {
  #title { align-items: flex-end; background: linear-gradient(0deg, rgba(4, 6, 10, 0.96), rgba(4, 6, 10, 0.6) 60%, rgba(4, 6, 10, 0)); }
  .tTag { font-size: 14.5px; }
}

/* --- the HUD */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud > *, #hud .hRight > * { pointer-events: auto; }
#clockPill { position: fixed; top: calc(64px + var(--safe-t)); left: calc(12px + var(--safe-l)); display: flex; flex-direction: column; padding: 7px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line2); pointer-events: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#clockPill b { font: 700 20px var(--serif); color: var(--gold2); letter-spacing: 0.5px; }
#clockPill span { font-size: 12px; color: var(--mute); font-weight: 600; }
#goal { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: min(460px, calc(100vw - 280px)); padding: 8px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line2); pointer-events: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#goal i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
#goal div { display: flex; flex-direction: column; min-width: 0; }
#goal b { font-size: 14px; }
#goal span { font-size: 12.5px; color: var(--mute); }
#goal em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--gold); white-space: nowrap; }
#goal.urgent { border-color: rgba(255, 120, 90, 0.6); }
#goal.urgent i { background: var(--bad); box-shadow: 0 0 12px var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.hRight { position: fixed; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); display: flex; gap: 6px; }
.hb { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(216, 178, 106, 0.45); background: rgba(6, 9, 14, 0.78); display: grid; place-items: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.hb svg { width: 21px; height: 21px; fill: #f8e3a8; }
.hb b { position: absolute; right: -4px; bottom: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: var(--goldInk); font-size: 11px; display: grid; place-items: center; }
#meters { position: fixed; left: calc(12px + var(--safe-l)); top: calc(126px + var(--safe-t)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.meter { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--mute); }
.meter i { width: 90px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.meter i b { display: block; height: 100%; width: 100%; background: var(--ice); transition: width 0.2s; }
.meter.low i b { background: var(--bad); }
.meter em { font-style: normal; color: var(--ink); }
.meter.warn { border-color: rgba(255, 177, 90, 0.6); } .meter.warn em { color: var(--warn); }
#line { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); max-width: min(620px, calc(100vw - 32px)); text-align: center; font: italic 600 17px/1.35 var(--serif); color: #fff6e0; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 2px #000; opacity: 0; transition: opacity 0.6s; pointer-events: none; }
#line.on { opacity: 1; }
#line small { display: block; font: 600 12px var(--font); font-style: normal; color: var(--gold); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 3px; }
#useBtn { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 170px); padding: 0 18px; height: 52px; border-radius: 99px; border: 1px solid rgba(255, 230, 160, 0.7); background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, #c99a40); color: var(--goldInk); font-weight: 750; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); animation: pop 0.25s; }
#useBtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#useBtn kbd { font: 700 11px var(--font); border: 1px solid rgba(42, 28, 4, 0.4); border-radius: 5px; padding: 1px 5px; }
body.touch #useBtn kbd { display: none; }
@keyframes pop { from { transform: translateX(-50%) scale(0.85); opacity: 0; } }
@media (max-width: 700px) {
  #goal { top: calc(58px + var(--safe-t)); left: 12px; right: 12px; transform: none; max-width: none; padding: 6px 12px; }
  #clockPill { top: calc(112px + var(--safe-t)); padding: 4px 10px; } #clockPill b { font-size: 16px; }
  #meters { top: calc(168px + var(--safe-t)); }
  .hb { width: 40px; height: 40px; }
  body.touch #useBtn { bottom: calc(190px + var(--safe-b)); }
  #line { bottom: calc(150px + var(--safe-b)); font-size: 15px; }
}

/* --- touch: hold and jump (the stick is the shared MDT stick, fixed bottom-left) */
#controls { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
body:not(.touch) #controls button { display: none; }
#jumpBtn, #holdBtn { position: fixed; border-radius: 50%; border: 1px solid var(--line2); background: rgba(6, 9, 14, 0.6); pointer-events: auto; display: grid; place-items: center; touch-action: none; }
#jumpBtn { right: calc(22px + var(--safe-r)); bottom: calc(30px + var(--safe-b)); width: 62px; height: 62px; }
#holdBtn { right: calc(96px + var(--safe-r)); bottom: calc(44px + var(--safe-b)); width: 70px; height: 70px; flex-direction: column; gap: 0; border-color: rgba(216, 178, 106, 0.6); }
#holdBtn span { font-size: 10.5px; font-weight: 800; color: var(--gold2); letter-spacing: 0.5px; margin-top: -2px; }
#jumpBtn svg, #holdBtn svg { width: 26px; height: 26px; fill: #fff; }
#holdBtn:active, #holdBtn.on { background: rgba(232, 194, 106, 0.35); }
body.steep #holdBtn { animation: pulse 1s infinite; border-color: var(--gold); }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(232, 194, 106, 0.15); } }

/* --- the cinematic bars (the break, the end) */
#cine { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
#cine .cineTop, #cine .cineBot { position: absolute; left: 0; right: 0; height: 11vh; background: #000; transition: transform 0.8s; }
#cine .cineTop { top: 0; } #cine .cineBot { bottom: 0; display: flex; align-items: center; justify-content: center; }
#cine p { font: italic 600 17px var(--serif); color: #f4ead0; margin: 0; padding: 0 20px; text-align: center; }

/* --- toast and note */
#toast { position: fixed; left: 50%; top: calc(80px + var(--safe-t)); transform: translateX(-50%) translateY(-10px); z-index: 70; padding: 10px 16px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line2); font-weight: 650; font-size: 14px; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; max-width: calc(100vw - 30px); text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#note { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); z-index: 50; width: min(420px, calc(100vw - 24px)); padding: 14px 16px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); animation: up 0.25s ease-out; }
#note p { margin: 0 0 10px; } #note .btns { margin-top: 6px; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0; } }

/* --- sheets */
.screen { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) 14px calc(16px + var(--safe-b)); background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.screen .card { width: 100%; max-width: 460px; max-height: 100%; overflow: auto; padding: 18px 20px 20px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line2); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.screen .card.wide { max-width: 620px; }
/* clear the shell's top bar (the full bar and guest line on the title and end screens, the small pill in play) */
body[data-phase="play"] .screen { padding-top: calc(70px + var(--safe-t)); }
body[data-phase="title"] .screen, body[data-phase="end"] .screen { padding-top: calc(100px + var(--safe-t)); }
.shHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.06); }
.pBar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 4px 0 10px; }
.pBar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ice), var(--gold)); }
.logList { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.logItem { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.logItem b { display: block; font: 700 15px var(--serif); color: var(--gold2); }
.logItem span { font-size: 12px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.logItem p { font-size: 13.5px; color: #dfe4ea; margin: 4px 0 0; }
.logItem.locked { opacity: 0.45; } .logItem.locked p { display: none; }
.howList p { padding-left: 4px; }
.howList b { color: var(--gold2); }
.mem { text-align: center; }
.mem .big { font: 800 52px/1 var(--serif); color: var(--gold2); }
.mem .row { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.mem .row div { flex: 1; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.mem .row b { display: block; font: 800 26px var(--serif); color: var(--ink); }
.mem .row span { font-size: 12px; color: var(--mute); }
.endTitle { font: 800 36px/1.05 var(--serif); margin: 6px 0; background: linear-gradient(180deg, #fff6d8, #e8c26a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.endTitle.lost { background: linear-gradient(180deg, #e8eef4, #8aa0b8); -webkit-background-clip: text; background-clip: text; }
.statRow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.statRow div { padding: 9px 11px; border-radius: 13px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.statRow b { display: block; font-size: 18px; } .statRow span { font-size: 12px; color: var(--mute); }
.mxcBox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 10px; border-radius: 14px; background: rgba(232, 194, 106, 0.1); border: 1px solid rgba(232, 194, 106, 0.35); }
.mxcBox span { flex: 1; } .mxcBox.paid { border-color: var(--good); }
/* the deck plan */
#plan { width: 100%; height: auto; display: block; margin-top: 8px; border-radius: 12px; background: #0a1018; border: 1px solid var(--line); }
.planTabs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.planTabs button { padding: 5px 9px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.05); font-size: 12px; font-weight: 700; }
.planTabs button.on { background: var(--gold); color: var(--goldInk); border-color: var(--gold); }

/* the ticket choice on the title card */
.ticket { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; }
.ticket span { font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--mute); margin-right: 4px; }
.ticket button { padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.05); font-size: 13px; font-weight: 700; }
.ticket button.on { background: var(--gold); color: var(--goldInk); border-color: var(--gold); }

/* Watch her sink: only the clock and the narration */
body.watch #goal, body.watch .hRight, body.watch #meters, body.watch #useBtn, body.watch #controls { display: none !important; }
body.watch #line { bottom: calc(40px + var(--safe-b)); }
.ldFact { display: block; margin-top: 8px; font: italic 600 13px/1.4 var(--serif); color: var(--ice); opacity: 0.85; }

/* the goal's direction when its marker is off screen */
#edge { position: fixed; left: 0; top: 0; width: 0; height: 0; margin: 0; pointer-events: none; z-index: 5; }
#edge::before { content: ''; position: absolute; left: -14px; top: -11px; border-left: 22px solid rgba(232, 194, 106, 0.92); border-top: 11px solid transparent; border-bottom: 11px solid transparent; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8)); animation: edgePulse 1.2s ease-in-out infinite; }
#edge[hidden] { display: none; }
@keyframes edgePulse { 50% { transform: translateX(-4px); } }
