/* Checkmate — minimal, warm, quiet. */

:root {
  --bg: #f5f4f5;
  --ink: #2b292c;
  --ink-soft: #8a8590;
  --card: #ffffff;
  --line: #e4e2e6;
  --line-hover: #cbc8cf;
  --dot: #c7c4cb;
  --sq-light: #f0d9b5;
  --sq-dark: #b58863;
  --accent: #5c8a58;
  --accent-ink: #ffffff;
  --sel: rgba(92, 138, 88, 0.55);
  --last: rgba(214, 176, 70, 0.45);
  --danger: #b0563e;
}

/* Dark mode: the page dims, the wooden board stays the star. */
:root[data-theme="dark"] {
  --bg: #2b292c;
  --ink: #e9e2d3;
  --ink-soft: #9c9280;
  --card: #353338;
  --line: #434046;
  --line-hover: #56525a;
  --dot: #545159;
  --accent: #6b9b67;
  --accent-ink: #ffffff;
  --danger: #cf7c5f;
}

html { background: var(--bg); }

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
  /* Fast taps are game input (two-tap moves, "Sure?" resign) — stop iPad
     Safari from treating them as double-tap-to-zoom. Pinch still zooms. */
  touch-action: manipulation;
}

.theme-btn {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 50;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 0;
  color: var(--ink-soft);
  padding: 8px;
}

.theme-btn svg { display: block; }

.theme-btn:hover { color: var(--ink); }

.theme-btn svg {
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
}

/* Hover the moon: it twists a little... */
.theme-btn[data-icon="moon"]:hover svg {
  transform: rotate(-20deg);
}

/* ...and three little stars pop up behind it. */
.theme-btn .stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.theme-btn .stars i {
  position: absolute;
  display: block;
  background: var(--ink);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
  transform: translateY(5px) scale(0.3);
  transition: opacity 0.22s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-btn .stars i:nth-child(1) { width: 8px; height: 8px; top: 3px; left: 5px; }
.theme-btn .stars i:nth-child(2) { width: 6px; height: 6px; top: 14px; left: 1px; transition-delay: 0.07s; }
.theme-btn .stars i:nth-child(3) { width: 5px; height: 5px; top: 0; left: 18px; transition-delay: 0.14s; }

.theme-btn[data-icon="moon"]:hover .stars i {
  opacity: 1;
  transform: translateY(-3px) scale(1);
}

/* Hovering the sun: rays dip in slightly, then glide out past where they
   began — and ease back down smoothly when the cursor leaves. The dip and
   overshoot both come from the easing curve, so it's one fluid motion. */
.theme-btn .rays {
  transform-box: view-box;
  transform-origin: 50% 50%;
  transform: scale(1);
  transition: transform 0.55s cubic-bezier(0.45, -0.4, 0.25, 1.3);
}

.theme-btn[data-icon="sun"]:hover .rays {
  transform: scale(1.2);
}

/* Freshly switched via click: hold still until the pointer re-enters. */
.theme-btn.settle .rays {
  transform: scale(1) !important;
  transition: none;
}

.signin-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.signin-btn:hover { color: var(--ink); }

/* Signed in, hovering the chip opens the Sign out popover (its own card,
   above the email). With the privacy blur on, the address is one plain
   blurred text — soft natural edges, no clipping box — and hovering simply
   fades the blur away in place; leaving fades it back. */
.fab-email { display: inline-block; }

#signInFabLabel { transition: filter 0.35s ease; }

.signin-btn.authed .fab-email.blurred #signInFabLabel { filter: blur(3.2px); }

@media (hover: hover) {
  .signin-btn.authed:hover .fab-email.blurred #signInFabLabel { filter: blur(0); }
}

.auth-back {
  display: block;
  margin: 0 0 14px;
  padding: 0;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
}

.auth-back:hover { color: var(--ink); }

.auth-note { text-align: center; margin-bottom: 12px; }

.settings-btn {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 50;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 0;
  color: var(--ink-soft);
  padding: 8px;
  transition: transform 0.25s ease, color 0.15s ease;
}

.settings-btn:hover {
  color: var(--ink);
  transform: rotate(45deg);
}

.settings-panel {
  position: fixed;
  bottom: 62px;
  right: 16px;
  z-index: 60;
  width: 272px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  box-shadow: 0 10px 30px rgba(40, 30, 15, 0.18);
}

.settings-panel h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
}

.settings-label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

#settingsNameInput {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}

#settingsNameInput:focus { border-color: var(--accent); }

.settings-saved {
  margin: 10px 0 0;
  color: var(--accent);
}

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-name-btn {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}

.edit-name-btn:hover { color: var(--ink); }

.view {
  width: 100%;
  max-width: 560px;
  padding: 0 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Landing ---------- */

#landing {
  justify-content: center;
  align-items: center;
  text-align: center;
  max-width: 860px;
}

.home-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  width: 100%;
}

.landing-inner { width: 100%; max-width: 340px; }

