/* ==========================================================================
   HEXHOLD — Imperial Dark & Gold
   Pure CSS, no external assets, no build step.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens and reset
   -------------------------------------------------------------------------- */

:root {
  --bg: #0b132b;
  --bg-deep: #050814;
  --bg-slate: #101a34;
  --panel: rgba(17, 24, 39, 0.88);
  --panel-solid: #111827;
  --panel-deep: rgba(8, 14, 27, 0.94);
  --panel-soft: rgba(30, 41, 59, 0.48);
  --gold: #d4a373;
  --gold-bright: #e9c46a;
  --gold-deep: #a47148;
  --gold-line: rgba(212, 163, 115, 0.28);
  --gold-line-strong: rgba(233, 196, 106, 0.55);
  --ink: #101623;
  --text: #eef2f7;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --muted-dim: #7b8ba1;
  --cyan: #67e8f9;
  --teal: #5eead4;
  --green: #4ade80;
  --green-deep: #22c55e;
  --red: #fb7185;
  --red-deep: #ef4444;
  --orange: #fb923c;
  --violet: #c4b5fd;
  --blue: #60a5fa;
  --player-color: #e63946;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-panel: 0 18px 50px rgba(2, 6, 23, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  --shadow-gold: 0 0 0 1px rgba(233, 196, 106, 0.22), 0 10px 36px rgba(212, 163, 115, 0.12);
  --font-ui: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg-deep);
  color-scheme: dark;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 8%, rgba(23, 54, 94, 0.55), transparent 46%),
    radial-gradient(circle at 74% 92%, rgba(35, 29, 72, 0.42), transparent 55%),
    var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
h4,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(233, 196, 106, 0.28);
  color: #fffbea;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* Thin, dark-gold scrollbars. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 163, 115, 0.44) rgba(2, 6, 23, 0.25);
}

*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

*::-webkit-scrollbar-track {
  background: rgba(2, 6, 23, 0.22);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(212, 163, 115, 0.4);
  border-radius: 999px;
  border: 1px solid rgba(5, 8, 20, 0.5);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(233, 196, 106, 0.58);
}

#game-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

/* --------------------------------------------------------------------------
   2. Shared utilities
   -------------------------------------------------------------------------- */

.eyebrow {
  display: block;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.19em;
  line-height: 1.2;
  text-transform: uppercase;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  padding: 1px 4px;
  border: 1px solid rgba(212, 163, 115, 0.28);
  border-bottom-color: rgba(212, 163, 115, 0.44);
  border-radius: 4px;
  background: rgba(2, 6, 23, 0.42);
  color: var(--text-soft);
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.panel {
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.032), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 11px;
  border-bottom: 1px solid rgba(212, 163, 115, 0.14);
}

.panel__title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.panel__hint {
  max-width: 145px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.35;
  text-align: right;
  text-transform: uppercase;
}

.progress {
  position: relative;
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.55);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.progress__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
  box-shadow: 0 0 10px rgba(233, 196, 106, 0.4);
  transition: width 320ms var(--ease);
}

.progress--tech {
  height: 4px;
  margin-top: 5px;
}

.progress--hp .progress__fill {
  background: linear-gradient(90deg, #b91c1c, var(--red));
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.38);
}

.progress--hp.is-low .progress__fill {
  background: linear-gradient(90deg, #7f1d1d, #f87171);
}

.progress--food .progress__fill {
  background: linear-gradient(90deg, #15803d, var(--green));
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

.progress--prod .progress__fill {
  background: linear-gradient(90deg, #c2410c, var(--orange));
  box-shadow: 0 0 10px rgba(251, 146, 60, 0.3);
}

.player-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--player-color);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 10px var(--player-color);
}

.player-dot--large {
  width: 13px;
  height: 13px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.button-row--center {
  justify-content: center;
}

/* --------------------------------------------------------------------------
   3. Buttons, inputs, switches
   -------------------------------------------------------------------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 9px;
  background: rgba(30, 41, 59, 0.64);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition:
    transform 150ms var(--ease),
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease;
  user-select: none;
}

.btn:hover:not(:disabled) {
  border-color: rgba(233, 196, 106, 0.42);
  background: rgba(51, 65, 85, 0.72);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: saturate(0.55);
}

.btn--gold {
  border-color: rgba(255, 236, 179, 0.55);
  background: linear-gradient(145deg, #f2d78d 0%, var(--gold-bright) 38%, var(--gold) 100%);
  color: var(--ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.34) inset,
    0 8px 22px rgba(212, 163, 115, 0.18);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn--gold:hover:not(:disabled) {
  border-color: #fff0bd;
  background: linear-gradient(145deg, #ffe6a3 0%, #f0cf7a 42%, #d9ab78 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.42) inset,
    0 10px 28px rgba(233, 196, 106, 0.28);
}

.btn--ghost {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.46);
  color: var(--text-soft);
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--gold-line-strong);
  background: rgba(30, 41, 59, 0.72);
  color: var(--text);
}

.btn--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn--small {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 10px;
}

.btn--tiny {
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 9px;
}

.btn--wide {
  width: 100%;
  min-height: 40px;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading kbd {
  visibility: hidden;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 13px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(16, 22, 35, 0.3);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.btn--ghost.is-loading::after,
.btn--quiet.is-loading::after {
  border-color: rgba(233, 196, 106, 0.25);
  border-top-color: var(--gold-bright);
}

.btn--end-turn {
  min-width: 174px;
  max-width: 270px;
  min-height: 38px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.btn--end-turn #end-turn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn--end-turn .kbd {
  opacity: 0.7;
}

.btn--end-turn.is-my-turn {
  animation: turnGlow 2.4s ease-in-out infinite;
}

.btn--end-turn.is-waiting {
  min-width: 190px;
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.58);
  color: var(--muted);
  box-shadow: none;
  text-shadow: none;
  animation: none;
}

.btn--end-turn.is-waiting::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(212, 163, 115, 0.65);
  animation: pulse 1.4s ease-in-out infinite;
}

.input {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(4, 9, 20, 0.58);
  color: var(--text);
  font-size: 12px;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.input::placeholder {
  color: var(--muted-dim);
}

.input:hover {
  border-color: rgba(212, 163, 115, 0.34);
}

.input:focus {
  border-color: var(--gold-bright);
  background: rgba(4, 9, 20, 0.74);
  box-shadow: 0 0 0 3px rgba(233, 196, 106, 0.1);
  outline: none;
}

.select {
  padding-right: 30px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 1px),
    calc(100% - 11px) calc(50% - 1px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  cursor: pointer;
}

.select option {
  background: var(--panel-solid);
  color: var(--text);
}

.input--code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-align: center;
  text-transform: uppercase;
}

.input--code::placeholder {
  letter-spacing: 0.18em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field__label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.field-row--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field--seed {
  max-width: 140px;
}

.switch-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: end;
  min-height: 36px;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.switch-field__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-field__track {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 21px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.62);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: border-color 160ms ease, background 160ms ease;
}

.switch-field__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f8fafc, #94a3b8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 180ms var(--ease), background 160ms ease;
}

.switch-field__input:checked + .switch-field__track {
  border-color: rgba(233, 196, 106, 0.6);
  background: rgba(212, 163, 115, 0.26);
}

.switch-field__input:checked + .switch-field__track .switch-field__thumb {
  background: linear-gradient(145deg, #fff3c4, var(--gold-bright));
  transform: translateX(17px);
}

.switch-field__input:focus-visible + .switch-field__track {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

.switch-field__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
}

.switch-field__text small {
  color: var(--muted-dim);
  font-size: 9px;
  font-weight: 500;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.44);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.icon-button:hover {
  border-color: var(--gold-line-strong);
  background: rgba(30, 41, 59, 0.7);
  color: var(--gold-bright);
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-button--text {
  width: auto;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   4. Game UI shell and top bar
   -------------------------------------------------------------------------- */

.game-ui {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  transition: opacity 320ms ease, visibility 320ms ease;
}

.game-ui.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.top-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  left: 10px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--gold-line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 44%),
    var(--panel);
  box-shadow:
    0 16px 44px rgba(2, 6, 23, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
  pointer-events: auto;
}

.top-bar::after {
  content: "";
  position: absolute;
  right: 16%;
  bottom: -1px;
  left: 16%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 196, 106, 0.5), transparent);
  pointer-events: none;
}

