/* Multiplayer Ludo — mobile-first, big tap targets. */
:root {
  --red: #d7263d; --green: #1e9e4a; --yellow: #f2b705; --blue: #1f6fd6;
  --ink: #1c2430; --muted: #667085; --line: #e4e7ec; --bg: #f6f7f9;
  --card: #ffffff; --wa: #25d366;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Naskh Arabic", sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 14px 40px; }
.screen.hidden, .hidden { display: none !important; }
h1 { font-size: 1.5rem; margin: 8px 0 14px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error {
  background: #fdecea; color: #b3261e; border: 1px solid #f5c6c2;
  border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; font-size: 0.95rem;
}
.note {
  background: #fff7e0; border: 1px solid #f0d98c; color: #6b5410;
  border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; font-size: 0.95rem;
}

/* Hero */
.hero { text-align: center; padding: 10px 0 18px; }
.hero h1 { font-size: 2.6rem; margin: 6px 0 2px; letter-spacing: 0.5px; }
.tagline { margin: 0; color: var(--muted); font-size: 1rem; }
.dice-logo {
  width: 64px; height: 64px; margin: 0 auto; background: var(--red);
  border-radius: 14px; position: relative;
  box-shadow: 0 6px 16px rgba(215, 38, 61, 0.35);
}
.dice-logo .pip {
  position: absolute; width: 11px; height: 11px; background: #fff; border-radius: 50%;
}
.dice-logo .pip:nth-child(1) { top: 10px; left: 10px; }
.dice-logo .pip:nth-child(2) { top: 10px; right: 10px; }
.dice-logo .pip:nth-child(3) { top: 26px; left: 26px; }
.dice-logo .pip:nth-child(4) { bottom: 10px; left: 10px; }
.dice-logo .pip:nth-child(5) { bottom: 10px; right: 10px; }
.dice-logo .pip:nth-child(6) { top: 26px; right: 26px; display: none; }

/* Cards + forms */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}
label { display: block; font-weight: 600; margin: 4px 0 6px; font-size: 0.95rem; }
input[type="text"] {
  width: 100%; font-size: 1.1rem; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; margin-bottom: 12px; background: #fff; color: var(--ink);
}
input[type="text"]:focus { outline: none; border-color: var(--blue); }
input#join-code { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }
.divider { text-align: center; color: var(--muted); margin: 4px 0 12px; position: relative; }
.divider::before, .divider::after {
  content: ""; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--line);
}
.divider::before { left: 0; } .divider::after { right: 0; }
.divider span { background: var(--card); padding: 0 10px; position: relative; }
.seg { display: flex; gap: 8px; margin-bottom: 12px; }
.seg-btn {
  flex: 1; padding: 12px 0; font-size: 1.1rem; font-weight: 700;
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px; cursor: pointer;
}
.seg-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.foot { text-align: center; font-size: 0.85rem; margin-top: 6px; }

/* Buttons */
.btn {
  display: block; width: 100%; padding: 14px 16px; font-size: 1.05rem; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer; margin-bottom: 10px;
  min-height: 52px;
}
.btn:last-child { margin-bottom: 0; }
.btn-primary { background: var(--red); color: #fff; }
.btn-secondary { background: #eef1f4; color: var(--ink); }
.btn-whatsapp { background: var(--wa); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 600; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

/* Lobby */
.room-code {
  font-size: 2.4rem; font-weight: 800; letter-spacing: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  padding: 6px 0 12px;
}
.player-list { list-style: none; margin: 0 0 12px; padding: 0; }
.player-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--line); font-size: 1.05rem;
}
.player-list li:last-child { border-bottom: none; }
.dot { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15); }
.dot.red { background: var(--red); } .dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); } .dot.blue { background: var(--blue); }
.host-tag { margin-left: auto; font-size: 0.8rem; color: var(--muted); }

/* Board */
.conn-banner {
  background: #fdecea; color: #b3261e; border: 1px solid #f5c6c2;
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; text-align: center;
}
.board-top { margin-bottom: 10px; }
.turn-banner { font-size: 1.15rem; font-weight: 700; text-align: center; min-height: 1.6em; }
.timer-wrap { height: 6px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.timer-bar { height: 100%; background: var(--green); width: 100%; transition: width 0.5s linear; }
.timer-bar.low { background: var(--red); }
.timer-text { text-align: center; font-size: 0.9rem; font-weight: 600; margin-top: 4px; }
.timer-text.low { color: var(--red); }
.room-line { text-align: center; font-size: 0.85rem; margin-top: 6px; }
.board-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 8px; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}
.board-wrap svg { display: block; width: 100%; height: auto; }
.token { cursor: default; }
.token.movable { cursor: pointer; }
.token.movable circle.ring, .token.movable circle.halo { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.dice-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.dice {
  width: 64px; height: 64px; flex: none; background: #fff; border: 2px solid var(--ink);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800;
}
.btn-roll { margin-bottom: 0; }
.board-msg { text-align: center; min-height: 1.4em; margin: 10px 0 4px; font-size: 0.98rem; }
.score-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 12px; }
.score-chip {
  display: flex; align-items: center; gap: 6px; background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 0.9rem;
}
.score-chip .dot { width: 12px; height: 12px; }

/* Winner */
.winner-card { padding: 28px 16px; }
.trophy { font-size: 3.4rem; }
.winner-card h1 { font-size: 1.9rem; }
