:root {
  --bg: #0b0b0b;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.18);
  --surface-soft: rgba(255, 255, 255, 0.05);
  --surface-active: rgba(255, 255, 255, 0.14);
  --surface-input: rgba(255, 255, 255, 0.12);
  --text: #f7f7f7;
  --muted: #e11d2e;
  --accent: #f7f7f7;
  --accent-contrast: #0b0b0b;
  --accent-strong: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.2);
  --board-light: #f0f0f0;
  --board-dark: #0f0f0f;
  --board-outline: rgba(255, 255, 255, 0.3);
  --board-outline-strong: rgba(255, 255, 255, 0.45);
  --piece-light: #ffffff;
  --focus: #e11d2e;
  --border: rgba(255, 255, 255, 0.18);
  --border-strong: rgba(255, 255, 255, 0.28);
  --piece-dark: #2b2b2b;
  --shadow: rgba(0, 0, 0, 0.6);
  --shadow-strong: rgba(0, 0, 0, 0.8);
  --toast-bg: rgba(10, 10, 10, 0.9);
  --check: #e11d2e;
  --bg-glow-1: rgba(255, 255, 255, 0.05);
  --bg-glow-2: rgba(225, 29, 46, 0.12);
  --bg-glow-3: rgba(9, 9, 9, 0.95);
  --bg-glow-4: rgba(0, 0, 0, 0.9);
  --glow-red: 226, 46, 68;
  --glow-orange: 255, 143, 64;
  --glow-purple: 154, 99, 255;
  --panel-bg: rgba(18, 18, 18, 0.85);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  scrollbar-color: var(--focus) rgba(0, 0, 0, 0.25);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: var(--focus);
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.35);
}

.bg-layer {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(circle at 80% 20%, var(--bg-glow-2), transparent 55%),
    linear-gradient(120deg, var(--bg-glow-3), var(--bg-glow-4));
  pointer-events: none;
  z-index: -1;
}

#app {
  padding: 32px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 6;
}

.brand-link {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  gap: 8px;
  box-shadow:
    0 0 12px var(--logo-halo-strong, rgba(225, 29, 46, 0.35)),
    0 0 22px var(--logo-halo-soft, rgba(255, 255, 255, 0.2));
}

.brand-link:hover {
  transform: translateY(-1px);
}

.brand-logo {
  height: 18px;
  width: auto;
  display: block;
  filter:
    brightness(0) invert(1)
    drop-shadow(0 0 6px var(--logo-glow-strong, rgba(225, 29, 46, 0.55)))
    drop-shadow(0 0 12px var(--logo-glow-soft, rgba(255, 255, 255, 0.35)));
}

.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  position: fixed;
  left: 24px;
  bottom: 24px;
  right: auto;
  top: auto;
  z-index: 7;
}

.home-mode .top-actions {
  left: 24px;
  bottom: 24px;
  right: auto;
  top: auto;
}

#homeView {
  width: min(100%, 480px);
  margin: 0 auto;
}

#settingsPanel {
  position: fixed;
  top: auto;
  right: auto;
  bottom: 72px;
  left: 24px;
  width: min(90vw, 360px);
  z-index: 8;
  box-shadow: 0 18px 40px var(--shadow-strong);
}

.home-mode #settingsPanel {
  right: auto;
  left: 24px;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
}

.icon {
  width: 16px;
  height: 16px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeUp 0.6s ease both;
}

.hidden {
  display: none !important;
}

.view-header h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 36px);
}

.view-header {
  text-align: center;
}

.view-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.block-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
  width: 100%;
}

.ai-model {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  justify-content: center;
}

.auto-flip-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.auto-flip-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.switch-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  width: 42px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s ease;
  box-shadow: inset 0 0 0 1px var(--border);
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--accent-strong);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.switch-input:checked + .switch-slider {
  background: var(--focus);
}