.top-bar__left,
.top-bar__right {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.top-bar__left {
  flex-wrap: wrap;
}

.top-bar__right {
  justify-content: flex-end;
}

.top-bar__center {
  display: flex;
  min-width: 0;
  align-items: stretch;
  justify-content: center;
  gap: 5px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 2px;
  padding: 2px 4px 2px 1px;
  user-select: none;
}

.brand__hex {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 34px;
  color: var(--gold-bright);
  filter: drop-shadow(0 0 9px rgba(233, 196, 106, 0.32));
}

.brand__hex::before {
  content: "";
  position: absolute;
  inset: 1px 2px;
  border: 1px solid rgba(233, 196, 106, 0.64);
  background: linear-gradient(150deg, rgba(233, 196, 106, 0.16), rgba(212, 163, 115, 0.02));
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
}

.brand__hex span {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.brand__word {
  background: linear-gradient(180deg, #fff4c9 0%, var(--gold-bright) 46%, #c89663 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-shadow: 0 0 20px rgba(233, 196, 106, 0.14);
}

.badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(8, 14, 27, 0.48);
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge__caption {
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.badge__value {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge--room {
  border-color: rgba(212, 163, 115, 0.35);
  background:
    linear-gradient(145deg, rgba(212, 163, 115, 0.12), rgba(8, 14, 27, 0.55));
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.badge--room:hover {
  border-color: var(--gold-line-strong);
  background:
    linear-gradient(145deg, rgba(233, 196, 106, 0.2), rgba(8, 14, 27, 0.62));
  transform: translateY(-1px);
}

.badge--room .badge__value {
  color: var(--gold-bright);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
}

.badge__copy {
  color: var(--gold);
  font-size: 10px;
  opacity: 0.72;
}

.badge--player {
  border-color: color-mix(in srgb, var(--player-color) 45%, transparent);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--player-color) 14%, transparent), rgba(8, 14, 27, 0.5));
}

.badge--player .badge__caption {
  max-width: 76px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
}

.badge--player .badge__value {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-counter {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(8, 14, 27, 0.4);
  white-space: nowrap;
}

.turn-counter__caption {
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.turn-counter__value {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.turn-counter__value b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.turn-counter__max {
  color: var(--muted-dim);
  font-size: 9px;
}

/* Resource stats */
.hud-stat {
  position: relative;
  display: flex;
  min-width: 80px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent),
    rgba(8, 14, 27, 0.4);
  transition: border-color 160ms ease, background 160ms ease;
}

.hud-stat:hover {
  border-color: rgba(212, 163, 115, 0.24);
  background: rgba(15, 23, 42, 0.6);
}

.hud-stat__glyph {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--gold);
  font-size: 11px;
  line-height: 1;
}

.hud-stat__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0;
}

.hud-stat__label {
  overflow: hidden;
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-stat__value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.15;
  white-space: nowrap;
}

.hud-stat__value b {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hud-stat__value em {
  color: var(--green);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.hud-stat--gold .hud-stat__glyph {
  color: var(--gold-bright);
  background: rgba(233, 196, 106, 0.08);
}

.hud-stat--gold .hud-stat__value b {
  color: #f6d98d;
}

.hud-stat--science .hud-stat__glyph {
  color: var(--cyan);
  background: rgba(103, 232, 249, 0.08);
}

.hud-stat--science .hud-stat__value b {
  color: #a5f3fc;
}

.hud-stat--science .hud-stat__value em {
  color: var(--cyan);
}

.hud-stat--tech {
  min-width: 235px;
  max-width: 280px;
  flex: 0 1 280px;
  gap: 7px;
  border-color: rgba(212, 163, 115, 0.2);
}

.hud-stat--tech .hud-stat__glyph {
  color: var(--violet);
  background: rgba(196, 181, 253, 0.08);
}

.hud-stat--tech .hud-stat__body {
  flex: 1 1 auto;
}

.hud-stat__value--tech {
  justify-content: space-between;
  gap: 8px;
}

.hud-stat__value--tech b {
  overflow: hidden;
  color: #e9d5ff;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
}

.hud-stat__value--tech em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
}

.hud-stat--compact {
  min-width: 64px;
}

.hud-stat--compact .hud-stat__value b {
  font-size: 13px;
}

.hud-stat--compact .hud-stat__glyph {
  width: 18px;
  height: 18px;
  color: var(--muted);
  font-size: 9px;
}

.turn-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.waiting-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(8, 14, 27, 0.42);
  color: var(--gold-bright);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.waiting-count::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(233, 196, 106, 0.6);
  animation: pulse 1.6s ease-in-out infinite;
}

.finished-label {
  padding: 5px 9px;
  border: 1px solid rgba(233, 196, 106, 0.25);
  border-radius: 8px;
  background: rgba(233, 196, 106, 0.08);
  color: var(--gold-bright);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   5. Turn banner
   -------------------------------------------------------------------------- */

.turn-banner {
  position: absolute;
  top: 88px;
  left: 50%;
  z-index: 3;
  display: inline-flex;
  max-width: min(620px, calc(100vw - 32px));
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 14px;
  border: 1px solid var(--gold-line-strong);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
    rgba(12, 20, 36, 0.88);
  box-shadow:
    0 14px 38px rgba(2, 6, 23, 0.46),
    0 0 32px rgba(233, 196, 106, 0.09);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.015em;
  pointer-events: none;
  transform: translateX(-50%);
  animation: bannerIn 320ms var(--ease) both;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.turn-banner__glyph {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(233, 196, 106, 0.12);
  color: var(--gold-bright);
  font-size: 11px;
}

.turn-banner__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-banner--your-turn {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow:
    0 14px 38px rgba(2, 6, 23, 0.46),
    0 0 34px rgba(94, 234, 212, 0.12);
}

.turn-banner--your-turn .turn-banner__glyph {
  background: rgba(94, 234, 212, 0.13);
  color: var(--teal);
}

.turn-banner--waiting {
  border-color: rgba(212, 163, 115, 0.45);
  color: var(--text-soft);
}

.turn-banner--waiting .turn-banner__glyph {
  animation: pulse 1.8s ease-in-out infinite;
}

.turn-banner--hotseat {
  border-color: rgba(196, 181, 253, 0.5);
}

.turn-banner--hotseat .turn-banner__glyph {
  background: rgba(196, 181, 253, 0.13);
  color: var(--violet);
}

.turn-banner--enemy {
  border-color: rgba(148, 163, 184, 0.32);
  color: var(--text-soft);
}

.turn-banner--enemy .turn-banner__glyph {
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   6. Inspector
   -------------------------------------------------------------------------- */

.inspector-panel {
  position: absolute;
  top: 86px;
  right: 12px;
  z-index: 3;
  display: flex;
  width: 342px;
  max-height: calc(100vh - 150px);
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
}

.inspector-panel__scroll {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 2px 15px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.inspector-section {
  order: 2;
  padding: 13px 0;
  border-bottom: 1px solid rgba(212, 163, 115, 0.13);
}

.inspector-section.is-primary {
  order: 1;
}

.inspector-section:last-of-type {
  border-bottom: 0;
}

.inspector-empty {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  padding: 28px 14px;
  text-align: center;
}

.inspector-empty__glyph {
  display: flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border: 1px solid rgba(212, 163, 115, 0.22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 163, 115, 0.09), transparent 70%);
  color: var(--gold);
  font-size: 23px;
  box-shadow: 0 0 30px rgba(212, 163, 115, 0.07);
}

.inspector-empty p {
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 14px;
}

.inspector-empty span {
  max-width: 200px;
  color: var(--muted-dim);
  font-size: 10px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.section-head h3 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.12;
}

.section-head h3 .section-coords {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.section-title {
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-note {
  margin: 8px 0 0;
  color: var(--muted-dim);
  font-size: 9.5px;
  line-height: 1.45;
}

.section-note--accent {
  color: var(--gold);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 5px;
  background: rgba(8, 14, 27, 0.42);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.chip b {
  color: var(--text-soft);
  font-weight: 700;
}

.chip--owner {
  border-color: color-mix(in srgb, var(--owner-color) 36%, transparent);
  color: var(--text-soft);
}

.chip--owner .player-dot {
  width: 6px;
  height: 6px;
}

.chip--gold {
  border-color: rgba(233, 196, 106, 0.25);
  color: var(--gold-bright);
}

.chip--cyan {
  border-color: rgba(103, 232, 249, 0.22);
  color: var(--cyan);
}

.chip--green {
  border-color: rgba(74, 222, 128, 0.22);
  color: var(--green);
}

.chip--red {
  border-color: rgba(251, 113, 133, 0.25);
  color: var(--red);
}

.chip--violet {
  border-color: rgba(196, 181, 253, 0.24);
  color: var(--violet);
}

.terrain-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 5px;
  background: rgba(8, 14, 27, 0.45);
  color: var(--text-soft);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.terrain-chip--plains {
  border-color: rgba(82, 183, 136, 0.42);
  color: #86efac;
}

.terrain-chip--forest {
  border-color: rgba(64, 145, 108, 0.46);
  color: #6ee7b7;
}

.terrain-chip--desert {
  border-color: rgba(233, 196, 106, 0.4);
  color: #fde68a;
}

.terrain-chip--mountain {
  border-color: rgba(148, 163, 184, 0.38);
  color: #cbd5e1;
}

.terrain-chip--water {
  border-color: rgba(58, 166, 216, 0.44);
  color: #7dd3fc;
}

.terrain-chip--unseen {
  border-color: rgba(100, 116, 139, 0.3);
  color: var(--muted-dim);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.detail {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  padding: 5px 7px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 6px;
  background: rgba(8, 14, 27, 0.3);
}

.detail__label {
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail__value {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yield-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}

.yield {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  padding: 6px 3px 5px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 7px;
  background: rgba(8, 14, 27, 0.36);
}

.yield__label {
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.yield__value {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.yield--food .yield__value {
  color: var(--green);
}

.yield--prod .yield__value {
  color: var(--orange);
}

.yield--gold .yield__value {
  color: var(--gold-bright);
}

.yield--science .yield__value {
  color: var(--cyan);
}

/* Unit block */
.unit-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.unit-icon {
  position: relative;
  display: flex;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--unit-color) 55%, transparent);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--unit-color) 24%, transparent), transparent 68%),
    rgba(8, 14, 27, 0.6);
  color: var(--unit-color);
  font-size: 21px;
  box-shadow:
    0 0 22px color-mix(in srgb, var(--unit-color) 13%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.unit-icon::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--unit-color);
  box-shadow: 0 0 6px var(--unit-color);
}

.unit-hero__body {
  min-width: 0;
  flex: 1 1 auto;
}

.unit-hero__body h3 {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meter {
  margin-bottom: 8px;
}

.meter__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meter__head b {
  color: var(--text-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
}

.meter__head .is-low {
  color: var(--red);
}

.mp-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-pips {
  display: inline-flex;
  gap: 3px;
}

.mp-pip {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(94, 234, 212, 0.4);
  border-radius: 2px;
  background: transparent;
  transform: rotate(45deg);
}

.mp-pip.is-filled {
  background: var(--teal);
  box-shadow: 0 0 6px rgba(94, 234, 212, 0.45);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 9px;
}

.stat {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 0;
  padding: 5px 2px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 6px;
  background: rgba(8, 14, 27, 0.3);
}

.stat__label {
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat__value {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.section-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.action-button {
  display: flex;
  width: 100%;
  min-height: 37px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(94, 234, 212, 0.08), transparent 60%),
    rgba(8, 14, 27, 0.42);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.action-button:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.48);
  background:
    linear-gradient(90deg, rgba(94, 234, 212, 0.14), transparent 64%),
    rgba(15, 23, 42, 0.6);
  transform: translateY(-1px);
}

.action-button:disabled {
  opacity: 0.44;
  cursor: not-allowed;
}

.action-button--gold {
  border-color: rgba(233, 196, 106, 0.28);
  background:
    linear-gradient(90deg, rgba(233, 196, 106, 0.1), transparent 60%),
    rgba(8, 14, 27, 0.42);
}

.action-button--gold:hover:not(:disabled) {
  border-color: rgba(233, 196, 106, 0.55);
  background:
    linear-gradient(90deg, rgba(233, 196, 106, 0.16), transparent 64%),
    rgba(15, 23, 42, 0.6);
}

.action-button__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.action-button__label kbd {
  min-width: 14px;
  font-size: 8px;
}

.action-button__meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: right;
  white-space: nowrap;
}

.action-button--gold .action-button__meta {
  color: var(--gold);
}

.unit-hint {
  margin-top: 7px;
  padding: 6px 7px;
  border: 1px dashed rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: rgba(8, 14, 27, 0.26);
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.45;
}

.unit-hint .move {
  color: var(--teal);
  font-weight: 700;
}

.unit-hint .attack {
  color: var(--red);
  font-weight: 700;
}

/* City block */
.city-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.city-hero__name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.05;
}

.city-crown {
  color: var(--gold-bright);
  font-size: 14px;
  filter: drop-shadow(0 0 6px rgba(233, 196, 106, 0.42));
}

.city-hero__meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.city-shield {
  display: flex;
  min-width: 47px;
  align-items: center;
  flex-direction: column;
  gap: 0;
  padding: 4px 6px;
  border: 1px solid rgba(212, 163, 115, 0.2);
  border-radius: 7px;
  background: rgba(8, 14, 27, 0.4);
}

.city-shield b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.1;
}

.city-shield span {
  color: var(--muted-dim);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.city-meters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.building-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 9px;
}

.building-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
  border: 1px solid rgba(196, 181, 253, 0.22);
  border-radius: 5px;
  background: rgba(196, 181, 253, 0.06);
  color: #ddd6fe;
  font-size: 8px;
  font-weight: 600;
}

.production-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.production-head b {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.production-current {
  margin-bottom: 10px;
  padding: 7px;
  border: 1px solid rgba(148, 163, 184, 0.11);
  border-radius: 7px;
  background: rgba(8, 14, 27, 0.32);
}

.production-current .progress {
  height: 5px;
  margin-top: 5px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted-dim);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 8px;
}

.production-subhead {
  grid-column: 1 / -1;
  margin-top: 3px;
  color: var(--gold);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.production-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.produce-button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 6px;
  background: rgba(8, 14, 27, 0.34);
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
}

.produce-button:hover:not(:disabled) {
  border-color: rgba(233, 196, 106, 0.4);
  background: rgba(30, 41, 59, 0.58);
  color: var(--text);
}

.produce-button.is-selected {
  border-color: rgba(233, 196, 106, 0.6);
  background: rgba(233, 196, 106, 0.1);
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px rgba(233, 196, 106, 0.08);
}

.produce-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.produce-button__glyph {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold);
  font-size: 9px;
}

.produce-button__body {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0;
  line-height: 1.2;
}

.produce-button__name {
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.produce-button__cost {
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 600;
}

.produce-button.is-selected .produce-button__cost {
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   7. Chronicle / event log
   -------------------------------------------------------------------------- */

.event-log-panel {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 3;
  display: flex;
  width: 378px;
  max-height: 286px;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
}

.event-log__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px 8px;
  border-bottom: 1px solid rgba(212, 163, 115, 0.13);
}

.event-log__head .panel__title {
  font-size: 15px;
}

.event-log__body {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.event-log-panel.is-collapsed {
  max-height: none;
}

.event-log-panel.is-collapsed .event-log__body {
  display: none;
}

.event-log-panel.is-collapsed #event-log-toggle {
  transform: rotate(-90deg);
}

.event-log {
  display: flex;
  min-height: 42px;
  max-height: 166px;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.event-log__empty {
  padding: 9px 5px;
  color: var(--muted-dim);
  font-size: 9.5px;
  font-style: italic;
}

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 5px;
  color: var(--text-soft);
  font-size: 9.5px;
  line-height: 1.4;
}

.event-item[data-focus-x] {
  cursor: pointer;
}

.event-item[data-focus-x]:hover {
  background: rgba(255, 255, 255, 0.035);
}

.event-item__turn {
  flex: 0 0 auto;
  min-width: 24px;
  padding-top: 1px;
  color: var(--muted-dim);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 8px;
  font-weight: 600;
  text-align: right;
}

.event-item__glyph {
  display: inline-flex;
  width: 14px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 9px;
  line-height: 1.45;
}

.event-item__text {
  min-width: 0;
  word-break: break-word;
}

.event-item--combat .event-item__glyph,
.event-item--city_captured .event-item__glyph {
  color: var(--red);
}

.event-item--tech_unlocked .event-item__glyph {
  color: var(--cyan);
}

.event-item--city_founded .event-item__glyph,
.event-item--improvement_built .event-item__glyph {
  color: var(--green);
}

.event-item--game_started .event-item__glyph,
.event-item--game_over .event-item__glyph {
  color: var(--gold-bright);
}

.controls-hint {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px 7px;
  padding: 8px 12px 9px;
  border-top: 1px solid rgba(212, 163, 115, 0.1);
  background: rgba(2, 6, 23, 0.2);
}

.controls-hint span {
  color: var(--muted-dim);
  font-size: 8px;
  line-height: 1.35;
}

.controls-hint b {
  color: var(--muted);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   8. Toasts
   -------------------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  top: 132px;
  left: 50%;
  z-index: 150;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(212, 163, 115, 0.35);
  border-radius: 9px;
  background: rgba(12, 20, 36, 0.94);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.45);
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.4;
  pointer-events: auto;
  animation: toastIn 220ms var(--ease) both;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.toast.is-leaving {
  animation: toastOut 200ms ease both;
}

.toast__glyph {
  flex: 0 0 auto;
  color: var(--gold-bright);
  font-size: 11px;
  line-height: 1.3;
}

.toast__text {
  min-width: 0;
  flex: 1 1 auto;
}

.toast--success {
  border-color: rgba(74, 222, 128, 0.4);
}

.toast--success .toast__glyph {
  color: var(--green);
}

.toast--error {
  border-color: rgba(251, 113, 133, 0.45);
}

.toast--error .toast__glyph {
  color: var(--red);
}

.toast--info .toast__glyph {
  color: var(--cyan);
}

/* --------------------------------------------------------------------------
   9. Modals — shared
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 16%, rgba(26, 44, 76, 0.28), transparent 48%),
    rgba(2, 6, 16, 0.76);
  -webkit-backdrop-filter: blur(7px) saturate(0.9);
  backdrop-filter: blur(7px) saturate(0.9);
  animation: fadeIn 220ms ease both;
}

.modal__card {
  position: relative;
  width: min(1120px, 100%);
  max-height: calc(100vh - 40px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(212, 163, 115, 0.34);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% -20%, rgba(233, 196, 106, 0.11), transparent 38%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.04), transparent 32%),
    linear-gradient(145deg, rgba(20, 30, 50, 0.98), rgba(9, 15, 29, 0.985));
  box-shadow:
    0 36px 100px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset,
    0 0 90px rgba(212, 163, 115, 0.06);
  animation: modalIn 320ms var(--ease) both;
}

.modal__card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 8%;
  left: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 235, 175, 0.52), transparent);
  pointer-events: none;
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 50%;
  background: rgba(8, 14, 27, 0.68);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.modal__close:hover {
  border-color: var(--gold-line-strong);
  color: var(--gold-bright);
  transform: rotate(90deg);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 76px 16px 28px;
  border-bottom: 1px solid rgba(212, 163, 115, 0.14);
}

.modal-title {
  margin-top: 3px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.modal-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
}

.science-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 5px;
  padding: 8px 12px;
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 999px;
  background: rgba(103, 232, 249, 0.07);
  color: var(--cyan);
}

.science-pill span {
  font-size: 13px;
}

.science-pill b {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.science-pill small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   10. Lobby
   -------------------------------------------------------------------------- */

.lobby-card {
  padding: 26px 30px 20px;
}

.lobby-hero {
  position: relative;
  padding: 6px 30px 22px;
  text-align: center;
}

.lobby-hero__emblem {
  display: flex;
  width: 54px;
  height: 60px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  border: 1px solid rgba(233, 196, 106, 0.42);
  background:
    radial-gradient(circle at 50% 38%, rgba(233, 196, 106, 0.21), transparent 68%),
    rgba(8, 14, 27, 0.32);
  color: var(--gold-bright);
  font-size: 27px;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  filter: drop-shadow(0 0 16px rgba(233, 196, 106, 0.22));
}

.lobby-hero__title {
  margin: 5px 0 2px;
  background: linear-gradient(180deg, #fff6d5 0%, var(--gold-bright) 46%, #c08c58 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(38px, 5.2vw, 58px);
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
  filter: drop-shadow(0 4px 18px rgba(233, 196, 106, 0.13));
}

.lobby-hero__sub {
  max-width: 540px;
  margin: 9px auto 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.lobby-message {
  max-width: 760px;
  margin: 0 auto 16px;
  padding: 9px 13px;
  border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: 8px;
  background: rgba(251, 113, 133, 0.07);
  color: #fecdd3;
  font-size: 10.5px;
  line-height: 1.45;
  text-align: center;
}

.lobby-message.is-info {
  border-color: rgba(103, 232, 249, 0.3);
  background: rgba(103, 232, 249, 0.055);
  color: #a5f3fc;
}

.lobby-message.is-success {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.055);
  color: #bbf7d0;
}

.quick-play {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.quick-card {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  overflow: hidden;
  border: 1px solid rgba(212, 163, 115, 0.28);
  border-radius: 13px;
  background:
    linear-gradient(110deg, rgba(212, 163, 115, 0.1), transparent 58%),
    rgba(8, 14, 27, 0.48);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 170ms ease, transform 170ms var(--ease), box-shadow 170ms ease, background 170ms ease;
}

.quick-card::after {
  content: "";
  position: absolute;
  top: -60%;
  right: -15%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 196, 106, 0.1), transparent 68%);
  pointer-events: none;
  transition: opacity 160ms ease;
}

.quick-card:hover {
  border-color: rgba(233, 196, 106, 0.55);
  background:
    linear-gradient(110deg, rgba(233, 196, 106, 0.14), transparent 60%),
    rgba(15, 23, 42, 0.62);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.3);
  transform: translateY(-2px);
}

.quick-card:active {
  transform: translateY(0);
}

.quick-card--hotseat {
  border-color: rgba(196, 181, 253, 0.26);
  background:
    linear-gradient(110deg, rgba(196, 181, 253, 0.09), transparent 58%),
    rgba(8, 14, 27, 0.48);
}

.quick-card--hotseat:hover {
  border-color: rgba(196, 181, 253, 0.5);
  background:
    linear-gradient(110deg, rgba(196, 181, 253, 0.13), transparent 60%),
    rgba(15, 23, 42, 0.62);
}

.quick-card__glyph {
  display: inline-flex;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(233, 196, 106, 0.28);
  border-radius: 11px;
  background: rgba(2, 6, 23, 0.44);
  color: var(--gold-bright);
  font-size: 19px;
  box-shadow: 0 0 20px rgba(233, 196, 106, 0.08);
}

.quick-card--hotseat .quick-card__glyph {
  border-color: rgba(196, 181, 253, 0.26);
  color: var(--violet);
}

.quick-card__body {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
}

.quick-card__body strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.quick-card__body span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.quick-card__cta {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  align-self: center;
  color: var(--gold-bright);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.quick-card--hotseat .quick-card__cta {
  color: var(--violet);
}

.quick-card:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 18px;
}

.lobby-section {
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 14px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.022), transparent 42%),
    rgba(5, 11, 23, 0.35);
}

.lobby-section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.lobby-section h2 {
  margin-top: 2px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.1;
}

.lobby-section h3 {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-hint {
  margin: -2px 0 0;
  padding: 6px 8px;
  border: 1px dashed rgba(196, 181, 253, 0.24);
  border-radius: 6px;
  color: var(--violet);
  font-size: 9px;
  line-height: 1.4;
}

.join-form {
  display: flex;
  gap: 8px;
}

.join-form .input {
  min-width: 0;
  flex: 1 1 auto;
}

.join-form .btn {
  flex: 0 0 auto;
}

.rooms-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 7px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 163, 115, 0.12);
}

.rooms-head h3 {
  margin-top: 2px;
}

.rooms-list {
  display: flex;
  min-height: 96px;
  max-height: 248px;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rooms-empty {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  color: var(--muted-dim);
  font-size: 10px;
  font-style: italic;
  text-align: center;
}

.room-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 8px;
  background: rgba(8, 14, 27, 0.32);
  transition: border-color 140ms ease, background 140ms ease;
}

.room-entry:hover {
  border-color: rgba(212, 163, 115, 0.3);
  background: rgba(15, 23, 42, 0.52);
}

.room-entry__code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: 4px 5px;
  border: 1px solid rgba(233, 196, 106, 0.25);
  border-radius: 5px;
  background: rgba(233, 196, 106, 0.07);
  color: var(--gold-bright);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.room-entry__body {
  min-width: 0;
}

.room-entry__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.room-entry__meta {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted-dim);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-entry__players {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 99px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-transform: uppercase;
}

.status-pill--waiting {
  border-color: rgba(233, 196, 106, 0.28);
  background: rgba(233, 196, 106, 0.07);
  color: var(--gold-bright);
}

.status-pill--active {
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(74, 222, 128, 0.06);
  color: var(--green);
}

.status-pill--finished {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
}

.hotseat-pill {
  display: inline-flex;
  padding: 1px 5px;
  border: 1px solid rgba(196, 181, 253, 0.24);
  border-radius: 99px;
  color: var(--violet);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.5;
  text-transform: uppercase;
}

.room-entry__action {
  min-height: 26px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 8.5px;
}

.lobby-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 18px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid rgba(212, 163, 115, 0.11);
  color: var(--muted-dim);
  font-size: 8px;
  line-height: 1.5;
}

.lobby-footer__hint {
  color: rgba(148, 163, 184, 0.6);
}

/* --------------------------------------------------------------------------
   11. Technology tree
   -------------------------------------------------------------------------- */

.tech-card {
  width: min(1180px, 100%);
}

.tech-tree-wrap {
  position: relative;
  padding: 22px 28px 18px;
  overflow-x: auto;
  overflow-y: hidden;
}

.tech-links {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.tech-link {
  fill: none;
  stroke: rgba(212, 163, 115, 0.22);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.2;
}

.tech-link.is-unlocked {
  stroke: rgba(74, 222, 128, 0.38);
}

.tech-link.is-researching {
  stroke: rgba(233, 196, 106, 0.48);
}

.tech-link-node {
  fill: rgba(212, 163, 115, 0.4);
}

.tech-link-node.is-unlocked {
  fill: rgba(74, 222, 128, 0.6);
}

.tech-tree-board {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 840px;
  grid-template-columns: repeat(4, minmax(168px, 1fr));
  grid-template-areas:
    "agriculture mining archery sailing"
    ". metallurgy . ."
    ". ascension . .";
  gap: 46px 20px;
  align-items: stretch;
}

.tech-node {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 155px;
  flex-direction: column;
  padding: 13px 13px 11px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.03), transparent 48%),
    rgba(8, 14, 27, 0.76);
  color: var(--text-soft);
  text-align: left;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.24);
  transition: border-color 160ms ease, transform 160ms var(--ease), box-shadow 160ms ease, background 160ms ease;
}

