:root {
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #f3f5ff;
  background: #080d1a;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #f3f5ff;
  --muted: #9aa5c0;
  --subtle: #67738e;
  --panel: rgba(15, 23, 42, 0.84);
  --line: rgba(161, 178, 219, 0.13);
  --cyan: #70e7e4;
  --purple: #aa91ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 50% -24%, rgba(55, 83, 160, 0.24), transparent 55%),
    radial-gradient(ellipse at 4% 58%, rgba(53, 123, 155, 0.09), transparent 35%),
    #080d1a;
}

button { font: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #b8d7ff;
  box-shadow: 0 0 12px 2px rgba(151, 191, 255, 0.55);
  opacity: 0.5;
}
.ambient-one { top: 18%; left: 12%; }
.ambient-two { top: 31%; right: 13%; width: 2px; height: 2px; opacity: 0.35; }

.shell { width: min(1120px, calc(100% - 56px)); margin: 0 auto; }
.topbar { height: 80px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(164, 178, 220, 0.1); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #e8edff; text-decoration: none; font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; }
.brand b { color: #8894b4; font-weight: 400; }
.brand-mark { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(112, 231, 228, 0.7); border-radius: 50%; transform: rotate(-30deg); }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ''; position: absolute; border: 1px solid rgba(112, 231, 228, 0.68); border-radius: 50%; }
.brand-mark::before { width: 31px; height: 10px; }
.brand-mark::after { width: 10px; height: 31px; }
.brand-mark span { width: 4px; height: 4px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.pipeline-pill { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(112, 231, 228, 0.2); border-radius: 999px; color: #94c8cf; background: rgba(42, 122, 134, 0.08); font: 9px var(--mono); letter-spacing: 0.11em; }
.pulse-dot, .hull-status i, .mission-destination i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px rgba(112, 231, 228, 0.7); }
.pulse-dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.intro { padding: 65px 0 35px; max-width: 700px; }
.eyebrow, .card-kicker, .panel-label, .board-topline, .board-coordinates, .stat > span, .mission-destination > span, .footer-note { font-family: var(--mono); letter-spacing: 0.1em; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #94a1bd; font-size: 9px; }
.eyebrow-line { width: 26px; height: 1px; background: var(--cyan); box-shadow: 0 0 8px rgba(112, 231, 228, 0.55); }
h1 { margin: 19px 0 13px; font-size: clamp(41px, 6.1vw, 70px); line-height: 1.04; letter-spacing: -0.065em; font-weight: 700; }
h1 em { color: #a8b6d5; font-style: normal; font-weight: 500; }
.intro-copy { max-width: 515px; margin: 0; color: #96a2bd; font-size: 13px; line-height: 1.8; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 17px; align-items: stretch; }
.game-card, .mission-card, .flight-stats, .controls-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22); backdrop-filter: blur(14px); }
.game-card { min-width: 0; padding: 22px; }
.game-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.card-kicker { margin-bottom: 7px; color: #8290ad; font-size: 8px; }
.card-kicker span { margin: 0 4px; color: var(--cyan); }
h2 { margin: 0; font-size: 17px; letter-spacing: -0.025em; }
.reset-button { border: 1px solid rgba(158, 174, 214, 0.19); border-radius: 7px; padding: 7px 10px; color: #a5b1ce; background: rgba(139, 158, 204, 0.05); font-size: 10px; cursor: pointer; transition: 160ms ease; }
.reset-button:hover { border-color: rgba(112, 231, 228, 0.48); color: var(--cyan); background: rgba(112, 231, 228, 0.07); }
.reset-button span { margin-right: 4px; font-size: 14px; vertical-align: -1px; }

.game-board-frame { position: relative; overflow: hidden; padding: 13px 13px 11px; border: 1px solid rgba(137, 169, 227, 0.17); border-radius: 10px; background: radial-gradient(ellipse at 50% 42%, rgba(33, 52, 94, 0.42), transparent 70%), #0a1122; }
.game-board-frame::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.3; background-image: radial-gradient(#a9cbff 0.7px, transparent 0.7px); background-size: 31px 27px; }
.board-topline, .board-coordinates { position: relative; z-index: 1; display: flex; justify-content: space-between; color: #657594; font-size: 7px; }
.board-topline { margin-bottom: 11px; }
.board-topline i { display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
.game-board { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(9, minmax(18px, 1fr)); grid-template-rows: repeat(7, clamp(32px, 5vw, 48px)); gap: 4px; max-width: 620px; margin: 0 auto 11px; }
.tile { position: relative; display: grid; place-items: center; min-width: 0; border: 1px solid rgba(115, 144, 199, 0.09); border-radius: 5px; background: rgba(36, 52, 86, 0.32); }
.tile::after { content: ''; width: 2px; height: 2px; border-radius: 50%; background: rgba(175, 200, 246, 0.33); }
.tile.wall { border-color: rgba(99, 121, 169, 0.11); background: linear-gradient(145deg, rgba(91, 107, 146, 0.36), rgba(40, 51, 79, 0.56)); box-shadow: inset 0 1px 0 rgba(211, 220, 255, 0.07), 0 3px 9px rgba(0, 0, 0, 0.16); }
.tile.wall::before { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(167, 182, 224, 0.08); border-radius: 3px; }
.tile.wall::after { width: 4px; height: 4px; background: #7384a8; box-shadow: 5px -4px 0 -1px #485c7e, -4px 4px 0 -1px #9ba8c4; }
.tile.start { background: rgba(88, 114, 180, 0.18); }
.tile.goal { border-color: rgba(112, 231, 228, 0.28); background: radial-gradient(circle, rgba(112, 231, 228, 0.16), rgba(112, 231, 228, 0.035) 72%); }
.dock-ring { position: absolute; width: 20px; height: 20px; border: 1px solid rgba(112, 231, 228, 0.75); border-radius: 50%; box-shadow: 0 0 13px rgba(112, 231, 228, 0.3), inset 0 0 8px rgba(112, 231, 228, 0.2); animation: dock 2.5s ease-in-out infinite; }
@keyframes dock { 50% { transform: scale(0.8); opacity: 0.6; } }
.courier { position: absolute; z-index: 3; width: 22px; height: 22px; background: url('../assets/courier-ship.png') center / contain no-repeat; image-rendering: pixelated; pointer-events: none; transition: left 120ms ease, top 120ms ease; }
.courier::before, .courier::after { content: none; }
.board-coordinates { color: #5e6c88; font-size: 6px; }
.game-status-row { display: flex; align-items: center; gap: 9px; min-height: 35px; padding: 4px 2px 0; }
.status-indicator { display: grid; flex: 0 0 18px; width: 18px; height: 18px; place-items: center; border: 1px solid rgba(112, 231, 228, 0.2); border-radius: 50%; }
.status-indicator span { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
#playtest-status { margin: 0; color: #9eabc6; font-size: 10px; line-height: 1.5; }

.side-panel { display: flex; flex-direction: column; gap: 12px; }
.mission-card { position: relative; flex: 1; overflow: hidden; min-height: 210px; padding: 19px 17px 15px; background: radial-gradient(ellipse at 100% 4%, rgba(121, 94, 207, 0.14), transparent 40%), var(--panel); }
.mission-card::after { content: ''; position: absolute; right: -26px; top: 42px; width: 88px; height: 88px; border: 1px solid rgba(172, 151, 255, 0.09); border-radius: 50%; box-shadow: 0 0 0 12px rgba(172, 151, 255, 0.025), 0 0 0 25px rgba(172, 151, 255, 0.018); }
.panel-label { color: #75829f; font-size: 7px; }
.mission-icon { display: grid; width: 28px; height: 28px; margin: 16px 0 10px; place-items: center; border: 1px solid rgba(170, 145, 255, 0.26); border-radius: 8px; color: #c5b8ff; background: rgba(170, 145, 255, 0.09); font-size: 17px; }
h3 { position: relative; z-index: 1; margin: 0; font-size: 19px; line-height: 1.25; letter-spacing: -0.045em; }
.mission-card p { position: relative; z-index: 1; max-width: 200px; margin: 8px 0 17px; color: #8d9ab6; font-size: 9px; line-height: 1.7; }
.mission-divider { height: 1px; margin-bottom: 12px; background: var(--line); }
.mission-destination { display: flex; justify-content: space-between; align-items: center; font: 7px var(--mono); }
.mission-destination > span { color: #71809c; }
.mission-destination b { color: #a9e3e5; font-weight: 400; }
.mission-destination i { width: 5px; height: 5px; margin-right: 3px; }
.flight-stats { padding: 0 16px; }
.stat { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.stat + .stat { border-top: 1px solid var(--line); }
.stat > span { color: #75829f; font-size: 7px; }
.stat strong { color: #d8e0f4; font: 11px var(--mono); }
.stat strong small { color: #74819b; font: 7px var(--mono); }
.hull-status { display: flex; align-items: center; gap: 6px; color: #9dd8bc !important; font-size: 8px !important; }
.hull-status i { width: 5px; height: 5px; background: #7fe2b5; box-shadow: 0 0 7px #7fe2b5; }
.controls-card { padding: 14px 16px 13px; }
.control-layout { display: grid; grid-template-columns: repeat(3, 31px); grid-template-rows: repeat(2, 28px); justify-content: center; gap: 4px; margin: 11px auto 8px; }
.direction-button { border: 1px solid rgba(153, 173, 219, 0.17); border-radius: 6px; color: #bdc9e2; background: rgba(127, 150, 207, 0.07); cursor: pointer; transition: 140ms ease; }
.direction-button:hover, .direction-button:focus-visible { border-color: rgba(112, 231, 228, 0.6); color: var(--cyan); background: rgba(112, 231, 228, 0.11); outline: none; }
.direction-button.up { grid-column: 2; grid-row: 1; }
.direction-button.left { grid-column: 1; grid-row: 2; }
.direction-button.down { grid-column: 2; grid-row: 2; }
.direction-button.right { grid-column: 3; grid-row: 2; }
.controls-card > p { display: flex; align-items: center; justify-content: center; gap: 3px; margin: 0; color: #6f7c98; font-size: 8px; }
kbd { padding: 2px 4px; border: 1px solid rgba(143, 161, 201, 0.17); border-radius: 3px; color: #a1afcb; background: rgba(128, 147, 192, 0.07); font: 7px var(--mono); }
.footer-note { display: flex; justify-content: space-between; gap: 15px; padding: 21px 2px 28px; color: #66738f; font-size: 7px; }
.footer-sparkle { color: var(--cyan); font-size: 10px; vertical-align: -1px; }
.footer-divider { padding: 0 5px; color: #3f4a64; }

@media (max-width: 760px) {
  .shell { width: min(100% - 32px, 560px); }
  .topbar { height: 68px; }
  .intro { padding: 45px 0 26px; }
  .game-layout { grid-template-columns: 1fr; }
  .side-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .mission-card { grid-row: span 2; }
  .game-card { padding: 15px; }
  .game-board { grid-template-rows: repeat(7, clamp(31px, 9vw, 43px)); gap: 3px; }
  .footer-note { flex-direction: column; gap: 8px; }
}

@media (max-width: 430px) {
  .pipeline-pill { padding: 7px 8px; font-size: 7px; }
  .brand { gap: 7px; font-size: 10px; }
  .brand-mark { transform: rotate(-30deg) scale(0.84); }
  .side-panel { grid-template-columns: 1fr; }
  .mission-card { grid-row: auto; min-height: 190px; }
  .flight-stats { order: 2; }
  .controls-card { order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