.switch-input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.ai-model-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.ai-model-buttons {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.ai-model-button {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.ai-model-button.active {
  border-color: var(--accent);
  background: var(--surface-active);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.select {
  min-width: 140px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
  font-family: "Space Grotesk", sans-serif;
  outline: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 14px,
    calc(100% - 12px) 14px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.mode-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 8px 12px;
  justify-content: center;
}

.mode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 12px;
  background: var(--surface);
  backdrop-filter: blur(6px);
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  width: max-content;
}

.mode-card {
  width: 36px;
  height: 30px;
  padding: 0;
}

.mode-card .mode-icon {
  width: 16px;
  height: 16px;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px var(--shadow);
}

.card.active {
  border-color: var(--accent);
  box-shadow: 0 10px 26px var(--shadow-strong);
}

.card-title {
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
}

.card-desc {
  color: var(--muted);
  font-size: 11px;
}

.mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.info-wrap {
  position: relative;
}

.info-button {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: grid;
  place-items: center;
}

.info-button .icon {
  width: 11px;
  height: 11px;
}

.info-tip {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: rgba(10, 10, 12, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f7f7f7;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  min-width: 220px;
  max-width: 320px;
  display: grid;
  gap: 6px;
  text-align: left;
  box-shadow: 0 10px 20px var(--shadow);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.info-wrap:hover .info-tip {
  opacity: 1;
  transform: translateY(0);
}

.info-line {
  display: block;
}

.info-line strong {
  font-weight: 600;
  color: var(--text);
}

button,
input {
  font-family: "Space Grotesk", sans-serif;
}

button {
  border: 1px solid var(--border-strong);
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  font-weight: 600;
}

.primary:hover {
  background: var(--accent-strong);
}

.ghost {
  background: var(--surface-soft);
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1;
  height: 28px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.pill .icon {
  width: 13px;
  height: 13px;
}

.pill.active {
  border-color: var(--accent);
  background: var(--surface-active);
}

.pill.glow-red {
  box-shadow:
    0 0 12px rgba(var(--glow-red), 0.35),
    0 0 22px rgba(var(--glow-red), 0.2);
}

.pill.glow-orange {
  box-shadow:
    0 0 12px rgba(var(--glow-orange), 0.35),
    0 0 22px rgba(var(--glow-orange), 0.2);
}

.pill.glow-purple {
  box-shadow:
    0 0 12px rgba(var(--glow-purple), 0.35),
    0 0 22px rgba(var(--glow-purple), 0.2);
}

.panel {
  border-radius: 16px;
  background: var(--panel-bg, var(--surface-strong));
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeUp 0.5s ease both;
}

.panel.hidden {
  display: none;
}

.panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.palette-option {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  background: var(--surface-soft);
  font-size: 11px;
}

.palette-swatch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.palette-swatch span {
  height: 14px;
  border-radius: 4px;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.palette-option.active {
  border-color: var(--accent);
}

.game-header {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 16px;
  position: sticky;
  top: 16px;
  z-index: 5;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.game-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.game-title {
  font-size: 20px;
  font-weight: 600;
}

.game-meta {
  color: var(--muted);
  font-size: 14px;
}

.game-actions {
  display: flex;
  gap: 10px;
}

.game-new {
  align-self: flex-start;
}

.scoreboard {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--text);
}

.scoreboard .score-divider {
  opacity: 0.6;
}

.scoreboard .score-value {
  font-size: 18px;
}

.score-separator {
  opacity: 0.6;
}

.game-layout {
  --board-size: min(80vh, 80vw);
  display: grid;
  grid-template-columns: 1fr minmax(0, var(--board-size)) 1fr;
  gap: 24px;
  align-items: start;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  grid-column: 2;
  width: min(100%, var(--board-size));
}

.board-clock-row {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
}

.clock-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.clock-pill .clock-value {
  font-size: 16px;
}

.board-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.board-area {
  position: relative;
  width: 100%;
}

.board-legend {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.75;
  pointer-events: none;
}

.board-legend-files {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  text-align: center;
}

.board-legend-ranks {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  width: 18px;
}

.board-legend-left {
  left: -20px;
  text-align: right;
}

.board-legend-right {
  right: -20px;
  text-align: left;
}

.board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  background: var(--board-base, var(--board-light));
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--board-outline);
  box-shadow: 0 18px 32px var(--shadow-strong);
  position: relative;
  z-index: 1;
  transform: translateZ(0);
}

.board-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.board-arrows .arrow-line {
  stroke: var(--focus);
  opacity: 0.85;
}

.board-arrows .arrow-head {
  fill: var(--focus);
  opacity: 0.9;
}

.square {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0;
  position: relative;
  transition: background 0.15s ease, transform 0.15s ease;
  border-radius: 0;
  touch-action: manipulation;
}

.square.possible::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--focus);
  opacity: 0.6;
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.square.possible.possible-capture::after {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--focus);
  opacity: 0.8;
}

.square.check::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 2px solid var(--check);
  box-shadow: 0 0 12px rgba(226, 75, 75, 0.35);
  z-index: 0;
}

.square.light {
  background: var(--board-light);
}

.square.dark {
  background: var(--board-dark);
}

.square.selected {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.square.last-move {
  box-shadow: inset 0 0 0 2px var(--board-outline-strong);
}

.square.premove-from {
  outline: 3px solid rgba(82, 177, 255, 0.95);
  outline-offset: -3px;
}

.square.premove-to {
  outline: 3px solid rgba(82, 177, 255, 0.65);
  outline-offset: -3px;
}

.piece-icon {
  width: 78%;
  height: 78%;
  display: block;
  fill: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: relative;
  z-index: 1;
}

.piece-white {
  color: var(--piece-light, var(--text));
  stroke: rgba(0, 0, 0, 0.65);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

.piece-black {
  color: var(--piece-dark);
  stroke: rgba(255, 255, 255, 0.45);
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.35));
}

.status-line {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.game-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.game-header .auto-flip-row {
  justify-content: flex-start;
}

.rematch-button.hidden {
  display: none;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  grid-column: 3;
  justify-self: end;
  width: min(90vw, 280px);
  margin-top: 26px;
}

.clock-card {
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-card {
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.score-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
}

.clock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.clock-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
}

.side-block {
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.moves-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.move-list {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-line;
  scrollbar-color: var(--focus) rgba(0, 0, 0, 0.2);
  scrollbar-width: thin;
}

.move-list::-webkit-scrollbar {
  width: 8px;
}

.move-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.move-list::-webkit-scrollbar-thumb {
  background: var(--focus);
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.35);
}

.captures {
  width: 100%;
  display: flex;
  justify-content: center;
}

.capture-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.capture-pieces {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 16px;
}

.capture-pieces .piece-icon {
  width: 14px;
  height: 14px;
}

.capture-points {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
  min-width: 28px;
  text-align: right;
}

.rematch-wrap {
  display: flex;
  justify-content: center;
}

.rematch-button {
  width: 34px;
  height: 34px;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 12, 0.35);
  backdrop-filter: blur(6px);
  z-index: 12;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(90vw, 360px);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  box-shadow: 0 20px 40px var(--shadow-strong);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#shareModal .modal-card {
  background: var(--panel-bg, rgba(18, 18, 18, 0.92));
  border-color: var(--border-strong);
}

.rematch-card {
  width: min(90vw, 320px);
  background: var(--panel-bg, rgba(18, 18, 18, 0.92));
  border-color: var(--border-strong);
}

.rematch-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.rematch-message {
  font-size: 14px;
  color: var(--text);
}

.rematch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
}

