:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #181c20;
  --panel-2: #20262b;
  --line: #303941;
  --text: #f3f6f8;
  --muted: #9aa7b2;
  --cyan: #4cc9f0;
  --yellow: #f7b84b;
  --red: #ff6573;
  --green: #65d46e;
  --purple: #b392f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior: none;
}

body {
  min-width: 320px;
  min-height: 100svh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #252c32;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover {
  border-color: #52616d;
  background: #2c353d;
}

button:active {
  transform: translateY(1px);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  min-height: 100svh;
}

.arena-shell {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-width: 0;
  background: #101417;
}

@media (max-width: 560px) {
  .arena-shell {
    background: #101417;
  }
}

.topbar,
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 14px 18px;
  border-color: var(--line);
  background: rgba(16, 20, 23, 0.92);
  flex-wrap: nowrap;
}

.statusbar {
  justify-content: flex-start;
}

@supports (backdrop-filter: blur(10px)) {
  @media (min-width: 1024px) {
    .topbar,
    .statusbar {
      backdrop-filter: blur(10px);
    }
  }
}

.topbar {
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(25, 32, 37, 0.96), rgba(13, 17, 20, 0.92));
}

.statusbar {
  border-top: 1px solid var(--line);
}

.brand,
.match-strip,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  flex: 1 1 180px;
  font-weight: 750;
  overflow: hidden;
}

