:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #f0eee7;
  --mint: #a7e8c8;
  --muted: #aeb8bf;
  --panel: #151d26;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; background: #1b2233; }
main, #scene, #markers, .lobby, #hud, .finish { position: absolute; inset: 0; }
#scene { width: 100%; height: 100%; }
#markers, #hud { pointer-events: none; }
.lobby, .finish {
  display: grid; align-items: center; padding: 22px clamp(20px,7vw,110px);
  background: linear-gradient(90deg, #0c111dea 4%, #101726b8 43%, #161a2208 90%);
  overflow: auto;
}
.card {
  width: min(100%, 432px); padding: clamp(24px,4vw,40px); border: 1px solid #ffffff27;
  background: #141c26ec; box-shadow: 0 15px 65px #080c18a0; border-radius: 14px;
}
h1, h2 { margin: 14px 0; line-height: .96; letter-spacing: -.075em; font-weight: 850; }
h1 { font-size: clamp(48px,7vw,86px); }
h2 { font-size: clamp(48px,6vw,72px); }
h1 span, h2 span { color: var(--mint); }
.eyebrow, label, .wallet > span, .brand {
  font-size: 11px; font-weight: 750; letter-spacing: .14em;
}
.eyebrow { color: var(--mint); margin: 0; }
.eyebrow span, .brand i { display: inline-block; vertical-align: 1px; width: 7px; height: 7px; background: var(--mint); border-radius: 50%; margin-right: 7px; }
.intro, .finish p { color: #c6ced1; line-height: 1.55; }
label { display: block; margin: 17px 0 6px; color: #e2e8e8; }
input, button { font: inherit; border-radius: 7px; }
input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #657783; background: #0e1620; color: #fff; }
input:focus-visible, button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#host-login { margin-top: 13px; font-size: 13px; color: var(--mint); }
#host-login summary { cursor: pointer; }
#code { text-transform: uppercase; letter-spacing: .12em; }
button { cursor: pointer; border: 0; }
.card button { display: flex; justify-content: space-between; width: 100%; background: var(--mint); color: #14281e; font-weight: 750; padding: 13px 15px; margin-top: 21px; }
.card button:hover { background: #c9f8df; }
.card button.secondary { background: #243543; color: #e7f2ef; border: 1px solid #687c88; margin-top: 9px; }
.card button.secondary:hover { background: #334858; }
.card button:disabled { opacity: .63; cursor: default; }
#error { color: #ffbaaa; margin: 10px 0 0; font-size: 13px; }
#error:empty { display: none; }
.hud-head, .hud-foot { position: absolute; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hud-head { top: 16px; }
.crew-hud { display: flex; align-items: center; gap: 7px; }
#open-skills, #hud-replay { pointer-events: auto; font-size: 12px; }
#hud-replay { color: var(--mint); }
#open-skills strong { color: var(--mint); margin-left: 4px; }
.hud-foot { bottom: 17px; align-items: flex-end; }
.brand, .pill, .mission, .wallet, .controls, .action, #notice, .capture, .marker {
  border: 1px solid #ffffff28; background: #111a24ea; border-radius: 7px;
}
.brand, .pill { padding: 9px 11px; }
.pill { color: #d8e6e5; font-size: 12px; }
.mission { position: absolute; left: 18px; top: 62px; width: min(310px,calc(100% - 36px)); padding: 12px; }
.mission strong { display: block; font-size: 14px; margin: 5px 0 9px; }
#progress { display: flex; gap: 3px; }
#progress span { height: 3px; flex: 1; background: #495562; border-radius: 3px; }
#progress span.done { background: var(--mint); }
.wallet { min-width: 108px; padding: 9px 11px; }
.wallet > span { display: block; color: var(--muted); font-size: 9px; }
.wallet > strong { display: block; font-size: 23px; line-height: 1.08; margin-top: 2px; }
.wallet small { font-size: 11px; color: var(--mint); }
.bag { text-align: right; }
.controls { font-size: 11px; padding: 7px; text-align: center; line-height: 1.7; }
kbd { display: inline-block; font: 700 11px/1.35 "Segoe UI", sans-serif; border: 1px solid #8b9b9e; padding: 0 4px; border-radius: 4px; color: #f8faf2; }
#reticle { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; border: 2px solid white; border-radius: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 5px #000; }
#reticle.active { border-color: var(--mint); }
.marker { position: absolute; top: 0; left: 0; padding: 3px 6px; font-size: 11px; font-weight: 650; color: #dbeae7; white-space: nowrap; }
.action, #notice, .capture { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; }
.action { top: calc(50% + 17px); display: flex; align-items: center; gap: 7px; padding: 6px 9px; font-size: 13px; white-space: nowrap; }
.action kbd { background: var(--mint); border-color: var(--mint); color: #14281e; }
#notice { top: 65%; padding: 8px 12px; margin: 0; font-size: 13px; width: max-content; max-width: 95vw; }
.capture { bottom: 64px; pointer-events: auto; color: var(--mint); font-weight: 700; font-size: 12px; padding: 7px 10px; white-space: nowrap; }
.finish { place-items: center; background: #0c111d8a; }
.replay { max-width: calc(100% - 24px); padding: 0; border: 0; background: transparent; color: #f0eee7; }
.replay::backdrop { background: #090f19bd; }
.replay h2 { font-size: clamp(30px,5vw,47px); }
.replay p { color: #c6ced1; line-height: 1.5; }
#replay-notice { color: #ffbaaa; }
.cut { position: absolute; top: calc(50% + 50px); left: 50%; transform: translateX(-50%); display: grid; gap: 4px; min-width: 154px; padding: 8px; text-align: center; background: #111a24ea; border: 1px solid #ffffff36; border-radius: 7px; font-size: 12px; }
progress { width: 100%; height: 7px; accent-color: var(--mint); }
.skills { width: min(840px,calc(100% - 24px)); max-height: calc(100% - 24px); padding: clamp(16px,3vw,30px); border: 1px solid #677b85; border-radius: 12px; color: #f0eee7; background: #151d26; box-shadow: 0 15px 65px #080c18a0; }
.skills::backdrop { background: #090f19bd; }
.skills-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.skills-head h2 { font-size: clamp(27px,4.2vw,45px); letter-spacing: -.055em; margin: 8px 0 14px; }
.close-skills { flex: 0 0 36px; height: 36px; background: #253441; border: 1px solid #687c88; color: #fff; font-size: 23px; line-height: 1; }
.close-skills:hover { background: #3b4e5e; }
.skills-summary { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 7px; }
.skills-summary > div { min-width: 0; display: grid; gap: 4px; align-content: center; padding: 8px 10px; background: #0f1721; border-radius: 6px; border: 1px solid #536470; }
.skills-summary strong { color: var(--mint); }
.skills-summary small { color: #c1cbd0; font-size: 11px; }
.skills-location { font-size: 13px; color: #c1cbd0; margin: 12px 0; }
.skill-nodes { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; align-items: stretch; }
.skill-card { position: relative; display: grid; grid-template-rows: auto auto 1fr auto auto; gap: 6px; padding: 12px; border: 1px solid #596e78; background: #1c2834; border-radius: 8px; }
.skill-card.root { grid-column: 2; grid-row: 1; margin-bottom: 5px; }
.skill-card.branch { grid-row: 2; }
.skill-card.branch::before { content: ''; position: absolute; left: 50%; bottom: 100%; height: 13px; width: 1px; background: #607880; }
.skill-card.branch::after { content: ''; position: absolute; left: 50%; bottom: calc(100% + 13px); width: calc(50% + 7px); height: 1px; background: #607880; }
.skill-card.branch:nth-child(3)::before { height: 19px; }
.skill-card.branch:nth-child(3)::after { left: -7px; width: calc(100% + 14px); }
.skill-card.branch:nth-child(4)::after { left: auto; right: 50%; }
.skill-card.owned { border-color: #82b79c; }
.skill-card .eyebrow { font-size: 9px; }
.skill-card h3, .skill-card p { margin: 0; }
.skill-card h3 { font-size: 17px; line-height: 1.15; }
.skill-card p { color: #c6ced1; font-size: 12px; line-height: 1.35; }
.skill-card .skill-cost { color: #e8dfc7; font-weight: 650; }
.skill-card button { padding: 7px 8px; background: var(--mint); color: #14281e; font-weight: 700; font-size: 12px; text-align: left; }
.skill-card button:disabled { background: #2e4050; color: #dae3e9; cursor: default; }
.skill-card.owned button { color: var(--mint); }
.skill-notice { margin: 12px 0 0; color: var(--mint); font-weight: 650; font-size: 13px; }
@media (max-width: 560px) {
  .controls { position: absolute; bottom: 52px; left: 0; right: 0; }
  .capture { bottom: 108px; }
  .brand { display: none; }
  .crew-hud { margin-left: auto; }
  .skill-nodes { grid-template-columns: 1fr; gap: 6px; }
  .skill-card.root, .skill-card.branch { grid-row: auto; grid-column: auto; }
  .skill-card.branch::before, .skill-card.branch::after { display: none; }
}
