:root {
  --ink: rgba(8, 9, 12, 0.72);
  --paper: #f7f5ec;
  --muted: #b3b8c2;
  --safe: #5ad873;
  --caution: #ffc520;
  --danger: #ff523a;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
/* Author display rules (e.g. #lobby's grid) would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fb4d8; color: var(--paper); font-family: var(--font); }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#lobby { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, rgba(20,30,50,0.35), rgba(20,30,50,0.75)); padding: 16px; }
#lobby .card { width: min(440px, 100%); background: var(--ink); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
#lobby h1 { margin: 0; font-size: 44px; letter-spacing: 0.08em; color: var(--caution); }
#lobby .tag { margin: 4px 0 20px; color: var(--muted); }
#lobby label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
#lobby input { width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 8px; border: 1px solid #444b57; background: #15181e; color: var(--paper); font-size: 16px; }
#lobby .row { display: flex; gap: 10px; }
#lobby .row input { margin-top: 0; text-transform: uppercase; letter-spacing: 0.2em; }
#lobby button { padding: 10px 18px; border-radius: 8px; border: 0; font-size: 16px; font-weight: 600; cursor: pointer; background: #39404c; color: var(--paper); white-space: nowrap; }
#lobby button.primary { width: 100%; background: var(--caution); color: #1b1c22; }
#lobby button:disabled { opacity: 0.5; cursor: default; }
#lobby .or { text-align: center; margin: 16px 0 10px; color: var(--muted); font-size: 13px; }
#lobby .status { min-height: 1.4em; color: var(--caution); }
#lobby details { margin-top: 10px; color: var(--muted); font-size: 13px; }
#lobby .keys td { padding: 2px 10px 2px 0; }
#lobby .keys td:first-child { color: var(--paper); white-space: nowrap; }

#hud { position: fixed; inset: 0; pointer-events: none; font-size: 15px; text-shadow: 0 1px 2px #000; }
.panel { background: var(--ink); border-radius: 8px; padding: 10px 14px; }

#sunset { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: min(520px, 60vw); height: 14px; background: var(--ink); border-radius: 7px; overflow: visible; }
#sunset-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, #ff6b20, var(--caution)); }
#sunset-text { position: absolute; top: 18px; left: 0; right: 0; text-align: center; font-weight: 600; letter-spacing: 0.05em; }

#jobs { position: absolute; top: 16px; left: 16px; min-width: 300px; }
#jobs h3 { margin: 0 0 6px; color: var(--caution); font-size: 14px; letter-spacing: 0.1em; }
#jobs .job { margin: 3px 0; }
#jobs .job.done { color: var(--muted); text-decoration: line-through; }
#jobs .meta { margin-top: 6px; color: var(--muted); font-size: 13px; }

#session { position: absolute; top: 16px; right: 16px; text-align: right; color: var(--muted); }
#session .room { color: var(--caution); font-size: 22px; font-weight: 700; letter-spacing: 0.15em; }
#session .link { pointer-events: auto; color: var(--paper); font-size: 12px; cursor: pointer; text-decoration: underline; }

#gust { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); background: var(--ink); border-radius: 8px; padding: 8px 18px; text-align: center; font-size: 24px; font-weight: 800; color: var(--danger); }
#gust small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

#prompts { position: absolute; bottom: 140px; left: 0; right: 0; text-align: center; font-size: 17px; font-weight: 600; }
#prompts div { margin: 4px 0; }
#prompts .danger { color: var(--danger); font-size: 22px; }
#prompts .caution { color: var(--caution); }

#station { position: absolute; right: 16px; bottom: 120px; width: 300px; }
#station h3 { margin: 0; color: var(--caution); font-size: 15px; }
#station .bar { position: relative; height: 16px; margin-top: 8px; background: #2c2f36; border-radius: 4px; overflow: hidden; }
#station .bar > div { height: 100%; }
#station .bar::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 20%; background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(255,255,255,0.35) 4px 6px); }

#tilt { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 4px 10px; }
#tilt .horizon { stroke: var(--muted); stroke-width: 1.5; }
#tilt .deck { stroke-width: 7; stroke-linecap: round; }
#tilt .limit { stroke: var(--danger); stroke-width: 3; }
#tilt text { fill: var(--paper); font: 600 15px var(--font); }

#markers { position: absolute; inset: 0; }
.marker { position: absolute; transform: translate(-50%, -50%); text-align: center; font-size: 12px; font-weight: 700; white-space: nowrap; }
.marker .dot { width: 18px; height: 18px; margin: 0 auto 2px; transform: rotate(45deg); border-radius: 3px; }
.marker.window .dot { background: rgba(255, 197, 32, 0.85); transform: none; width: 22px; height: 22px; border: 2px solid #fff3; }
.marker.edge { opacity: 0.6; }

#chat { position: absolute; left: 16px; bottom: 120px; width: min(460px, 50vw); }
#chat-lines div { margin: 2px 0; }
#chat-input { pointer-events: auto; width: 100%; padding: 8px; border-radius: 6px; border: 0; background: #15181eee; color: var(--paper); font-size: 15px; }

#rating { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(10, 11, 15, 0.92); border-radius: 14px; padding: 26px 40px; text-align: center; pointer-events: auto; }
#rating h2 { margin: 0 0 8px; color: var(--caution); letter-spacing: 0.1em; }
#rating .stars { font-size: 52px; color: var(--caution); letter-spacing: 6px; }
#rating .stars .off { color: #555b66; }

#hint { position: absolute; bottom: 8px; left: 16px; color: var(--muted); font-size: 12px; }

@media (max-width: 700px) {
  #jobs { min-width: 0; max-width: 55vw; font-size: 12px; }
  #station { width: 220px; }
}