/* Right column: analysis link + friends card */
.side-col {
  width: 270px;
  flex-shrink: 0;
  margin-top: 6px;
  text-align: left;
}

/* "Play Chess Bot | Analysis Board" — one row over the friends card */
.side-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0 0 6px;
}

.side-links-sep {
  color: var(--ink-soft);
  font-size: 13px;
  opacity: 0.5;
}

.analyze-link {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 4px;
}

.analyze-link:hover { color: var(--ink); }

/* "Play Chess Bot" chooser — floats ABOVE the link row, out of the page
   flow, so opening it never shifts the logo/title/friends card. It rises
   into place with a fade. */
.side-col { position: relative; }

.bot-float {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%; /* sits just above the link row */
  margin-bottom: 10px;
  z-index: 30;
  visibility: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.25s ease,
    transform 0.28s ease,
    visibility 0s linear 0.28s; /* stay clickable-free once faded out */
}

.bot-float.open {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 0.25s ease, transform 0.28s ease;
}

/* Same card language as the friends panel under it. */
.bot-chooser {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bot-row-label {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

.bot-colors { display: flex; gap: 6px; }

.bot-color {
  width: 34px;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-color img { width: 100%; height: 100%; }

.bot-color:hover { border-color: var(--line-hover); }

.bot-color.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.bot-levels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
}

.bot-levels .btn {
  padding-left: 0;
  padding-right: 0;
  font-size: 10.5px; /* 20% under btn-small's 13px so the four labels sit comfortably */
}

/* Armed = tapped once, asking "Start?" — the second tap begins the game. */
.bot-levels .btn.armed {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.friends-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 10px;
  text-align: left;
}

.friend-scroll {
  max-height: 56vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* First roster after a page load arrives a beat late — ease it in instead
   of popping. Re-renders (presence flips etc.) don't animate. */
.friend-scroll.friends-in { animation: friendsIn 0.4s ease; }

@keyframes friendsIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 760px) {
  .home-layout {
    flex-direction: column;
    align-items: center;
  }
  .side-col {
    width: 100%;
    max-width: 340px;
    margin-top: 0;
  }
  .friend-scroll { max-height: 38vh; }
}

.wordmark {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
}

h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.tagline {
  color: var(--ink-soft);
  margin: 0 0 32px;
  font-size: 15px;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { border-color: var(--line-hover); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  padding: 13px 18px;
  font-size: 16px;
}

.btn-primary:hover { background: #527c4e; border-color: #527c4e; }

.btn-small {
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 8px;
}

.btn-quiet {
  color: var(--ink-soft);
  background: transparent;
  border-color: transparent;
}

.btn-quiet:hover { color: var(--danger); border-color: transparent; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 13px;
  margin: 24px 0 16px;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.join-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

#codeInput {
  width: 120px;
  text-align: center;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 9px 6px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  outline: none;
}

#codeInput:focus { border-color: var(--accent); }

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 16px;
}

/* ---------- Home (friends) ---------- */

/* Sign-in box (signed-out landing) */

.auth-box {
  max-width: 300px;
  margin: 0 auto;
}

.google-btn {
  width: 100%;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-input {
  font: inherit;
  font-size: 15px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  outline: none;
}

.auth-input:focus { border-color: var(--accent); }

.auth-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 2px;
}

.account-popover {
  position: fixed;
  bottom: 58px;
  left: 18px;
  z-index: 60;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 10px 30px rgba(40, 30, 15, 0.18);
  /* fade in on the same clock as the email un-blur (0.35s) */
  animation: popFade 0.35s ease;
}

@keyframes popFade {
  from { opacity: 0; }
}

/* ~20% smaller than the stock small button */
.account-popover .btn {
  font-size: 10.5px;
  padding: 4px 8px;
}

.btn-inline { width: auto; padding: 10px 20px; font-size: 15px; }

.you-row {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 18px;
}

.you-row strong { color: var(--ink); }

.btn-bare {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 2px 4px;
}

.btn-bare:hover { color: var(--ink); }

.banner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.banner.good { border-color: var(--accent); }

.challenge-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  text-align: left;
}

.challenge-card span { flex: 1; }

.friends-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 10px;
}

.friends-head h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0;
  font-weight: 600;
}

.hint {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0 0 12px;
  text-align: left;
  overflow-wrap: anywhere;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.friend-card:last-child { border-bottom: none; }

.friend-name {
  font-weight: 600;
  font-size: 15px;
}

.friend-status {
  flex: 1;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.friend-card .btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.home-link {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 18px;
  margin-right: 2px;
}

.home-link:hover { color: var(--ink); }

/* ---------- Game ---------- */

#game { padding-top: 18px; }

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-code {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
  transition: background 0.3s ease;
}

.dot.on { background: var(--accent); }

/* Player rows: color icon + name + presence, captures fill the rest */

.player-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px; /* keeps the board from shifting as pieces appear */
  padding: 1px 2px;
}

.player-color {
  width: 19px;
  height: 19px;
  filter: drop-shadow(0 1px 1px rgba(40, 30, 15, 0.2));
}

.player-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
}

