/* WC Games!: phone first, portrait, one thumb. Same warm palette as the rest of the site. */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #1a0a00;
    --panel: #28190a;
    --accent: #e8c060;
    --text: #f0e6d0;
    --text-dim: #a09080;
    --you: #8fd18a;
    --sel: #ffcc00;
}

/* manipulation: taps are taps. No double-tap zoom on iOS (pinch still works) and no 300 ms delay. */
html, body, button, a { touch-action: manipulation; }

html { background: var(--bg); }

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

#wc {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 520px;
    margin: 0 auto;
    padding: 12px 16px 28px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    text-align: center;
}

/* ===== HEADER ===== */
#timer {
    font-size: 40px;
    font-weight: 200;
    letter-spacing: 3px;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    line-height: 1.1;
    text-shadow: 0 0 18px rgba(232, 192, 96, 0.35);
}

#goal {
    margin-top: 6px;
    font-size: 15px;
    font-weight: 600;
}

#foe {
    margin-top: 2px;
    font-size: 13px;
    font-style: italic;
    color: var(--text-dim);
}

/* ===== STAGE ===== */
#stage {
    position: relative;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#status {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 28px;
    min-height: 28px;
    color: var(--text-dim);
}
#status.you { color: var(--you); }
#note {
    min-height: 18px;
    margin-top: -6px;
    font-size: 13px;
    font-style: italic;
    color: var(--accent);
}
.step {
    position: absolute;
    top: 1px;
    right: 3px;
    z-index: 2;
    font-style: normal;
    font-size: 11px;
    font-weight: 800;
    color: #1a0a00;
    background: #f4d58a;
    border-radius: 7px;
    min-width: 14px;
    padding: 0 3px;
    line-height: 14px;
    text-align: center;
}
.ghost { position: absolute; width: 46%; height: 46%; border-radius: 50%; border: 2px dashed rgba(224, 80, 60, 0.8); }
#status.end { font-size: 22px; letter-spacing: 0.5px; text-transform: none; color: var(--accent); }
#board.done .ur-dice { visibility: hidden; }

#board {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#board button {
    position: relative;
    border: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.count {
    position: absolute;
    right: 3px;
    bottom: 2px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    text-shadow: 0 1px 2px #000;
}

/* ===== END OF MATCH ===== */
#end {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
#end[hidden] { display: none; }

#rematch {
    pointer-events: auto;
    padding: 14px 44px;
    min-height: 48px;
    border: 1px solid rgba(232, 192, 96, 0.6);
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #1a0a00;
    background: rgba(232, 192, 96, 0.72);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
#rematch:active { transform: scale(0.96); }

/* ===== ORIGINS ===== */
#origins {
    margin-top: 32px;
    max-width: 420px;
    text-align: left;
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-dim);
}
#origins h2 {
    font-size: 15px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}
#origins p + p { margin-top: 10px; }
#origins h3 {
    margin: 26px 0 10px;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
}
#origins ul { list-style: none; }
#origins li {
    padding-left: 14px;
    border-left: 2px solid rgba(232, 192, 96, 0.35);
}
#origins li + li { margin-top: 14px; }
#origins li b { color: var(--text); }

#back {
    margin-top: 28px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-dim);
    text-decoration: none;
}

/* ===== ROYAL GAME OF UR ===== */
/* Upright board: mAIa's lane, the shared lane, your lane. Sized to fit a phone screen without scrolling. */
.ur { --cell: min(19vw, calc((100vh - 210px) / 8.6), 64px); }
@supports (height: 100svh) { .ur { --cell: min(19vw, calc((100svh - 210px) / 8.6), 64px); } }