.tech-node[data-tech="agriculture"] {
  grid-area: agriculture;
}

.tech-node[data-tech="mining"] {
  grid-area: mining;
}

.tech-node[data-tech="archery"] {
  grid-area: archery;
}

.tech-node[data-tech="sailing"] {
  grid-area: sailing;
}

.tech-node[data-tech="metallurgy"] {
  grid-area: metallurgy;
}

.tech-node[data-tech="ascension"] {
  grid-area: ascension;
}

button.tech-node {
  cursor: pointer;
}

.tech-node:disabled {
  cursor: default;
}

.tech-node--available:disabled {
  opacity: 0.62;
}

.tech-node--unlocked {
  border-color: rgba(74, 222, 128, 0.32);
  background:
    linear-gradient(160deg, rgba(74, 222, 128, 0.06), transparent 48%),
    rgba(8, 14, 27, 0.76);
}

.tech-node--researching {
  border-color: rgba(233, 196, 106, 0.58);
  background:
    linear-gradient(160deg, rgba(233, 196, 106, 0.1), transparent 52%),
    rgba(8, 14, 27, 0.8);
  box-shadow:
    0 0 0 1px rgba(233, 196, 106, 0.09) inset,
    0 12px 32px rgba(2, 6, 23, 0.28),
    0 0 28px rgba(233, 196, 106, 0.08);
}