/* Captured pieces + material count */

.captures {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin-left: 6px;
}

.captures img {
  width: 20px;
  height: 20px;
  margin-right: -8px; /* same-kind pieces overlap into a small stack */
  filter: drop-shadow(0 1px 1px rgba(40, 30, 15, 0.25));
}

.captures img.group { margin-left: 6px; }

.captures span {
  margin-left: 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* Board */

.board-wrap { position: relative; }

#board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr); /* rows must never size to content */
  aspect-ratio: 1;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(60, 48, 30, 0.16);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* the board handles its own touch gestures (drag) */
}

.sq.own { cursor: grab; }
#board.dragging, #board.dragging .sq.own { cursor: grabbing; }

.drag-ghost {
  position: fixed;
  transform: translate(-50%, -50%) scale(1.08);
  pointer-events: none;
  z-index: 1000;
  filter: drop-shadow(0 6px 10px rgba(40, 30, 15, 0.35));
}

.sq.drop-hover {
  box-shadow: inset 0 0 0 4px rgba(45, 38, 28, 0.35);
}

.sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }

.sq img {
  width: 97%;
  height: 97%;
  pointer-events: none;
  position: relative;
  z-index: 2;
}

.sq.last::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--last);
}

.sq.sel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sel);
}

.sq.dest::after {
  content: "";
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(45, 38, 28, 0.25);
  z-index: 1;
}

.sq.dest.capture::after {
  width: 88%;
  height: 88%;
  background: none;
  border: 4px solid rgba(45, 38, 28, 0.3);
}

.sq.check {
  background-image: radial-gradient(circle, rgba(200, 60, 40, 0.55) 20%, rgba(200, 60, 40, 0) 75%);
}

.sq .coord {
  position: absolute;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.55;
  z-index: 1;
}

.sq .coord.file { right: 3px; bottom: 2px; }
.sq .coord.rank { left: 3px; top: 2px; }
.sq.light .coord { color: var(--sq-dark); }
.sq.dark .coord { color: var(--sq-light); }

/* Promotion picker */

.promo {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(43, 38, 32, 0.3);
  border-radius: 8px;
}

.promo-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(20, 15, 5, 0.35);
}

.promo-btn img {
  width: 84%;
  height: 84%;
  transition: transform 0.12s ease;
}

.promo-btn:hover img { transform: scale(1.14); }

/* Overlay (game over / waiting) */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(43, 38, 32, 0.35);
  border-radius: 8px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 5;
}

.overlay-card {
  background: var(--card);
  border-radius: 14px;
  padding: 22px 30px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(40, 30, 15, 0.25);
  max-width: 82%;
}

.overlay-title {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 4px;
}

.overlay-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.overlay-card .btn-primary { width: auto; padding: 10px 26px; }

/* Status + moves */

.status-row {
  display: flex;
  align-items: center;
  margin-top: 12px;
  min-height: 30px;
}

.status {
  font-size: 15px;
  font-weight: 600;
}

.status.subtle { color: var(--ink-soft); font-weight: 500; }

/* Board block on the left, actions stacked down its right side. The board
   column flexes; the button rail is a fixed width so the board keeps as
   much room as possible. */
.play-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-col {
  flex: 1;
  min-width: 0;
}

/* Undo / Draw / Resign: three clear rectangles beside the board. Every one
   is a two-tap control — the first tap arms it (the button fills in and the
   status line spells out what a second tap will do). */
.game-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 54px;
  padding: 5px 0 4px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.action-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.action-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.action-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line-hover);
}

.action-btn:active:not(:disabled) { transform: scale(0.96); }

.action-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Waiting on the opponent to answer a draw/undo request. */
.action-btn.pending {
  color: var(--accent);
  border-color: var(--accent);
}

/* Armed (tapped once). Resign is the destructive one, so it arms red.
   Listed last so a filled confirm state always beats the pending outline —
   otherwise a green icon could land on a green fill and vanish. */
.action-btn.armed {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

#resignBtn.armed {
  background: var(--danger);
  border-color: var(--danger);
}

.draw-bar { margin-top: 10px; margin-bottom: 4px; }

.movelist {
  margin: 10px 0 20px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.9;
  max-height: 96px;
  overflow-y: auto;
}

.movelist .num { opacity: 0.55; margin-right: 2px; }
.movelist .mv { color: var(--ink); margin-right: 10px; font-weight: 500; }

.settings-gap { margin-top: 14px; }

.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.settings-check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.settings-credit {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-soft);
}

.settings-credit a { color: inherit; }

@media (max-width: 430px) {
  h1 { font-size: 30px; }
  .game-header { margin-bottom: 10px; }
  /* On a phone every pixel of board counts — drop the button labels and
     narrow the rail rather than shrinking the board further. */
  .action-btn {
    width: 40px;
    padding: 8px 0;
  }
  .action-label { display: none; }
  .play-area { gap: 6px; }
}