.home-button {
  justify-content: flex-start;
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.home-button:hover {
  background: transparent;
}

.home-button:focus-visible {
  outline: 2px solid rgba(76, 201, 240, 0.7);
  outline-offset: 5px;
}

.brand > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand strong {
  min-width: 0;
  overflow: hidden;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.brand-mark {
  width: 18px;
  height: 18px;
  background: conic-gradient(from 30deg, var(--cyan), var(--yellow), var(--green), var(--cyan));
  clip-path: polygon(50% 0, 94% 25%, 94% 75%, 50% 100%, 6% 75%, 6% 25%);
}

.brand-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  height: 18px;
  border-radius: 999px;
  padding: 2px 8px;
  background: linear-gradient(135deg, var(--yellow), #ff9500);
  color: white;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.beta-badge-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  height: 22px;
  border-radius: 999px;
  padding: 3px 10px;
  background: linear-gradient(135deg, var(--yellow), #ff9500);
  color: white;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}

.version-info {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 16px;
}

.match-strip {
  justify-content: center;
  flex: 1 1 330px;
  max-width: 520px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .topbar {
    flex-wrap: wrap;
  }

  .brand {
    flex: 1 1 160px;
  }

  .match-strip {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .actions {
    flex: 0 0 auto;
  }
}

.status-pill {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
}

.phase-badge {
  min-width: 108px;
  border: 1px solid #3d4b55;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--cyan);
  text-align: center;
  font-weight: 700;
}

.phase-badge.waiting {
  border-color: rgba(76, 201, 240, 0.55);
  color: var(--cyan);
  background: rgba(76, 201, 240, 0.08);
}

.phase-badge.input {
  border-color: rgba(247, 184, 75, 0.58);
  color: var(--yellow);
  background: rgba(247, 184, 75, 0.09);
}

.phase-badge.execute,
.phase-badge.action {
  border-color: rgba(255, 101, 115, 0.62);
  color: var(--red);
  background: rgba(255, 101, 115, 0.1);
}

.phase-badge.resolve,
.phase-badge.result {
  border-color: rgba(179, 146, 240, 0.62);
  color: var(--purple);
  background: rgba(179, 146, 240, 0.1);
}

.phase-badge.urgent {
  border-color: rgba(255, 101, 115, 0.76);
  color: var(--red);
  background: rgba(255, 101, 115, 0.14);
}

.timer-label {
  min-width: 118px;
  color: var(--text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-label.waiting {
  color: var(--cyan);
}

.timer-label.input {
  color: var(--yellow);
}

.timer-label.execute {
  color: var(--red);
}

.timer-label.resolve,
.timer-label.result {
  color: var(--purple);
}

.timer-label.urgent {
  color: var(--red);
}

.actions {
  justify-content: flex-end;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.035);
}

.actions button,
.menu-grid button {
  font-size: 13px;
}

.actions button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

#accountButton,
#settingsButton {
  color: var(--text);
}

#topLogoutButton {
  border: 1px solid #dc2626;
  background: #252c32;
  color: #fff;
}

#topLogoutButton:hover {
  border-color: #ef4444;
  background: #2c353d;
  color: #fff;
}

.playfield {
  position: relative;
  isolation: isolate;
  min-height: 0;
  overflow: hidden;
}

#gameCanvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 0;
}

.countdown-badge {
  position: absolute;
  left: 50%;
  top: 18px;
  display: grid;
  min-width: 148px;
  border: 1px solid rgba(247, 184, 75, 0.5);
  border-radius: 8px;
  padding: 8px 14px 10px;
  background: rgba(12, 16, 18, 0.88);
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.countdown-badge[hidden] {
  display: none;
}

.countdown-badge span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.countdown-badge strong {
  color: var(--yellow);
  font-size: 32px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.countdown-badge.waiting {
  border-color: rgba(76, 201, 240, 0.52);
}

.countdown-badge.waiting strong {
  color: var(--cyan);
}

.countdown-badge.input {
  border-color: rgba(247, 184, 75, 0.5);
}

.countdown-badge.input strong {
  color: var(--yellow);
}

.countdown-badge.execute {
  border-color: rgba(255, 101, 115, 0.55);
}

.countdown-badge.execute strong {
  color: var(--red);
}

.countdown-badge.resolve,
.countdown-badge.result {
  border-color: rgba(179, 146, 240, 0.56);
}

.countdown-badge.resolve strong,
.countdown-badge.result strong {
  color: var(--purple);
}

.countdown-badge.urgent {
  border-color: rgba(255, 101, 115, 0.7);
  background: rgba(28, 11, 14, 0.9);
}

.countdown-badge.urgent strong,
.countdown-badge.urgent span {
  color: var(--red);
}

.match-ranking {
  position: static;
  width: 100%;
  min-height: 230px;
  max-height: 340px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(12, 16, 18, 0.84);
  pointer-events: none;
  overflow: hidden;
}

.match-ranking[hidden] {
  display: none;
}

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ranking-header strong {
  color: var(--yellow);
  font-size: 12px;
}

.ranking-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}

.ranking-row {
  display: grid;
  grid-template-columns: 28px 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: 12px;
}

.ranking-row.local {
  border-color: rgba(76, 201, 240, 0.45);
  background: rgba(76, 201, 240, 0.1);
}

.ranking-row.out {
  color: var(--muted);
  opacity: 0.68;
}

.ranking-place,
.ranking-state {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.ranking-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.ranking-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-state {
  color: var(--green);
  font-size: 11px;
}

.ranking-row.out .ranking-state {
  color: var(--red);
}

.spectator-banner {
  position: absolute;
  left: 50%;
  top: 82px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: min(520px, calc(100% - 36px));
  border: 1px solid rgba(255, 101, 115, 0.42);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(18, 10, 12, 0.82);
  color: var(--text);
  transform: translateX(-50%);
  pointer-events: auto;
}

.spectator-banner[hidden] {
  display: none;
}

.spectator-banner strong {
  color: var(--red);
  font-size: 15px;
  font-weight: 900;
}

.spectator-banner span {
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 13px;
}

.spectator-banner button {
  min-height: 30px;
  border: 1px solid rgba(179, 146, 240, 0.58);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(179, 146, 240, 0.14);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.spectator-banner button:hover {
  border-color: rgba(179, 146, 240, 0.86);
  background: rgba(179, 146, 240, 0.22);
}

.spectator-banner button[hidden] {
  display: none;
}

.auto-fire-toast {
  position: absolute;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  border: 1px solid rgba(247, 184, 75, 0.5);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(18, 16, 10, 0.86);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  z-index: 3;
}

.auto-fire-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.auto-fire-toast[hidden] {
  display: none;
}

.start-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 11, 13, 0.68);
  backdrop-filter: blur(8px);
  z-index: 10;
  min-height: 100%;
}

.start-overlay[hidden] {
  display: none;
}

.start-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(640px, 100%);
  max-height: min(92vh, 780px);
  overflow: auto;
  border: 1px solid #3d4b55;
  border-radius: 8px;
  padding: 28px 22px;
  background: #151a1e;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
}

.start-panel h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
}

