:root {
  color-scheme: light;
  --page-bg: #f3f6f9;
  --surface: #ffffff;
  --surface-soft: #edf3f7;
  --line: rgba(15, 49, 74, 0.16);
  --line-strong: rgba(15, 49, 74, 0.28);
  --text: #0d2030;
  --muted: #617487;
  --cyan: #08bde8;
  --cyan-dark: #087ea4;
  --purple: #8d62ff;
  --amber: #f7b843;
  --red: #f2526f;
  --shadow: 0 22px 65px rgba(27, 58, 79, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 18%, rgba(8, 189, 232, 0.11), transparent 28rem),
    radial-gradient(circle at 88% 36%, rgba(141, 98, 255, 0.09), transparent 32rem),
    var(--page-bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="color"],
input[type="range"] {
  cursor: pointer;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  min-height: 94px;
  padding: 14px 48px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(64px, 1fr);
  align-items: center;
  gap: 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(25, 54, 78, 0.08);
  backdrop-filter: blur(18px);
}

.site-logo {
  display: block;
  width: 238px;
}

.site-logo img {
  display: block;
  width: 100%;
  height: auto;
}

nav {
  display: flex;
  align-items: center;
}

nav ul {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 27px;
  list-style: none;
}

nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  transition: color 0.18s ease;
}

nav a:hover,
nav a.active {
  color: #00aaff;
}

.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.6rem;
}

.armino-account-slot {
  justify-self: end;
}

main {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding-top: 118px;
}

.game-intro {
  padding: 34px 4px 26px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 34px;
}

.eyebrow,
.section-label,
.setup-kicker,
.winner-kicker {
  color: var(--cyan-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-intro h1 {
  margin: 5px 0 10px;
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.065em;
}

.game-intro p {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.16rem);
}

.build-note {
  flex: 0 0 310px;
  padding: 17px 19px;
  border: 1px solid rgba(141, 98, 255, 0.22);
  border-radius: 16px;
  background: rgba(141, 98, 255, 0.07);
}

.build-note strong,
.build-note span {
  display: block;
}

.build-note strong {
  margin-bottom: 5px;
  color: #7450df;
}

.build-note span {
  color: var(--muted);
  font-size: 0.84rem;
}

.game-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #08101b;
  box-shadow: var(--shadow);
  scroll-margin-top: 104px;
}