.tech-node--available {
  border-color: rgba(103, 232, 249, 0.3);
}

.tech-node--available:hover {
  border-color: rgba(103, 232, 249, 0.58);
  background:
    linear-gradient(160deg, rgba(103, 232, 249, 0.07), transparent 52%),
    rgba(15, 23, 42, 0.82);
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.32);
  transform: translateY(-2px);
}

.tech-node--locked {
  border-color: rgba(100, 116, 139, 0.14);
  background: rgba(8, 14, 27, 0.48);
  opacity: 0.56;
}

.tech-node__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tech-node__title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.08;
}

.tech-node__glyph {
  display: inline-flex;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212, 163, 115, 0.2);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.4);
  color: var(--gold);
  font-size: 11px;
}

.tech-node--unlocked .tech-node__glyph {
  border-color: rgba(74, 222, 128, 0.22);
  color: var(--green);
}

.tech-node--available .tech-node__glyph {
  border-color: rgba(103, 232, 249, 0.24);
  color: var(--cyan);
}

.tech-status {
  flex: 0 0 auto;
  padding: 1px 5px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 99px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}

.tech-status--unlocked {
  border-color: rgba(74, 222, 128, 0.26);
  background: rgba(74, 222, 128, 0.06);
  color: var(--green);
}

.tech-status--researching {
  border-color: rgba(233, 196, 106, 0.3);
  background: rgba(233, 196, 106, 0.07);
  color: var(--gold-bright);
}

