/* Chess Football — dark site, electric blue accent (no gold, per house palette rule). */
:root {
  --bg: #0e1411;
  --bg-soft: #16201a;
  --line: #24352b;
  --text: #e6efe4;
  --muted: #93a89a;
  --accent: #3fa4ff;
  --accent-soft: rgba(63, 164, 255, 0.16);
  --good: #37d4a0;
  --size: min(min(92vw - 2rem, 78vh), 620px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #16241c 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  padding: 0.9rem 1.4rem 0.4rem;
  flex-wrap: wrap;
}
h1 { font-size: 1.35rem; margin: 0; letter-spacing: 0.02em; }
.score { color: var(--muted); font-variant-numeric: tabular-nums; }
.score-side { color: var(--text); font-weight: 600; }

main {
  display: flex;
  gap: 1.4rem;
  padding: 0.6rem 1.4rem 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.board-column { display: flex; flex-direction: column; gap: 0.5rem; }

.turnbar { display: flex; align-items: center; gap: 0.6rem; width: var(--size); justify-content: space-between; }
.chip {
  padding: 0.2rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  transition: all 0.25s;
}
.chip.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 12px rgba(63, 164, 255, 0.25);
}
.ball-dot { font-size: 1.15rem; }

#board { width: var(--size); height: var(--size); border-radius: 6px; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5); }
#board cg-board { background-image: url('../assets/pitch.svg'); background-size: 100% 100%; }

/* square markers — the vendored chessground css ships layout only, no visuals */
#board square.last-move { background: rgba(63, 164, 255, 0.30); }
#board square.selected { background: rgba(63, 164, 255, 0.42); box-shadow: inset 0 0 8px rgba(63, 164, 255, 0.9); }
#board square.move-dest {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.66) 19%, transparent 25%);
}
#board square.move-dest.oc {
  background: radial-gradient(circle, transparent 0%, transparent 54%, rgba(255, 255, 255, 0.9) 58%, transparent 68%);
}

/* the ball */
.ball {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 15;
  transition: transform 0.3s cubic-bezier(0.25, 0.9, 0.3, 1.15);
}
.ball-inner { width: 100%; height: 100%; transition: transform 0.25s ease; }
.ball svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45)); }
.ball.possessed .ball-inner { transform: translate(34%, 34%) scale(0.58); }
.ball.grabbable { pointer-events: auto; cursor: grab; }
.ball.dragging { transition: none; cursor: grabbing; }
.ball.flash svg { animation: goalpulse 0.6s ease-in-out 3; }
@keyframes goalpulse {
  50% { transform: scale(1.45); filter: drop-shadow(0 0 14px rgba(63, 164, 255, 0.9)); }
}

/* side panel */
.panel {
  flex: 1 1 300px;
  min-width: 280px;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.status {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  min-height: 2.4em;
  display: flex;
  align-items: center;
}
.status.goal { border-color: var(--good); color: var(--good); font-weight: 700; }

.controls { display: flex; flex-direction: column; gap: 0.5rem; }
.controls-row { display: flex; gap: 0.5rem; }
button {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }
.controls-row button { flex: 1; }
.segment { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segment button { flex: 1; border: none; border-radius: 0; background: transparent; padding: 0.5rem; }
.segment button.on { background: var(--accent-soft); color: #fff; font-weight: 600; }

h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0.4rem 0 0; }
#log {
  margin: 0;
  padding: 0.4rem 0.2rem;
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  font-variant-numeric: tabular-nums;
  min-height: 3em;
}
#log li { padding: 0.12rem 0.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
#log li .dot { display: inline-block; width: 0.55em; height: 0.55em; border-radius: 50%; margin-right: 0.45em; vertical-align: baseline; }
#log li.white .dot { background: #f5f5f5; }
#log li.black .dot { background: #333; border: 1px solid #777; }
#log .empty { color: var(--muted); font-style: italic; }

.help { border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); padding: 0.4rem 0.8rem; }
.help summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.help p { margin: 0.5rem 0; color: var(--text); }
.help b { color: var(--accent); }

.settings { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.4rem 0; }
.settings-row { display: grid; grid-template-columns: 1fr auto; gap: 0 0.8rem; align-items: center; }
.settings-row small { grid-column: 1 / -1; color: var(--muted); }
.settings-row select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.4rem; font: inherit; }

.credit { color: var(--muted); font-size: 0.8rem; }
.credit a,a.credit{ color: var(--accent); text-decoration: none; }
.credit a:hover { text-decoration: underline; }

/* result banner */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 8, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(3px);
}
#overlay[hidden] { display: none; }
.banner {
  background: var(--bg-soft);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 2rem 2.6rem;
  text-align: center;
  box-shadow: 0 0 60px rgba(63, 164, 255, 0.25);
}
.banner-title { font-size: 2.2rem; font-weight: 800; color: var(--accent); }
.banner-sub { color: var(--muted); margin: 0.5rem 0 1.3rem; }
.banner-actions { display: flex; gap: 0.7rem; justify-content: center; }
.banner-actions .ghost { border-color: var(--line); color: var(--muted); }

@media (max-width: 900px) {
  :root { --size: min(94vw - 2rem, 64vh); }
  main { padding: 0.6rem 0.7rem 2rem; }
  .panel { max-width: none; }
}