.ur-dice {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 26px;
}
.ur-dice span {
    margin-left: 6px;
    font-size: 22px;
    font-weight: 800;
    color: var(--you);
    min-width: 14px;
}
.ur-dice.theirs span { color: var(--text-dim); }
.ur-die { width: 24px; height: 22px; }
.ur-die path { fill: #3a2a18; stroke: #6a5030; stroke-width: 1.5; stroke-linejoin: round; }
.ur-die circle { fill: #3a2a18; }
.ur-die.up circle { fill: var(--text); }

.ur-board {
    display: grid;
    grid-template-columns: repeat(3, var(--cell));
    grid-template-rows: repeat(8, var(--cell));
    gap: 3px;
}

.ur-sq, .ur-tray {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.ur-sq {
    background: #1f3f78;
    box-shadow: inset 0 0 0 3px #2b528f, inset 0 0 0 6px #d9cdb2;
}
.ur-sq.rosette {
    background: #1f3f78 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23d9cdb2' fill-opacity='.9'%3E%3Cellipse cx='20' cy='10' rx='4' ry='8'/%3E%3Cellipse cx='20' cy='10' rx='4' ry='8' transform='rotate(45 20 20)'/%3E%3Cellipse cx='20' cy='10' rx='4' ry='8' transform='rotate(90 20 20)'/%3E%3Cellipse cx='20' cy='10' rx='4' ry='8' transform='rotate(135 20 20)'/%3E%3Cellipse cx='20' cy='10' rx='4' ry='8' transform='rotate(180 20 20)'/%3E%3Cellipse cx='20' cy='10' rx='4' ry='8' transform='rotate(225 20 20)'/%3E%3Cellipse cx='20' cy='10' rx='4' ry='8' transform='rotate(270 20 20)'/%3E%3Cellipse cx='20' cy='10' rx='4' ry='8' transform='rotate(315 20 20)'/%3E%3C/g%3E%3Ccircle cx='20' cy='20' r='4' fill='%23b03a2e'/%3E%3C/svg%3E") center / 76% no-repeat;
}
.ur-tray {
    background: transparent;
    border: 1px dashed rgba(232, 192, 96, 0.25) !important;
}
.ur-tray.empty { border-color: rgba(232, 192, 96, 0.1) !important; }
.ur-tray .ur-piece { width: 54%; height: 54%; margin-top: 14%; }
.ur-tray::after {
    position: absolute;
    top: 3px;
    left: 0;
    right: 0;
    font-size: 8px;
    letter-spacing: 1px;
    color: var(--text-dim);
    opacity: 0.7;
}
.ur-tray.start::after { content: 'START'; }
.ur-tray.home::after { content: 'HOME'; }

.ur-sq.last { box-shadow: inset 0 0 0 3px #b08a3a, inset 0 0 0 6px #d9cdb2; }
.ur-sq.sel, .ur-tray.sel { outline: 3px solid var(--sel); outline-offset: -1px; }
.ur-sq.can .ur-piece, .ur-tray.can .ur-piece { box-shadow: 0 0 0 3px rgba(143, 209, 138, 0.8), 0 2px 4px #000; }
.ur-sq.target::before, .ur-tray.target::before {
    content: '';
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    border: 3px solid var(--sel);
    background: rgba(255, 204, 0, 0.18);
    z-index: 1;
}

/* Pieces: shell discs with five dots, light for you, dark for mAIa. */
.ur-piece {
    position: relative;
    width: 72%;
    height: 72%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fffaf0, #d8ccb4);
    box-shadow: 0 2px 4px #000;
}
.ur-piece.p1 { background: radial-gradient(circle at 35% 30%, #4a4a52, #15151a); }
.ur-piece i {
    position: absolute;
    width: 16%;
    height: 16%;
    border-radius: 50%;
    background: #1f3f78;
    transform: translate(-50%, -50%);
}
.ur-piece.p1 i { background: #e9dfc8; }
.ur-piece i:nth-child(1) { left: 50%; top: 50%; }
.ur-piece i:nth-child(2) { left: 28%; top: 28%; }
.ur-piece i:nth-child(3) { left: 72%; top: 28%; }
.ur-piece i:nth-child(4) { left: 28%; top: 72%; }
.ur-piece i:nth-child(5) { left: 72%; top: 72%; }

/* ===== DŌBUTSU SHŌGI ===== */
.dobutsu { --cell: min(25vw, calc((100vh - 230px) / 5.6), 104px); }
@supports (height: 100svh) { .dobutsu { --cell: min(25vw, calc((100svh - 230px) / 5.6), 104px); } }

.db-board {
    display: grid;
    grid-template-columns: repeat(3, var(--cell));
    grid-template-rows: repeat(4, var(--cell));
    gap: 3px;
    padding: 3px;
    border-radius: 10px;
    background: #6b4a24;
}
.db-board > .db-sq { background: #efe3c2; border-radius: 6px; }
/* Each side's home row, as on the original board. */
.db-board > .db-sq:nth-child(-n+3) { background: #f3d6cf; }
.db-board > .db-sq:nth-child(n+10) { background: #d6ead0; }

.db-hand {
    display: flex;
    gap: 6px;
    min-height: calc(var(--cell) * 0.62);
}
.db-hand .db-sq {
    width: calc(var(--cell) * 0.62);
    height: calc(var(--cell) * 0.62);
    background: transparent;
    border-radius: 6px;
}

.db-sq { display: flex; align-items: center; justify-content: center; }
.db-sq.last { box-shadow: inset 0 0 0 3px #c9a240; }
.db-sq.sel { box-shadow: inset 0 0 0 4px var(--sel); }
.db-sq.target::after {
    content: '';
    position: absolute;
    width: 26%;
    height: 26%;
    border-radius: 50%;
    background: rgba(60, 40, 10, 0.4);
}
.db-sq.target.capture::after {
    width: 84%;
    height: 84%;
    background: none;
    border: 4px solid rgba(176, 58, 46, 0.75);
}

/* Tiles with dots on the sides a piece can step to. mAIa's tiles are turned to face you. */
.db-piece {
    position: relative;
    width: 84%;
    height: 84%;
    border-radius: 14%;
    background: #fffaf0;
    border: 3px solid #5e9c55;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}
.db-piece.p1 { border-color: #c0675a; transform: rotate(180deg); }
.db-animal { font-size: calc(var(--cell) * 0.42); line-height: 1; }
.db-hand .db-animal { font-size: calc(var(--cell) * 0.27); }
.db-piece i {
    position: absolute;
    left: calc(50% + var(--c) * 38%);
    top: calc(50% + var(--r) * 38%);
    width: 12%;
    height: 12%;
    border-radius: 50%;
    background: #b03a2e;
    transform: translate(-50%, -50%);
}
.db-hand .db-piece i { width: 14%; height: 14%; }

/* ===== BRANDUBH ===== */
.brandubh { --cell: min(calc((100vw - 32px) / 7), calc((100vh - 230px) / 7.2), 58px); }
@supports (height: 100svh) { .brandubh { --cell: min(calc((100vw - 32px) / 7), calc((100svh - 230px) / 7.2), 58px); } }

.bd-board {
    display: grid;
    grid-template-columns: repeat(7, var(--cell));
    grid-template-rows: repeat(7, var(--cell));
    gap: 2px;
    padding: 4px;
    border-radius: 8px;
    background: #4a3018;
}
.bd-sq {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    background: #c9a46a;
}
.bd-sq.refuge {
    background: #9c7442 repeating-linear-gradient(45deg, transparent 0 5px, rgba(0, 0, 0, 0.12) 5px 7px);
}
.bd-sq.last { box-shadow: inset 0 0 0 3px #f4d58a; }
.bd-sq.sel { box-shadow: inset 0 0 0 3px var(--sel); }
.bd-sq.target::after {
    content: '';
    position: absolute;
    width: 26%;
    height: 26%;
    border-radius: 50%;
    background: rgba(40, 20, 0, 0.45);
}
.bd-piece {
    width: 70%;
    height: 70%;
    border-radius: 50%;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.55);
}
.bd-piece.att { background: radial-gradient(circle at 35% 30%, #5a4a3e, #1d140e); }
.bd-piece.def { background: radial-gradient(circle at 35% 30%, #fffaf0, #d6c7a8); }
.bd-piece.king {
    width: 82%;
    height: 82%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 35% 30%, #fff3c4, #d9a93a);
}
.bd-piece.king::after { content: '♚'; font-size: calc(var(--cell) * 0.46); color: #5a3a10; line-height: 1; }

/* ===== FANORONA ===== */
.fanorona { --cell: min(calc((100vw - 32px) / 9), 54px); }

.fn-board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(9, var(--cell));
    grid-template-rows: repeat(5, var(--cell));
    padding: 4px;
    border-radius: 10px;
    background: #b98a52;
}
.fn-lines {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    pointer-events: none;
}
.fn-lines path { fill: none; stroke: #5b3a18; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#board .fn-pt {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}
.fn-pt::before {
    content: '';
    position: absolute;
    width: 10%;
    height: 10%;
    border-radius: 50%;
    background: #5b3a18;
}
.fn-piece {
    position: relative;
    width: 72%;
    height: 72%;
    border-radius: 50%;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
    background: radial-gradient(circle at 35% 30%, #fffaf0, #d6c7a8);
}
.fn-piece.p1 { background: radial-gradient(circle at 35% 30%, #5a4a3e, #1d140e); }
.fn-pt.last .fn-piece, .fn-pt.last::before { box-shadow: 0 0 0 3px #f4d58a; }
.fn-pt.sel .fn-piece { box-shadow: 0 0 0 3px var(--sel), 0 2px 3px rgba(0, 0, 0, 0.5); }
.fn-pt.can .fn-piece { box-shadow: 0 0 0 3px rgba(143, 209, 138, 0.9), 0 2px 3px rgba(0, 0, 0, 0.5); }
.fn-pt.target::after {
    content: '';
    position: absolute;
    width: 36%;
    height: 36%;
    border-radius: 50%;
    border: 3px solid var(--sel);
    background: rgba(255, 204, 0, 0.2);
}
.fn-pt.pick .fn-piece { box-shadow: 0 0 0 4px #e0503c, 0 2px 3px rgba(0, 0, 0, 0.5); animation: fn-pulse 0.9s ease-in-out infinite alternate; }
@keyframes fn-pulse { to { transform: scale(0.86); } }

#board .fn-stop {
    padding: 10px 26px;
    min-height: 44px;
    border-radius: 10px;
    font-weight: 700;
    color: #1a0a00;
    background: var(--accent);
}

/* ===== POOSWEEPER ===== */
.ps-board {
    --cell: min(calc((100vw - 32px) / var(--cols)), calc((100vh - 270px) / var(--rows)), 46px);
    display: grid;
    grid-template-columns: repeat(var(--cols), var(--cell));
    grid-template-rows: repeat(var(--rows), var(--cell));
    gap: 2px;
}
@supports (height: 100svh) { .ps-board { --cell: min(calc((100vw - 32px) / var(--cols)), calc((100svh - 270px) / var(--rows)), 46px); } }
#board .ps-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: calc(var(--cell) * 0.5);
    font-weight: 800;
    background: linear-gradient(160deg, #7a9a4e, #5d7d38);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
#board .ps-cell.open { background: #e9dcc0; box-shadow: none; }
#board .ps-cell.boom { background: #d0503c; }
#board .ps-cell[data-n="1"] { color: #2f6fb8; }
#board .ps-cell[data-n="2"] { color: #3b8a3b; }
#board .ps-cell[data-n="3"] { color: #c0392b; }
#board .ps-cell[data-n="4"] { color: #2b3a8f; }
#board .ps-cell[data-n="5"] { color: #8a2f1f; }
#board .ps-cell[data-n="6"] { color: #1d7d7d; }
#board .ps-cell[data-n="7"], #board .ps-cell[data-n="8"] { color: #222; }

#board .ps-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    min-height: 44px;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
#board .ps-mode.on { background: rgba(232, 192, 96, 0.25); border-color: var(--accent); }
.ps-mode span { font-size: 18px; }
.ps-mode small { font-weight: 600; color: var(--text-dim); }

/* ===== TIME'S UP ===== */
#out {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    background: rgba(26, 10, 0, 0.88);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
#out[hidden] { display: none; }
.out-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    width: 100%;
    max-width: 440px;
    min-height: 78vh;
    min-height: 78dvh;
    padding: 32px 24px;
    text-align: center;
    border-radius: 24px;
    background: var(--panel);
    border: 1px solid rgba(232, 192, 96, 0.35);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.out-eyebrow {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-dim);
}
#nudge {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--accent);
}
#leave {
    padding: 16px 48px;
    min-height: 52px;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    color: #1a0a00;
    background: linear-gradient(135deg, #e8c060, #c89830);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
#leave:active { transform: scale(0.96); }

/* ===== SHARED: POINT BOARDS ===== */
.kn-board, .hs-board, .tb-board { display: grid; gap: 2px; padding: 4px; border-radius: 8px; }
#board .kn-pt, #board .hs-sq, #board .tb-sq, #board .pl-sq, #board .pl-home, #board .sk-pt {
    display: flex; align-items: center; justify-content: center; background: transparent;
}
.target-dot, .kn-pt.target::after, .hs-sq.target::after, .tb-sq.target::after, .pl-sq.target::after, .pl-home.target::after, .sk-pt.target::after {
    content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%;
    border: 3px solid var(--sel); background: rgba(255, 204, 0, 0.2); z-index: 1;
}
.kn-pt.sel > span, .hs-sq.sel > span, .tb-sq.sel > span, .sk-pt.sel > span { box-shadow: 0 0 0 3px var(--sel), 0 2px 3px rgba(0, 0, 0, 0.5); }
.kn-pt.can > span, .tb-sq.can > span, .sk-pt.can > span, .pl-sq.can .pl-stack > :first-child, .pl-home.can .pl-piece:first-child { box-shadow: 0 0 0 3px rgba(143, 209, 138, 0.9), 0 2px 3px rgba(0, 0, 0, 0.5); }

/* ===== KŌNANE ===== */
.konane { --cell: min(calc((100vw - 40px) / 6), 58px); }
.kn-board { grid-template-columns: repeat(6, var(--cell)); grid-template-rows: repeat(6, var(--cell)); background: #6d4a2a; }
#board .kn-pt { background: radial-gradient(circle, #8a6238 18%, #7a5530 20%); border-radius: 4px; }
#board .kn-pt.last { box-shadow: inset 0 0 0 2px #f4d58a; }
.kn-stone { width: 74%; height: 74%; border-radius: 50%; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.55); }
.kn-stone.dark { background: radial-gradient(circle at 35% 30%, #5b5b5b, #121212); }
.kn-stone.light { background: radial-gradient(circle at 35% 30%, #ffffff, #cfcac0); }

/* ===== HASAMI SHŌGI ===== */
.hasami { --cell: min(calc((100vw - 40px) / 9), calc((100vh - 300px) / 9.6), 44px); }
.hs-board { grid-template-columns: repeat(9, var(--cell)); grid-template-rows: repeat(9, var(--cell)); gap: 1px; background: #5b3e1e; }
#board .hs-sq { background: #e3c48a; border-radius: 1px; }
#board .hs-sq.last { background: #f0d9a4; }
.hs-piece {
    width: 82%; height: 88%; display: flex; align-items: center; justify-content: center;
    font-size: calc(var(--cell) * 0.46); font-weight: 700; color: #2b1a08;
    background: #f6e3b4; clip-path: polygon(50% 0, 88% 18%, 100% 100%, 0 100%, 12% 18%);
}
.hs-piece.p1 { transform: rotate(180deg); color: #8a1f12; }
.hs-sq.sel .hs-piece { background: #ffe58a; }
.hs-score { display: flex; gap: 5px; }
.hs-score i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.hs-score i.off { background: rgba(255, 255, 255, 0.12); }

/* ===== SURAKARTA ===== */
.surakarta { --u: min(calc((100vw - 32px) / 9.6), 44px); }
.sk-board {
    position: relative; display: grid; grid-template-columns: repeat(6, var(--u)); grid-template-rows: repeat(6, var(--u));
    padding: calc(var(--u) * 1.8); border-radius: 12px; background: #c49a62;
}
.sk-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sk-lines path { fill: none; stroke-width: 0.07; }
.sk-lines .grid { stroke: #6b4a24; stroke-width: 0.04; }
.sk-lines .small { stroke: #2f6fb8; }
.sk-lines .large { stroke: #b03a2e; }
.sk-piece { width: 70%; height: 70%; border-radius: 50%; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); background: radial-gradient(circle at 35% 30%, #fffaf0, #d6c7a8); }
.sk-piece.p1 { background: radial-gradient(circle at 35% 30%, #5a4a3e, #1d140e); }
.sk-pt.last::before { content: ''; position: absolute; width: 22%; height: 22%; border-radius: 50%; background: #f4d58a; }
.sk-pt.target.capture::after { width: 84%; height: 84%; background: none; border-color: #e0503c; }

/* ===== PULUC ===== */
.puluc { --cell: min(calc((100vh - 250px) / 11.6), 54px); }
.pl-dice { display: flex; align-items: center; gap: 8px; height: 26px; }
.pl-dice span:last-child { margin-left: 6px; font-size: 22px; font-weight: 800; color: var(--you); }
.pl-dice.theirs span:last-child { color: var(--text-dim); }
.pl-kernel { width: 12px; height: 18px; border-radius: 50% 50% 45% 45%; background: #e9d79c; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15); }
.pl-kernel.up { background: radial-gradient(circle at 50% 45%, #2b1a08 22%, #e9d79c 25%); }
.pl-track { display: flex; flex-direction: column; gap: 3px; width: min(260px, 70vw); }
#board .pl-sq, #board .pl-home { height: var(--cell); border-radius: 8px; }
#board .pl-sq { background: #3d6b3a; box-shadow: inset 0 0 0 2px #2c5129; }
#board .pl-sq.last { box-shadow: inset 0 0 0 3px #f4d58a; }
#board .pl-home { background: rgba(255, 255, 255, 0.06); border: 1px dashed rgba(232, 192, 96, 0.3); gap: 8px; }
.pl-home small { color: #e0503c; font-size: 14px; letter-spacing: 2px; }
.pl-home-pieces, .pl-stack { display: flex; align-items: center; gap: 4px; }
.pl-piece { width: calc(var(--cell) * 0.6); height: calc(var(--cell) * 0.6); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffaf0, #d6c7a8); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); }
.pl-piece.p1 { background: radial-gradient(circle at 35% 30%, #5a4a3e, #1d140e); }
.pl-piece.under { width: calc(var(--cell) * 0.36); height: calc(var(--cell) * 0.36); opacity: 0.9; }
.pl-home .pl-piece { width: calc(var(--cell) * 0.42); height: calc(var(--cell) * 0.42); }

/* ===== TÂB ===== */
.tab { --cell: min(calc((100vw - 40px) / 9), 50px); }
.tb-board { grid-template-columns: repeat(9, var(--cell)); grid-template-rows: repeat(4, var(--cell)); background: #4a3018; }
#board .tb-sq { background: #d8b98a; border-radius: 3px; }
#board .tb-sq:nth-child(-n+9) { background: #c9a1a0; }
#board .tb-sq:nth-child(n+28) { background: #b5cfa6; }
#board .tb-sq.last { box-shadow: inset 0 0 0 3px #f4d58a; }
.tb-piece { width: 70%; height: 70%; border-radius: 50%; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); background: radial-gradient(circle at 35% 30%, #fffaf0, #d6c7a8); }
.tb-piece.p1 { background: radial-gradient(circle at 35% 30%, #5a4a3e, #1d140e); }
.tb-piece.asleep { width: 58%; height: 58%; opacity: 0.75; }
.tb-piece.been { outline: 2px dashed #b03a2e; outline-offset: 1px; }
.tb-sq.sel.single > span { box-shadow: 0 0 0 3px #e0503c; }
.tb-bar { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.tb-sticks { display: flex; gap: 5px; }
.tb-stick { width: 8px; height: 30px; border-radius: 4px; background: #5b3a18; }
.tb-stick.white { background: #f3ead6; }
.tb-roll { font-size: 22px; font-weight: 800; color: var(--you); }
.tb-bar.theirs .tb-roll { color: var(--text-dim); }
.tb-roll small { font-size: 14px; color: var(--accent); }
#board .tb-skip { padding: 6px 14px; min-height: 36px; border-radius: 8px; font-weight: 700; background: rgba(255, 255, 255, 0.12); }

/* ===== CARDS (shared) ===== */
.pc {
    position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    width: 42px; height: 60px; border-radius: 6px; background: #fbf7ee; color: #1d1d1d;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); font-weight: 800; line-height: 1; flex-shrink: 0;
}
.pc b { font-size: 17px; }
.pc i { font-style: normal; font-size: 18px; }
.pc.red { color: #c0392b; }
.pc.small { width: 30px; height: 42px; border-radius: 4px; }
.pc.small b { font-size: 12px; }
.pc.small i { font-size: 12px; }
.pc.back { background: repeating-linear-gradient(45deg, #7a2a1a 0 4px, #8f3523 4px 8px); border: 2px solid #f3e6c8; }
.pc.trump { transform: rotate(-90deg); margin: 0 -6px 0 4px; }
.dk-stack { position: relative; display: inline-flex; margin-left: 2px; }
.dk-stack .count { right: 4px; bottom: 3px; color: #fff; text-shadow: 0 1px 2px #000; }
.pc.over { position: absolute; left: 10px; top: 14px; }
.cg-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 100%; }
.cg-hand.theirs { gap: 2px; min-height: 42px; }
.cg-hand.mine { min-height: 64px; }
#board .cg-card { background: none; padding: 0; border-radius: 6px; transition: transform 0.12s ease; }
#board .cg-card.can > span { box-shadow: 0 0 0 3px rgba(143, 209, 138, 0.9), 0 2px 4px rgba(0, 0, 0, 0.5); }
#board .cg-card.sel { transform: translateY(-8px); }
#board .cg-card.sel > span { box-shadow: 0 0 0 3px var(--sel), 0 2px 4px rgba(0, 0, 0, 0.5); }
.cg-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 40px; }
#board .cg-actions button {
    padding: 8px 16px; min-height: 40px; border-radius: 10px; font-weight: 700; color: #1a0a00; background: var(--accent);
}
.count { pointer-events: none; }

/* ===== DURAK ===== */
.dk-middle { display: flex; align-items: center; gap: 14px; min-height: 92px; width: min(100%, 420px); }
.dk-talon { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.dk-suit { font-size: 28px; color: var(--accent); }
.dk-table { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.dk-pair { position: relative; width: 52px; height: 76px; }

/* ===== KOI-KOI ===== */
.hf {
    position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 38px; height: 58px; border-radius: 5px; background: #f7efe0; border: 2px solid #3a2a1a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.hf b { position: absolute; top: 1px; left: 3px; font-size: 10px; color: #3a2a1a; }
.hf i { font-style: normal; font-size: 22px; }
.hf u { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 7px; margin-left: 10px; border-radius: 2px; }
.hf u.red { background: #c0392b; }
.hf u.blue { background: #2f5fb0; }
.hf u.poem::after { content: ''; position: absolute; left: 1px; right: 1px; top: 40%; height: 14px; background: #fff3d8; }
.hf.tB { border-color: #c9a240; box-shadow: 0 0 0 2px #e8c060, 0 2px 4px rgba(0, 0, 0, 0.5); }
.hf.m1, .hf.m11 { background: #e8f0e0; } .hf.m2, .hf.m3 { background: #fbe6ea; } .hf.m4, .hf.m5 { background: #ece6f6; }
.hf.m6, .hf.m7 { background: #fbe9e2; } .hf.m8, .hf.m12 { background: #f3efd8; } .hf.m9, .hf.m10 { background: #fbecd6; }
.hf.mini { width: 22px; height: 32px; border-width: 1px; }
.hf.mini b { display: none; }
.hf.mini i { font-size: 12px; }
.hf.mini u { width: 4px; margin-left: 5px; top: 3px; bottom: 3px; }
.hf.back { background: repeating-linear-gradient(45deg, #222 0 4px, #3a3a3a 4px 8px); border-color: #111; }
.kk-score { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 13px; font-weight: 700; }
.kk-score small { width: 100%; text-align: center; font-weight: 500; color: var(--text-dim); }
.kk-field { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; width: min(100%, 380px); min-height: 64px; padding: 6px; border-radius: 10px; background: rgba(60, 120, 60, 0.25); }
#board .kk-fieldcard { background: none; padding: 0; }
#board .kk-fieldcard.pick > span { box-shadow: 0 0 0 3px var(--sel); animation: fn-pulse 0.9s ease-in-out infinite alternate; }
.kk-drawn { margin-right: 8px; }
.kk-drawn .hf { box-shadow: 0 0 0 3px #e0503c; }
.kk-pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 32px; width: min(100%, 380px); }
.kk-sets { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 2px; }
.kk-sets em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: rgba(232, 192, 96, 0.25); color: var(--accent); }
.kk-sets em.koi { background: #c0392b; color: #fff; }

/* ===== CUTTLE ===== */
.ct-side { display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(100%, 400px); padding: 6px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.ct-score { font-size: 13px; color: var(--text-dim); }
.ct-score b { font-size: 18px; color: var(--accent); }
.ct-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 42px; }
.ct-row.perms { min-height: 0; }
.ct-pt { position: relative; display: inline-flex; }
.ct-pt .jack { margin-left: -16px; }
.ct-middle { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 64px; }
.ct-deck, .ct-scrap { position: relative; display: inline-flex; min-width: 42px; }
.ct-deck .count, .ct-scrap .count { color: #fff; text-shadow: 0 1px 2px #000; }
.ct-pending { display: inline-flex; gap: 4px; padding: 3px; border-radius: 8px; box-shadow: 0 0 0 2px #e0503c; }
.ct-scrappick { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: min(100%, 400px); }
#board .ct-scrappick button, #board .ct-target { background: none; padding: 0; }
#board .ct-target > span { box-shadow: 0 0 0 3px var(--sel), 0 2px 4px rgba(0, 0, 0, 0.5); animation: fn-pulse 0.9s ease-in-out infinite alternate; }