.start-panel p {
  margin: 0 0 4px;
  color: var(--muted);
}

.primary-action,
.start-panel .primary-action {
  min-width: 160px;
  border-color: rgba(247, 184, 75, 0.58);
  background: #353027;
  color: var(--yellow);
  font-weight: 800;
}

.danger-action {
  border-color: rgba(255, 101, 115, 0.58);
  background: rgba(255, 101, 115, 0.12);
  color: var(--red);
  font-weight: 900;
}

.danger-action:hover {
  border-color: rgba(255, 101, 115, 0.78);
  background: rgba(255, 101, 115, 0.22);
  color: #ff8b95;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.menu-field {
  display: grid;
  gap: 7px;
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.menu-field input,
.menu-field select,
.menu-field button {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #11161a;
  color: var(--text);
  font: inherit;
}

.menu-field.inline-check {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.menu-field.inline-check input {
  width: 22px;
  min-height: 22px;
}

.start-ad-slot {
  display: grid;
  place-items: center;
  width: 100%;
  border: 1px dashed #53616b;
  border-radius: 8px;
  padding: 12px;
  background: #10161a;
  color: var(--muted);
  text-align: center;
}

.start-ad-slot.wide {
  min-height: 90px;
}

.start-ad-slot.compact {
  min-height: 86px;
}

.start-ad-slot span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
}

.start-ad-slot strong {
  color: var(--text);
  font-size: 18px;
}

.start-ad-slot p {
  margin: 0;
  font-size: 12px;
}

.online-panel {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.online-heading,
.online-actions,
.online-fields {
  display: grid;
  gap: 10px;
}

.online-section {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.online-section > strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.room-control-section {
  border-color: rgba(76, 201, 240, 0.22);
  background: rgba(76, 201, 240, 0.055);
}

.online-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.online-heading strong {
  color: var(--text);
  font-size: 14px;
}

.online-heading span {
  max-width: 240px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.online-actions,
.online-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width-actions {
  grid-template-columns: 1fr;
}

.full-width {
  width: 100%;
}

.full-width-actions {
  grid-template-columns: 1fr !important;
}

.full-width {
  width: 100%;
}

.private-room-guide {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.private-room-guide li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid rgba(76, 201, 240, 0.18);
  border-radius: 6px;
  padding: 6px 8px;
  background: rgba(76, 201, 240, 0.055);
}

.private-room-guide span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(76, 201, 240, 0.16);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.private-room-guide p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

#createPrivateRoomButton,
#startOnlineMatchButton {
  border-color: rgba(76, 201, 240, 0.35);
}

#createPrivateRoomButton {
  background: rgba(76, 201, 240, 0.1);
  color: var(--cyan);
  font-weight: 900;
}

.password-field input {
  background: rgba(255, 101, 115, 0.1);
  border-color: rgba(255, 101, 115, 0.4);
  transition: background-color 150ms ease, border-color 150ms ease;
  will-change: background-color, border-color;
}

.password-field input:focus {
  background: rgba(255, 101, 115, 0.15);
  border-color: rgba(255, 101, 115, 0.6);
  box-shadow: 0 0 12px rgba(255, 101, 115, 0.25);
}

#startOnlineMatchButton:not(:disabled) {
  background: #20343d;
  color: var(--cyan);
  font-weight: 900;
}

.room-code-display {
  border: 1px solid rgba(247, 184, 75, 0.45);
  border-radius: 6px;
  padding: 9px 10px;
  background: rgba(247, 184, 75, 0.08);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.06em;
}

.room-code-display[hidden] {
  display: none;
}

.room-progress-notice {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(247, 184, 75, 0.45);
  border-radius: 6px;
  padding: 9px 10px;
  background: rgba(247, 184, 75, 0.08);
}

.room-progress-notice[hidden] {
  display: none;
}

.room-progress-notice strong {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.room-progress-notice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.room-player-list {
  display: grid;
  gap: 6px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.room-player-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.room-player-list li.has-actions {
  grid-template-columns: 10px minmax(0, 1fr) auto minmax(0, auto);
}

.room-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.room-player-list span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-player-list strong {
  color: var(--yellow);
  font-size: 11px;
}

.room-member-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.room-member-actions button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.room-member-actions button.danger {
  border-color: rgba(255, 101, 115, 0.48);
  background: rgba(255, 101, 115, 0.12);
  color: var(--red);
}

.result-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  overflow: auto;
  padding: 16px;
  background: rgba(9, 12, 14, 0.68);
  text-align: center;
  z-index: 12;
}

.result-overlay[hidden] {
  display: none;
}

.result-overlay strong {
  font-size: 34px;
  letter-spacing: 0;
}

.result-overlay p {
  max-width: 320px;
  margin: -6px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-ranking-list {
  width: min(420px, calc(100vw - 40px));
  max-height: 238px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(12, 16, 18, 0.9);
  text-align: left;
}

@media (max-height: 720px), (max-width: 640px) {
  .result-overlay {
    gap: 10px;
    place-content: center;
  }

  .result-overlay strong {
    font-size: 26px;
  }

  .result-overlay p {
    margin-top: -2px;
  }

  .result-ranking-list {
    max-height: min(168px, 32dvh);
  }
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(8, 11, 13, 0.76);
  z-index: 30;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
}

@supports (backdrop-filter: blur(8px)) {
  @media (min-width: 1024px) {
    .tutorial-overlay {
      backdrop-filter: blur(8px);
    }
  }
}

.tutorial-overlay[hidden] {
  display: none;
}

.tutorial-panel {
  width: min(720px, 100%);
  max-height: min(86vh, 760px);
  max-height: min(86dvh, 760px);
  overflow: auto;
  border: 1px solid #3d4b55;
  border-radius: 8px;
  padding: 22px;
  background: #151a1e;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 18px;
  align-content: start;
}

.tutorial-panel > * {
  margin: 0;
}

.compact-panel {
  width: min(480px, 100%);
  gap: 24px;
}

.practice-pad {
  position: relative;
  height: 210px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    #10161a;
  background-size: 32px 32px;
  cursor: crosshair;
  touch-action: none;
}

.practice-map {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 150px;
  border: 2px solid rgba(243, 246, 248, 0.5);
  transform: translate(-50%, -50%) rotate(30deg);
  clip-path: polygon(50% 0, 94% 25%, 94% 75%, 50% 100%, 6% 75%, 6% 25%);
}

.practice-player {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  border: 3px solid white;
  border-radius: 999px;
  background: var(--cyan);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 18px rgba(76, 201, 240, 0.5);
  transition: transform 520ms cubic-bezier(0.2, 0.88, 0.22, 1.1), box-shadow 180ms ease;
  z-index: 2;
}

.practice-player.shooting {
  box-shadow: 0 0 26px rgba(76, 201, 240, 0.78), 0 0 42px rgba(247, 184, 75, 0.38);
}

.practice-trail {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(247, 184, 75, 0.2);
  opacity: 0;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
}

.practice-trail.burst {
  animation: practiceBurst 520ms ease-out;
}

@keyframes practiceBurst {
  0% {
    opacity: 0.52;
    transform: translate(-50%, -50%) scale(0.8);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(6.2);
  }
}

.practice-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80px;
  height: 4px;
  border-radius: 999px;
  background: var(--yellow);
  transform-origin: left center;
  transform: rotate(-90deg) scaleX(0.6);
}

.practice-arrow::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 12px solid var(--yellow);
  transform: translateY(-50%);
}

.practice-readout {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.practice-meter {
  position: absolute;
  right: 12px;
  bottom: 16px;
  width: 170px;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #273038;
}

.practice-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--yellow), var(--red));
}

.practice-fire-button {
  position: absolute;
  right: 12px;
  bottom: 34px;
  min-height: 32px;
  border-color: rgba(247, 184, 75, 0.55);
  background: #352f25;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  z-index: 3;
  pointer-events: auto;
}

.account-stack {
  display: grid;
  gap: 12px;
}

.account-section {
  display: grid;
  gap: 8px;
}

.account-section[hidden] {
  display: none;
}

.google-auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 900;
}

.google-auth-button::before {
  content: "G";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-size: 14px;
  font-weight: 900;
  font-family: Arial, sans-serif;
}

.google-auth-button.google-logout-button::before {
  color: var(--red);
}

.server-wait-panel,
.onboarding-panel {
  position: relative;
  text-align: left;
}

.onboarding-header-title {
  display: block;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.server-wait-spinner {
  width: 42px;
  height: 42px;
  margin: 2px auto;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: server-spin 900ms linear infinite;
}

.server-wait-spinner[hidden] {
  display: none;
}

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

.language-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.onboarding-step {
  display: grid;
  gap: 12px;
  padding-top: 34px;
}

.onboarding-step[hidden] {
  display: none;
}

.onboarding-step-label {
  width: fit-content;
  border: 1px solid rgba(76, 201, 240, 0.36);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

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

.onboarding-bottom-actions {
  margin-top: 8px;
}

.onboarding-skip-button {
  position: absolute;
  right: 16px;
  top: 16px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.onboarding-skip-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.13);
  color: var(--text);
}

.onboarding-practice {
  display: grid;
  gap: 10px;
}

.onboarding-practice[hidden] {
  display: none;
}

.onboarding-practice-world {
  position: relative;
  min-height: 190px;
  border: 1px solid rgba(76, 201, 240, 0.25);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(76, 201, 240, 0.08), transparent 58%),
    #10161a;
  cursor: crosshair;
  touch-action: none;
}

