/* Nornvi Games. Colours, fonts and logos come from https://brand.nornvi.com/brand.css (the --nv-* variables).
   The variables below are this site's own additions (boards, cards, game pieces). */
:root {
  --g-card: #FFFDFB; --g-card-ink: #2B1022; --g-card-red: #A10A3F; --g-card-back: #50133B; --g-card-back2: #6A2A54;
  --g-sq-light: #EADFE8; --g-sq-dark: #B99DB2; --g-board: #D9C7D5; --g-line: #7A5870;
  --g-p0: #50133B; --g-p0-edge: #2E0A22; --g-p1: #FBF6EE; --g-p1-edge: #7A5870;
  --g-felt: #E7DCE6; --g-hi: #0F5E4B; --g-hi-soft: rgba(15, 94, 75, .22); --g-last: rgba(161, 10, 63, .22);
  --g-ok: #0F5E4B; --g-warn: #A10A3F; --g-chip: #E9DDE7; --g-shadow: 0 1px 2px rgba(80, 19, 59, .12), 0 4px 14px rgba(80, 19, 59, .08);
  --g-accent-text: #0F5E4B; --g-tab-h: 60px; --g-rail: 232px;
}
@media (prefers-color-scheme: dark) { :root[data-nv-theme="auto"] {
  --g-card: #F4EDF2; --g-sq-light: #B39AAD; --g-sq-dark: #6E5167; --g-board: #24141F; --g-line: #8E7386;
  --g-p0: #7B2A61; --g-p0-edge: #D7C7D3; --g-p1: #F3ECE2; --g-p1-edge: #1A0D15;
  --g-felt: #150A11; --g-hi: #3FB896; --g-hi-soft: rgba(63, 184, 150, .28); --g-last: rgba(217, 87, 127, .3);
  --g-ok: #3FB896; --g-warn: #E0789A; --g-chip: #24141F; --g-shadow: 0 0 0 1px #3A2433; --g-accent-text: #D7C7D3;
} }
:root[data-nv-theme="dark"] {
  --g-card: #F4EDF2; --g-sq-light: #B39AAD; --g-sq-dark: #6E5167; --g-board: #24141F; --g-line: #8E7386;
  --g-p0: #7B2A61; --g-p0-edge: #D7C7D3; --g-p1: #F3ECE2; --g-p1-edge: #1A0D15;
  --g-felt: #150A11; --g-hi: #3FB896; --g-hi-soft: rgba(63, 184, 150, .28); --g-last: rgba(217, 87, 127, .3);
  --g-ok: #3FB896; --g-warn: #E0789A; --g-chip: #24141F; --g-shadow: 0 0 0 1px #3A2433; --g-accent-text: #D7C7D3;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--nv-bg); color: var(--nv-text); font: 400 1rem/1.5 var(--nv-font-sans); -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
h1, h2, h3 { font-family: var(--nv-font-serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.1rem); } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0; } a { color: var(--nv-link); text-underline-offset: .2em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--g-hi); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--nv-surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.soft { color: var(--nv-text-soft); } .small { font-size: .875rem; } .center { text-align: center; }
[hidden] { display: none !important; }
svg { width: 1.5em; height: 1.5em; flex: none; }

/* ---------- shell: left rail on wide screens, bottom tabs on phones */
.app { min-height: 100%; display: grid; grid-template-columns: var(--g-rail) 1fr; }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--nv-border); }
.rail .brand { display: block; padding: 4px 8px 18px; }
.rail .brand img { width: 100%; max-width: 204px; height: auto; display: block; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; color: var(--nv-text-soft); font-weight: 600; position: relative; }
.nav-item:hover { background: var(--nv-surface); color: var(--nv-text); }
.nav-item[aria-current="page"] { background: var(--nv-surface); color: var(--nv-text); box-shadow: inset 3px 0 0 var(--nv-ruby); }
.nav-item .dot { position: absolute; top: 8px; left: 28px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--nv-ruby); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.rail .spacer { flex: 1; }
.main { min-width: 0; padding: 28px clamp(16px, 4vw, 44px) 40px; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.tabs { display: none; }
@media (max-width: 899px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 6px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar img { height: 38px; width: auto; display: block; }
  .main { padding: 8px 16px calc(var(--g-tab-h) + 28px + env(safe-area-inset-bottom)); }
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--nv-surface); border-top: 1px solid var(--nv-border); padding-bottom: env(safe-area-inset-bottom); }
  .tabs .nav-item { flex-direction: column; gap: 2px; padding: 8px 4px 7px; border-radius: 0; font-size: .75rem; min-height: var(--g-tab-h); justify-content: center; }
  .tabs .nav-item[aria-current="page"] { box-shadow: inset 0 3px 0 var(--nv-ruby); background: none; }
  .tabs .nav-item .dot { left: 50%; top: 4px; margin-left: 6px; }
}
.app.playing { display: block; }
.app.playing > .rail, .app.playing > .tabs, .app.playing > .topbar { display: none; }