.tech-status--available {
  border-color: rgba(103, 232, 249, 0.26);
  background: rgba(103, 232, 249, 0.05);
  color: var(--cyan);
}

.tech-node__cost {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tech-node__cost b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.tech-node__desc {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.42;
}

.tech-node__prereqs {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  color: var(--muted-dim);
  font-size: 8.5px;
  line-height: 1.4;
}

.tech-node__prereqs b {
  color: var(--text-soft);
  font-weight: 600;
}

.tech-node__progress {
  margin-top: 6px;
}

.tech-node__progress .progress {
  height: 3px;
}

.tech-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 16px;
  padding: 12px 28px 16px;
  border-top: 1px solid rgba(212, 163, 115, 0.12);
  color: var(--muted);
  font-size: 8px;
}

.tech-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-dot--unlocked {
  background: var(--green);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

.legend-dot--researching {
  background: var(--gold-bright);
  box-shadow: 0 0 6px rgba(233, 196, 106, 0.5);
}

.legend-dot--available {
  background: var(--cyan);
  box-shadow: 0 0 6px rgba(103, 232, 249, 0.5);
}

.legend-dot--locked {
  background: var(--muted-dim);
}

.tech-legend__hint {
  margin-left: auto;
  color: var(--muted-dim);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   12. Victory
   -------------------------------------------------------------------------- */

.victory-card {
  width: min(620px, 100%);
  padding: 24px 28px 22px;
  overflow: hidden;
  text-align: center;
}

.victory-card__rays {
  position: absolute;
  top: -230px;
  left: 50%;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(233, 196, 106, 0.055) 0deg 7deg, transparent 7deg 17deg);
  opacity: 0.75;
  pointer-events: none;
  transform: translateX(-50%);
  animation: slowSpin 80s linear infinite;
}

.victory-crown {
  position: relative;
  z-index: 1;
  display: flex;
  width: 62px;
  height: 62px;
  align-items: center;
  justify-content: center;
  margin: 2px auto 8px;
  border: 1px solid rgba(233, 196, 106, 0.4);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 32%, rgba(233, 196, 106, 0.28), transparent 68%),
    rgba(8, 14, 27, 0.35);
  color: var(--gold-bright);
  font-size: 29px;
  box-shadow:
    0 0 34px rgba(233, 196, 106, 0.16),
    inset 0 1px 0 rgba(255, 244, 201, 0.12);
}

.victory-title {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  background: linear-gradient(180deg, #fff6d5, var(--gold-bright) 55%, #c08c58);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
}

.victory-type {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.victory-winner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 15px auto 12px;
  padding: 9px 16px;
  border: 1px solid color-mix(in srgb, var(--winner-color, var(--gold)) 44%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--winner-color, var(--gold)) 12%, transparent), transparent 70%),
    rgba(8, 14, 27, 0.42);
  text-align: left;
}

.victory-winner .player-dot {
  background: var(--winner-color, var(--gold));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 14px var(--winner-color, var(--gold));
}

.victory-winner__label {
  display: block;
  color: var(--muted-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.victory-winner strong {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.15;
}

.score-table {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 auto 17px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
  background: rgba(2, 6, 23, 0.26);
  text-align: left;
}

.score-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 10px;
}

.score-row--winner {
  background: rgba(233, 196, 106, 0.075);
}

.score-row__name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-row__tags {
  color: var(--muted-dim);
  font-size: 8px;
  white-space: nowrap;
}

.score-row__score {
  min-width: 40px;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-align: right;
}

.score-row__crown {
  color: var(--gold-bright);
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   13. Boot / noscript
   -------------------------------------------------------------------------- */

.booting-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 50% 35%, rgba(25, 48, 82, 0.5), transparent 42%),
    linear-gradient(180deg, #07101f, #030711 70%);
  transition: opacity 420ms ease, visibility 420ms ease;
}

.booting-overlay.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.booting-hex {
  color: var(--gold-bright);
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 0 18px rgba(233, 196, 106, 0.28));
  animation: bootPulse 2.2s ease-in-out infinite;
}