.game-toolbar {
  min-height: 62px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(113, 193, 237, 0.16);
  background: linear-gradient(180deg, #101b2a, #0a1421);
  color: #eef9ff;
}

.game-identity,
.toolbar-actions,
.battle-status {
  display: flex;
  align-items: center;
}

.game-identity {
  gap: 10px;
}

.game-logo {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 16px rgba(8, 189, 232, 0.18);
}

.game-identity small,
.game-identity strong {
  display: block;
}

.game-identity small {
  color: #8097aa;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-identity strong {
  font-size: 0.9rem;
}

.battle-status {
  gap: 6px;
}

.battle-status > span {
  min-width: 74px;
  padding: 5px 9px;
  border: 1px solid rgba(113, 193, 237, 0.15);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}

.battle-status small,
.battle-status strong {
  display: block;
  line-height: 1.15;
}

.battle-status small {
  color: #718a9f;
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.battle-status strong {
  margin-top: 2px;
  font-size: 0.76rem;
}

.toolbar-actions {
  justify-content: flex-end;
  gap: 6px;
}

.speed-control {
  min-height: 34px;
  padding: 3px;
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(113, 193, 237, 0.2);
  border-radius: 9px;
  background: rgba(4, 11, 19, 0.7);
}

.speed-control-label {
  padding: 0 5px;
  color: #718a9f;
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.speed-button {
  min-width: 32px;
  height: 26px;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8aa1b4;
  font-size: 0.58rem;
  font-weight: 900;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.speed-button:hover {
  color: #e8faff;
  background: rgba(48, 217, 255, 0.1);
}

.speed-button.active {
  background: #22d7fa;
  color: #04121b;
  box-shadow: 0 0 12px rgba(34, 215, 250, 0.2);
}

.toolbar-button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(113, 193, 237, 0.22);
  border-radius: 9px;
  background: #142235;
  color: #dff7ff;
  font-size: 0.66rem;
  font-weight: 800;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.toolbar-button:hover {
  border-color: #2fdcff;
  background: #18304a;
}

.arena-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 10 / 7;
  overflow: hidden;
  background: #050a12;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #050a12;
  object-fit: contain;
}

.game-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: #050a12;
}

.game-shell:fullscreen .game-toolbar {
  flex: 0 0 auto;
}

.game-shell:fullscreen .arena-stage {
  flex: 0 1 auto;
  width: 100%;
  max-width: calc((100vh - 62px) * 10 / 7);
  height: auto;
  max-height: calc(100vh - 62px);
  margin: auto;
  aspect-ratio: 10 / 7;
}

.game-shell:fullscreen .arena-caption {
  display: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2.6vw, 30px);
  background:
    radial-gradient(circle at 50% 35%, rgba(8, 189, 232, 0.12), transparent 34%),
    rgba(4, 9, 16, 0.9);
  backdrop-filter: blur(7px);
}

.game-overlay[hidden],
.pause-overlay[hidden] {
  display: none;
}

.setup-panel {
  width: min(920px, 100%);
  max-height: 100%;
  padding: clamp(16px, 2.3vw, 26px);
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.7fr);
  grid-template-rows: auto 1fr auto;
  gap: 17px 24px;
  overflow: hidden;
  border: 1px solid rgba(111, 211, 255, 0.22);
  border-radius: 20px;
  background: rgba(10, 19, 31, 0.97);
  color: #eef9ff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
}

.setup-heading {
  align-self: center;
}

.setup-heading h2 {
  margin: 4px 0 7px;
  font-size: clamp(1.55rem, 3.2vw, 2.45rem);
  line-height: 1;
}

.setup-heading p {
  color: #8ca2b5;
  font-size: 0.78rem;
}

.setup-controls {
  align-self: center;
  display: grid;
  gap: 9px;
}

.fighter-count-control {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

.fighter-count-control label {
  color: #9bb0c0;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.fighter-count-control input {
  width: 100%;
  accent-color: var(--cyan);
}

.fighter-count-control output {
  padding: 5px;
  border: 1px solid rgba(8, 189, 232, 0.32);
  border-radius: 9px;
  color: #3bddff;
  font-weight: 900;
  text-align: center;
}

.arena-size-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.arena-size-control > span {
  color: #9bb0c0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.arena-size-control select {
  min-width: 0;
  width: 100%;
  height: 34px;
  padding: 5px 9px;
  border: 1px solid rgba(113, 193, 237, 0.2);
  border-radius: 8px;
  outline: none;
  background: #111f30;
  color: #ecf9ff;
  font-size: 0.69rem;
  font-weight: 750;
}

.arena-size-control select:focus {
  border-color: var(--cyan);
}

.fighter-roster {
  grid-column: 1 / -1;
  min-height: 0;
  padding-right: 5px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.fighter-row {
  min-width: 0;
  padding: 7px;
  display: grid;
  grid-template-columns: 28px minmax(80px, 1fr) minmax(96px, 0.82fr) 36px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(113, 193, 237, 0.13);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}

.fighter-number {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: rgba(8, 189, 232, 0.1);
  color: #61e7ff;
  font-size: 0.62rem;
  font-weight: 900;
}

.fighter-row input[type="text"],
.fighter-row select {
  min-width: 0;
  width: 100%;
  height: 33px;
  padding: 5px 8px;
  border: 1px solid rgba(113, 193, 237, 0.18);
  border-radius: 8px;
  outline: none;
  background: #111f30;
  color: #ecf9ff;
  font-size: 0.7rem;
  font-weight: 700;
}

.fighter-row input[type="text"]:focus,
.fighter-row select:focus {
  border-color: var(--cyan);
}

.fighter-row input[type="color"] {
  width: 34px;
  height: 32px;
  padding: 2px;
  border: 1px solid rgba(113, 193, 237, 0.22);
  border-radius: 8px;
  background: #111f30;
}

.setup-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 0.72fr 0.9fr 1.35fr;
  gap: 9px;
}

.game-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid rgba(113, 193, 237, 0.24);
  border-radius: 11px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  transition: transform 0.17s ease, border-color 0.17s ease, background 0.17s ease;
}

