@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;800;900&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --bg: #0b1828;
  --panel: rgba(18, 34, 55, 0.82);
  --line: rgba(123, 224, 255, 0.42);
  --line-strong: rgba(166, 242, 255, 0.86);
  --txt: #f2fbff;
  --muted: #c6d9ed;
  --accent: #5ef2ff;
  --accent-2: #7dffb2;
  --accent-3: #73a7ff;
  --panel-edge: rgba(136, 232, 255, 0.22);
  --panel-deep: rgba(5, 10, 18, 0.94);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 18% 12%, rgba(120,180,255,0.28) 0%, transparent 24%), radial-gradient(circle at 82% 18%, rgba(126,246,255,0.22) 0%, transparent 28%), linear-gradient(180deg, #13253d 0%, #0b1727 55%, #07101a 100%);
  color: var(--txt);
  font-family: "Rajdhani", "Segoe UI", sans-serif;
}

#app {
  position: fixed;
  inset: 0;
  display: block;
}

.runtime-status {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.turn-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-weight: 800;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  background: #56f3af;
  color: #56f3af;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 0 14px currentColor;
}

.stats {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(16, 32, 61, 0.9);
  border: 1px solid rgba(144, 178, 255, 0.15);
}

.stat-row span {
  color: var(--muted);
  font-size: 13px;
}

.stat-row strong {
  font-size: 18px;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.bottom-game-actions {
  position: fixed;
  right: 225px;
  bottom: 14px;
  z-index: 2147481990;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bottom-game-actions button {
  min-height: 42px;
  border-radius: 999px;
  border-color: rgba(94, 242, 255, 0.36);
  background: rgba(10, 18, 32, 0.92);
  color: #eef4ff;
  padding: 0 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.hero-overlay:not(.hidden) ~ .bottom-game-actions,
.setup-overlay:not(.hidden) ~ .bottom-game-actions,
.loading-overlay:not(.hidden) ~ .bottom-game-actions {
  display: none;
}

button {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #10203d;
  color: #fff;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  border-color: #80a6ff;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 10px;
}

.setup-overlay.hidden {
  display: none;
}

.hero-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  padding: 18px;
}

.hero-overlay.hidden {
  display: none;
}

.hero-card {
  width: min(1280px, 96vw);
  min-height: min(640px, 90vh);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(28,50,79,0.92), rgba(14,28,46,0.97));
  padding: 30px;
  box-shadow: inset 0 0 0 2px rgba(132, 214, 255, 0.08), 0 26px 64px rgba(0, 0, 0, 0.56), 0 0 0 1px rgba(25, 58, 88, 0.65);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 18px;
  border: 1px solid rgba(123, 193, 255, 0.18);
  background: linear-gradient(180deg, rgba(62, 124, 255, 0.06), rgba(94, 242, 255, 0.03));
  pointer-events: none;
}

.hero-card img {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  display: block;
}

.hero-actions {
  display: flex;
  justify-content: center;
}

.hero-actions button {
  border: 1px solid rgba(130, 244, 255, 0.92);
  background: linear-gradient(180deg, #a9fdff 0%, #5ef2ff 48%, #4aa1ff 100%);
  color: #021423;
  padding: 18px 38px;
  font-size: 26px;
  font-weight: 900;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  min-width: 280px;
  box-shadow: 0 16px 0 rgba(8, 44, 71, 0.9), 0 26px 40px rgba(0, 0, 0, 0.38), 0 0 18px rgba(94,242,255,.28);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 7, 15, 0.82);
  padding: 18px;
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  width: min(840px, 96vw);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(144, 178, 255, 0.38);
  background: rgba(8, 15, 28, 0.97);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5);
}

.loading-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 20px;
  background: radial-gradient(circle at 20% 20%, rgba(80, 132, 245, 0.28), rgba(6, 12, 24, 0.98));
}

.loading-banner img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
}

.loading-body {
  padding: 22px 24px 26px;
}

.loading-body h2 {
  margin: 0 0 10px;
  font-size: 30px;
}

.loading-copy {
  margin: 0 0 16px;
  color: var(--muted);
}

.loading-progress-shell {
  height: 22px;
  border-radius: 999px;
  background: rgba(16, 32, 61, 0.95);
  border: 1px solid rgba(144, 178, 255, 0.16);
  overflow: hidden;
}

.loading-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #36e392 0%, #74ffbe 50%, #c2ffe6 100%);
  box-shadow: 0 0 18px rgba(84, 244, 166, 0.45);
  transition: width 140ms ease;
}

.loading-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.setup-card {
  width: min(1120px, 97vw);
  height: min(880px, 95vh);
  max-height: min(880px, 95vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(23,43,68,0.97), rgba(12,24,39,0.985));
  box-shadow: inset 0 0 0 2px rgba(130, 214, 255, 0.07), 0 28px 64px rgba(0,0,0,.58);
  position: relative;
}

.setup-card::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 18px;
  border: 1px solid rgba(124, 195, 255, 0.18);
  pointer-events: none;
}

.setup-right {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.setup-right-full {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.setup-right h2 {
  margin: 0;
  font-size: 34px;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #dff9ff;
  text-shadow: 0 0 18px rgba(94,242,255,.16);
}

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

.native-form {
  display: grid;
  align-content: start;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-width: auto;
  scrollbar-color: rgba(106, 240, 177, 0.92) rgba(10, 22, 42, 0.92);
}

.native-form::-webkit-scrollbar {
  width: 14px;
}

.native-form::-webkit-scrollbar-track {
  background: rgba(10, 22, 42, 0.92);
  border-radius: 999px;
  border: 1px solid rgba(144, 178, 255, 0.12);
}

.native-form::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6af0b1 0%, #2fbf7d 100%);
  border-radius: 999px;
  border: 2px solid rgba(10, 22, 42, 0.92);
  box-shadow: 0 0 12px rgba(84, 244, 166, 0.32);
}

.native-form::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #86ffd0 0%, #3cd78e 100%);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
}