.booting-copy {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}

.booting-copy strong {
  background: linear-gradient(180deg, #fff6d5, var(--gold-bright) 52%, #bd8b57);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.2em;
}

.booting-copy span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.spinner {
  width: 18px;
  height: 18px;
  margin-top: 5px;
  border: 2px solid rgba(233, 196, 106, 0.18);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   14. Motion preferences
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   15. Responsive layout
   -------------------------------------------------------------------------- */

@media (max-width: 1680px) {
  .hud-stat {
    min-width: 72px;
    padding-right: 6px;
    padding-left: 6px;
  }

  .hud-stat--tech {
    min-width: 205px;
    flex-basis: 230px;
  }

  .hud-stat--compact {
    min-width: 58px;
  }

  .top-bar__left {
    gap: 4px;
  }

  .brand__word {
    font-size: 15px;
  }

  .badge--player .badge__caption {
    display: none;
  }
}

@media (max-width: 1480px) {
  .top-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }

  .top-bar__center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    padding-top: 5px;
    border-top: 1px solid rgba(212, 163, 115, 0.1);
  }

  .inspector-panel {
    top: 124px;
    max-height: calc(100vh - 188px);
  }

  .turn-banner {
    top: 122px;
  }

  .toast-stack {
    top: 170px;
  }
}

