/* Line Games app shell. The Ludo table itself is styled in style.css. */

html.platform {
  --bg: #101214;
  --surface: #181b1f;
  --raised: #22262c;
  --line: #2a2e35;
  --text: #f1f2f4;
  --muted: #8d949e;
  --accent: #f2b51d;
  --accent-ink: #1a1405;
  --ok: #4cc38a;
  --danger: #f07272;
  --tabs-h: 58px;
  --bar-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html.platform, html.platform body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Ethiopic", "Kefa", "Nyala", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
/* Ethiopic script sits taller than Latin: give it air. */
html.platform:lang(am) body { line-height: 1.55; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.center { text-align: center; }
.platform a { color: var(--accent); }
.platform p { margin: 0; }
.platform button { font: inherit; color: inherit; }

/* ------------------------------------------------------------ brand */

.wordmark {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.01em; color: var(--text) !important; text-decoration: none;
  white-space: nowrap;
}
.wordmark::before { content: ""; width: 16px; height: 4px; background: var(--accent); }
.wordmark span { font-weight: 400; margin-left: -3px; }
.wordmark.big { font-size: 28px; }
.wordmark.big::before { width: 26px; height: 6px; }

/* ------------------------------------------------------------ shell */

.bar {
  position: sticky; top: 0; z-index: 5; height: var(--bar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.bar-title { margin: 0; font-size: 17px; font-weight: 700; }
.back { background: none; border: 0; padding: 8px; margin-left: -10px; display: grid; place-items: center; cursor: pointer; }
.lang { background: none; border: 0; padding: 8px 6px; color: var(--muted) !important; font-size: 14px !important; cursor: pointer; }
.bal {
  font-weight: 700; font-variant-numeric: tabular-nums; text-decoration: none; color: var(--text) !important;
  background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: 8px; white-space: nowrap;
}

.banner { background: #2a2410; color: #e9cf85; text-align: center; padding: 7px 14px; font-size: 13px; }

.page {
  max-width: 520px; margin: 0 auto; padding: 18px 16px calc(var(--tabs-h) + var(--safe-b) + 24px);
  display: grid; gap: 22px; align-content: start;
}
.page.docked { padding-bottom: calc(150px + var(--safe-b)); }
.page section { display: grid; gap: 10px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; display: grid; place-items: center; align-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11.5px;
}
.tabs svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.active { color: var(--text); }
.tabs a.active svg { stroke: var(--accent); }

/* ------------------------------------------------------------ type */

.sec { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.sec .count { font-weight: 400; }
.title { margin: 0; font-size: 22px; font-weight: 750; }
.hint { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 13.5px; min-height: 0; }
.error:empty { display: none; }

/* ------------------------------------------------------------ buttons, inputs */

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn.primary { background: var(--accent); color: var(--accent-ink) !important; }
.btn.primary:active { background: #dba315; }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--text); font-weight: 600; }
.btn.quiet:active { background: var(--surface); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.small { width: auto; min-height: 38px; padding: 0 16px; font-size: 14.5px; border-radius: 10px; }

.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); }
.platform input:not([type="checkbox"]) {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 17px;
}
.platform input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.tick { display: flex !important; align-items: center; gap: 12px; color: var(--text) !important; font-size: 15.5px !important; }
.tick input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

/* ------------------------------------------------------------ lists */

.list { display: grid; background: var(--surface); border-radius: 12px; overflow: hidden; margin: 0; padding: 0; list-style: none; }
.item {
  display: flex; align-items: center; gap: 14px; padding: 14px; min-height: 64px;
  color: var(--text) !important; text-decoration: none; background: none; border: 0; text-align: left; width: 100%;
}
.item + .item { border-top: 1px solid var(--line); }
.item-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item-main b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .amt { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.amt.pos { color: var(--ok); }
.amt.neg { color: var(--muted); }
.chev { color: var(--muted); flex: none; }
.empty { color: var(--muted); font-size: 14.5px; padding: 6px 0; }

/* the Ludo mark: the four yards */
.ludo-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 40px; height: 40px; flex: none; }
.ludo-mark i { border-radius: 4px; }
.ludo-mark i:nth-child(1) { background: var(--red); }
.ludo-mark i:nth-child(2) { background: var(--green); }
.ludo-mark i:nth-child(3) { background: var(--blue); }
.ludo-mark i:nth-child(4) { background: var(--yellow); }

/* ------------------------------------------------------------ lobby */

.stakes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stake {
  display: grid; gap: 1px; justify-items: center; padding: 13px 4px 11px; cursor: pointer;
  background: var(--surface); border: 1.5px solid transparent; border-radius: 12px;
}
.stake b { font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stake b span { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stake small { font-size: 12.5px; color: var(--muted); }
.stake.on { border-color: var(--accent); background: #211c0e; }
.stake.on small { color: var(--accent); }
.stake.short b { color: var(--muted); }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 12px; }
.seg button {
  flex: 1; min-width: 0; display: grid; gap: 1px; justify-items: center; padding: 9px 4px; min-height: 44px; align-content: center;
  background: none; border: 0; border-radius: 9px; cursor: pointer; color: var(--muted);
}
.seg b { font-weight: 650; font-size: 15px; }
.seg small { font-size: 12px; }
.seg button.on { background: var(--raised); color: var(--text); }
.seg button.on small { color: var(--muted); }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + var(--safe-b));
}
.dock > * { max-width: 488px; margin-left: auto; margin-right: auto; }
.dock-row { display: flex; align-items: center; gap: 14px; }
.dock-prize { display: grid; flex: 1; min-width: 0; }
.dock-prize small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-prize b { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dock .btn { width: auto; flex: none; min-width: 46%; }
.low { font-size: 13.5px; color: var(--danger); margin-bottom: 10px !important; }

/* ------------------------------------------------------------ waiting room */

.seats .item { min-height: 56px; }
.seats .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }

/* ------------------------------------------------------------ wallet, history, admin */

.balance-block { gap: 2px !important; }
.balance-block small { color: var(--muted); font-size: 13.5px; }
.balance-block b { font-size: 36px; font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button {
  height: 42px; border-radius: 10px; background: var(--surface); border: 1px solid transparent; cursor: pointer;
  font-weight: 650; font-variant-numeric: tabular-nums;
}
.quick button:active { border-color: var(--accent); }

.tag { font-size: 12.5px; color: var(--muted); }
.tag.won, .tag.paid { color: var(--ok); }
.tag.lost, .tag.forfeit, .tag.rejected { color: var(--danger); }
.tag.pending { color: var(--accent); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--surface); padding: 12px 14px; border-radius: 12px; display: grid; gap: 2px; }
.stat small { color: var(--muted); font-size: 12.5px; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.admin-row { display: grid; gap: 10px; padding: 14px; }
.admin-row + .admin-row { border-top: 1px solid var(--line); }
.admin-row .acts { display: flex; gap: 8px; }

/* ------------------------------------------------------------ gate / welcome */

.gate { min-height: 100vh; min-height: 100dvh; display: grid; align-items: center; padding: 24px 20px; }
.gate-box { width: 100%; max-width: 400px; margin: 0 auto; display: grid; gap: 18px; }

/* ------------------------------------------------------------ modal, toast */

.platform .winner { background: rgba(0, 0, 0, 0.6); backdrop-filter: none; padding: 16px; z-index: 30; }
.platform .winner-card {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px 20px 20px; box-shadow: none;
}
.platform .winner-card h2 { font-size: 21px; }
.platform .winner-card p { color: var(--muted); margin-bottom: 20px; }
.platform .winner-card .row { display: grid; gap: 8px; }
.platform .winner-card button { min-height: 48px; border-radius: 12px; font-weight: 700; cursor: pointer; width: 100%; padding: 0 16px; }
.platform .winner-card button:not(.ghost) { background: var(--accent); color: var(--accent-ink); border: 0; }
.platform .winner-card button.ghost { background: none; border: 1px solid var(--line); }

.toast {
  position: fixed; bottom: calc(var(--tabs-h) + var(--safe-b) + 14px); left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  max-width: calc(100vw - 32px); text-align: center;
}

/* ------------------------------------------------------------ Ludo table (layout only) */

.game { display: grid; grid-template-columns: minmax(320px, 1fr) 340px; gap: 22px; max-width: 1180px; margin: 0 auto; padding: 22px; align-items: center; }
.platform .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.pot { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(242, 181, 29, 0.1); border: 1px solid rgba(242, 181, 29, 0.28); }
.pot strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.player.out { opacity: 0.45; }
.player em { font-style: normal; color: var(--muted); font-weight: 400; }
.timer { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 8px; }
.timer-bar { height: 100%; width: 0; background: var(--muted); transition: width 0.2s linear; }
.timer-bar.mine { background: var(--accent); }
.timer-bar.low { background: var(--danger); }
.ghost.danger { color: var(--danger); border-color: rgba(240, 114, 114, 0.4); }
.platform .check input { accent-color: var(--accent); }

@media (max-width: 900px) {
  /* Phone: board first, then the dice within thumb reach, then everything else. */
  .game { grid-template-columns: 1fr; padding: 10px 10px calc(16px + var(--safe-b)); gap: 10px; align-items: start; }
  .game canvas#board { width: min(100%, 62vh); }
  .game .side { padding: 12px; gap: 10px; }
  .game .side .controls { order: -2; }
  .game .side .players { order: -1; }
}