/* ---------- common pieces */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 44px; padding: 0 1.2em; border-radius: 999px; border: 1.5px solid var(--nv-border); background: var(--nv-surface); color: var(--nv-text); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--nv-text-soft); }
.btn.primary { background: var(--nv-button-bg); border-color: var(--nv-button-bg); color: var(--nv-button-text); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.big { min-height: 54px; font-size: 1.1rem; padding: 0 1.8em; }
.btn.quiet { border-color: transparent; background: none; }
.btn.small { min-height: 36px; font-size: .875rem; padding: 0 .9em; }
.btn.danger { color: var(--g-warn); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 0; background: none; color: inherit; }
.icon-btn:hover { background: var(--nv-surface); }
.card { background: var(--nv-surface); border: 1px solid var(--nv-border); border-radius: var(--nv-radius); padding: 16px; }
.row { display: flex; align-items: center; gap: 12px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); } .stack.lg { gap: 28px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--nv-border); background: none; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--nv-text); color: var(--nv-bg); border-color: var(--nv-text); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--g-chip); color: var(--nv-text-soft); }
.field { display: grid; gap: 4px; } .field label, .label { font-weight: 600; font-size: .9rem; }
input[type="text"], input[type="search"], select { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--nv-border); background: var(--nv-surface); width: 100%; }
.seg { display: inline-flex; border: 1.5px solid var(--nv-border); border-radius: 12px; overflow: hidden; flex-wrap: wrap; }
.seg button { min-height: 42px; padding: 0 14px; border: 0; background: none; font-weight: 600; font-size: .9rem; }
.seg button[aria-pressed="true"] { background: var(--nv-text); color: var(--nv-bg); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 1.15rem; flex: none; position: relative; }
.avatar.sm { width: 30px; height: 30px; font-size: .9rem; } .avatar.lg { width: 64px; height: 64px; font-size: 1.8rem; }
.avatar .on { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #2FA37F; border: 2px solid var(--nv-surface); }
.empty { text-align: center; padding: 28px 16px; color: var(--nv-text-soft); border: 1.5px dashed var(--nv-border); border-radius: var(--nv-radius); }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--g-tab-h) + 18px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 16px; }
.app.playing ~ .toasts { bottom: auto; top: calc(62px + env(safe-area-inset-top)); }
.toast { background: var(--nv-text); color: var(--nv-bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .95rem; max-width: 30rem; box-shadow: var(--g-shadow); animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.sheet-back { position: fixed; inset: 0; background: rgba(20, 6, 15, .55); z-index: 40; display: grid; align-items: end; justify-items: center; }
.sheet { background: var(--nv-bg); color: var(--nv-text); width: min(100%, 34rem); max-height: 88dvh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--nv-border); animation: rise .2s ease-out; }
@media (min-width: 640px) { .sheet-back { align-items: center; } .sheet { border-radius: 20px; } }
.sheet h2 { margin-bottom: 10px; }
.nv-legal { margin-top: 44px; color: var(--nv-text-soft); }

/* ---------- home */
.hello { display: grid; gap: 4px; margin-bottom: 18px; }
.strip { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--g-hi) calc(var(--p) * 1%), var(--nv-border) 0); position: relative; font: 700 1.2rem var(--nv-font-serif); }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--nv-surface); }
.ring span { position: relative; }
.ring.lg { width: 92px; height: 92px; font-size: 2rem; } .ring.lg::before { inset: 7px; }
.bar { height: 8px; border-radius: 4px; background: var(--nv-border); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--g-hi); border-radius: 4px; }
.hero { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.stack, .setup, .gcols > * { min-width: 0; } .stack > *, .setup > * { min-width: 0; }
.continue { display: grid; gap: 8px; }
.resume { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--nv-border); background: var(--nv-bg); text-decoration: none; color: inherit; }
.resume:hover { border-color: var(--nv-text-soft); }
.resume .your { color: var(--g-accent-text); font-weight: 700; }
.gicon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--g-chip); color: var(--nv-text); flex: none; }
.gicon svg { width: 26px; height: 26px; } .gicon.lg { width: 72px; height: 72px; border-radius: 18px; } .gicon.lg svg { width: 42px; height: 42px; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 172px); gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: grid; gap: 8px; align-content: start; padding: 14px; border-radius: var(--nv-radius); border: 1px solid var(--nv-border); background: var(--nv-surface); text-decoration: none; color: inherit; scroll-snap-align: start; position: relative; min-height: 148px; }
.tile:hover { border-color: var(--nv-text-soft); transform: translateY(-1px); }
.tile .name { font: 600 1.05rem/1.2 var(--nv-font-serif); }
.tile .meta { font-size: .8rem; color: var(--nv-text-soft); }
.tile .fav { position: absolute; top: 6px; right: 6px; }
.pips { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; min-height: 10px; }
.pips i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--nv-text-soft); opacity: .5; }
.pips i.on { background: var(--g-hi); border-color: var(--g-hi); opacity: 1; }
.pips i.t { border-radius: 2px; }
.pips .n { font-size: .75rem; color: var(--nv-text-soft); margin-left: 4px; }
.try-new { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }

/* ---------- game page */
.ghead { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.gcols { display: grid; gap: 20px; }
@media (min-width: 880px) { .gcols { grid-template-columns: 1.15fr 1fr; align-items: start; } }
.setup { display: grid; gap: 16px; }
.ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.rung { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 12px; border: 1.5px solid var(--nv-border); background: none; position: relative; min-height: 58px; }
.rung b { font: 700 1.1rem var(--nv-font-serif); } .rung small { font-size: .62rem; color: var(--nv-text-soft); line-height: 1.1; text-align: center; }
.rung.beat { border-color: var(--g-hi); background: var(--g-hi-soft); }
.rung.beat::after { content: "✓"; position: absolute; top: 1px; right: 5px; font-size: .7rem; font-weight: 700; color: var(--g-accent-text); }
.rung[aria-pressed="true"] { outline: 3px solid var(--nv-text); outline-offset: 1px; }
.rung.next { border-style: dashed; border-color: var(--nv-text); }
.how h3 { margin: 12px 0 2px; font-size: .95rem; font-family: var(--nv-font-sans); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat { padding: 10px 12px; border-radius: 12px; background: var(--g-chip); }
.stat b { display: block; font: 700 1.3rem var(--nv-font-serif); } .stat span { font-size: .78rem; color: var(--nv-text-soft); }

/* ---------- progress, friends */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--nv-border); background: var(--nv-surface); }
.badge .em { font-size: 1.7rem; line-height: 1.2; } .badge b { font-size: .82rem; line-height: 1.2; } .badge small { font-size: .7rem; color: var(--nv-text-soft); line-height: 1.25; }
.badge.locked { opacity: .5; } .badge.locked .em { filter: grayscale(1); }
.jrow { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--nv-border); text-decoration: none; color: inherit; }
.jrow:first-child { border-top: 0; }
table.plain { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.plain th { text-align: left; font-weight: 600; color: var(--nv-text-soft); font-size: .8rem; padding: 6px 8px; }
table.plain td { padding: 8px; border-top: 1px solid var(--nv-border); }
.friend { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--nv-border); }
.friend:first-child { border-top: 0; }
.code { font: 700 1.3rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatars button { aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; display: grid; place-items: center; font-size: 1.1rem; background: var(--g-chip); }
.avatars button[aria-pressed="true"] { border-color: var(--nv-text); }

/* ---------- playing: the table takes the whole screen */
.app.playing .main { padding: 0; max-width: none; }
.play { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto; background: var(--nv-bg); }
.play > .pbar { grid-row: 1; } .play > .side { grid-row: 2; } .play > .coach { grid-row: 3; } .play > .stage { grid-row: 4; } .play > .actions { grid-row: 5; }
.play.wide { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.play.wide > .side { grid-row: 2; grid-column: 2; } .play.wide > .coach { grid-row: 3; grid-column: 2; align-self: start; margin: 0 14px; }
.play.wide > .stage { grid-row: 2 / span 2; grid-column: 1; } .play.wide > .actions { grid-row: 4; }
.pbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); grid-column: 1 / -1; border-bottom: 1px solid var(--nv-border); }
.pbar .t { flex: 1; min-width: 0; padding: 0 4px; }
.pbar .t b { display: block; font: 600 1.05rem/1.2 var(--nv-font-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbar .t span { font-size: .85rem; color: var(--nv-text-soft); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbar .t span.go { color: var(--g-accent-text); font-weight: 700; }
.side { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; align-items: stretch; scrollbar-width: none; }
.play.wide .side { flex-direction: column; overflow: auto; padding: 14px; }
.play.wide > .side, .play.wide > .coach { border-left: 0; }
.seat { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1.5px solid var(--nv-border); white-space: nowrap; font-weight: 600; font-size: .9rem; flex: none; }
.play.wide .seat { border-radius: 14px; padding: 10px; }
.seat.turn { border-color: var(--g-hi); background: var(--g-hi-soft); }
.seat .sc { margin-left: auto; padding-left: 8px; font: 700 1rem var(--nv-font-serif); }
.seat .mark { width: 14px; height: 14px; border-radius: 50%; border: 2px solid; flex: none; }
.seat.away { opacity: .55; }
.coach { margin: 0 12px 6px; padding: 10px 12px; border-radius: 12px; background: var(--g-hi-soft); border: 1px solid var(--g-hi); font-size: .95rem; display: flex; gap: 10px; align-items: start; }
.coach b { color: var(--g-accent-text); }
.stage { min-height: 0; min-width: 0; display: grid; place-items: center; padding: 8px; overflow: auto; position: relative; }
.play.wide .stage { border-right: 1px solid var(--nv-border); }
.actions { display: flex; justify-content: center; gap: 6px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--nv-border); grid-column: 1 / -1; overflow-x: auto; }
.act { display: grid; justify-items: center; gap: 1px; min-width: 62px; min-height: 50px; padding: 5px 8px; border-radius: 12px; border: 0; background: none; font-size: .74rem; font-weight: 600; color: var(--nv-text); }
.act:hover:not(:disabled) { background: var(--nv-surface); } .act:disabled { opacity: .35; cursor: default; }
.act.primary { background: var(--nv-button-bg); color: var(--nv-button-text); padding: 5px 18px; }
.curtain { position: fixed; inset: 0; z-index: 50; background: var(--g-card-back); color: #F1EAF1; display: grid; place-items: center; text-align: center; padding: 24px; }
.curtain h1 { color: #fff; margin-bottom: 8px; } .curtain .btn { margin-top: 22px; }
.result { text-align: center; display: grid; gap: 12px; justify-items: center; }
.result .big { font-size: 3rem; line-height: 1; }
.gains { display: grid; gap: 4px; width: 100%; max-width: 22rem; text-align: left; font-size: .92rem; }
.gains div { display: flex; justify-content: space-between; gap: 12px; } .gains b { color: var(--g-accent-text); }
.lobby { width: min(100%, 30rem); display: grid; gap: 14px; }
.lobby .seatrow { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--nv-border); min-height: 60px; }
.lobby .seatrow.open { border-style: dashed; color: var(--nv-text-soft); }

/* ---------- boards */
.board-wrap { display: grid; gap: 8px; justify-items: center; width: 100%; }
.board { --n: 8; display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, calc((100dvh - 250px) * var(--ar, 1)), 640px); aspect-ratio: var(--ar, 1); border-radius: 10px; overflow: hidden; background: var(--g-board); box-shadow: var(--g-shadow); position: relative; touch-action: manipulation; user-select: none; -webkit-user-select: none; container-type: inline-size; }
.play.wide .board { width: min(100%, calc((100dvh - 190px) * var(--ar, 1)), 720px); }
.cell { border: 0; padding: 0; margin: 0; background: none; position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; aspect-ratio: 1; color: inherit; -webkit-tap-highlight-color: transparent; }
.cell:disabled { cursor: default; }
.cell.lt { background: var(--g-sq-light); } .cell.dk { background: var(--g-sq-dark); }
.cell.sel { box-shadow: inset 0 0 0 4px var(--g-hi); }
.cell.last::before { content: ""; position: absolute; inset: 0; background: var(--g-last); }
.cell.can::after { content: ""; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: var(--g-hi); opacity: .75; }
.cell.can.has::after { width: 86%; height: 86%; background: none; border: 4px solid var(--g-hi); opacity: 1; }
.cell.hint { box-shadow: inset 0 0 0 4px var(--nv-ruby); }
.cell.win { background-color: var(--g-hi-soft); }
.cell.check { background: radial-gradient(circle, rgba(161, 10, 63, .75), transparent 70%), var(--g-sq-light); }
.pc { width: 78%; height: 78%; border-radius: 50%; position: relative; z-index: 1; display: grid; place-items: center; }
.pc.p0 { background: var(--g-p0); box-shadow: inset 0 0 0 2px var(--g-p0-edge), 0 2px 3px rgba(0, 0, 0, .3); color: #F1EAF1; }
.pc.p1 { background: var(--g-p1); box-shadow: inset 0 0 0 2px var(--g-p1-edge), 0 2px 3px rgba(0, 0, 0, .3); color: #3A1A2E; }
.pc.p1::before { content: ""; position: absolute; inset: 22%; border-radius: 50%; border: 2px solid var(--g-p1-edge); opacity: .45; } /* light pieces carry a ring, so colour isn't the only cue */
.pc.king::after { content: "♛\FE0E"; font-size: 6cqw; line-height: 1; position: relative; }
.pc.pop { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: .4; } }
.chessp { font-size: 9.800cqw; line-height: 1; position: relative; z-index: 1; font-family: "Segoe UI Symbol", "Noto Sans Symbols2", "Apple Symbols", "DejaVu Sans", serif; }
.chessp.w { color: #FBF6EE; -webkit-text-stroke: 1.2px #2B1022; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.chessp.b { color: #2A0B1F; -webkit-text-stroke: .8px #F1EAF1; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.coord { position: absolute; font-size: .6rem; font-weight: 700; opacity: .6; pointer-events: none; z-index: 1; } .coord.f { right: 3px; bottom: 1px; } .coord.r { left: 3px; top: 1px; }
.board.ttt { --n: 3; background: var(--nv-surface); gap: 4px; padding: 4px; max-width: 420px; }
.board.ttt .cell { background: var(--g-sq-light); border-radius: 8px; font: 700 22cqw/1 var(--nv-font-serif); }
.board.ttt .x { color: var(--g-p0); } .board.ttt .o { color: var(--g-hi); }
:root[data-nv-theme="dark"] .board.ttt .x { color: var(--nv-light-aubergine); }
@media (prefers-color-scheme: dark) { :root[data-nv-theme="auto"] .board.ttt .x { color: var(--nv-light-aubergine); } }
.board.c4 { --n: 7; --ar: 7 / 6; background: var(--g-sq-dark); padding: 1.5%; gap: 0; }
.board.c4 .cell::before { content: ""; position: absolute; inset: 8%; border-radius: 50%; background: var(--nv-bg); }
.board.c4 .pc { width: 84%; height: 84%; } .board.c4 .pc.p1 { background: var(--nv-malachite); box-shadow: inset 0 0 0 2px #083D30; color: #fff; }
.board.c4 .cell.win .pc { outline: 4px solid var(--nv-ruby); }
.board.rev .cell { background: var(--g-sq-light); box-shadow: inset 0 0 0 .5px var(--g-line); }
.board.go { --n: 15; background: var(--g-sq-light); }
.board.go .cell::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--g-line); opacity: .6; }
.board.go .cell::after { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid var(--g-line); opacity: .6; width: auto; height: 0; border-radius: 0; background: none; }
.board.go .cell.hint { box-shadow: inset 0 0 0 3px var(--nv-ruby); border-radius: 50%; }
.board.go .pc { width: 88%; height: 88%; } .board.go .cell.last .pc { outline: 3px solid var(--nv-ruby); outline-offset: -1px; } .board.go .cell.last::before { background: none; inset: auto; left: 50%; top: 0; bottom: 0; }
.board.mor { --n: 7; background: var(--g-sq-light); }
.board.mor svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; stroke: var(--g-line); }
.board.mor .cell.pt::before { content: ""; width: 26%; height: 26%; border-radius: 50%; background: var(--g-line); position: absolute; }
.board.mor .cell.can::after { width: 60%; height: 60%; opacity: .5; }
.board.mor .cell.can.has::after { width: 92%; height: 92%; }
.below { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; font-weight: 600; min-height: 32px; font-size: .95rem; }
.below .pc { width: 20px; height: 20px; display: inline-grid; vertical-align: middle; }

/* ---------- cards */
.cardgame { width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; --cw: clamp(44px, 12.5vw, 84px); max-width: 900px; }
.pcard { width: var(--cw); aspect-ratio: 5 / 7; border-radius: calc(var(--cw) * .1); background: var(--g-card); color: var(--g-card-ink); box-shadow: 0 0 0 1px rgba(43, 16, 34, .35), 0 1px 3px rgba(0, 0, 0, .2); position: relative; flex: none; border: 0; padding: 0; font-family: var(--nv-font-sans); display: block; user-select: none; -webkit-user-select: none; }
.pcard.red { color: var(--g-card-red); }
.pcard .tl { position: absolute; left: 7%; top: 3%; font-weight: 700; font-size: calc(var(--cw) * .3); line-height: 1.05; text-align: center; }
.pcard .tl small { display: block; font-size: 1em; }
.pcard .mid { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cw) * .52); padding-top: 22%; }
.pcard.back { background: repeating-linear-gradient(45deg, var(--g-card-back), var(--g-card-back) 6px, var(--g-card-back2) 6px, var(--g-card-back2) 12px); box-shadow: inset 0 0 0 3px var(--g-card), 0 0 0 1px rgba(43, 16, 34, .4); }
.pcard.slot { background: none; box-shadow: inset 0 0 0 2px var(--nv-border); color: var(--nv-text-soft); display: grid; place-items: center; font-size: calc(var(--cw) * .4); }
.pcard.ok { transform: translateY(-14%); cursor: pointer; } .pcard.dim { filter: brightness(.86) saturate(.8); } .pyr .pcard.dim { filter: brightness(.95); }
.pcard.sel { transform: translateY(-22%); box-shadow: 0 0 0 3px var(--g-hi), 0 4px 8px rgba(0, 0, 0, .25); }
.pcard.hint { box-shadow: 0 0 0 3px var(--nv-ruby); }
.pcard.tgt { box-shadow: 0 0 0 3px var(--g-hi); }
.hand { display: flex; justify-content: center; padding: calc(var(--cw) * .32) 6px 6px; min-height: calc(var(--cw) * 1.75); }
.hand .pcard { margin-left: calc(var(--cw) * var(--ov, -.45)); transition: transform .12s; } .hand .pcard:first-child { margin-left: 0; }
@media (min-width: 700px) { .hand .pcard { margin-left: calc(var(--cw) * max(var(--ov, -.45), -.36)); } }
.others { display: flex; justify-content: space-around; gap: 8px; flex-wrap: wrap; }
.opp { display: grid; justify-items: center; gap: 2px; padding: 6px 10px; border-radius: 12px; border: 1.5px solid transparent; background: none; font-weight: 600; font-size: .85rem; min-width: 84px; }
.opp.turn { border-color: var(--g-hi); background: var(--g-hi-soft); } .opp.pick { border-color: var(--nv-text); border-style: dashed; cursor: pointer; }
.opp .mini { display: flex; } .opp .mini i { width: 13px; height: 18px; border-radius: 3px; background: var(--g-card-back); box-shadow: 0 0 0 1px var(--g-card); margin-left: -7px; } .opp .mini i:first-child { margin-left: 0; }
.felt { display: grid; place-items: center; align-content: center; gap: 10px; background: var(--g-felt); border-radius: 18px; padding: 12px; min-height: 0; position: relative; }
.felt .mid-row { display: flex; gap: 16px; align-items: center; justify-content: center; }
.note { font-weight: 600; text-align: center; min-height: 1.5em; font-size: .95rem; }
.suits { display: flex; gap: 8px; justify-content: center; } .suits button { width: 56px; height: 56px; border-radius: 14px; border: 1.5px solid var(--nv-border); background: var(--g-card); font-size: 1.7rem; color: var(--g-card-ink); } .suits button.red { color: var(--g-card-red); }
.trick { display: grid; grid-template-areas: ". n ." "w . e" ". s ."; gap: 4px; justify-items: center; align-items: center; } .trick .n { grid-area: n; } .trick .s { grid-area: s; } .trick .e { grid-area: e; } .trick .w { grid-area: w; }
.trick .pcard.slot { box-shadow: none; }
.books { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; font-size: .75rem; } .books b { padding: 1px 6px; border-radius: 5px; background: var(--g-chip); }