.modal-close:hover {
  transform: none;
}

.modal-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-url {
  flex: 1;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.02em;
  animation: fadeUp 0.4s ease both;
}

.ads-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(42vw, 320px);
  z-index: 6;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding-top: 6px;
}

.ads-banner.hidden {
  display: none;
}

.ads-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
}

.ads-close .icon {
  width: 14px;
  height: 14px;
}

.ads-banner .adsbygoogle {
  width: 100%;
  min-height: 90px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .game-layout {
    --board-size: min(80vh, 90vw);
    grid-template-columns: 1fr;
  }

  .board-wrap,
  .side {
    grid-column: auto;
  }

  .side {
    width: min(90vw, 420px);
    justify-self: center;
    margin-top: 0;
  }
}

@media (max-width: 600px) {
  #app {
    padding: 24px 18px 40px;
  }

  .top-actions {
    left: 18px;
    bottom: 18px;
    right: auto;
    top: auto;
  }

  #settingsPanel {
    right: auto;
    left: 18px;
    bottom: 64px;
    width: min(90vw, 320px);
  }

  .home-mode .top-actions {
    left: 18px;
    bottom: 18px;
    right: auto;
    top: auto;
  }

  .home-mode #settingsPanel {
    left: 18px;
    right: auto;
  }

  .mode-grid {
    justify-content: center;
  }

  .segmented {
    grid-template-columns: repeat(2, max-content);
  }

  .game-header {
    grid-template-columns: 1fr;
    row-gap: 12px;
  }

  .ads-banner {
    right: 12px;
    bottom: 12px;
    width: min(90vw, 320px);
  }
}
.create-button {
  align-self: center;
  width: min(100%, 240px);
}
