:root {
  --bg-deep: #06080b;
  --bg: #0c1016;
  --text: #eef1f5;
  --text-muted: #8d97a5;
  --accent: #ff8c00;
  --accent-bright: #ffa726;
  --green-bright: #7a9a6a;
  --red-bright: #c06050;
  --border: #252f3d;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100svh;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
  background: rgba(8, 10, 14, 0.92);
  border-bottom: 1px solid rgba(255, 140, 0, 0.18);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  font-size: 0.95rem;
}

.brand:hover {
  color: var(--accent);
}

.brand img {
  display: block;
}

.topbar-title {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex: 1;
}

.topbar-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.topbar-link:hover {
  color: var(--accent-bright);
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #0a120e;
  overflow: hidden;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  pointer-events: none;
  z-index: 3;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 140, 0, 0.9);
}

.crosshair::before {
  left: 8px;
  top: 0;
  width: 2px;
  height: 18px;
}

.crosshair::after {
  left: 0;
  top: 8px;
  width: 18px;
  height: 2px;
}

.hud {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: flex-end;
  pointer-events: none;
  z-index: 2;
}

.hud-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: rgba(6, 8, 11, 0.72);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
}

.stat-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
}

.stat-val {
  font-weight: 600;
  min-width: 3.5rem;
}

.mono {
  font-family: var(--mono);
}

.bar {
  width: 88px;
  height: 8px;
  background: #1a222c;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transition: transform 0.12s linear;
}

.bar-hp {
  background: linear-gradient(90deg, #6a8a58, #9aba78);
}

.objectives {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.obj {
  background: rgba(6, 8, 11, 0.78);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  min-width: 4.5rem;
}

.obj strong {
  display: block;
  letter-spacing: 0.04em;
}

.obj .prog {
  margin-top: 0.25rem;
  height: 4px;
  background: #1a222c;
  border-radius: 1px;
  overflow: hidden;
}

.obj .prog > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--green-bright);
}

.obj.enemy .prog > i {
  background: var(--red-bright);
}

.obj.ours {
  border-color: rgba(122, 154, 106, 0.55);
}

.obj.theirs {
  border-color: rgba(192, 96, 80, 0.55);
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  background: rgba(6, 8, 11, 0.55);
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(90, 122, 82, 0.2), transparent 55%),
    rgba(6, 8, 11, 0.78);
  z-index: 4;
  padding: 1rem;
  overflow: auto;
}

.overlay[hidden] {
  display: none;
}

.panel {
  width: min(440px, 100%);
  background: #0e141c;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 1.5rem 1.35rem 1.35rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.panel-mark {
  display: block;
  margin-bottom: 0.75rem;
}

.panel h1 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lead {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.brief {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.brief strong {
  color: var(--accent-bright);
}

.controls {
  margin: 0 0 1.15rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #151c26;
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 0.7rem 1.1rem;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #120a00;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--accent-bright);
  color: #120a00;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.footnote {
  margin: 1rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.score {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.score dt {
  color: var(--text-muted);
  margin: 0;
}

.score dd {
  margin: 0;
  font-family: var(--mono);
  text-align: right;
}

@media (max-width: 640px) {
  .topbar-title {
    display: none;
  }

  .hint {
    display: none;
  }

  .btn-ghost {
    margin-left: 0;
    margin-top: 0.5rem;
  }
}