@media (max-width: 1180px) {
  .top-bar__left .btn--small {
    padding: 4px 8px;
    font-size: 9px;
  }

  .hud-stat--tech {
    min-width: 190px;
    flex-basis: 210px;
  }

  .inspector-panel {
    width: 318px;
  }

  .event-log-panel {
    width: 340px;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .rooms-list {
    max-height: 280px;
  }
}

@media (max-width: 960px) {
  .brand__word {
    display: none;
  }

  .top-bar__left {
    gap: 4px;
  }

  .badge--room .badge__caption,
  .turn-counter__caption {
    display: none;
  }

  .hud-stat {
    flex: 0 0 auto;
  }

  .top-bar__center {
    padding-bottom: 1px;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .top-bar__center::-webkit-scrollbar {
    display: none;
  }

  .inspector-panel {
    width: 300px;
  }

  .inspector-panel__scroll {
    padding-right: 12px;
    padding-left: 12px;
  }

  .event-log-panel {
    width: 312px;
  }

  .controls-hint {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-play {
    grid-template-columns: 1fr;
  }

  .lobby-card {
    padding: 20px;
  }

  .tech-tree-board {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: none;
    gap: 12px;
  }

  .tech-node {
    grid-area: auto !important;
    min-height: 145px;
  }

  .tech-links {
    display: none;
  }

  .tech-tree-wrap {
    padding: 16px 20px;
  }

  .tech-legend {
    padding-right: 20px;
    padding-left: 20px;
  }

  .tech-legend__hint {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .top-bar {
    top: 6px;
    right: 6px;
    left: 6px;
    padding: 6px 7px;
  }

  .top-bar__left .btn--small kbd,
  #center-button {
    display: none;
  }

  .top-bar__left {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .top-bar__left::-webkit-scrollbar {
    display: none;
  }

  .top-bar__left > * {
    flex: 0 0 auto;
  }

  .badge--player .badge__value {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-bar__right {
    gap: 4px;
  }

  .btn--end-turn {
    min-width: 130px;
    max-width: 180px;
  }

  .btn--end-turn.is-waiting {
    min-width: 140px;
  }

  .inspector-panel {
    top: auto;
    right: 6px;
    bottom: 6px;
    left: 6px;
    width: auto;
    max-height: 39vh;
  }

  .event-log-panel {
    display: none;
  }

  .turn-banner {
    top: 110px;
    max-width: calc(100vw - 20px);
    font-size: 12px;
  }

  .toast-stack {
    top: 152px;
  }

  .modal {
    padding: 8px;
  }

  .modal__card {
    max-height: calc(100vh - 16px);
    border-radius: 16px;
  }

  .lobby-card {
    padding: 14px;
  }

  .lobby-hero {
    padding: 5px 10px 16px;
  }

  .lobby-hero__emblem {
    width: 44px;
    height: 49px;
    font-size: 22px;
  }

  .lobby-grid {
    gap: 10px;
  }

  .lobby-section {
    padding: 12px;
  }

  .field-row--three {
    grid-template-columns: 1fr;
  }

  .field--seed {
    max-width: none;
  }

  .quick-card {
    padding: 11px;
  }

  .quick-card__glyph {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .quick-card__body strong {
    font-size: 14px;
  }

  .quick-card__cta {
    display: none;
  }

  .modal-head {
    padding: 19px 58px 13px 18px;
  }

  .modal-title {
    font-size: 24px;
  }

  .tech-card .modal__close {
    top: 10px;
    right: 10px;
  }

  .tech-tree-board {
    grid-template-columns: 1fr;
  }

  .tech-tree-wrap {
    padding: 12px;
  }

  .tech-node {
    min-height: 0;
  }

  .victory-card {
    padding: 20px 14px 16px;
  }

  .score-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .score-row__tags {
    display: none;
  }

  .lobby-footer {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 460px) {
  .badge--room .badge__copy {
    display: none;
  }

  .iteration-helper {
    display: none;
  }

  .hud-stat {
    min-width: 64px;
    padding: 4px 6px;
  }

  .hud-stat__glyph {
    width: 17px;
    height: 17px;
    font-size: 9px;
  }

  .hud-stat__value b {
    font-size: 12px;
  }

  .hud-stat--tech {
    min-width: 170px;
    flex-basis: 190px;
  }

  .waiting-count {
    display: none;
  }

  .inspector-panel {
    max-height: 45vh;
  }

  .turn-banner {
    top: 106px;
    padding: 6px 12px;
    font-size: 11px;
  }

  .modal__close {
    top: 8px;
    right: 8px;
  }
}

/* --------------------------------------------------------------------------
   16. Keyframes
   -------------------------------------------------------------------------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slowSpin {
  to {
    transform: translateX(-50%) rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.42;
  }
  50% {
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translate(-50%, -6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes turnGlow {
  0%,
  100% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.34) inset,
      0 8px 22px rgba(212, 163, 115, 0.18),
      0 0 0 rgba(233, 196, 106, 0);
  }
  50% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.4) inset,
      0 10px 26px rgba(212, 163, 115, 0.24),
      0 0 22px rgba(233, 196, 106, 0.18);
  }
}

@keyframes bootPulse {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(0.97);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}