.mini-hex {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 50px;
  border: 1px solid rgba(243, 246, 248, 0.28);
  background: rgba(76, 201, 240, 0.12);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  transform: translate(-50%, -50%);
}

.mini-hex-center {
  background: rgba(247, 184, 75, 0.13);
}

.mini-hex-top {
  transform: translate(-50%, -50%) translateY(-44px);
}

.mini-hex-right-top {
  transform: translate(-50%, -50%) translate(39px, -22px);
}

.mini-hex-right-bottom {
  transform: translate(-50%, -50%) translate(39px, 22px);
}

.mini-hex-bottom {
  transform: translate(-50%, -50%) translateY(44px);
}

.mini-hex-left-bottom {
  transform: translate(-50%, -50%) translate(-39px, 22px);
}

.mini-hex-left-top {
  transform: translate(-50%, -50%) translate(-39px, -22px);
}

.onboarding-practice-player {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--cyan);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 16px rgba(76, 201, 240, 0.48);
  transition: transform 460ms cubic-bezier(0.2, 0.88, 0.22, 1), box-shadow 160ms ease;
  z-index: 3;
}

.onboarding-practice-player.shooting {
  box-shadow: 0 0 24px rgba(76, 201, 240, 0.76), 0 0 34px rgba(247, 184, 75, 0.32);
}

.onboarding-practice-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--yellow), transparent);
  transform-origin: 0 50%;
  transform: rotate(-1.5708rad) scaleX(0.7);
  z-index: 2;
}

.onboarding-practice-trail {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(247, 184, 75, 0.22);
  opacity: 0;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  z-index: 1;
}

.onboarding-practice-trail.burst {
  animation: practiceBurst 480ms ease-out;
}

.onboarding-practice-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.onboarding-practice-meter span {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.onboarding-practice-meter button {
  min-height: 32px;
  padding: 0 12px;
  white-space: nowrap;
}

.onboarding-map-demo {
  display: grid;
  min-height: 186px;
  border: 1px solid rgba(247, 184, 75, 0.22);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 48%, rgba(247, 184, 75, 0.08), transparent 62%), #10161a;
  overflow: hidden;
  place-items: center;
}

.onboarding-map-demo[hidden] {
  display: none;
}

.onboarding-map-demo-grid {
  position: relative;
  width: 230px;
  height: 154px;
}

.map-demo-hex {
  position: absolute;
  width: 48px;
  height: 42px;
  border: 1px solid rgba(243, 246, 248, 0.28);
  background: rgba(76, 201, 240, 0.13);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  opacity: 1;
  transform: scale(1);
  animation: mapDemoFade 5.2s ease-in-out infinite;
}

