:root {
  color-scheme: dark;
  --bg: #08070b;
  --panel: rgba(14, 13, 22, 0.82);
  --panel-solid: #111019;
  --ink: #fbf8f1;
  --soft: #b8afc8;
  --muted: #817890;
  --line: rgba(255, 255, 255, 0.14);
  --lime: #d8ff24;
  --cyan: #34e7ff;
  --coral: #ff5b61;
  --amber: #ffd36a;
  --violet: #a36bff;
  --hot: #ff2bd6;
  --shadow: rgba(0, 0, 0, 0.44);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-width: 320px;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 540px;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 43, 214, 0.1), transparent 30%),
    linear-gradient(225deg, rgba(52, 231, 255, 0.09), transparent 32%),
    #08070b;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #08070b;
  cursor: crosshair;
}

.hud {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.hud-top {
  top: 18px;
  left: 18px;
  right: 18px;
  justify-content: space-between;
}

.brand-lockup,
.metric-row,
.hud-actions,
.live-panel,
.power-strip,
.modal-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 48px var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(280px, 33vw);
  min-height: 58px;
  padding: 8px 12px;
  border-radius: 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #10120b;
  background: var(--lime);
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 0 28px rgba(216, 255, 36, 0.38);
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: clamp(0.95rem, 1.2vw, 1.12rem);
  line-height: 1.1;
}

.eyebrow,
.metric span,
.strip-label span,
.live-head span,
.modal-kicker,
.result-grid span {
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(104px, 1fr));
  gap: 1px;
  min-width: min(460px, 42vw);
  overflow: hidden;
  border-radius: 8px;
  pointer-events: auto;
}

.metric {
  display: grid;
  align-content: center;
  min-height: 58px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.035);
}

.metric strong {
  margin-top: 2px;
  font-size: clamp(1.1rem, 1.9vw, 1.65rem);
  line-height: 1;
}

.hud-actions {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  pointer-events: auto;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-weight: 900;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.live-panel {
  position: absolute;
  z-index: 4;
  top: 96px;
  right: 18px;
  width: min(300px, 28vw);
  max-height: min(52vh, 460px);
  padding: 12px;
  border-radius: 8px;
  overflow: hidden;
}

.live-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.live-head strong {
  color: var(--lime);
  font-size: 1.25rem;
}

.chat-feed {
  display: grid;
  gap: 8px;
  max-height: calc(min(52vh, 460px) - 56px);
  padding: 10px 0 0;
  margin: 0;
  list-style: none;
  overflow: hidden;
}

.chat-feed li {
  min-height: 28px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--soft);
  font-size: 0.84rem;
  line-height: 1.2;
}

.chat-feed strong {
  color: var(--cyan);
  font-weight: 900;
}

