:root {
  --bg: #04050d;
  --glass: rgba(10, 14, 32, 0.52);
  --glass-strong: rgba(8, 11, 26, 0.78);
  --line: rgba(160, 200, 255, 0.16);
  --line-strong: rgba(170, 215, 255, 0.34);
  --text: #e8f0ff;
  --muted: rgba(210, 225, 255, 0.62);
  --faint: rgba(200, 220, 255, 0.36);
  --cyan: #7fe3ff;
  --warm: #ffcf8a;
  --rose: #ff9ad5;
  --green: #86ffb6;
  --red: #ff6b7a;
  --radius: 18px;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); overflow: hidden; -webkit-font-smoothing: antialiased; }
#unity-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; background: var(--bg); }

.hidden { display: none !important; }
.display { font-family: var(--display); letter-spacing: 0.01em; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--faint); }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.22em; color: var(--muted); }
kbd { display: inline-block; min-width: 1.7em; padding: 1px 6px; margin: 0 2px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; font: 600 11px var(--mono); color: var(--text); text-align: center; background: rgba(255,255,255,0.04); }

.glass {
  background: linear-gradient(160deg, rgba(40, 60, 120, 0.22), rgba(10, 12, 30, 0.35)) , var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 10, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button.primary {
  padding: 11px 20px; border-radius: 999px; font-weight: 700; letter-spacing: 0.02em; color: #051018;
  background: linear-gradient(135deg, #9ef0ff, #7fb8ff 55%, #c79bff);
  box-shadow: 0 0 24px rgba(127, 227, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s;
}
button.primary:hover { transform: translateY(-1px); box-shadow: 0 0 36px rgba(127, 227, 255, 0.55); }
button.primary:disabled { filter: grayscale(0.9) brightness(0.6); cursor: default; transform: none; box-shadow: none; }
button.primary.big { padding: 14px 28px; font-size: 15px; }
button.primary kbd { border-color: rgba(0,0,0,0.25); color: #051018; background: rgba(255,255,255,0.35); }
button.ghost { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text); transition: background .2s; }
button.ghost:hover { background: rgba(255,255,255,0.07); }
button.close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,0.35); border: 1px solid var(--line); color: var(--text); z-index: 3; }
button.close:hover { background: rgba(255,255,255,0.12); }

input, textarea {
  width: 100%; font: 500 14px var(--body); color: var(--text); padding: 11px 14px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line-strong); border-radius: 12px; outline: none; resize: none;
}
input:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(127, 227, 255, 0.15); }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#ui .glass, #ui button, #ui input, #ui textarea, #ui .modal, #map, #touch * { pointer-events: auto; }