.map-demo-hex::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(247, 184, 75, 0.24);
  opacity: 0;
  transform: rotate(12deg);
  animation: mapDemoCrack 5.2s ease-in-out infinite;
}

.map-demo-hex-1 { left: 91px; top: 0; animation-delay: 0s; }
.map-demo-hex-2 { left: 52px; top: 22px; animation-delay: 1.4s; }
.map-demo-hex-3 { left: 130px; top: 22px; animation-delay: 3.1s; }
.map-demo-hex-4 { left: 13px; top: 44px; animation-delay: 2.2s; }
.map-demo-hex-5 { left: 91px; top: 44px; animation-delay: 0s; background: rgba(247, 184, 75, 0.14); }
.map-demo-hex-6 { left: 169px; top: 44px; animation-delay: 1.8s; }
.map-demo-hex-7 { left: 52px; top: 66px; animation-delay: 2.8s; }
.map-demo-hex-8 { left: 130px; top: 66px; animation-delay: 0.7s; }
.map-demo-hex-9 { left: 91px; top: 88px; animation-delay: 3.7s; }
.map-demo-hex-10 { left: 169px; top: 88px; animation-delay: 4.2s; }

@keyframes mapDemoFade {
  0%, 42%, 100% {
    opacity: 1;
    transform: scale(1);
  }

  56%, 78% {
    opacity: 0.2;
    transform: scale(0.82);
  }
}

@keyframes mapDemoCrack {
  0%, 24%, 100% {
    opacity: 0;
  }

  34%, 48% {
    opacity: 1;
  }
}

.settings-danger-zone {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(255, 101, 115, 0.24);
  padding-top: 14px;
}

.reset-profile-button {
  width: 100%;
}

.muted-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.profile-summary {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
}

.profile-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.profile-summary div + div {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 8px;
}

.profile-summary span {
  color: var(--muted);
}

.profile-summary strong {
  color: var(--text);
}

.tutorial-panel h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.tutorial-panel ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tutorial-panel li {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-2);
}

.tutorial-panel strong {
  color: var(--yellow);
}

.tutorial-panel span {
  color: var(--text);
  line-height: 1.45;
}

.tutorial-panel .profile-summary span {
  color: var(--muted);
}

.tutorial-panel .profile-summary strong {
  color: var(--text);
}

.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(360px, 58vw);
  flex: 1 1 auto;
  max-width: 60%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meter-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #273038;
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--yellow), var(--red));
}

.aim-stats {
  min-width: 172px;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.input-label {
  min-width: 120px;
  color: var(--muted);
  text-align: right;
  font-size: 13px;
}

.ad-panel {
  display: grid;
  grid-auto-rows: auto;
  gap: 12px;
  min-height: 100svh;
  max-height: 100svh;
  border-left: 1px solid var(--line);
  padding: 18px;
  background: var(--panel);
  overflow-y: auto;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 0;
  border: 1px dashed #53616b;
  border-radius: 8px;
  padding: 18px;
  background: #12171b;
  color: var(--muted);
  text-align: center;
}

.ad-slot span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--yellow);
  font-weight: 900;
}

.ad-slot strong {
  color: var(--text);
  font-size: 24px;
}

.ad-slot p {
  margin: 0;
}

.side-primary-ad {
  min-height: 360px;
}