.style-picker {
  display: grid;
  gap: 8px;
}

.players-picker {
  display: grid;
  gap: 8px;
}

.matrix3d-only {
  display: none;
}

.matrix2d-only {
  display: block;
}

.setup-card[data-render-mode="3d-webgl"] .matrix3d-only {
  display: block;
}

.native-form label.disabled-option {
  opacity: 0.52;
}

.native-form label.disabled-option select {
  cursor: not-allowed;
}

.setup-card[data-render-mode="3d-webgl"] .matrix2d-only {
  display: none;
}

.board-texture-only {
  display: none;
}

.setup-card[data-board-frame-nonclassic="1"] .board-texture-only {
  display: block;
}

.player-config-row .matrix3d-only {
  display: none;
}

.player-config-row[data-player-type="UMANO"] .player-human-only {
  display: block;
}

.player-config-row[data-player-type="UMANO"][data-render-mode="3d-webgl"] .matrix3d-only {
  display: block;
}

.player-config-row[data-player-type="AI"] .player-human-only {
  display: none;
}

.style-picker-title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.style-preview-panel {
  display: grid;
  gap: 10px;
  border-radius: 18px;
  border: 1px solid rgba(116, 211, 255, 0.28);
  background: linear-gradient(180deg, rgba(31, 58, 95, 0.96), rgba(15, 28, 46, 0.99));
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(112, 205, 255, 0.1), 0 10px 24px rgba(0,0,0,.24);
}

.style-preview-name {
  color: #dff8ff;
  font-size: 15px;
  font-weight: 900;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.style-preview-canvas {
  width: 100%;
  height: 144px;
  display: block;
  border-radius: 14px;
  background:
    radial-gradient(circle at 18% 22%, rgba(94, 242, 255, 0.18), transparent 42%),
    radial-gradient(circle at 82% 16%, rgba(125, 167, 255, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(22, 43, 70, 0.96), rgba(12, 23, 39, 0.995));
  border: 1px solid rgba(125, 206, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(127, 225, 255, 0.08);
}

.native-form label {
  display: block;
  color: #a7c0da;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
}

.native-form select,
.native-form input {
  width: 100%;
  margin-top: 6px;
  border-radius: 14px;
  border: 1px solid rgba(122, 213, 255, 0.28);
  background: linear-gradient(180deg, rgba(38,66,104,.96), rgba(18,36,59,.98));
  color: #f7fcff;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 0 0 1px rgba(18,49,88,.35);
}

.native-form select:focus,
.native-form input:focus {
  outline: none;
  border-color: rgba(126, 246, 255, 0.88);
  box-shadow: 0 0 0 2px rgba(94,242,255,.15), 0 0 20px rgba(94,242,255,.18);
}

.native-form select option,
.native-form select optgroup {
  background: #16304f;
  color: #f7fcff;
}

.native-form select option:checked,
.native-form select option:hover {
  background: #24507e;
  color: #ffffff;
}

#blockStyleSelect {
  font-size: 14px;
  line-height: 1.2;
}

.player-config-grid {
  display: grid;
  gap: 8px;
}

.player-config-row {
  display: grid;
  grid-template-columns: 52px 0.9fr 0.9fr 1.2fr 1.1fr 0.8fr 0.8fr;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(120, 204, 255, 0.18);
  background: linear-gradient(180deg, rgba(24, 45, 73, 0.82), rgba(15, 29, 48, 0.88));
  box-shadow: inset 0 0 0 1px rgba(110, 186, 255, 0.06);
}

.player-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(58, 102, 166, 0.96), rgba(25, 53, 92, 0.98));
  border: 1px solid rgba(116, 226, 255, 0.32);
  color: #effbff;
  font-weight: 900;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  letter-spacing: .08em;
  box-shadow: 0 0 18px rgba(94,242,255,.12);
}

.setup-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.setup-actions button {
  border: 1px solid rgba(130, 244, 255, 0.92);
  background: linear-gradient(180deg, #b3ffff 0%, #67f1ff 44%, #4a97ff 100%);
  color: #051628;
  padding: 16px 30px;
  font-size: 21px;
  font-weight: 900;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  min-width: 250px;
  box-shadow: 0 14px 0 rgba(8, 41, 73, 0.92), 0 24px 34px rgba(0, 0, 0, 0.34), 0 0 18px rgba(94,242,255,.24);
}

.setup-actions button:hover {
  border-color: #d7ffff;
  filter: brightness(1.04);
  transform: translateY(-1px);
}

@media (max-width: 980px) {
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .player-config-row {
    grid-template-columns: 52px 1fr 1fr 1fr;
  }

  .player-config-row label:nth-last-child(-n + 3) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .settings-grid,
  .player-config-row {
    grid-template-columns: 1fr;
  }

  .player-slot {
    min-height: 38px;
  }

  .bottom-game-actions {
    right: 172px;
    bottom: 10px;
  }

  .bottom-game-actions button {
    min-height: 42px;
    padding: 0 12px;
  }
}


.style-picker-title,
.players-picker > .style-picker-title {
  color: #dff9ff;
  font-size: 16px;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.menu-check {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(122, 213, 255, 0.2);
  background: linear-gradient(180deg, rgba(18,35,61,.9), rgba(10,21,39,.95));
}

.menu-check input[type=checkbox] {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: #5ef2ff;
}

.setup-actions-top {
  justify-content: flex-end;
}

.loading-card,
.loading-body,
.loading-progress-shell,
.loading-meta {
  font-family: "Rajdhani", "Segoe UI", sans-serif;
}
