/* Nine Men's Morris — Playnesta shell stylesheet (MIT).
   No fonts, images or network assets: the board is lines and circles, the
   pieces are plain colours. */

:root {
  --bg: #191308;
  --bg-2: #221a0d;
  --bg-3: #2d2211;
  --line: #4a3a1d;
  --ink: #f4ead7;
  --ink-2: #c8b593;
  --ink-3: #92805f;
  --accent: #e8b04b;
  --white: #f1e6cf;
  --black: #2b2b33;
  --good: #6fc98a;
  --bad: #e07a5f;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 35%, #241b0d 0%, var(--bg) 70%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { overflow: hidden; }

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: calc(var(--pn-vh, 1vh) * 100);
  min-height: 0;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  min-height: 32px;
}
.title { font-size: 14px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.title small { color: var(--ink-3); font-weight: 500; margin-left: 4px; font-size: 11px; }
.spacer { flex: 1 1 auto; }
.hud { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.hud b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hud .opt { color: var(--ink-3); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.you { background: var(--white); border: 1px solid #7a6a4d; }
.dot.ai { background: var(--black); border: 1px solid #8d8776; }

/* ------------------------------------------------------------------ main */
#main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  min-height: 0;
  overflow: hidden;
}

#board {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  touch-action: manipulation;
  user-select: none;
}

.rail {
  stroke: #7a6134;
  stroke-width: 7;
  stroke-linecap: round;
}

.target {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-dasharray: 8 7;
  opacity: .85;
  animation: breathe 1.6s ease-in-out infinite;
}
.target.remove {
  stroke: var(--bad);
  fill: rgba(224, 122, 95, .12);
}
.target.hint {
  stroke: var(--good);
  stroke-dasharray: none;
  stroke-width: 5;
  animation: none;
}

@keyframes breathe {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

.piece {
  stroke-width: 4;
  cursor: pointer;
  transition: r .12s ease;
}
.piece.white {
  fill: var(--white);
  stroke: #8c7a58;
}
.piece.black {
  fill: var(--black);
  stroke: #9d9788;
}
.piece.selected {
  stroke: var(--accent);
  stroke-width: 7;
  r: 30;
}
.piece.mill {
  stroke: var(--good);
  stroke-width: 6;
}

.hit {
  fill: transparent;
  cursor: pointer;
}

/* -------------------------------------------------------------- statusbar */
#statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 9px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  min-height: 40px;
  flex-wrap: wrap;
}

#status {
  flex: 1 1 160px;
  font-size: 12px;
  color: var(--ink-2);
  min-width: 0;
}
#status[data-tone="over"] { color: var(--accent); font-weight: 600; }

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

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--ink);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 9px;
  min-height: 26px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #21190a;
  font-size: 13px;
  padding: 9px 16px;
  min-height: 36px;
}

/* ------------------------------------------------------------------- win */
#win {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 9, 4, .72);
  padding: 16px;
  z-index: 20;
}
#win.hidden, #modal.hidden { display: none; }

.win-card {
  width: min(360px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.win-label { font-size: 17px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
.win-body { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.win-body div { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--ink-3); }
.win-body b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- modal */
#modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 9, 4, .78);
  padding: 14px;
  z-index: 25;
}

.modal-card {
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  font-size: 13px;
  line-height: 1.55;
}
.modal-card h2 { margin: 0 0 10px; font-size: 16px; color: var(--accent); }
.modal-card ol { padding-left: 20px; margin: 8px 0; }
.modal-card li { margin-bottom: 5px; }
.modal-card .muted { color: var(--ink-3); font-size: 12px; }
.modal-card .btn { margin-top: 10px; }

/* ---------------------------------------------------------------- toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%) translateY(8px);
  background: #3a2c15;
  border: 1px solid var(--accent);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  max-width: 92vw;
  text-align: center;
  z-index: 30;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --------------------------------------------------------------- narrow */
@media (max-width: 720px) {
  .title small { display: none; }
  #statusbar { gap: 5px; padding: 5px 7px 7px; }
  #status { flex-basis: 100%; font-size: 11px; }
  .actions { width: 100%; justify-content: space-between; }
  .btn { font-size: 10px; padding: 5px 7px; }
}
