:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070a0f;
  color: #edf2f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 50% -24%, #253449 0, transparent 53%),
    #070a0f;
}
button { font: inherit; }
.application {
  width: min(1540px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.topbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #536a83;
  border-radius: 50%;
  color: #d7e4f2;
  background: #172332;
  font-weight: 900;
  letter-spacing: -.12em;
  padding-right: 3px;
  box-shadow: inset 0 0 18px #8ba9ca16;
}
.brand-title { margin: 0; font-size: 13px; font-weight: 850; letter-spacing: .22em; }
.brand-subtitle { margin: 3px 0 0; color: #7f91a7; font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.topbar-note { margin: 0; color: #8795a7; font-size: 12px; }
.game-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
  max-height: calc(100dvh - 150px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #2e3b4e;
  border-radius: 12px;
  background: #030507;
  box-shadow: 0 24px 80px #0008, inset 0 0 35px #0e18231f;
}
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: contain;
  background: #030507;
  touch-action: none;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}
.viewport-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at center, #101b2aef, #05080deF 78%);
}
.viewport-overlay[hidden] { display: none; }
.loading-mark { color: #a9bed5; opacity: .16; font-size: clamp(56px, 11vw, 104px); font-weight: 950; letter-spacing: -.12em; padding-right: .12em; }
.loading-title { margin: -4px 0 0; color: #e8eff7; font-size: 12px; font-weight: 850; letter-spacing: .24em; }
.loading-message { max-width: 520px; margin: 0; color: #9cacc0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.loading-track { width: min(180px, 55vw); height: 2px; margin-top: 8px; overflow: hidden; background: #28374a; }
.loading-track span { display: block; width: 42%; height: 100%; background: #9db5ce; animation: loading-sweep 1.25s ease-in-out infinite alternate; }
@keyframes loading-sweep { from { transform: translateX(-8%); } to { transform: translateX(150%); } }
.game-controls { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 40px; }
.control-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sound-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid #536b84;
  border-radius: 6px;
  color: #edf4fb;
  background: #172638;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.sound-button:hover { background: #223b54; border-color: #718ba8; }
.sound-button:focus-visible { outline: 2px solid #a9c8e8; outline-offset: 3px; }
.sound-button span { font-size: 16px; }
.control-hint, .keyboard-hint { margin: 0; color: #8392a5; font-size: 11px; line-height: 1.4; }
.keyboard-hint { text-align: right; }
.diagnostics {
  border-top: 1px solid #273344;
  color: #93a2b5;
  font-size: 12px;
}
.diagnostics summary { width: fit-content; padding: 8px 0; cursor: pointer; color: #aebdd0; user-select: none; }
.status { margin: 4px 0 8px; color: #b6c4d5; overflow-wrap: anywhere; }
.status.success { color: #9ed5b3; }
.status.failure { color: #f0a2a2; }
.details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 18px; }
.detail-row { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 7px 0; border-bottom: 1px solid #1e2937; }
.detail-row span { color: #77889d; font-size: 10px; }
.detail-row strong { color: #c5d0dd; font-size: 11px; font-weight: 550; overflow-wrap: anywhere; }
.runtime-warning { margin: 10px 0; color: #c2a876; font-size: 11px; line-height: 1.5; }
.runtime-warning[hidden] { display: none; }
.footer { display: flex; justify-content: space-between; gap: 12px; color: #647286; font-size: 10px; }
.footer a { color: #8396ad; text-decoration: none; }
.footer a:hover { color: #d0deec; text-decoration: underline; }
.file-warning { padding: 12px; border: 1px solid #855b36; border-radius: 7px; color: #f0d7b6; background: #392818; font-size: 12px; line-height: 1.5; }
.file-warning[hidden] { display: none; }
.file-warning a { color: inherit; }
.file-protocol-warning { display: block; }
.file-protocol .game-stage, .file-protocol .game-controls, .file-protocol .diagnostics { display: none; }
.file-protocol .file-warning.file-protocol-warning { display: block; }
@media (max-width: 680px) {
  .application { gap: 9px; padding-left: 9px; padding-right: 9px; }
  .topbar { min-height: 46px; }
  .topbar-note { display: none; }
  .game-stage { min-height: 220px; max-height: calc(100dvh - 138px); border-radius: 7px; }
  #game-canvas { min-height: 220px; }
  .game-controls { align-items: flex-start; flex-direction: column; gap: 8px; }
  .control-group { flex-wrap: wrap; }
  .keyboard-hint { text-align: left; }
  .details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