.game-button:hover {
  transform: translateY(-2px);
}

.game-button.primary {
  border-color: #23d5fb;
  background: #23d5fb;
  color: #04121b;
}

.game-button.secondary {
  background: #142337;
  color: #dff8ff;
}

.game-button.secondary:hover {
  border-color: #23d5fb;
}

.game-button.accent {
  border-color: rgba(141, 98, 255, 0.55);
  background: rgba(141, 98, 255, 0.13);
  color: #d8caff;
}

.winner-overlay {
  background: rgba(3, 8, 14, 0.84);
}

.winner-panel {
  width: min(560px, 100%);
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(8, 189, 232, 0.28);
  border-radius: 22px;
  background: rgba(10, 19, 31, 0.97);
  color: #f0f9ff;
  text-align: center;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.winner-orb {
  width: 68px;
  height: 68px;
  margin: 12px auto;
  border: 4px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  background: var(--winner-color, #23d5fb);
  box-shadow: 0 0 32px color-mix(in srgb, var(--winner-color, #23d5fb) 75%, transparent);
}

.winner-panel h2 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
}

.winner-panel > p {
  margin-top: 7px;
  color: #91a7ba;
}

.winner-stats {
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.winner-stat {
  padding: 9px 5px;
  border: 1px solid rgba(113, 193, 237, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.winner-stat strong,
.winner-stat small {
  display: block;
}

.winner-stat strong {
  color: #effaff;
  font-size: 0.86rem;
}

.winner-stat small {
  margin-top: 2px;
  color: #758da0;
  font-size: 0.48rem;
  font-weight: 800;
  text-transform: uppercase;
}

.winner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 14, 0.55);
  color: #ffffff;
  font-size: clamp(2rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(3px);
}

.arena-caption {
  padding: 10px 14px;
  border-top: 1px solid rgba(113, 193, 237, 0.13);
  background: #0a1421;
  color: #758da1;
  font-size: 0.68rem;
  font-weight: 650;
  text-align: center;
}

.game-details {
  margin: 24px 0 66px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.game-details article {
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.game-details h2 {
  margin: 5px 0 8px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.game-details p {
  color: var(--muted);
  font-size: 0.88rem;
}

footer {
  padding: 38px 24px;
  border-top: 1px solid var(--line);
  background: #e7eef5;
  color: #718597;
  text-align: center;
  font-size: 0.82rem;
}

footer p + p {
  margin-top: 7px;
}

footer a {
  color: #009ed1;
  text-decoration: none;
}

body.dark-mode {
  color-scheme: dark;
  --page-bg: #071019;
  --surface: #0c1824;
  --surface-soft: #112333;
  --line: rgba(143, 203, 232, 0.16);
  --line-strong: rgba(143, 203, 232, 0.28);
  --text: #eff8fc;
  --muted: #9db0be;
  --shadow: 0 24px 75px rgba(0, 0, 0, 0.36);
}

body.dark-mode .site-header {
  background: rgba(3, 10, 16, 0.96);
  box-shadow: none;
}

body.dark-mode .game-details article {
  background: rgba(12, 24, 36, 0.82);
}

body.dark-mode footer {
  background: #050d14;
}

@media (max-width: 1240px) {
  .site-header {
    grid-template-columns: 220px 1fr auto;
    padding-inline: 26px;
  }

  nav ul {
    gap: 16px;
  }

  nav a {
    font-size: 0.82rem;
  }
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto auto;
    min-height: 82px;
    padding: 12px 18px;
  }

  .site-logo {
    width: 205px;
  }

  nav {
    order: 3;
  }

  nav ul {
    position: fixed;
    top: 82px;
    right: 12px;
    width: min(290px, calc(100% - 24px));
    padding: 16px;
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  nav.active ul {
    display: flex;
  }

  nav a {
    display: block;
    padding: 8px;
    color: var(--text);
  }

  .menu-toggle {
    display: block;
  }

  main {
    width: min(calc(100% - 20px), 760px);
    padding-top: 98px;
  }

  .game-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding-top: 24px;
  }

  .build-note {
    width: 100%;
    flex-basis: auto;
  }

  .game-toolbar {
    grid-template-columns: 1fr auto;
  }

  .battle-status {
    display: none;
  }

  .setup-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 10px;
  }

  .fighter-roster,
  .setup-actions {
    grid-column: 1;
  }

  .game-details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  main {
    width: 100%;
    padding-top: 82px;
  }

  .game-intro,
  .game-details {
    width: calc(100% - 24px);
    margin-right: auto;
    margin-left: auto;
  }

  .game-intro h1 {
    font-size: clamp(2.8rem, 16vw, 4.2rem);
  }

  .game-shell {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .game-toolbar {
    min-height: 52px;
    padding: 7px 8px;
  }

  .game-identity small,
  .game-identity strong,
  #soundButton {
    display: none;
  }

  .game-logo {
    width: 34px;
    height: 34px;
  }

  .toolbar-actions {
    min-width: 0;
    gap: 3px;
  }

  .speed-control {
    min-height: 32px;
    padding: 2px;
  }

  .speed-control-label {
    display: none;
  }

  .speed-button {
    min-width: 25px;
    height: 26px;
    padding: 0 3px;
    font-size: 0.51rem;
  }

  .toolbar-button {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 0.59rem;
  }

  .game-overlay {
    align-items: stretch;
    padding: 7px;
  }

  .setup-panel {
    align-self: center;
    padding: 12px;
    border-radius: 14px;
  }

  .setup-heading p {
    display: none;
  }

  .setup-heading h2 {
    font-size: 1.35rem;
  }

  .fighter-count-control {
    gap: 7px;
  }

  .fighter-roster {
    grid-template-columns: 1fr;
  }

  .fighter-row {
    grid-template-columns: 24px minmax(65px, 1fr) minmax(84px, 0.9fr) 31px;
    padding: 5px;
  }

  .fighter-number {
    width: 24px;
    height: 24px;
  }

  .fighter-row input[type="text"],
  .fighter-row select,
  .fighter-row input[type="color"] {
    height: 29px;
    font-size: 0.62rem;
  }

  .fighter-row input[type="color"] {
    width: 30px;
  }

  .setup-actions {
    gap: 5px;
  }

  .game-button {
    min-height: 34px;
    padding: 6px;
    font-size: 0.6rem;
  }

  .winner-panel {
    padding: 18px 12px;
  }

  .winner-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .arena-caption {
    display: none;
  }

  .game-details {
    margin-top: 18px;
    margin-bottom: 42px;
  }
}

@media (max-height: 720px) and (min-width: 901px) {
  .setup-panel {
    padding: 14px 18px;
    gap: 9px 16px;
  }

  .setup-heading p {
    display: none;
  }

  .fighter-row {
    padding: 5px;
  }

  .fighter-row input[type="text"],
  .fighter-row select,
  .fighter-row input[type="color"] {
    height: 29px;
  }

  .game-button {
    min-height: 36px;
  }
}

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