:root {
  /* Swarajya Rakshak — Sahyadri heritage (dark: a fort at night, black basalt and torchlight) */
  --bg: #17120D; --surface: #211A13; --surface2: #2C231A; --border: #43352A; --text: #F3E6CC; --muted: #C9B798;
  --saffron: #F7A440; --on-saffron: #1E1205; --saffron-text: #F7A440; --gold: #F4C56A; --torch: #F4C56A;
  --good: #8FD07A; --bad: #F08A72; --felt1: #2b4a2a; --felt2: #16291a;
  --parch: #f4e9d2; --ink: #3a2410; --center-text: #F3E6CC;
  --right-bg: #23401B; --wrong-bg: #4E1F14;
  --fact-bg: #1E2A18; --fact-border: #3F5C2E; --fact-text: #DDE8C8; --fact-strong: #B5DB8F;
  --cardtext-1: #3b2a0a; --cardtext-2: #1f1606;
  --font-display: 'Cinzel', 'Yatra One', Georgia, serif;
  --font-deva-display: 'Yatra One', 'Cinzel', Georgia, serif;
  --font-body: Inter, Mukta, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
/* light: an old parchment map */
:root[data-theme="light"] {
  --bg: #F4E9D2; --surface: #FFF8EA; --surface2: #F7EEDB; --border: #D8C7A2; --text: #3A2410; --muted: #6B5A3E;
  --saffron: #B0541A; --on-saffron: #FFF8EA; --saffron-text: #9C4A12; --gold: #8A5A12;
  --good: #3E6B1F; --bad: #9C3B22;
  --right-bg: #E4EBD3; --wrong-bg: #F6DDD5;
  --fact-bg: #EEF2E0; --fact-border: #B9C79A; --fact-text: #2F3A14; --fact-strong: #3E6B1F;
  --cardtext-1: #FFF3DA; --cardtext-2: #F5E2BC;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font-body); }
body.playing { overflow: hidden; height: 100vh; height: 100dvh; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.screen { max-width: 980px; margin: 0 auto; padding: 0 16px env(safe-area-inset-bottom); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 0; justify-content: space-between; }
.back { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; }
.langs { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.langs button { background: transparent; border: 0; padding: 6px 12px; font-size: 13px; font-weight: 800; color: var(--muted); }
.langs button.on { background: var(--saffron); color: var(--on-saffron); }
/* setup */
.hero { display: flex; gap: 14px; align-items: flex-end; margin: 6px 0 14px; }
.hero-text { flex: 1; }
.kicker { color: var(--saffron-text); font-weight: 800; letter-spacing: 3px; font-size: 12px; margin: 0; }
h1 { font-size: 38px; margin: 2px 0; line-height: 1.1; font-family: var(--font-display); font-weight: 700; letter-spacing: .5px; font-synthesis: none; }
h1 .mr { display: block; font-size: 30px; color: var(--saffron-text); font-family: var(--font-deva-display); font-weight: 400; letter-spacing: 0; }
.tag { color: var(--gold); font-weight: 700; margin: 6px 0; }
.sub { color: var(--muted); margin: 6px 0 0; }
.coach { width: 120px; mask-image: linear-gradient(#000 70%, transparent); -webkit-mask-image: linear-gradient(#000 70%, transparent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; margin: 0 0 14px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }
.prow { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.prow .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.prow input { flex: 1; min-width: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
select.emb { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 7px 4px; font-size: 18px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { background: transparent; border: 0; padding: 8px 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--saffron); color: var(--on-saffron); }
.x { background: transparent; border: 0; color: var(--muted); font-size: 18px; width: 28px; }
.row { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.row label { color: var(--muted); font-weight: 600; }
.row select { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 9px; }
.primary { width: 100%; background: var(--saffron); color: var(--on-saffron); border: 0; border-radius: 12px; padding: 13px; font-weight: 800; font-size: 16px; }
.ghost { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 11px; font-weight: 700; margin-top: 8px; }
.danger { color: var(--bad); }
.meta { color: var(--muted); font-size: 13px; }
.emblems { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12px; }
.theme { display: block; width: 100%; text-align: left; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.theme.on { border-color: var(--saffron); box-shadow: 0 0 0 1px var(--saffron) inset; }
.theme small { display: block; color: var(--muted); margin-top: 3px; }
.theme em { display: block; font-style: normal; font-size: 12px; color: var(--gold); margin-top: 2px; }
#themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 10px; }
#themes .meta { grid-column: 1 / -1; }
.rules summary { font-weight: 800; cursor: pointer; }
.rules-body p { color: var(--muted); } .rules-body b { color: var(--text); }

/* game screen: a column filling the viewport */
#game { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 0 8px env(safe-area-inset-bottom); max-width: 1500px; margin: 0 auto; }
.gbar { display: flex; align-items: center; gap: 8px; padding: 6px 0 4px; flex: none; }
.iconbtn { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; width: 38px; height: 34px; font-size: 17px; flex: none; }
.gtitle { flex: 1; text-align: center; font-weight: 700; font-family: var(--font-display); font-synthesis: none; color: var(--saffron-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtitle small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 6px; scrollbar-width: none; flex: none; }
.strip::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px 3px 3px; font-size: 12px; }
.chip.on { border-color: var(--saffron); box-shadow: 0 0 0 1px var(--saffron) inset; }
.chip.out { opacity: .4; }
.chip b { display: block; font-size: 12px; line-height: 1.1; white-space: nowrap; }
.chip span { color: var(--gold); font-weight: 700; white-space: nowrap; }
i.em { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-style: normal; font-size: 12px; flex: none; vertical-align: middle; box-shadow: 0 0 0 1.5px #fff9; }
.gamebody { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: flex-start; gap: 12px; }
.panebtns { display: flex; gap: 6px; padding: 6px 0; flex: none; }
.panebtns button { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 4px; font-weight: 800; font-size: 13px; }

/* board */
#board { position: relative; background: #1a1206; border: 3px solid #6b4a1e; border-radius: 10px; box-shadow: 0 10px 30px #0009; }
.tile { position: absolute; display: flex; overflow: hidden; cursor: pointer; border: 1px solid #2b1d0a; background: var(--parch); }
.tile[data-side="2"] { flex-direction: column; }            /* top row: photo above, name below (towards the centre) */
.tile[data-side="0"] { flex-direction: column-reverse; }    /* bottom row: name above, photo below */
.tile[data-side="1"] { flex-direction: row; }               /* left column: photo left, name right */
.tile[data-side="3"] { flex-direction: row-reverse; }       /* right column: photo right, name left */
.tile[data-side="c"] { flex-direction: column; }
.tile .ph { position: relative; flex: 0 0 44%; background: #2b2318; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.tile[data-side="c"] .ph { flex: 0 0 55%; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph .ic { font-size: calc(var(--fs) * 1.9); }
.tile .ph .star { position: absolute; top: 1px; right: 2px; color: var(--torch); font-size: calc(var(--fs) * 1.15); text-shadow: 0 0 3px #000, 0 0 2px #000; line-height: 1; }
.tile .info { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; color: var(--ink); text-align: center; line-height: 1.05; }
.tile .band { position: absolute; background: #888; }
.tile[data-side="2"] .band { top: 0; left: 0; right: 0; height: 4px; }
.tile[data-side="0"] .band { bottom: 0; left: 0; right: 0; height: 4px; }
.tile[data-side="1"] .band { left: 0; top: 0; bottom: 0; width: 4px; }
.tile[data-side="3"] .band { right: 0; top: 0; bottom: 0; width: 4px; }
.tile .nm { font-weight: 900; color: var(--ink); overflow: hidden; max-width: 100%; word-break: normal; }
.tile .nm.v { writing-mode: vertical-rl; text-orientation: mixed; white-space: nowrap; max-height: 100%; }
.tile .val { font-size: calc(var(--fs) * .78); font-weight: 800; color: #8a4b08; }
.tile .val::before { content: "₹"; content: "◈ "; font-size: .8em; color: #b07d2a; }
.tile .own { display: flex; align-items: center; gap: 1px; justify-content: center; flex-wrap: wrap; }
.tile .own i.em { width: calc(var(--fs) * 1.25); height: calc(var(--fs) * 1.25); font-size: calc(var(--fs) * .7); box-shadow: 0 0 0 1px #fff; }
.tile .own .lv { font-size: calc(var(--fs) * .8); color: #8a4b08; }
.tile.cardt .ph, .tile.corner .ph { background: radial-gradient(circle, #3a2a10, #1c1408); }
.tile.cardt .info, .tile.corner .info { background: #2a1d0b; }
.tile.cardt .nm, .tile.corner .nm { color: var(--torch); }
.tile .ic2 { font-size: calc(var(--fs) * 1.1); }
.tile.owned { box-shadow: inset 0 0 0 3px var(--own); }
.tile.owned .info { background: color-mix(in srgb, var(--own) 22%, var(--parch)); }
.tile.inv { box-shadow: inset 0 0 0 3px var(--torch), 0 0 10px var(--torch); z-index: 3; }
.tile.here { outline: 3px solid #fff; outline-offset: -3px; z-index: 4; box-shadow: 0 0 16px var(--saffron); }
i.oi { display: inline-block; width: calc(var(--fs, 12px) * 1.15); height: calc(var(--fs, 12px) * 1.15); font-style: normal; vertical-align: middle; }
i.oi svg { width: 100%; height: 100%; display: block; }
i.oi.off { opacity: .22; filter: grayscale(1); }
i.oi.hide { display: none; }
.token { position: absolute; width: var(--tok, 18px); height: var(--tok, 18px); border-radius: 50%; border: 2px solid #fff; transform: translate(-50%, -50%); transition: left .2s ease, top .2s ease; z-index: 6; box-shadow: 0 2px 5px #000b; display: flex; align-items: center; justify-content: center; font-size: calc(var(--tok, 18px) * .6); pointer-events: none; }
.token.me { width: calc(var(--tok, 18px) * 1.25); height: calc(var(--tok, 18px) * 1.25); z-index: 7; box-shadow: 0 0 0 2px var(--torch), 0 2px 6px #000; }

/* centre */
#center { color: var(--center-text); position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 3% 4%; text-align: center; overflow: hidden;
  background-image: linear-gradient(#16291ad0, #16291ae0), url(/forts/sardar-shivaji.jpg), radial-gradient(ellipse at 50% 35%, var(--felt1), var(--felt2));
  background-size: cover, auto 92%, cover; background-position: center; background-repeat: no-repeat; }
#spot { position: absolute; inset: 0; background: center/cover no-repeat; opacity: .16; pointer-events: none; }
#center > *:not(#spot):not(#sardars) { position: relative; z-index: 2; }
#sardars { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; justify-content: center; gap: 6px; z-index: 1; }
#sardars .sd { width: clamp(26px, 8%, 52px); aspect-ratio: 1; border-radius: 50%; border: 2px solid #c9a227; background: #2a1d0b center/cover; opacity: .7; color: #f5e6c4; font-weight: 900; font-size: 10px; padding: 0; }
#sardars .sd:hover { opacity: 1; }
#who { font-weight: 800; font-size: 17px; }
#who small { display: block; color: #cfe3c8; font-weight: 600; font-size: 12px; }
#goal { font-size: 12px; color: #e8f2e3; width: min(330px, 92%); }
#goal b { color: var(--torch); }
.bar { height: 7px; background: #0008; border-radius: 99px; overflow: hidden; margin: 3px 0; }
.bar i { display: block; height: 100%; background: var(--torch); border-radius: 99px; }
#dice { display: flex; gap: 8px; min-height: 64px; align-items: center; justify-content: center; }
.kpts { font-size: 28px; font-weight: 900; color: var(--torch); margin-left: 8px; text-shadow: 0 2px 4px #000; }
#actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#actions button { background: var(--saffron); color: var(--on-saffron); border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 800; font-size: 15px; }
#actions button.alt { background: #0007; color: var(--center-text); border: 1px solid #fff3; }
#feed { font-size: 12px; color: #d9e6d3; max-width: 100%; }
#feed div { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0; }
#feed .good { color: #a7f3c0; } #feed .bad { color: #fecaca; } #feed .big { color: var(--torch); font-weight: 700; } #feed .card { color: #c7d2fe; }
#dyk { font-size: 12px; color: #f5e6c4; max-width: 94%; background: #0007; border-radius: 10px; padding: 6px 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#dyk b { color: var(--torch); }
#game.small #sardars, #game.small #dyk { display: none; }
#game.small #who { font-size: 15px; } #game.small #actions button { padding: 8px 14px; font-size: 14px; }

/* kavdya: 3D cowries with thickness, gloss and a shadow */
.kavdi { display: inline-flex; gap: 12px; perspective: 600px; }
.shell { position: relative; width: 30px; height: 42px; display: inline-block; transform-style: preserve-3d; }
.cw { position: absolute; inset: 0; transform-style: preserve-3d; }
.shell.is-d .cw { transform: rotateX(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 0 #0003); }
.fw { transform: translateZ(4px); }
.fd { transform: rotateX(180deg) translateZ(4px); }
.rim { position: absolute; inset: 1px 1px; border-radius: 50%; background: radial-gradient(ellipse, #cdb48a, #8a6a3e); }
.r1 { transform: translateZ(2px); } .r2 { transform: translateZ(0); background: radial-gradient(ellipse, #b78d58, #6f4a22); } .r3 { transform: translateZ(-2px); background: radial-gradient(ellipse, #9c6a35, #4f2c10); }
.shell .shadow { position: absolute; left: 10%; right: 10%; bottom: -8px; height: 8px; border-radius: 50%; background: radial-gradient(ellipse, #000a, transparent 70%); transform: translateZ(-6px); }
.kavdi.flying .shell { animation: toss var(--dur) cubic-bezier(.3,.7,.4,1) var(--d) both; }
.kavdi.flying .cw { animation: spin var(--dur) cubic-bezier(.2,.6,.3,1) var(--d) both; }
.kavdi.flying .shadow { animation: shad var(--dur) cubic-bezier(.3,.7,.4,1) var(--d) both; }
@keyframes toss { 0% { transform: translateY(0) rotateZ(0); } 40% { transform: translateY(calc(var(--h) * -1)) rotateZ(calc(var(--rz) / 2)); } 70% { transform: translateY(0) rotateZ(var(--rz)); } 82% { transform: translateY(-8px) rotateZ(var(--rz)); } 100% { transform: translateY(0) rotateZ(var(--rz)); } }
@keyframes spin { from { transform: rotateX(0) rotateY(0); } to { transform: rotateX(var(--rx)) rotateY(var(--ry)); } }
@keyframes shad { 0% { opacity: 1; } 40% { opacity: .2; transform: translateZ(-6px) scale(.5); } 70%, 100% { opacity: 1; transform: translateZ(-6px) scale(1); } }
.force { display: flex; align-items: center; gap: 12px; }
.force .meter { width: 18px; height: 70px; border-radius: 9px; background: #0009; border: 2px solid #fff6; display: flex; align-items: flex-end; overflow: hidden; }
.force .meter i { display: block; width: 100%; background: linear-gradient(0deg, #4ade80, #ffd54f 60%, #ef4444); border-radius: 7px; }
.force .throw { background: var(--saffron); color: var(--on-saffron); border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 900; font-size: 16px; animation: pulse 1s infinite; }
.force small { color: #e8f2e3; font-size: 11px; max-width: 90px; }
@keyframes pulse { 50% { transform: scale(1.06); } }
#game.small .shell { width: 24px; height: 34px; } #game.small .kavdi { gap: 8px; } #game.small .force .meter { height: 54px; }

/* side panel (wide screens) */
#side { width: 300px; flex: none; overflow: auto; align-self: stretch; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; position: sticky; top: 0; background: var(--bg); padding-bottom: 4px; z-index: 2; }
.tabs button { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 4px; font-weight: 800; font-size: 12px; color: var(--muted); }
.tabs button.on { background: var(--saffron); color: var(--on-saffron); border-color: var(--saffron); }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.pcard.on { border-color: var(--saffron); }
.pcard.out { opacity: .45; }
.pcard .phd { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pcard .phd span { color: var(--muted); }
.pcard .phd .c { margin-left: auto; color: var(--gold); font-weight: 800; }
.pcard .need { font-size: 12px; color: var(--muted); }
.pcard .need b { color: var(--gold); }
.forts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fchip { display: flex; align-items: center; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px 2px 2px; font-size: 11px; font-weight: 700; --fs: 10px; }
.fchip.u { border-color: var(--gold); color: var(--gold); }
.fchip.inv { box-shadow: 0 0 8px var(--gold); }
.fchip .th, .fortlist .th { width: 24px; height: 24px; border-radius: 50%; background: center/cover #333; flex: none; }
.fortlist .th { width: 44px; height: 44px; border-radius: 8px; }
.none { color: var(--muted); font-size: 12px; }
.dates h4 { margin: 0 0 8px; color: var(--saffron-text); font-size: 15px; }
.dt { font-size: 12px; padding: 5px 8px; border-left: 4px solid; margin-bottom: 5px; border-radius: 0 8px 8px 0; opacity: .6; }
.dt span { display: block; font-weight: 800; font-size: 11px; }
.dt.g { border-color: #22c55e; background: #14532d55; } .dt.g span { color: var(--good); }
.dt.r { border-color: #ef4444; background: #7f1d1d55; } .dt.r span { color: var(--bad); }
.dt.past { opacity: 1; }
.dates .lg { font-size: 11px; color: var(--muted); } .dates .lg .g { color: var(--good); } .dates .lg .r { color: var(--bad); }
.sdrow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); cursor: pointer; }
.sdpic { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 2px solid #c9a227; background: #2a1d0b center/cover; display: flex; align-items: center; justify-content: center; font-weight: 900; color: #f5e6c4; }
.sdrow small { display: block; color: var(--muted); font-size: 12px; }

/* sheets */
.modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: 20px 20px 0 0; width: 100%; max-width: 620px; max-height: 94vh; max-height: 94dvh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 760px) { .modal { align-items: center; } .sheet { border-radius: 20px; } }
.sheet h3 { margin: 0 0 4px; font-size: 22px; font-family: var(--font-display); font-weight: 700; font-synthesis: none; }
.sheet .yr { font-size: 13px; color: var(--gold); font-weight: 700; }
.photo { margin: -18px -16px 10px; position: relative; }
.photo img { width: 100%; max-height: 230px; object-fit: cover; display: block; border-radius: 20px 20px 0 0; }
.photo.sm img { max-height: 140px; }
.photo figcaption { position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: #fffc; background: #0008; padding: 2px 6px; border-radius: 6px; max-width: 80%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact { background: var(--fact-bg); border: 1px solid var(--fact-border); color: var(--fact-text); border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.fact b { color: var(--fact-strong); }
.card-text { background: linear-gradient(135deg, var(--cardtext-1), var(--cardtext-2)); border: 1px solid var(--saffron); border-radius: 14px; padding: 16px; font-size: 16px; margin: 10px 0; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btns button { flex: 1 1 140px; border-radius: 12px; padding: 12px; font-weight: 800; border: 1px solid var(--border); background: var(--surface2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; --fs: 16px; }
.btns button.go { background: var(--saffron); color: var(--on-saffron); border: 0; }
.btns button:disabled { opacity: .4; }
.ownrow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 6px 0; --fs: 18px; }
.ownrow .v { margin-left: auto; font-size: 13px; color: var(--muted); }
.ownrow .v b { color: var(--gold); }
.invtag, .hardtag { background: var(--torch); color: #1E1205; font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; letter-spacing: .5px; }
.hardtag { background: #b91c1c; color: #fff; }
.ladder { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; --fs: 26px; }
.rung { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 6px; text-align: center; opacity: .5; }
.rung.on { opacity: 1; border-color: var(--gold); }
.rung.next { opacity: 1; border: 2px dashed var(--saffron); }
.rung b { display: block; font-size: 12px; } .rung small { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; }
.q { font-size: 17px; font-weight: 700; margin: 8px 0 12px; }
.opts { display: grid; gap: 8px; }
@media (min-width: 560px) { .opts { grid-template-columns: 1fr 1fr; } }
.opt { text-align: left; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-weight: 600; }
.opt b { color: var(--saffron-text); margin-right: 6px; }
.opt.gone { opacity: .2; pointer-events: none; }
.opt.right { background: var(--right-bg); border-color: var(--good); }
.opt.wrong { background: var(--wrong-bg); border-color: var(--bad); }
.verdict { font-weight: 800; } .verdict.ok { color: var(--good); } .verdict.no { color: var(--bad); }
.life { display: flex; gap: 8px; margin: 12px 0 0; }
.life button { flex: 1; background: transparent; border: 1px dashed var(--border); border-radius: 10px; padding: 8px 4px; font-size: 13px; font-weight: 700; }
.life button:disabled { opacity: .3; }
.hint { display: flex; gap: 10px; align-items: center; background: var(--surface2); border-radius: 12px; padding: 8px 10px; margin-top: 10px; font-size: 14px; }
.hint img { width: 40px; height: 40px; object-fit: cover; object-position: top; border-radius: 50%; }
.progress { color: var(--gold); font-weight: 800; font-size: 13px; }
.fortlist .f { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--border); cursor: pointer; --fs: 12px; }
.fortlist .f .grow { flex: 1; } .fortlist .f small { color: var(--muted); display: block; }
.vs { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.vs > div { flex: 1; text-align: center; background: var(--surface2); border-radius: 12px; padding: 6px; }
.vs img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; }
.vs b { display: block; } .vs small { color: var(--muted); }
.vs > span { font-weight: 900; color: var(--saffron-text); font-size: 20px; }
.rank { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.rank a { color: var(--gold); }
.win { text-align: center; } .win .big { font-size: 34px; font-weight: 700; font-family: var(--font-display); font-synthesis: none; color: var(--saffron-text); margin: 6px 0; }
.mandil { width: 160px; display: block; margin: 0 auto; filter: drop-shadow(0 6px 12px #000a); }
.toast { font-size: 13px; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--saffron); border-radius: 999px; padding: 10px 16px; font-weight: 700; z-index: 60; max-width: 90vw; text-align: center; }
/* war */
.modal.warmode { align-items: stretch; }
.modal.warmode .sheet { max-width: 760px; height: 100%; max-height: 100vh; border-radius: 0; padding: 10px 12px; display: flex; }
.war { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.war .half { flex: 1; background: var(--surface2); border: 2px solid var(--pc); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
.war .half.rot { transform: rotate(180deg); }
.war .hh { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.war .pts { margin-left: auto; font-size: 26px; font-weight: 900; color: var(--gold); }
.war .st { font-size: 12px; color: var(--muted); min-width: 70px; text-align: right; }
.war .good { color: var(--good); font-weight: 800; } .war .bad { color: var(--bad); font-weight: 800; }
.war .wq { font-weight: 700; font-size: 15px; }
.war .opts { grid-template-columns: 1fr 1fr; }
.war .opt { padding: 10px; font-size: 14px; }
.war .opt.mine { box-shadow: 0 0 0 3px var(--gold); }
.wmid { text-align: center; color: var(--saffron-text); font-weight: 800; font-size: 13px; }
.wfact { color: var(--fact-text); font-weight: 500; font-size: 12px; margin-top: 4px; }

#game.small .tile .ph { flex-basis: 40%; }
.gamebody.below { flex-direction: column; align-items: center; }
.gamebody.below #side { width: 100%; max-width: 620px; flex: 1; min-height: 0; overflow: auto; align-self: center; }

/* online play */
.netctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.netctl .or { color: var(--muted); font-size: 13px; }
#net-code { width: 5.5em; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; text-align: center; }
#online.hl { border-color: var(--saffron); }
#net-room { margin-top: 10px; }
.roomcode { display: flex; align-items: baseline; gap: 10px; }
.roomcode b { font-size: 34px; letter-spacing: .25em; color: var(--gold); }
.btnlink { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }
.prow .netname { flex: 1; font-weight: 600; }
.prow input.page { flex: 0 0 56px; width: 56px; text-align: center; padding: 9px 2px; -moz-appearance: textfield; }
.prow input.page::-webkit-outer-spin-button, .prow input.page::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
@media (max-width: 480px) {
  .prow { gap: 5px; }
  .prow input.page { flex-basis: 44px; width: 44px; }
  .prow input.pname { padding: 9px 7px; }
  select.emb { font-size: 16px; padding: 6px 1px; }
  .seg button { padding: 7px 7px; font-size: 12px; }
  .prow .x { padding: 0 2px; }
}
.agenote { margin: 0 0 8px; }
.lvtag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .4px; vertical-align: middle; text-transform: uppercase; }
.lvtag.lv1 { background: #1f7a3d; color: #fff; }
.lvtag.lv2 { background: #b7791f; color: #fff; }
.lvtag.lv3 { background: #c2410c; color: #fff; }
.lvtag.lv4 { background: #b91c1c; color: #fff; }
.prow .tag { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.waitnote { color: var(--muted); font-size: 14px; text-align: center; margin: 8px 0 0; }
#actions .waitnote { display: block; padding: 6px 10px; }
body.netclient #themes-card, body.netclient #add-player, body.netclient #start, body.netclient #resume, body.netclient #resume-net,
body.netclient .row:has(#rounds), body.netclient #players .prow:not(:first-child), body.netclient #players .seg, body.netclient #players .x { display: none !important; }
.netctl .ghost { width: auto; flex: 1 1 8em; margin-top: 0; }
#net-code { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; color: inherit; font-size: 16px; }
.passbox { display: flex; flex-direction: column; gap: 4px; background: var(--fact-bg); border: 1.5px solid var(--good); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.passbox b { color: var(--good); font-size: 18px; }
.passbox span { color: var(--muted); }
/* long option text (e.g. "Until someone becomes Swarajya Rakshak") must never widen the page */
.row select, #rounds { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.row label { flex: 0 0 auto; }
.nafoot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin: 22px 0 8px; color: var(--muted); font-size: 13px; text-align: center; }
.nafoot img { height: 30px; width: auto; }
.nafoot b { color: var(--text); }
.nafoot nav { flex-basis: 100%; }
.nafoot a { color: var(--muted); }

/* war score card */
.warsum { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.warsum h3 { margin: 0; }
.wsrow { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 2px solid var(--pc); border-radius: 14px; padding: 10px 12px; }
.wsrow.win { box-shadow: 0 0 0 2px var(--gold) inset; }
.wsrow .wsn { flex: 1; min-width: 0; text-align: left; align-items: flex-start; display: flex; flex-direction: column; gap: 2px; }
.wsrow .wsn small { color: var(--muted); }
.wsrow .wsp { font-size: 34px; font-weight: 900; color: var(--gold); }
.wsdots { display: flex; flex-wrap: wrap; gap: 3px; }
.wsdots i { font-style: normal; font-size: 12px; font-weight: 900; width: 18px; height: 18px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; }
.wsdots i.y { background: rgba(74,222,128,.18); color: var(--good); } .wsdots i.n { background: rgba(255,120,140,.15); color: var(--bad); }
.wsres { font-weight: 800; font-size: 17px; text-align: center; margin: 4px 0; }
.war .st small { color: var(--muted); font-weight: 600; }

/* ===== theme switch + heritage polish ===== */
.themebtn { width: 34px; height: 34px; flex: none; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.topbar .tools { display: flex; align-items: center; gap: 8px; }
.card h2 { font-family: var(--font-display); font-weight: 700; font-synthesis: none; letter-spacing: .3px; }
:root[lang="mr"] .card h2, :root[lang="hi"] .card h2, :root[lang="mr"] .sheet h3, :root[lang="hi"] .sheet h3, :root[lang="mr"] .gtitle, :root[lang="hi"] .gtitle { font-family: var(--font-deva-display); font-weight: 400; letter-spacing: 0; }
.photo img { border-bottom: 3px solid #8A6A3A; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
/* light: parchment grain with faint map lines; dark: torch-warm glow at the top */
:root[data-theme="light"] body { background-color: var(--bg); background-image: radial-gradient(rgba(110,80,30,.06) 1px, transparent 1.2px), repeating-linear-gradient(35deg, rgba(110,80,30,.035) 0 1px, transparent 1px 46px); background-size: 7px 7px, auto; }
:root[data-theme="dark"] body { background-color: var(--bg); background-image: radial-gradient(ellipse 120% 40% at 50% -10%, rgba(247,164,64,.10), transparent 60%); background-attachment: fixed; }
:root[data-theme="light"] .card, :root[data-theme="light"] .pcard, :root[data-theme="light"] .sheet { box-shadow: 0 1px 2px rgba(70,45,15,.06), 0 8px 20px rgba(70,45,15,.08); }
:root[data-theme="light"] .modal { background: rgba(58,36,16,.45); }
:root[data-theme="light"] #board { box-shadow: 0 10px 30px rgba(70,45,15,.35); }
:root[data-theme="light"] .nafoot img { filter: none; }

.freebadge { margin: 4px 0 10px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--saffron) 14%, transparent); color: var(--text); font-weight: 700; text-align: center; }

/* home → host / join views */
#setup[data-view="home"] .v-room, #setup[data-view="home"] .v-host, #setup:not([data-view="home"]) .v-home, #setup[data-view="join"] .v-host { display: none !important; }
.namerow { display: flex; gap: 8px; margin-bottom: 6px; }
.namerow input { flex: 1; min-width: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-size: 16px; color: var(--text); }
.namerow #my-age { flex: 0 0 76px; text-align: center; -moz-appearance: textfield; }
.namerow #my-age::-webkit-outer-spin-button, .namerow #my-age::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.primary.big { padding: 16px; font-size: 18px; margin-top: 6px; }
.or-line { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 8px; display: flex; align-items: center; gap: 10px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.joinrow { display: flex; gap: 8px; }
.joinrow input { flex: 1; min-width: 0; text-align: center; letter-spacing: .3em; font-size: 20px; font-weight: 800; text-transform: uppercase; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; color: var(--text); }
.joinrow .ghost { flex: 0 0 auto; width: auto; margin-top: 0; padding: 0 22px; font-size: 16px; }
#home-card #resume, #home-card #resume-net { margin-top: 12px; }
.viewhead { display: flex; align-items: center; gap: 10px; }
.viewhead h2 { margin: 0; flex: 1; }
.viewhead .backbtn { width: auto; margin: 0; padding: 6px 12px; font-size: 14px; }
.prow .you { font-size: 12px; color: var(--muted); font-weight: 600; }
.prow .bottag { font-size: 12px; color: var(--muted); border: 1px dashed var(--border); border-radius: 999px; padding: 2px 8px; flex: none; }
#start:disabled { opacity: .5; }

/* ===================== Melody Queen look: neon stage at night (dark) / glossy magazine (light) ===================== */
:root {
  --bg: #0E0B1A; --surface: #17132A; --surface2: #211B3A; --border: #352C5A; --text: #F1ECFF; --muted: #B7AED8;
  --saffron: #FF4FA3; --on-saffron: #FFFFFF; --saffron-text: #FF7AC0; --gold: #FFD54F; --torch: #FFD54F;
  --good: #7CE3A4; --bad: #FF8A80; --felt1: #2A1B4F; --felt2: #120C26; --center-text: #F1ECFF;
  --right-bg: #173B2B; --wrong-bg: #4A1830;
  --fact-bg: #1B1838; --fact-border: #3E3577; --fact-text: #DCD6FF; --fact-strong: #FFD54F;
  --cardtext-1: #2B0B2A; --cardtext-2: #12061A;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-deva-display: 'Playfair Display', Georgia, serif;
}
:root[data-theme="light"] {
  --bg: #FFF5FA; --surface: #FFFFFF; --surface2: #FBEAF3; --border: #EBC8DA; --text: #2A1230; --muted: #6E5470;
  --saffron: #D81B78; --on-saffron: #FFFFFF; --saffron-text: #B3125F; --gold: #9A6A00; --torch: #FFC400;
  --good: #1E7A45; --bad: #B3261E; --felt1: #3B1E6E; --felt2: #1A0F3A; --center-text: #F7F1FF;
  --right-bg: #DDF3E6; --wrong-bg: #FBDDE5;
  --fact-bg: #F4EEFF; --fact-border: #CDB8F5; --fact-text: #2D1B58; --fact-strong: #6A2BD6;
  --cardtext-1: #FFF4FB; --cardtext-2: #FBE2F0;
}
:root[data-theme="dark"] body { background-image: radial-gradient(ellipse 80% 35% at 15% -5%, rgba(255,79,163,.16), transparent 60%), radial-gradient(ellipse 80% 35% at 85% -5%, rgba(79,195,247,.14), transparent 60%); background-attachment: fixed; }
:root[data-theme="light"] body { background-image: radial-gradient(rgba(216,27,120,.05) 1px, transparent 1.2px); background-size: 8px 8px; }
h1 { font-style: italic; letter-spacing: 0; }
h1 .mr { font-style: normal; font-family: var(--font-body); font-size: 15px; letter-spacing: 3px; text-transform: uppercase; color: var(--saffron-text); font-weight: 800; margin-top: 6px; }
.gtitle { font-style: italic; }
#center { background-image: radial-gradient(ellipse at 50% 15%, rgba(255,79,163,.28), transparent 55%), radial-gradient(ellipse at 50% 100%, rgba(79,195,247,.22), transparent 60%), radial-gradient(ellipse at 50% 40%, var(--felt1), var(--felt2)); background-size: cover; }
.tile .ph { background: linear-gradient(160deg, #241b45, #120c26); }
.tile.top { box-shadow: inset 0 0 0 2px var(--gold); }
.tile.cardt .ph, .tile.corner .ph { background: radial-gradient(circle, #3b2370, #140c2a); }
/* artist disc with initials */
.av { --ac: #888; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 900; letter-spacing: .5px; flex: none;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--ac) 55%, #fff), var(--ac) 55%, color-mix(in srgb, var(--ac) 60%, #000)); box-shadow: 0 1px 3px #0008, inset 0 0 0 2px #ffffff40; text-shadow: 0 1px 2px #0007; }
.tile .ph .av { width: 72%; aspect-ratio: 1; font-size: calc(var(--fs) * 1.25); }
.av.xs { width: 22px; height: 22px; font-size: 9px; margin-right: 4px; }
.av.lg { width: 58px; height: 58px; font-size: 20px; }
.qhead { display: flex; align-items: center; gap: 10px; } .qhead .av { width: 40px; height: 40px; font-size: 14px; } .qhead h3 { margin: 0; }
.ahead { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; } .ahead h3 { margin: 0; } .ahead.sm .av.lg { width: 46px; height: 46px; font-size: 16px; }
.vs .av.lg { margin: 4px auto; display: flex; }
.oe { font-size: 1em; line-height: 1; }
i.oi .oe { font-size: calc(var(--fs, 12px) * 0.95); }
.bigline { font-size: 18px; }
.outcome { font-weight: 800; padding: 8px 12px; border-radius: 12px; margin: 6px 0; text-align: center; }
.outcome.ok { background: var(--right-bg); color: var(--good); } .outcome.no { background: var(--wrong-bg); color: var(--bad); }
.bandrow { border-left: 4px solid var(--bc); padding: 6px 10px; margin: 8px 0; background: var(--surface2); border-radius: 10px; }
.bandrow > b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.bandrow .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 3px; }
.shell { width: 28px; height: 40px; }
.rim { border-radius: 40% 40% 50% 50%; background: radial-gradient(ellipse, #ff9ccc, #b3126a); }
.r2 { background: radial-gradient(ellipse, #c2186b, #6a0a3d); } .r3 { background: radial-gradient(ellipse, #5b5f73, #1c1e2a); }
.mandil { width: 150px; }
.theme b { font-size: 16px; }
/* tiles: stage-dark cards in both themes, with gold names */
.tile { --parch: #1d1736; --ink: #F1ECFF; border-color: #0b0818; }
.tile .val { color: #FFD54F; } .tile .val::before { content: ""; }
.tile.cardt .info, .tile.corner .info { background: #151028; }
.tile.cardt .nm, .tile.corner .nm { color: #FF7AC0; }
.tile.owned .info { background: color-mix(in srgb, var(--own) 30%, #1d1736); }