.event-banner,
.moment-callout {
  position: absolute;
  z-index: 6;
  top: 102px;
  left: 50%;
  min-width: 240px;
  max-width: min(560px, calc(100vw - 36px));
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(8, 7, 11, 0.72);
  color: var(--ink);
  text-align: center;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translate(-50%, -18px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.event-banner.is-visible,
.moment-callout.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.moment-callout {
  top: 50%;
  min-width: 0;
  border-color: rgba(216, 255, 36, 0.4);
  background: rgba(8, 7, 11, 0.5);
  color: var(--lime);
  font-size: clamp(1.9rem, 8vw, 5.8rem);
  line-height: 0.9;
  text-shadow:
    0 0 20px rgba(216, 255, 36, 0.46),
    0 0 42px rgba(52, 231, 255, 0.28);
}

.power-strip {
  position: absolute;
  z-index: 5;
  left: 18px;
  bottom: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  pointer-events: auto;
}

.stream-wrap {
  display: grid;
  align-content: center;
  gap: 7px;
}

.mission-line {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.mission-line div {
  min-width: 0;
}

.mission-line span {
  display: block;
  color: var(--soft);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mission-line strong {
  display: block;
  color: var(--ink);
  font-size: clamp(0.92rem, 1.6vw, 1.1rem);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#missionProgress {
  color: var(--lime);
  font-size: 1.05rem;
  text-align: right;
}

.mission-copy {
  margin: -2px 0 0;
  color: var(--soft);
  font-size: 0.84rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mission-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.mission-track div {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--hot), var(--amber));
  box-shadow: 0 0 18px rgba(255, 43, 214, 0.36);
  transition: width 160ms linear;
}

.strip-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.strip-label strong {
  color: var(--lime);
}

.bar-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  min-width: 0;
  border-radius: inherit;
  transition: width 120ms linear;
}

.stream-fill {
  background: linear-gradient(90deg, var(--coral), var(--amber), var(--lime));
  box-shadow: 0 0 22px rgba(216, 255, 36, 0.28);
}

.drop-button {
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 100px;
  min-height: 62px;
  border: 1px solid rgba(216, 255, 36, 0.36);
  border-radius: 8px;
  background: #10120b;
  color: var(--lime);
  font-weight: 950;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(216, 255, 36, 0.12);
}

.drop-button span {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

.drop-button strong {
  font-size: 1.2rem;
}

.drop-button.is-ready {
  color: #10120b;
  background: var(--lime);
  box-shadow:
    0 0 28px rgba(216, 255, 36, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

.modal {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(8, 7, 11, 0.82), rgba(8, 7, 11, 0.18), rgba(8, 7, 11, 0.82)),
    linear-gradient(180deg, rgba(216, 255, 36, 0.06), rgba(255, 43, 214, 0.07));
}

.modal-panel {
  position: relative;
  width: min(720px, 100%);
  padding: clamp(22px, 5vw, 42px);
  border-radius: 8px;
  text-align: left;
  overflow: hidden;
  border-color: rgba(216, 255, 36, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03)),
    rgba(12, 10, 18, 0.86);
}

.poster-lines {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(52, 231, 255, 0.2) 33px 34px),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(255, 211, 106, 0.16) 25px 26px);
}

.modal-panel h1,
.modal-panel h2 {
  position: relative;
  margin: 8px 0 12px;
  font-size: clamp(4rem, 12vw, 8rem);
  line-height: 0.86;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow:
    0 0 24px rgba(216, 255, 36, 0.28),
    0 0 56px rgba(255, 43, 214, 0.2);
}

.modal-panel h2 {
  font-size: clamp(2.4rem, 8vw, 4.8rem);
}

.modal-copy {
  position: relative;
  max-width: 46ch;
  margin: 0 0 24px;
  color: var(--soft);
  font-size: clamp(1rem, 2vw, 1.12rem);
  line-height: 1.5;
}

.button-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 950;
}

.primary-button {
  background: var(--lime);
  color: #10120b;
  box-shadow: 0 0 28px rgba(216, 255, 36, 0.24);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.modal-stats,
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 24px;
}

.modal-stats span,
.result-grid div {
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.modal-stats span {
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-weight: 950;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(52, 231, 255, 0.05);
}

.result-grid div {
  display: grid;
  align-content: center;
  gap: 2px;
}

.result-grid strong {
  font-size: 1.4rem;
}

@media (max-width: 920px) {
  .game-shell {
    min-height: 500px;
  }

  .hud-top {
    align-items: flex-start;
  }

  .brand-lockup {
    width: auto;
    min-width: 148px;
  }

  .brand-lockup div {
    display: none;
  }

  .metric-row {
    grid-template-columns: repeat(3, minmax(78px, 1fr));
    min-width: 0;
    width: min(420px, calc(100vw - 160px));
  }

  .metric {
    min-height: 54px;
    padding: 7px 9px;
  }

  .metric span {
    font-size: 0.62rem;
  }

  .live-panel {
    display: none;
  }

  .event-banner {
    top: 92px;
  }
}

@media (max-width: 620px) {
  .hud-top {
    display: grid;
    grid-template-columns: 48px 1fr 86px;
    align-items: start;
    left: 10px;
    right: 10px;
    top: 10px;
    gap: 8px;
  }

  .brand-mark,
  .icon-button {
    width: 38px;
    height: 38px;
  }

  .brand-lockup,
  .hud-actions {
    min-height: 48px;
    padding: 5px;
  }

  .brand-lockup {
    grid-column: 1;
  }

  .hud-actions {
    grid-column: 3;
    justify-self: end;
  }

  .metric-row {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric {
    min-height: 48px;
    min-width: 0;
  }

  .metric strong {
    font-size: 0.96rem;
  }

  .event-banner {
    top: 148px;
  }

  .power-strip {
    left: 10px;
    right: 10px;
    bottom: 10px;
    grid-template-columns: 1fr 86px;
    padding: 10px;
  }

  .drop-button {
    min-width: 78px;
    min-height: 58px;
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    padding: 22px;
  }

  .modal-stats,
  .result-grid {
    grid-template-columns: 1fr;
  }
}

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