.side-tall-ad {
  min-height: 420px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .arena-shell {
    min-height: 100svh;
  }

  .ad-panel {
    min-height: 0;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .ad-panel .match-ranking {
    min-height: 0;
    max-height: none;
  }

  .ad-slot {
    min-height: 160px;
  }

  .topbar,
  .statusbar {
    flex-wrap: wrap;
  }

  .match-strip {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .actions {
    flex: 0 0 auto;
  }

  .countdown-badge {
    top: 52px;
  }

  .spectator-banner {
    left: 12px;
    right: 12px;
    top: 104px;
    max-width: none;
    transform: none;
  }

  .auto-fire-toast {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 560px) {
  .arena-shell {
    grid-template-rows: auto minmax(360px, 58svh) auto;
    grid-template-rows: auto minmax(360px, 58dvh) auto;
    background-image: none;
    background-color: #101417;
  }

  .start-overlay {
    align-items: start;
    justify-items: center;
    padding: 8px;
    overflow: auto;
  }

  .start-panel {
    gap: 8px;
    width: 100%;
    max-height: none;
    padding: 14px 12px;
  }

  .language-choice-grid,
  .onboarding-actions {
    grid-template-columns: 1fr;
  }

  .onboarding-panel {
    gap: 16px;
    padding: 18px 12px;
  }

  .onboarding-header-title {
    padding-right: 118px;
  }

  .onboarding-step {
    padding-top: 38px;
  }

  .onboarding-skip-button {
    right: 12px;
    top: 12px;
    max-width: calc(100% - 24px);
  }

  .onboarding-practice-world {
    min-height: 168px;
  }

  .onboarding-practice-meter {
    grid-template-columns: 1fr;
  }

  .onboarding-map-demo {
    min-height: 160px;
  }

  .onboarding-map-demo-grid {
    transform: scale(0.82);
  }

  .start-panel h1 {
    font-size: 24px;
  }

  .start-panel p {
    font-size: 12px;
    text-align: center;
  }

  .menu-field {
    gap: 5px;
    font-size: 11px;
  }

  .menu-field input,
  .menu-field select,
  .menu-field button {
    min-height: 34px;
    will-change: auto;
  }

  .topbar,
  .statusbar {
    backdrop-filter: none !important;
  }

  .tutorial-overlay {
    backdrop-filter: none !important;
    align-items: start;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .tutorial-panel {
    width: min(100%, 480px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    padding: 16px 14px;
    gap: 14px;
  }

  .compact-panel {
    gap: 14px;
  }

  .start-ad-slot {
    padding: 8px;
  }

  .start-ad-slot.wide,
  .start-ad-slot.compact {
    min-height: 58px;
  }

  .start-ad-slot strong {
    font-size: 14px;
  }

  .start-ad-slot p {
    font-size: 11px;
  }

  .online-panel {
    gap: 8px;
    padding: 10px;
  }

  .private-room-guide {
    gap: 5px;
  }

  .private-room-guide li {
    min-height: 28px;
    padding: 5px 7px;
  }

  .private-room-guide p {
    font-size: 11px;
  }

  .topbar,
  .statusbar {
    gap: 8px;
    padding: 10px 12px;
  }

  .brand {
    flex-basis: 136px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small {
    font-size: 10px;
  }

  .beta-badge {
    height: 16px;
    padding: 1px 6px;
    font-size: 8px;
    gap: 4px;
  }

  .beta-badge-title {
    height: 18px;
    padding: 2px 8px;
    font-size: 10px;
  }

  .match-strip {
    gap: 6px;
    padding: 5px;
    font-size: 12px;
  }

  .phase-badge {
    min-width: 86px;
    padding: 4px 8px;
  }

  .timer-label {
    min-width: 96px;
  }

  .status-pill {
    padding: 4px 7px;
  }

  .actions {
    gap: 2px;
    padding: 3px;
  }

  .actions button {
    min-height: 28px;
    padding: 0 9px;
    font-size: 11px;
  }

  button {
    padding: 0 10px;
  }

  .tutorial-panel li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

  .online-heading,
  .online-actions,
  .online-fields {
    grid-template-columns: 1fr;
  }

  .room-player-list li,
  .room-player-list li.has-actions {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .room-player-list strong,
  .room-member-actions {
    grid-column: 2;
  }

  .room-member-actions {
    justify-content: stretch;
  }

  .room-member-actions button {
    flex: 1 1 auto;
  }

  .online-heading span {
    max-width: none;
    text-align: left;
  }

  .practice-meter {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .aim-stats,
  .input-label {
    min-width: 0;
    text-align: left;
    font-size: 12px;
  }

  .meter {
    min-width: min(220px, 100%);
    flex: 1 1 100%;
  }

  .version-info {
    display: none;
  }

  .ad-panel {
    display: none;
  }
}

@media (max-width: 380px) {
  .arena-shell {
    grid-template-rows: auto minmax(340px, 54svh) auto;
  }

  .match-strip {
    font-size: 11px;
  }

  .timer-label {
    min-width: 88px;
  }
}
