/* Dáma online - styl v duchu rezervace.nezbeda.eu (karty, proměnné) */
:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #2b2a26;
  --muted: #8a8578;
  --line: #e4ded2;
  --accent: #2f7d4f;
  --accent-dark: #256641;
  --danger: #b23b2e;
  --warn: #a06a00;
  --light-sq: #f0dfc0;
  --dark-sq: #a97d55;
  --mark: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

/* ---------- hlavička ---------- */
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 700; letter-spacing: .02em; }
.spacer { flex: 1; }
#me { color: var(--muted); }
#me strong { color: var(--ink); }

/* ---------- prvky ---------- */
main { max-width: 980px; margin: 0 auto; padding: 20px 14px 60px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card.narrow { max-width: 420px; margin: 8vh auto 0; }
.card h1 { margin: 0 0 6px; font-size: 1.5rem; }
.card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.muted { color: var(--muted); }
.err { color: var(--danger); font-weight: 600; }
.list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 320px; overflow: auto; }
.list li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 4px; border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; }
.badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  border-radius: 999px; padding: 2px 8px; text-transform: uppercase;
}
.badge.on  { background: #e2f2e7; color: var(--accent-dark); }
.badge.off { background: #efece4; color: var(--muted); }
.badge.play { background: #e8ecfa; color: #3b4fa0; }
.badge.wait { background: #fbf1dc; color: var(--warn); }

button {
  font: inherit; cursor: pointer;
  background: var(--accent); color: #fff; border: 0;
  border-radius: 9px; padding: 9px 16px; font-weight: 600;
}
button:hover { background: var(--accent-dark); }
button.danger { background: var(--danger); }
button.danger:hover { background: #8f2f24; }
button.link {
  background: none; color: var(--muted); padding: 4px 6px; font-weight: 500;
}
button.link:hover { color: var(--ink); background: none; text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }
input {
  font: inherit; width: 100%;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; margin: 8px 0 14px; background: #fffdf8;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.lobby-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .lobby-grid { grid-template-columns: 1fr; } }

/* ---------- hra ---------- */
.banner {
  min-height: 24px; padding: 8px 14px; margin-bottom: 10px;
  border-radius: var(--radius); font-weight: 600;
  background: var(--card); border: 1px solid var(--line);
}
.banner.turn { border-color: var(--accent); color: var(--accent-dark); }
.banner.wait { color: var(--warn); }
.banner.warn { border-color: var(--warn); color: var(--warn); }
.banner.win  { border-color: var(--accent); background: #e2f2e7; color: var(--accent-dark); }
.banner.lose { border-color: var(--danger); background: #f9e7e4; color: var(--danger); }
.banner.draw { background: #eef0f4; color: #4a5060; }

.seat {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px; font-weight: 600;
}
.seat .pcolor { font-size: .8rem; color: var(--muted); font-weight: 500; }
.seat .clock {
  margin-left: auto; font-variant-numeric: tabular-nums;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: 3px 12px; min-width: 86px; text-align: center;
}
.seat .clock.active { border-color: var(--accent); color: var(--accent-dark); }
.seat .clock.low { border-color: var(--danger); color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

#boardwrap {
  position: relative;
  width: min(92vw, 560px);
  aspect-ratio: 1;
  margin: 4px auto;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0,0,0,.16);
  touch-action: manipulation;
}
#board {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
}
.cell { position: relative; }
.cell.light { background: var(--light-sq); }
.cell.dark  { background: var(--dark-sq); }
.cell.mark-from { box-shadow: inset 0 0 0 3px rgba(255,255,255,.55); }
.cell.mark-to   { box-shadow: inset 0 0 0 3px rgba(47,125,79,.75); }

/* vrstvy přes desku: značky a figurky; prvek = 1/8 desky, pozice přes --x/--y.
   --hop řídí délku animace tahu (JS ji při animaci nastaví na 1/3 s apod.) */
#marks, #pieces { position: absolute; inset: 0; pointer-events: none; }
.mark, .piece {
  position: absolute; left: 0; top: 0;
  width: 12.5%; height: 12.5%;
  transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%));
}
.piece { transition: transform var(--hop, 280ms) cubic-bezier(.3, .8, .3, 1); }

/* tečky povolených tahů - malá bílá tečka; skoky jemně odlišené */
.mark.dot::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 26%; height: 26%; border-radius: 50%;
  background: var(--mark); opacity: .9;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.mark.dot.jump::after {
  width: 34%; height: 34%;
  background: radial-gradient(circle, #fff 55%, #ffd57e 60%);
}
.mark.sel::after {
  content: ""; position: absolute; inset: 12%;
  border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255,255,255,.8);
}
/* oběť huffu - červený kroužek, na který lze kliknout */
.mark.victim { pointer-events: auto; cursor: pointer; }
.mark.victim::after {
  content: ""; position: absolute; inset: 8%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--danger);
  animation: pulse 1s infinite;
}

/* figurky: dva disky na sobě = dáma */
.piece { pointer-events: none; }
.piece .disc {
  position: absolute; inset: 11%;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,.4), inset 0 -3px 4px rgba(0,0,0,.28),
              inset 0 2px 3px rgba(255,255,255,.35);
}
.piece.w .disc { background: radial-gradient(circle at 34% 30%, #fffdf6, #e8e2d2 70%); }
.piece.b .disc { background: radial-gradient(circle at 34% 30%, #5a5a58, #262624 70%); }
.piece.dama .disc::after {
  content: ""; position: absolute; inset: 18%;
  border-radius: 50%;
  border: 2px solid rgba(176, 141, 61, .95);
  box-shadow: 0 0 4px rgba(176, 141, 61, .8);
}
/* pulzování hratelných kamenů (jen disk, ať nepřebíjí pozicí transform) */
@keyframes breathe { 50% { filter: brightness(1.25); transform: scale(1.05); } }
.piece.movable .disc { animation: breathe 1.6s ease-in-out infinite; }

/* mizející kameny (vyřazení tahem) a huffnutý kámen */
.piece.captured .disc { transition: transform .45s ease, opacity .45s ease; transform: scale(.3); opacity: 0; }
.piece.huffed .disc {
  animation: huffed .35s steps(2, end) 4, fadeout .5s ease .9s forwards;
}
@keyframes huffed { 50% { filter: drop-shadow(0 0 6px var(--danger)) brightness(1.5) sepia(1) hue-rotate(-40deg); } }
@keyframes fadeout { to { transform: scale(.3); opacity: 0; } }

#overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center;
  background: rgba(20, 16, 10, .55);
  color: #fff; font-weight: 700; font-size: 1.15rem;
  text-align: center; padding: 16px;
}
#overlay[hidden] { display: none; }

#actions {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  margin-top: 12px; flex-wrap: wrap;
}

/* ---------- toasty ---------- */
#toasts {
  position: fixed; right: 14px; bottom: 14px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
  background: var(--ink); color: #fff;
  border-radius: 10px; padding: 10px 14px; font-weight: 500;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
  animation: slidein .25s ease;
}
.toast.warn { background: var(--warn); }
.toast.err  { background: var(--danger); }
.toast.win  { background: var(--accent-dark); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }
