:root {
  --bg: #FFF8EE;
  --paper: #FFFFFF;
  --ink: #2B2135;
  --muted: #6B6074;
  --line: #EADFCF;
  --mango: #F2A007;
  --peacock: #0E9E9A;
  --jamun: #6A48E8;
  --gulab: #E2386F;
  --cta: #E2386F;
  --cta-dark: #B81F52;
  --radius: 18px;
  --shadow: 0 10px 30px -12px rgba(43, 33, 53, .25);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}
a { color: var(--cta-dark); }
img, svg { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: rgba(255, 248, 238, .92); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 18px; font-size: 15px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--cta-dark); }
@media (max-width: 560px) { .nav .hide-sm { display: none; } }

/* hero + game */
.hero { padding-top: 22px; padding-bottom: 8px; }
.hero h1 { font-size: clamp(28px, 6vw, 46px); line-height: 1.1; margin: 0 0 8px; letter-spacing: -.025em; }
.hero .lede { margin: 0 0 4px; color: var(--muted); font-size: 17px; max-width: 46em; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 12px 0 0; }
.badges li { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 14px; font-weight: 600; }

.game-shell { margin: 16px auto 8px; max-width: max(320px, min(560px, calc(100vh - 170px))); background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; position: relative; scroll-margin-top: 8px; }
.game-shell h2 { margin: 0 0 4px; font-size: 20px; }
.noscript { padding: 16px; text-align: center; }

/* setup */
.setup-row { margin: 14px 0 0; }
.setup-row > span { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; gap: 8px; }
.seg button, .swatches button {
  flex: 1; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg);
  font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
}
.seg button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.swatches { display: flex; gap: 10px; }
.swatches button { background: var(--c); color: #fff; border-color: transparent; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.btn-play {
  display: block; width: 100%; margin-top: 18px; min-height: 56px; border: 0; border-radius: 14px;
  background: var(--cta); color: #fff; font: inherit; font-size: 20px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 0 var(--cta-dark); transition: transform .08s;
}
.btn-play:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--cta-dark); }
.setup-note { font-size: 13px; color: var(--muted); text-align: center; margin: 12px 0 0; }

/* play */
.chips { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 10px; }
.chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: var(--bg); font-size: 13px; font-weight: 700; border: 2px solid transparent; }
.chip.is-turn { border-color: var(--c); background: #fff; }
.chip.is-done { opacity: .6; }
.chip-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-home { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.board { display: block; width: 100%; aspect-ratio: 1; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.board .tok { transition: transform .15s ease-out; cursor: default; }
.board .tok-ring { opacity: 0; }
.board .tok.can-move { cursor: pointer; }
.board .tok.can-move .tok-ring { opacity: 1; animation: pulse 1s ease-in-out infinite; }
.board .tok:focus { outline: none; }
.board .tok:focus-visible .tok-ring { opacity: 1; stroke: var(--ink); }
.board .yard { transition: opacity .2s; }
.board .yard.is-turn { animation: glow 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@keyframes glow { 50% { opacity: .72; } }

.controls { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.status { flex: 1; font-weight: 700; font-size: 15px; line-height: 1.3; min-height: 2.6em; display: flex; align-items: center; }
.dice {
  width: 72px; height: 72px; flex: none; border-radius: 16px; border: 0; background: #fff; cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink), 0 5px 0 var(--ink); display: grid; padding: 12px;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr); transition: transform .08s;
}
.dice:disabled { cursor: default; box-shadow: 0 0 0 2px #CFC6B6, 0 5px 0 #CFC6B6; }
.dice:not(:disabled) { animation: nudge 1.2s ease-in-out infinite; }
.dice:active:not(:disabled) { transform: translateY(3px); }
.dice.is-rolling { animation: shake .12s linear infinite; }
.dice i { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); place-self: center; visibility: hidden; }
.dice[data-face="0"] i:nth-child(5) { visibility: visible; background: #CFC6B6; }
.dice[data-face="1"] i:nth-child(5),
.dice[data-face="2"] i:nth-child(1), .dice[data-face="2"] i:nth-child(9),
.dice[data-face="3"] i:nth-child(1), .dice[data-face="3"] i:nth-child(5), .dice[data-face="3"] i:nth-child(9),
.dice[data-face="4"] i:nth-child(1), .dice[data-face="4"] i:nth-child(3), .dice[data-face="4"] i:nth-child(7), .dice[data-face="4"] i:nth-child(9),
.dice[data-face="5"] i:nth-child(1), .dice[data-face="5"] i:nth-child(3), .dice[data-face="5"] i:nth-child(5), .dice[data-face="5"] i:nth-child(7), .dice[data-face="5"] i:nth-child(9),
.dice[data-face="6"] i:nth-child(1), .dice[data-face="6"] i:nth-child(3), .dice[data-face="6"] i:nth-child(4), .dice[data-face="6"] i:nth-child(6), .dice[data-face="6"] i:nth-child(7), .dice[data-face="6"] i:nth-child(9) { visibility: visible; }
.dice[data-face="6"] i { background: var(--cta); }
@keyframes nudge { 50% { transform: translateY(-3px); } }
@keyframes shake { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

.toolbar { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.toolbar button { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.toolbar button[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; }

.result { position: absolute; inset: 0; background: rgba(255, 253, 248, .96); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.result[hidden] { display: none; }
.res-title { font-size: 34px; font-weight: 800; margin: 0 0 10px; }
.res-list { list-style: none; counter-reset: r; padding: 0; margin: 0 0 18px; width: 100%; max-width: 260px; }
.res-list li { counter-increment: r; display: flex; gap: 10px; align-items: center; padding: 8px 12px; margin-bottom: 6px; border-radius: 10px; background: #fff; border-left: 6px solid var(--c); font-weight: 700; }
.res-list li::before { content: "#" counter(r); color: var(--muted); }
.result .btn-play { max-width: 260px; }
.res-setup { margin-top: 12px; background: none; border: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 40px; }
.res-share { margin-top: 6px; font-size: 14px; }

/* content */
.content { padding: 8px 0 40px; }
.content section { max-width: 760px; margin: 0 auto; padding: 22px 0 6px; border-top: 1px solid var(--line); }
.content h2 { font-size: clamp(22px, 4vw, 28px); line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; }
.content h3 { font-size: 18px; margin: 18px 0 4px; }
.content ol, .content ul { padding-left: 1.3em; }
.content li { margin-bottom: 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.cards li { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0; }
.cards b { display: block; margin-bottom: 2px; }
.soon { display: inline-block; font-size: 12px; font-weight: 700; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin-left: 6px; color: var(--muted); vertical-align: 2px; }
details { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 8px; }
summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
details p { margin: 0 0 12px; }
.cta-inline { display: inline-block; margin-top: 8px; background: var(--cta); color: #fff; font-weight: 800; padding: 10px 18px; border-radius: 12px; text-decoration: none; }

/* footer */
.site-foot { border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: 14px; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.site-foot a { color: var(--ink); }
.fairplay { font-weight: 600; color: var(--ink); }

/* simple text pages */
.page { max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; }
.page h1 { font-size: clamp(28px, 5vw, 38px); line-height: 1.15; margin: 0 0 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