/* ---------- solitaire */
.sol { width: 100%; max-width: 860px; align-self: start; --cols: 7; --gap: clamp(3px, 1vw, 10px); --cw: calc((min(100vw - 16px, 860px) - (var(--cols) - 1) * var(--gap)) / var(--cols)); display: grid; gap: calc(var(--cw) * .25); padding-bottom: 40px; }
.play.wide .sol { --cw: calc((min(100vw - 332px, 860px) - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.sol .srow { display: grid; grid-template-columns: repeat(var(--cols), var(--cw)); gap: var(--gap); align-items: start; }
.pile { position: relative; min-height: calc(var(--cw) * 1.4); border: 0; padding: 0; background: none; display: block; width: 100%; text-align: left; }
.pile.tab { display: grid; align-content: start; } .pile.tab .pcard + .pcard { margin-top: calc(var(--cw) * -1.4 + var(--fan, 28%)); }
.pile.tab .pcard { margin-top: 0; } .pile.tab .pcard.back + .pcard, .pile.tab .pcard.back + .pcard.back { margin-top: calc(var(--cw) * -1.4 + var(--cw) * .16); }
.pile.tab .pcard:not(.back) + .pcard:not(.back) { margin-top: calc(var(--cw) * -1.4 + var(--cw) * var(--f, .36)); }
.pile.rowfan { display: flex; } .pile.rowfan .pcard + .pcard { margin-left: calc(var(--cw) * -.68); }
.pile .count { position: absolute; right: 4px; bottom: 4px; font-size: .7rem; font-weight: 700; background: var(--nv-bg); color: var(--nv-text); border-radius: 8px; padding: 0 5px; z-index: 2; }
.pile.tgt .pcard:last-child, .pile.tgt > .slot { box-shadow: 0 0 0 3px var(--g-hi); } .pile.hint .pcard:last-child, .pile.hint > .slot { box-shadow: 0 0 0 3px var(--nv-ruby); }
.pile .info { font-weight: 600; font-size: .85rem; color: var(--nv-text-soft); padding-top: 8px; text-align: right; }
.pyr { display: grid; justify-items: center; --cw: clamp(38px, calc(min(100vw - 16px, 620px) / 7.6), 78px); width: 100%; align-self: start; }
.pyr .prow { display: flex; gap: calc(var(--cw) * .08); margin-top: calc(var(--cw) * -.78); } .pyr .prow:first-child { margin-top: 0; }
.pyr .gap { width: var(--cw); aspect-ratio: 5 / 7; } .pyr .under { margin-top: 18px; display: flex; gap: 16px; align-items: center; }

/* ---------- dice, tiles */
.dicegame { display: grid; gap: 16px; justify-items: center; width: 100%; max-width: 560px; }
.dice { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.die { width: 58px; height: 58px; border-radius: 13px; background: var(--g-card); box-shadow: 0 0 0 1px rgba(43, 16, 34, .35), 0 2px 4px rgba(0, 0, 0, .2); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 9px; border: 0; }
.die i { width: 9px; height: 9px; border-radius: 50%; background: var(--g-card-ink); place-self: center; }
.die.big { width: 96px; height: 96px; border-radius: 20px; padding: 16px; } .die.big i { width: 15px; height: 15px; }
.die.kept { box-shadow: 0 0 0 3px var(--g-hi), 0 2px 4px rgba(0, 0, 0, .2); transform: translateY(6px); } .die.blank i { opacity: 0; } .die.blank { opacity: .5; }
.die.roll { animation: wob .3s ease-out; } @keyframes wob { 0% { transform: rotate(-14deg) scale(.9); } 60% { transform: rotate(8deg); } }
.bigno { font: 700 3.2rem/1 var(--nv-font-serif); }
.scorecard { width: 100%; border-collapse: collapse; font-size: .92rem; }
.scorecard th, .scorecard td { padding: 0; border-top: 1px solid var(--nv-border); text-align: center; } .scorecard th { text-align: left; font-weight: 600; padding: 6px 8px; }
.scorecard thead th { border-top: 0; font-size: .8rem; color: var(--nv-text-soft); text-align: center; } .scorecard thead th:first-child { text-align: left; }
.scorecard td button { width: 100%; min-height: 34px; border: 0; background: var(--g-hi-soft); font-weight: 700; color: var(--g-accent-text); } .scorecard td button:hover { background: var(--g-hi); color: #fff; }
.scorecard td span { display: block; padding: 6px; } .scorecard tfoot td, .scorecard tfoot th { font-weight: 700; font-size: 1.05rem; padding: 8px; }
.scorecard .me { background: var(--nv-surface); }
.boxes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; width: 100%; }
.boxes button { aspect-ratio: 3 / 5; border-radius: 9px; border: 0; background: var(--g-card-back); color: #F1EAF1; font: 700 clamp(1.1rem, 5vw, 1.9rem) var(--nv-font-serif); }
.boxes button.shut { background: var(--g-chip); color: transparent; box-shadow: inset 0 0 0 1.5px var(--nv-border); } .boxes button.sel { outline: 4px solid var(--g-hi); outline-offset: -1px; transform: translateY(8px); } .boxes button.can { box-shadow: inset 0 -5px 0 var(--g-hi); }
.domgame { width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; max-width: 900px; --dw: clamp(26px, 6.4vw, 40px); }
.dom { display: inline-grid; grid-template-rows: 1fr 1fr; width: var(--dw); height: calc(var(--dw) * 2); border-radius: 6px; background: var(--g-card); box-shadow: 0 0 0 1px rgba(43, 16, 34, .45), 0 1px 3px rgba(0, 0, 0, .2); border: 0; padding: 0; flex: none; }
.dom.h { grid-template-rows: none; grid-template-columns: 1fr 1fr; width: calc(var(--dw) * 2); height: var(--dw); }
.dom .half { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14%; } .dom .half + .half { border-top: 1.5px solid rgba(43, 16, 34, .5); } .dom.h .half + .half { border-top: 0; border-left: 1.5px solid rgba(43, 16, 34, .5); }
.dom .half i { width: 62%; aspect-ratio: 1; border-radius: 50%; background: var(--g-card-ink); place-self: center; }
.dom.ok { transform: translateY(-8px); cursor: pointer; } .dom.sel { box-shadow: 0 0 0 3px var(--g-hi); transform: translateY(-12px); } .dom.dim { filter: brightness(.82); } .dom.hint { box-shadow: 0 0 0 3px var(--nv-ruby); }
.dom.back { background: var(--g-card-back); }
.line { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; justify-content: center; align-content: center; }
.domhand { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 14px 4px 4px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation: none !important; transition: none !important; }

.suitnow { font-size: 2rem; line-height: 1.1; } .suitnow.red { color: var(--g-warn); }