/* ───────── Labels & markers ───────── */
#labels, #markers { position: absolute; inset: 0; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0; white-space: pre; text-align: center;
  font: 600 12px var(--body); letter-spacing: 0.04em; text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 0 2px #000; opacity: 0.85;
  will-change: transform, left, top;
}
.label.k3 { font: 500 13px var(--display); letter-spacing: 0.08em; opacity: 0.9; }
.label.k7 { font-size: 12px; }
.marker { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; will-change: left, top; }
.marker .arrow { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 14px solid currentColor; filter: drop-shadow(0 0 6px currentColor); }
.marker .diamond { width: 12px; height: 12px; border: 2px solid currentColor; transform: rotate(45deg); box-shadow: 0 0 12px currentColor; animation: pulse 1.8s ease-in-out infinite; }
.marker .mlabel { font: 600 11px var(--body); color: var(--text); text-shadow: 0 0 6px #000; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.marker .mdist { font: 10px var(--mono); color: var(--muted); }
.marker.home .arrow { border-bottom-color: var(--green); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ───────── HUD ───────── */
#hud { position: absolute; inset: 0; }
#captain { position: absolute; top: 18px; left: 18px; display: flex; gap: 14px; align-items: center; padding: 10px 18px 10px 10px; }
.rings { position: relative; width: 64px; height: 64px; }
.rings svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 4; }
.ring { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .25s ease; }
.ring.hp { stroke: url(#none); stroke: var(--green); filter: drop-shadow(0 0 4px var(--green)); }
.ring.en { stroke: var(--cyan); filter: drop-shadow(0 0 4px var(--cyan)); }
#captain-ship { position: absolute; left: 50%; top: 50%; width: 30px; transform: translate(-50%, -50%); filter: drop-shadow(0 0 6px rgba(127,227,255,0.6)); }
#captain-name { font-size: 14px; }
.captain-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.minerals { margin-top: 6px; font: 700 15px var(--display); color: var(--warm); display: flex; align-items: center; gap: 8px; }
.gem { width: 10px; height: 10px; transform: rotate(45deg); background: linear-gradient(135deg, #fff2c9, var(--warm)); box-shadow: 0 0 10px var(--warm); }
.minerals.bump { animation: bump .5s ease; }
@keyframes bump { 30% { transform: scale(1.18); color: #fff; } }

#coords { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); }

#feed { position: absolute; top: 18px; right: 18px; width: min(380px, 38vw); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.feed-item {
  padding: 8px 14px; font-size: 12.5px; line-height: 1.45; color: var(--text); border-radius: 12px; max-width: 100%;
  background: rgba(8, 12, 28, 0.42); border: 1px solid var(--line); backdrop-filter: blur(8px);
  animation: feedIn .6s ease both; transition: opacity 1.2s ease;
}
.feed-item.chat b { color: var(--cyan); font-weight: 700; }
.feed-item.old { opacity: 0; }
@keyframes feedIn { from { opacity: 0; transform: translateX(20px); } }

#tracker { position: absolute; left: 18px; bottom: 18px; width: min(340px, 40vw); display: flex; flex-direction: column; gap: 8px; }
.track {
  padding: 10px 14px 10px 16px; position: relative; overflow: hidden; cursor: pointer; pointer-events: auto;
}
.track::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--cyan)); box-shadow: 0 0 12px var(--c, var(--cyan)); }
.track .t-title { font: 500 12.5px var(--display); }
.track .t-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.track .t-bar { height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 7px; overflow: hidden; }
.track .t-bar i { display: block; height: 100%; background: var(--c, var(--cyan)); }
.track.ready .t-hint { color: var(--green); }

#radar-wrap { position: absolute; right: 18px; bottom: 18px; width: 180px; height: 180px; border-radius: 50%; }
#radar { width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(20, 40, 80, 0.4), rgba(4, 6, 16, 0.65)); border: 1px solid var(--line); backdrop-filter: blur(6px); }
#radar-range { position: absolute; bottom: -18px; width: 100%; text-align: center; }

#prompt { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); padding: 10px 22px; border-radius: 999px; font-weight: 600; font-size: 14px; animation: promptIn .3s ease both; cursor: pointer; }
@keyframes promptIn { from { opacity: 0; transform: translate(-50%, 8px); } }
#hints { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); white-space: nowrap; opacity: 0.8; }
#chat-box { position: absolute; left: 50%; bottom: 140px; transform: translateX(-50%); width: min(560px, 80vw); pointer-events: auto; }

/* ───────── Panels ───────── */
.panel { position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(560px, 46vw); display: flex; flex-direction: column; overflow: hidden; animation: slideIn .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } }
.station-head { position: relative; height: 170px; flex: none; }
#station-image { position: absolute; inset: 0; background-size: cover; background-position: center; mask-image: linear-gradient(to bottom, #000 30%, transparent); -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent); opacity: 0.8; }
.station-title { position: absolute; left: 24px; bottom: 6px; right: 24px; }
.station-title h1 { margin: 4px 0; font-size: 28px; font-weight: 500; text-shadow: 0 2px 20px rgba(0,0,0,0.8); }
#station-owner { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); flex: none; }
.tabs button { padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--cyan); }
.tab-body { flex: 1; overflow-y: auto; padding: 18px 22px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent; }
.pane { display: none; animation: fade .35s ease both; }
.pane.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.panel footer { padding: 14px 22px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex: none; }

.section-title { font: 500 12px var(--display); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 18px 0 10px; }
.section-title:first-child { margin-top: 0; }

.story-card { position: relative; padding: 14px 16px 14px 20px; margin-bottom: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); cursor: pointer; transition: background .2s, transform .2s, border-color .2s; overflow: hidden; }
.story-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); box-shadow: 0 0 14px var(--c); }
.story-card:hover { background: rgba(255,255,255,0.07); transform: translateX(3px); border-color: var(--line-strong); }
.story-card h3 { margin: 0 0 4px; font: 500 15px var(--display); }
.story-card p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.story-card .who { font-size: 11px; color: var(--faint); margin-top: 8px; letter-spacing: 0.04em; }
.badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.badge.ai { background: rgba(199, 155, 255, 0.18); color: #d9b8ff; }
.badge.active { background: rgba(134, 255, 182, 0.15); color: var(--green); }
.badge.ship { background: rgba(255, 207, 138, 0.16); color: var(--warm); }
.story-card .lock { color: var(--warm); }
.story-card .unlock { color: var(--green); }
.chip.rep-up { border-color: rgba(255, 150, 190, 0.5); color: #ffc7dc; }
.chip.rep-down { border-color: rgba(140, 150, 180, 0.5); color: #b8c0d8; }
.story-card .chapter { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rose); margin: -2px 0 4px; }
.chip.ship { border-color: rgba(255, 207, 138, 0.55); color: #ffe2b8; box-shadow: 0 0 12px rgba(255, 207, 138, 0.2); }
.keys { display: flex; flex-direction: column; gap: 6px; }
.key { padding: 10px 14px; border-radius: 12px; font-size: 13px; border: 1px dashed rgba(255, 207, 138, 0.5); color: #ffe2b8; line-height: 1.5; }
.key.have { border-color: rgba(134, 255, 182, 0.5); color: #c4ffd9; }
.hull .trait { margin-top: 8px; font-size: 11px; color: var(--warm); line-height: 1.4; }
.hull .trait span { color: var(--faint); }

.waiting { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 14px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13px; line-height: 1.5; }
.spinner { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid rgba(127,227,255,0.2); border-top-color: var(--cyan); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.history { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line-strong); }
.history li { position: relative; padding: 0 0 12px 18px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.history li::before { content: ''; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.history li:last-child { color: var(--text); }

.items { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); }
.chip b { font-weight: 700; }
.chip.cost { border-color: rgba(255, 120, 140, 0.35); color: #ffc0c8; }
.chip.reward { border-color: rgba(134, 255, 182, 0.35); color: #c4ffd9; }
.chip.need { border-color: rgba(255, 207, 138, 0.35); color: #ffe2b8; }
.chip.gen { border-color: rgba(199, 155, 255, 0.4); color: #e2ccff; }
.chip.mineral b { color: var(--warm); }
.row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.colonize { margin-top: 10px; padding: 18px; border-radius: 16px; background: linear-gradient(135deg, rgba(134,255,182,0.08), rgba(127,227,255,0.06)); border: 1px solid rgba(134,255,182,0.25); }
.colonize p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }

.hulls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hull { padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); text-align: center; cursor: pointer; transition: all .2s; }
.hull:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.06); }
.hull.current { border-color: var(--cyan); box-shadow: 0 0 20px rgba(127,227,255,0.15) inset; }
.hull img { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(127,227,255,0.4)); }
.hull h4 { margin: 6px 0 2px; font: 500 13px var(--display); }
.hull p { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.4; }
.hull .stats { font: 10px var(--mono); color: var(--faint); margin-top: 6px; }
.upgrade { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.upgrade:last-child { border-bottom: 0; }
.upgrade .u-text { flex: 1; }
.upgrade h4 { margin: 0; font-size: 14px; }
.upgrade p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.pips { display: flex; gap: 4px; margin-top: 6px; }
.pips i { width: 16px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); }
.pips i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); }
.stat b { display: block; font: 500 18px var(--display); }
.stat span { font-size: 11px; color: var(--muted); }

/* ───────── Modals ───────── */
.modal { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(4, 6, 20, 0.35), rgba(2, 3, 10, 0.75)); animation: fade .35s ease both; z-index: 10; }
.quest-card { width: min(760px, 94vw); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; position: relative; }
#quest-art { position: relative; height: 260px; flex: none; background-size: cover; background-position: center; transition: opacity .25s ease; }
.quest-art-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.05), rgba(6, 8, 20, 0.2) 40%, rgba(8, 11, 26, 0.95)), linear-gradient(90deg, color-mix(in srgb, var(--qc, #7fe3ff) 22%, transparent), transparent 60%); }
.quest-heading { position: absolute; left: 28px; right: 28px; bottom: 14px; }
.quest-heading h2 { margin: 6px 0 6px; font-size: 26px; font-weight: 500; text-shadow: 0 2px 24px rgba(0,0,0,0.7); }
#quest-giver { font-size: 13px; color: var(--muted); }
#quest-giver b { color: var(--qc, var(--cyan)); font-weight: 700; }
.quest-body { padding: 18px 28px 22px; overflow-y: auto; }
#quest-outcome { font-style: italic; color: var(--warm); font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
#quest-outcome:empty { display: none; }
#quest-text { font-size: 15.5px; line-height: 1.75; color: #dfe8ff; white-space: pre-line; }
#quest-text .caret { display: inline-block; width: 7px; height: 1em; background: var(--qc, var(--cyan)); vertical-align: text-bottom; animation: pulse 0.8s infinite; margin-left: 2px; }
#quest-objective { margin-top: 16px; padding: 12px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--qc, #7fe3ff) 45%, transparent); background: color-mix(in srgb, var(--qc, #7fe3ff) 8%, transparent); font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
#quest-objective:empty { display: none; }
#quest-objective.done { border-color: rgba(134,255,182,0.5); background: rgba(134,255,182,0.07); }
#quest-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.choice { text-align: left; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(255,255,255,0.04); transition: all .2s ease; }
.choice:hover:not(:disabled) { background: color-mix(in srgb, var(--qc, #7fe3ff) 14%, transparent); border-color: var(--qc, var(--cyan)); transform: translateX(4px); }
.choice:disabled { opacity: 0.5; cursor: default; }
.choice .c-label { font-weight: 600; font-size: 14.5px; }
.choice .c-label::before { content: '›  '; color: var(--qc, var(--cyan)); }
.choice .items { margin-top: 8px; }
.choice .why { font-size: 12px; color: var(--warm); margin-top: 6px; }
#quest-meta { margin-top: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.epilogue { margin-top: 16px; padding: 16px 18px; border-radius: 14px; background: linear-gradient(135deg, rgba(255, 207, 138, 0.08), rgba(199, 155, 255, 0.07)); border: 1px solid rgba(255, 207, 138, 0.25); font-size: 14.5px; line-height: 1.7; }

.echo-card { width: min(520px, 92vw); padding: 34px 32px 26px; text-align: center; position: relative; overflow: hidden; }
.echo-wisp { width: 90px; height: 90px; margin: 0 auto 18px; border-radius: 50%; background: radial-gradient(circle, #fff 0%, #a9c9ff 20%, rgba(90, 140, 255, 0.25) 50%, transparent 70%); animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.15); opacity: 0.8; } }
#echo-text { font: 300 20px/1.5 var(--display); margin-bottom: 14px; }
.echo-card textarea { margin: 14px 0 4px; }
.echo-card .row { justify-content: center; }
.echo-card button.ghost { margin-top: 18px; }

.help-card { width: min(640px, 94vw); padding: 30px 32px; }
.help-card h2 { margin: 0 0 18px; font-weight: 500; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; font-size: 13px; color: var(--muted); }
.help-card p { line-height: 1.65; font-size: 13.5px; margin: 20px 0; }

/* ───────── Map ───────── */
#map { position: absolute; inset: 0; background: #03040b; z-index: 9; animation: fade .3s ease both; }
#map-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
#map-canvas:active { cursor: grabbing; }
.map-head { position: absolute; top: 22px; left: 26px; }
#map-stats { font-size: 13px; margin-top: 6px; }
.map-legend { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); }
#map-tip { position: absolute; padding: 10px 14px; font-size: 12.5px; line-height: 1.5; pointer-events: none; max-width: 260px; }
#map-tip b { font-family: var(--display); font-weight: 500; }

/* ───────── Toasts, banners ───────── */
#toasts { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 20; }
.toast { padding: 10px 18px; border-radius: 999px; font-size: 13.5px; background: rgba(8, 12, 30, 0.8); border: 1px solid var(--line-strong); backdrop-filter: blur(10px); animation: toastIn .4s ease both; max-width: 80vw; text-align: center; }
.toast.success { border-color: rgba(134,255,182,0.5); }
.toast.warn { border-color: rgba(255,120,140,0.5); }
.toast.quest, .toast.signal { border-color: rgba(199,155,255,0.55); box-shadow: 0 0 24px rgba(199,155,255,0.2); }
.toast.discovery { border-color: rgba(255,207,138,0.5); }
.toast.echo { border-color: rgba(127,180,255,0.6); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .5s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }
#banner { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 15; animation: bannerIn 4s ease both; pointer-events: none; }
#banner .b-title { font: 500 28px var(--display); text-shadow: 0 0 40px var(--bc, var(--cyan)); }
#banner .b-text { margin-top: 8px; color: var(--muted); font-size: 15px; }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -40%); letter-spacing: 0.2em; } 15% { opacity: 1; transform: translate(-50%, -50%); letter-spacing: 0; } 80% { opacity: 1; } 100% { opacity: 0; } }
#death { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 10px; background: radial-gradient(circle, rgba(60, 0, 20, 0.3), rgba(0, 0, 0, 0.7)); z-index: 12; animation: fade 1s ease both; }
#death .display { font-size: 34px; }

/* ───────── Loader ───────── */
#loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; text-align: center; transition: opacity 1.4s ease; overflow: hidden;
  background: radial-gradient(ellipse at 30% 20%, rgba(90, 60, 200, 0.35), transparent 55%), radial-gradient(ellipse at 75% 80%, rgba(20, 140, 200, 0.28), transparent 50%), radial-gradient(ellipse at 60% 40%, rgba(255, 120, 180, 0.12), transparent 40%), #03040b; }
#loader::before { content: ''; position: absolute; inset: -50%; background-image: radial-gradient(1px 1px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 120px 80px, #cde, transparent), radial-gradient(1.5px 1.5px at 200px 150px, #fff, transparent), radial-gradient(1px 1px at 300px 40px, #ddf, transparent), radial-gradient(1px 1px at 380px 190px, #fff, transparent); background-size: 420px 220px; opacity: 0.5; animation: drift 120s linear infinite; }
@keyframes drift { to { transform: translate(-420px, -220px); } }
#loader.gone { opacity: 0; pointer-events: none; }
.loader-inner { position: relative; padding: 24px; }
.title { font-size: clamp(38px, 7vw, 86px); font-weight: 300; line-height: 1.02; margin: 14px 0 20px; background: linear-gradient(120deg, #fff, #a9e8ff 40%, #d9b8ff 70%, #ffd6ea); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(127, 200, 255, 0.35)); }
.tagline { color: var(--muted); font-size: 15px; line-height: 1.7; margin: 0 auto 34px; max-width: 560px; }
.bar { width: min(360px, 70vw); height: 2px; background: rgba(255,255,255,0.1); margin: 0 auto 14px; border-radius: 2px; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--rose)); box-shadow: 0 0 12px var(--cyan); transition: width .3s ease; }
#enter { margin-top: 18px; animation: fade .6s ease both; }

/* ───────── Touch ───────── */
#touch { position: absolute; inset: 0; pointer-events: none; }
#stick { position: absolute; left: 28px; bottom: 120px; width: 140px; height: 140px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(10, 16, 36, 0.35); pointer-events: auto; touch-action: none; }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle, rgba(160, 230, 255, 0.6), rgba(80, 140, 255, 0.25)); box-shadow: 0 0 20px rgba(127,227,255,0.4); }
#touch-buttons { position: absolute; right: 22px; bottom: 220px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#touch-buttons button { width: 70px; height: 70px; border-radius: 50%; background: rgba(10, 16, 36, 0.45); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 700; touch-action: none; }
#touch-buttons button.on { background: rgba(127, 227, 255, 0.3); }

@media (max-width: 820px) {
  .panel { left: 8px; right: 8px; top: 30vh; bottom: 8px; width: auto; }
  #feed { display: none; }
  #hints { display: none; }
  #tracker { bottom: 280px; width: 60vw; }
  #radar-wrap { width: 120px; height: 120px; top: 110px; right: 12px; bottom: auto; }
  #radar { width: 120px; height: 120px; }
  #captain { transform: scale(0.85); transform-origin: top left; }
  .hulls { grid-template-columns: 1fr; }
  .cols, .help-grid { grid-template-columns: 1fr; }
}

/* ───────── Gear ───────── */
.ability { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; position: relative; }
.ability i { display: block; height: 3px; width: 60px; border-radius: 2px; background: linear-gradient(90deg, var(--cyan) var(--p, 100%), rgba(255,255,255,0.12) var(--p, 100%)); }
.ability.ready span { color: var(--cyan); }
.gear-card { width: min(720px, 94vw); max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; }
#gear-art { position: relative; height: 300px; flex: none; background: radial-gradient(circle at 50% 60%, rgba(127,227,255,0.15), transparent 60%), #05060f; background-size: cover; background-position: center; transition: background-image .6s; }
.gear-art-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, rgba(8,11,26,0.95)); }
#gear-preview { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 220px; height: 220px; display: grid; place-items: center; filter: drop-shadow(0 0 24px rgba(127,227,255,0.35)); }
#gear-preview img, #gear-preview svg { max-width: 100%; max-height: 100%; }
#gear-art.painted #gear-preview { display: none; }
.gear-body { padding: 18px 28px 22px; overflow-y: auto; }
.gear-body h2 { margin: 6px 0 8px; font-size: 26px; font-weight: 500; }
.gear-body p { line-height: 1.6; color: #dfe8ff; }
#gear-letter { margin: 14px 0; padding: 14px 18px; border-left: 3px solid var(--warm); background: rgba(255, 207, 138, 0.06); border-radius: 0 12px 12px 0; font-style: italic; line-height: 1.65; color: #ffe8c8; }
#gear-letter:empty { display: none; }
.hull .ship-icon { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; }
.hull .ship-icon img, .hull .ship-icon svg { max-width: 64px; max-height: 64px; }
.hull.hero { background-size: cover; background-position: center; }
.weapon-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); margin-bottom: 8px; }
.weapon-card .swatch { width: 36px; height: 36px; border-radius: 50%; flex: none; box-shadow: 0 0 16px var(--c1); background: radial-gradient(circle, #fff 0 12%, var(--c2) 13% 35%, var(--c1) 36% 60%, transparent 61%); }
.weapon-card .w-text { flex: 1; min-width: 0; }
.weapon-card h4 { margin: 0; font: 500 14px var(--display); }
.weapon-card p { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.weapon-card .w-mech { font-size: 11px; color: var(--cyan); margin-top: 4px; }
.weapon-card .w-actions { display: flex; flex-direction: column; gap: 4px; }
.weapon-card .w-actions button { padding: 5px 10px; font-size: 11px; }
.weapon-card .w-actions button.on { border-color: var(--cyan); color: var(--cyan); }
.weapon-card .hero-thumb { width: 54px; height: 54px; border-radius: 10px; background-size: cover; background-position: center; flex: none; }
.chip.gear { border-color: rgba(127, 227, 255, 0.55); color: #c8f4ff; box-shadow: 0 0 12px rgba(127,227,255,0.2); }

/* ───────── Market ───────── */
.hold { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.hold i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--warm)); }
.good { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); margin-bottom: 8px; }
.good h4 { margin: 0; font: 500 14px var(--display); }
.good p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.good .g-tip { font-size: 11px; color: var(--warm); margin-top: 4px; }
.good .g-prices { font-size: 12px; text-align: right; line-height: 1.6; }
.good .g-prices b { color: var(--warm); font-family: var(--display); font-weight: 500; }
.good .g-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.good .g-actions button { padding: 5px 10px; font-size: 12px; }

/* Playing means dragging and clicking a lot: never select text by accident. */
html, body, #ui, #loader { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
button.tiny { padding: 3px 9px; font-size: 11px; margin-top: 6px; }

.collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.coll-item { padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.03) center/cover; text-align: center; min-height: 130px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.coll-item .ci-icon { width: 56px; height: 56px; display: grid; place-items: center; }
.coll-item .ci-icon img, .coll-item .ci-icon svg { max-width: 56px; max-height: 56px; }
.coll-item b { font: 500 12px var(--display); }
.coll-item span { font-size: 10.5px; color: var(--muted); line-height: 1.35; }

/* Menu */
#captain { padding-right: 12px; }
.icon-btn { align-self: flex-start; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1; display: grid; place-items: center; transition: background .2s, color .2s, border-color .2s; }
.icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); border-color: var(--line-strong); }
.menu-card { width: min(440px, calc(100vw - 32px)); padding: 26px 28px; border-radius: 22px; }
.menu-card h2 { font-size: 22px; margin: 0 0 10px; }
.menu-card .section-title { margin-top: 14px; }
.slider { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 12px; margin: 10px 0; font-size: 13px; }
.slider b { font: 500 12px var(--mono); color: var(--muted); text-align: right; }
.slider input[type=range] { width: 100%; accent-color: #7fe3ff; }
.check { display: flex; gap: 10px; align-items: center; font-size: 13px; margin: 10px 0; cursor: pointer; }
.check input { accent-color: #7fe3ff; width: 16px; height: 16px; }
.menu-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.menu-row .primary { margin-left: auto; }
body.no-hints #hints { display: none; }
@media (max-width: 480px) { .slider { grid-template-columns: 96px 1fr 36px; } }

/* Story size, danger, riddles, pictures being painted */
.badge.tier-short { background: rgba(160, 200, 255, 0.12); color: var(--muted); }
.badge.tier-normal { background: rgba(127, 227, 255, 0.14); color: #9fe9ff; }
.badge.tier-long { background: rgba(255, 207, 138, 0.16); color: var(--warm); }
.badge.danger { background: rgba(255, 110, 110, 0.16); color: #ff9c9c; letter-spacing: 0; }
#quest-objective .hazards { margin-top: 6px; font-size: 12px; color: #ffb0a0; }
#quest-objective.riddle { color: #d9b8ff; }
#quest-art.painting { filter: blur(6px) saturate(0.7); }
#quest-art.painting::after { content: 'художник рисует эту сцену…'; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font: 500 13px var(--display); letter-spacing: 0.08em; color: rgba(255,255,255,0.85); animation: fade 1.6s ease-in-out infinite alternate; filter: none; }

/* Planet task countdown */
.task-bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; margin: 8px 0 4px; }
.task-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent, #7fe3ff), #c9a4ff); animation: taskFill linear forwards; }
@keyframes taskFill { from { width: 0; } to { width: 100%; } }

/* Tutorial lesson */
#lesson { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); max-width: min(620px, calc(100vw - 32px)); padding: 12px 18px 13px; border-color: rgba(127, 227, 255, 0.45); font-size: 14px; line-height: 1.5; animation: fade .4s ease both; pointer-events: none; }
#lesson .lesson-tag { font: 500 10px var(--display); letter-spacing: .16em; text-transform: uppercase; color: #7fe3ff; margin-bottom: 4px; }
.lesson-inline { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(127, 227, 255, 0.08); color: #bfefff; font-size: 12.5px; line-height: 1.5; }
.bio { line-height: 1.65; margin: 4px 0 10px; }

/* Captain's journal */
.journal-card { position: relative; width: min(980px, calc(100vw - 32px)); height: min(640px, calc(100vh - 48px)); display: grid; grid-template-columns: 300px 1fr; overflow: hidden; border-radius: 22px; }
.journal-card .close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.journal-list { padding: 22px 16px 16px; border-right: 1px solid var(--line); overflow-y: auto; }
.journal-list h2 { font-size: 18px; margin: 4px 0 4px; }
.journal-item { display: block; width: 100%; text-align: left; padding: 9px 12px; margin: 4px 0; border-radius: 12px; border: 1px solid transparent; background: none; color: var(--text); }
.journal-item b { display: block; font: 500 13px var(--display); }
.journal-item span { font-size: 11.5px; color: var(--muted); }
.journal-item.on, .journal-item:hover { background: rgba(127, 227, 255, 0.07); border-color: var(--line); }
.journal-page { padding: 26px 30px 30px; overflow-y: auto; line-height: 1.65; }
.journal-page h2 { font-size: 22px; margin: 6px 0 12px; }
.journal-cover { height: 220px; margin: -26px -30px 18px; background: center/cover; mask-image: linear-gradient(to bottom, #000 70%, transparent); -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); }
.journal-path { margin: 0; padding-left: 20px; color: var(--muted); }
.journal-path li { margin: 3px 0; }
@media (max-width: 720px) { .journal-card { grid-template-columns: 1fr; grid-template-rows: 200px 1fr; } .journal-list { border-right: none; border-bottom: 1px solid var(--line); } }

#quest-objective { flex-wrap: wrap; }
.lesson-inline { flex: 1 0 100%; width: 100%; box-sizing: border-box; }
#quest-objective .task-bar, #quest-objective .task-bar + .muted { flex: 1 0 100%; }

/* Painted weapon icons */
.weapon-icon { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(127, 227, 255, 0.35)); }
.weapon-icon.big { width: 160px; height: 160px; }

/* Captain card: steady digits, a steady menu button */
#captain { padding-right: 52px; }
#captain #menu-btn { position: absolute; top: 10px; right: 10px; }
#captain-speed, #captain-hold, #captain-minerals { font-variant-numeric: tabular-nums; display: inline-block; text-align: right; }
#captain-speed { min-width: 3ch; }
#captain-hold { min-width: 5ch; text-align: left; }
.check input[type=radio] { accent-color: #7fe3ff; width: 16px; height: 16px; flex: none; }
.check span { line-height: 1.45; }

/* Show the paintings off: a wider story window, a taller scene that drifts slowly, and a full view on click */
.quest-card { width: min(980px, 94vw); }
#quest-art { height: clamp(260px, 46vh, 540px); cursor: zoom-in; animation: artDrift 38s ease-in-out infinite alternate; }
@keyframes artDrift { from { background-position: 50% 35%; } to { background-position: 50% 65%; } }
@media (max-height: 720px) { #quest-art { height: clamp(200px, 36vh, 320px); } }
.quest-heading h2 { font-size: clamp(24px, 2.4vw, 32px); }
.journal-cover { height: 300px; cursor: zoom-in; }
#art-view { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(2, 3, 10, 0.94); cursor: zoom-out; animation: fade .3s ease both; }
#art-view img { max-width: 96vw; max-height: 90vh; border-radius: 14px; box-shadow: 0 30px 120px rgba(0, 0, 0, 0.7); }
#art-view .art-view-hint { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 12px; color: rgba(255,255,255,0.45); }

/* Bigger windows: the journal and the stories take most of the screen */
.journal-card { width: min(1440px, calc(100vw - 32px)); height: calc(100vh - 40px); grid-template-columns: 320px 1fr; }
.journal-page { padding: 26px 40px 34px; font-size: 15.5px; }
.journal-page h2 { font-size: clamp(22px, 2.2vw, 30px); }
.journal-page .journal-cover { height: clamp(260px, 52vh, 620px); margin: -26px -40px 18px; }
.journal-scene { position: relative; }
.journal-scene .journal-cover { transition: background-image .3s ease; }
.scene-nav { position: absolute; top: calc(50% - 30px); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(4, 6, 16, 0.55); color: #fff; font-size: 26px; line-height: 1; display: grid; place-items: center; backdrop-filter: blur(6px); cursor: pointer; }
.scene-nav.prev { left: -20px; } .scene-nav.next { right: -20px; }
.scene-nav:disabled { opacity: 0.25; cursor: default; }
.scene-dots { position: absolute; left: 0; right: 0; bottom: 30px; display: flex; justify-content: center; gap: 7px; }
.scene-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); cursor: pointer; }
.scene-dots i.on { background: #7fe3ff; box-shadow: 0 0 8px #7fe3ff; }
.scene-count { font-size: 12px; margin-bottom: -4px; }
.quest-card { width: min(1280px, 96vw); max-height: 96vh; }
#quest-art { height: clamp(280px, 56vh, 700px); }
.quest-body { font-size: 15.5px; }
@media (max-height: 720px) { #quest-art { height: clamp(200px, 40vh, 360px); } }

/* ───────── Phones: the ship stays in view, controls sit under the thumbs ───────── */
body.touch { --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --sb: env(safe-area-inset-bottom, 0px); --st: env(safe-area-inset-top, 0px); }
/* The joystick low in the left corner */
body.touch #stick { left: calc(var(--sl) + 18px); bottom: calc(var(--sb) + 18px); width: 132px; height: 132px; }
body.touch #stick-knob { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
/* The radar in the right corner — tap it for the map — and the buttons in an arc around it */
body.touch #radar-wrap { top: auto; right: calc(var(--sr) + 14px); bottom: calc(var(--sb) + 14px); width: 112px; height: 112px; pointer-events: auto; cursor: pointer; }
body.touch #radar { width: 112px; height: 112px; }
body.touch #radar-range { bottom: auto; top: -15px; font-size: 10px; }
body.touch #radar-wrap::after { content: 'карта'; position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font: 600 9px var(--display); letter-spacing: .14em; text-transform: uppercase; color: rgba(127, 227, 255, 0.7); pointer-events: none; }
body.touch #touch-buttons { position: absolute; inset: 0; display: block; pointer-events: none; }
body.touch #touch-buttons button { position: absolute; width: 52px; height: 52px; font-size: 11px; pointer-events: auto; backdrop-filter: blur(4px); }
body.touch #touch-buttons #t-fire { width: 76px; height: 76px; right: calc(var(--sr) + 150px); bottom: calc(var(--sb) + 32px); font-size: 13px; border-color: rgba(255, 140, 120, 0.55); }
body.touch #touch-buttons #t-alt { width: 56px; height: 56px; right: calc(var(--sr) + 139px); bottom: calc(var(--sb) + 110px); }
body.touch #touch-buttons #t-act { right: calc(var(--sr) + 88px); bottom: calc(var(--sb) + 153px); font-size: 15px; }
body.touch #touch-buttons #t-ab { right: calc(var(--sr) + 24px); bottom: calc(var(--sb) + 160px); font-size: 15px; }
body.touch #t-map { display: none; }
/* The lesson: compact, at the top, folds away on a tap */
body.touch #lesson { pointer-events: auto; cursor: pointer; left: 8px; right: 8px; top: calc(var(--st) + 112px); bottom: auto; transform: none; max-width: none; padding: 8px 12px 9px; font-size: 12.5px; line-height: 1.4; }
body.touch #lesson .lesson-tag { margin-bottom: 2px; }
body.touch #lesson.min { right: auto; padding: 5px 12px; }
body.touch #lesson.min #lesson-text { display: none; }
body.touch #lesson.min .lesson-tag { margin: 0; }
body.touch #lesson.min .lesson-tag::after { content: ' ▸'; }
body.touch #tracker { left: calc(var(--sl) + 8px); bottom: calc(var(--sb) + 172px); width: min(300px, 56vw); max-height: 26vh; overflow: hidden; }
body.touch #prompt { bottom: auto; top: calc(50% + 64px); }
@media (orientation: landscape) {
  body.touch #lesson { left: auto; right: calc(var(--sr) + 10px); top: calc(var(--st) + 8px); max-width: 38vw; }
  body.touch #lesson.min { right: calc(var(--sr) + 10px); }
  body.touch #tracker { left: calc(var(--sl) + 168px); bottom: calc(var(--sb) + 12px); width: min(300px, calc(100vw - 168px - 250px)); max-height: 40vh; }
  body.touch #prompt { top: calc(50% + 52px); bottom: auto; }
}

/* Stories as badges on a phone: colour and progress, a tap opens the whole story */
.track .t-badge { display: none; }
body.touch #tracker { flex-direction: row; flex-wrap: wrap; gap: 8px; top: auto; left: calc(var(--sl) + 18px); bottom: calc(var(--sb) + 162px); width: auto; max-width: 60vw; max-height: none; overflow: visible; }
body.touch .track { width: 46px; height: 46px; padding: 0; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--c, var(--cyan)); box-shadow: 0 0 14px color-mix(in srgb, var(--c, #7fe3ff) 45%, transparent); }
body.touch .track::before, body.touch .track .t-title, body.touch .track .t-hint, body.touch .track .t-bar { display: none; }
body.touch .track .t-badge { display: block; font: 600 12px var(--display); color: #fff; }
body.touch .track.ready { animation: badgePulse 1.6s ease-in-out infinite; }
body.touch .track.ready .t-badge { color: var(--green); font-size: 18px; }
@keyframes badgePulse { 50% { transform: scale(1.1); } }
/* No grey tap squares */
body.touch, body.touch * { -webkit-tap-highlight-color: transparent; }
body.touch button:focus, body.touch #radar-wrap:focus, body.touch canvas:focus { outline: none; }
/* Landed on a phone held sideways: the planet panel takes the whole right side, the lesson moves left */
@media (orientation: landscape) {
  body.touch .panel { top: calc(var(--st) + 8px); bottom: calc(var(--sb) + 8px); right: calc(var(--sr) + 8px); left: auto; width: min(560px, 60vw); }
  body.touch .station-head { height: 84px; }
  body.touch .station-title h1 { font-size: 20px; margin: 2px 0; }
  body.touch #station-owner { font-size: 11.5px; }
  body.touch .panel footer { padding: 8px 14px 10px; }
  body.touch.landed #lesson, body.touch.landed #lesson.min { left: calc(var(--sl) + 10px); right: auto; top: calc(var(--st) + 108px); max-width: calc(40vw - 30px); }
}
/* Fire buttons: the slot name, and the weapon's icon when it has one */
#t-fire, #t-alt { display: grid; place-items: center; overflow: hidden; }
#t-fire img, #t-alt img { position: absolute; inset: 12%; width: 76%; height: 76%; object-fit: contain; opacity: 0.85; pointer-events: none; }
#t-fire span, #t-alt span { position: relative; font-size: 10px; letter-spacing: .02em; text-shadow: 0 1px 4px #000; }
#t-fire img + span, #t-alt img + span { align-self: end; margin-bottom: 7px; font-size: 9px; }

/* Title: pick a captain, start a new one, or bring one over with a code */
#start { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; animation: fade .6s ease both; }
#start.hidden { display: none; }
#start-captains { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#start .ghost { min-width: 240px; }
button.linkish { background: none; border: none; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; }
button.linkish:hover { color: var(--text); }
#start-code { display: flex; gap: 8px; }
#start-code.hidden { display: none; }
#start-code input { width: 170px; text-align: center; letter-spacing: .18em; text-transform: uppercase; }
#start-error { color: #ff9a8a; font-size: 13px; max-width: 360px; line-height: 1.5; }
#start-error.hidden { display: none; }
#start input { -webkit-user-select: text; user-select: text; }
/* Menu: the transfer code */
#transfer { margin-top: 10px; }
.transfer-code { font-size: 30px; letter-spacing: .2em; color: #7fe3ff; margin: 4px 0 6px; -webkit-user-select: text; user-select: text; }

/* Shipyard: a ship whose picture is not ready yet */
.hull.building { opacity: 0.6; cursor: not-allowed; }
.hull.building .ship-icon { filter: grayscale(0.6) blur(1px); }
.building-note { margin-top: 6px; font-size: 12px; color: #ffcf8a; }
.hull.building .ship-icon { filter: none; }
.slipway { width: 100%; height: 100%; animation: slipwayPulse 2.4s ease-in-out infinite; }
@keyframes slipwayPulse { 50% { opacity: .6; } }
