/* ============================================================================
   Chopsticks "Playground" theme. Sits on top of Materia's compiled CSS
   (vendor-*.css: Bootstrap 5.3 reboot, grid and utilities) and is the one place
   the look is defined.

   Tokens first, then the variants the Settings page drives through attributes on
   <html> (set by js/chopsticks.js, restored before first paint by App.razor):
     data-theme="dark"      dark mode
     data-palette="cb"      colour-blind palette (mint -> blue, coral -> orange)
     data-contrast="high"   stronger text and borders
     data-motion="reduce"   no lifts or transitions on hands
     data-text="large|xl"   text size (font sizes are rem; layout stays px)

   Colours are the design's oklch values. Ownership is never colour alone: position,
   the label pill and the art's rotation carry it too.
   ========================================================================== */

:root {
    --pg-cream: #FBF6EE;
    --pg-paper: #FFFFFF;
    --pg-sand: #F3ECE1;
    --pg-line: #E8DFD2;
    --pg-divider: #F0E8DC;
    --pg-ink: #2A2522;
    --pg-on-ink: #FBF6EE;
    --pg-badge-fg: #FFFFFF;
    --pg-muted: #6F655C;
    --pg-placeholder: #9C9186;
    --pg-dead-tile: #EFE8DD;
    --pg-dead-badge: #B3A99D;
    --pg-toggle-off: #E3D9CB;
    --pg-ink-card: #3A3430;
    --pg-on-ink-muted: #C9BFB3;
    --pg-scrim: rgba(251, 246, 238, .82);
    --pg-art-filter: none;

    --pg-coral-h: 35;
    --pg-mint-h: 165;
    --pg-gold-h: 85;

    --pg-coral: oklch(0.72 0.14 var(--pg-coral-h));
    --pg-coral-ring: oklch(0.62 0.16 var(--pg-coral-h));
    --pg-coral-tint: oklch(0.94 0.04 var(--pg-coral-h));
    --pg-coral-ink: oklch(0.45 0.13 var(--pg-coral-h));
    --pg-coral-sub: oklch(0.4 0.12 var(--pg-coral-h));
    --pg-coral-soft-line: oklch(0.85 0.06 var(--pg-coral-h));

    --pg-mint: oklch(0.72 0.14 var(--pg-mint-h));
    --pg-mint-tint: oklch(0.94 0.04 var(--pg-mint-h));
    --pg-mint-ink: oklch(0.42 0.11 var(--pg-mint-h));
    --pg-mint-dot: oklch(0.62 0.14 var(--pg-mint-h));
    --pg-mint-sub: oklch(0.38 0.1 var(--pg-mint-h));

    --pg-gold: oklch(0.72 0.14 var(--pg-gold-h));
    --pg-gold-tint: oklch(0.94 0.04 var(--pg-gold-h));
    --pg-gold-ink: oklch(0.42 0.1 var(--pg-gold-h));
    --pg-gold-icon: oklch(0.5 0.11 var(--pg-gold-h));
    --pg-gold-sub: oklch(0.4 0.09 var(--pg-gold-h));
    --pg-gold-trophy: oklch(0.55 0.12 var(--pg-gold-h));

    --pg-shadow-lift: 0 16px 28px rgba(42, 37, 34, .18);
    --pg-shadow-modal: 0 30px 60px rgba(42, 37, 34, .16);
    --pg-shadow-sheet: 0 -20px 50px rgba(42, 37, 34, .14);
    --pg-shadow-seg: 0 1px 3px rgba(0, 0, 0, .08);

    --pg-font: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --pg-mono: 'DM Mono', ui-monospace, monospace;

    /* Hand Bootstrap/Materia the same ground and type, so stray components match. */
    --bs-body-bg: var(--pg-cream);
    --bs-body-color: var(--pg-ink);
    --bs-body-font-family: var(--pg-font);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.5;
    --bs-border-color: var(--pg-line);
    --bs-link-color: var(--pg-coral-ink);
    --bs-link-hover-color: var(--pg-ink);
    --bs-focus-ring-color: var(--pg-ink);
    --bs-emphasis-color: var(--pg-ink);
    --bs-secondary-color: var(--pg-muted);
}

/* Colour-blind palette: you become blue, the opponent orange. Same tints. */
html[data-palette="cb"] {
    --pg-coral-h: 60;
    --pg-mint-h: 245;
}

/* Dark mode: a warm charcoal version of the same system. Tints darken, inks lighten,
   and the line art is inverted so it stays visible on dark tiles. */
html[data-theme="dark"] {
    --pg-cream: #1C1917;
    --pg-paper: #272320;
    --pg-sand: #34302B;
    --pg-line: #463F38;
    --pg-divider: #36312C;
    --pg-ink: #F3ECE1;
    --pg-on-ink: #1C1917;
    --pg-badge-fg: #1C1917;
    --pg-muted: #B8AEA2;
    --pg-placeholder: #8E847A;
    --pg-dead-tile: #2F2A26;
    --pg-dead-badge: #6E655C;
    --pg-toggle-off: #4A433C;
    --pg-ink-card: #2A2522;
    --pg-on-ink-muted: #6F655C;
    --pg-scrim: rgba(28, 25, 23, .82);
    --pg-art-filter: invert(1);

    --pg-coral-tint: oklch(0.34 0.06 var(--pg-coral-h));
    --pg-coral-ink: oklch(0.84 0.09 var(--pg-coral-h));
    --pg-coral-sub: oklch(0.82 0.07 var(--pg-coral-h));
    --pg-coral-soft-line: oklch(0.5 0.09 var(--pg-coral-h));
    --pg-mint-tint: oklch(0.34 0.06 var(--pg-mint-h));
    --pg-mint-ink: oklch(0.84 0.09 var(--pg-mint-h));
    --pg-mint-sub: oklch(0.82 0.07 var(--pg-mint-h));
    --pg-gold-tint: oklch(0.34 0.05 var(--pg-gold-h));
    --pg-gold-ink: oklch(0.86 0.09 var(--pg-gold-h));
    --pg-gold-icon: oklch(0.8 0.11 var(--pg-gold-h));
    --pg-gold-sub: oklch(0.82 0.06 var(--pg-gold-h));
    --pg-gold-trophy: oklch(0.8 0.12 var(--pg-gold-h));

    --pg-shadow-lift: 0 16px 28px rgba(0, 0, 0, .45);
    --pg-shadow-modal: 0 30px 60px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

html[data-contrast="high"] {
    --pg-muted: #3F3833;
    --pg-placeholder: #5E554D;
    --pg-line: #8A8077;
    --pg-divider: #C4B9AD;
    --pg-coral-ink: oklch(0.38 0.13 var(--pg-coral-h));
    --pg-mint-ink: oklch(0.34 0.11 var(--pg-mint-h));
}

html[data-contrast="high"][data-theme="dark"] {
    --pg-muted: #E2D9CE;
    --pg-placeholder: #C0B6AA;
    --pg-line: #9C9186;
    --pg-divider: #5A524A;
}

html[data-text="large"] { font-size: 115%; }
html[data-text="xl"] { font-size: 130%; }

/* ---------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */

html, body {
    background: var(--pg-cream);
}

body {
    display: block; /* Materia makes body a flex row for its sidebar shell */
    min-height: 100vh;
    margin: 0;
    color: var(--pg-ink);
    font-family: var(--pg-font);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    color: var(--pg-ink);
    font-family: var(--pg-font);
    font-weight: 800;
}

p { margin: 0; }

a {
    color: var(--pg-coral-ink);
    text-decoration: none;
}

a:hover { color: var(--pg-ink); }

button {
    font-family: inherit;
    color: inherit;
}

:focus-visible {
    outline: 3px solid var(--pg-ink);
    outline-offset: 4px;
}

/* FocusOnNavigate moves focus to the page heading for screen readers; it needs no ring. */
h1:focus,
h1:focus-visible {
    outline: none;
}

.ms {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 1.375rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    user-select: none;
}

.pg-muted { color: var(--pg-muted); }
.pg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pg-display {
    font-size: 4.75rem;
    font-weight: 800;
    letter-spacing: -.045em;
    line-height: .95;
}

.pg-h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.15;
}

.pg-h2 {
    font-size: 1.625rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.pg-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.01em;
}

.pg-lead {
    font-size: 1.0625rem;
    color: var(--pg-muted);
}

.pg-caption {
    font-size: .8125rem;
    color: var(--pg-muted);
    line-height: 1.4;
}

/* ---------------------------------------------------------------------------
   Shell: top nav, page container, bottom tab bar (narrow screens)
   ------------------------------------------------------------------------- */

.pg-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.pg-nav {
    height: 76px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 0 32px;
    width: 100%;
    max-width: 1344px;
    margin: 0 auto;
    box-sizing: border-box;
}

.pg-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--pg-ink);
}

.pg-logo:hover { color: var(--pg-ink); }

.pg-logo-tiles { display: flex; }

.pg-logo-tiles span {
    width: 30px;
    height: 34px;
    border-radius: 10px;
    display: block;
}

.pg-logo-tiles span:first-child {
    background: var(--pg-coral);
    transform: rotate(-8deg);
}

.pg-logo-tiles span:last-child {
    background: var(--pg-mint);
    transform: rotate(8deg);
    margin-left: -6px;
}

.pg-wordmark {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -.04em;
    line-height: 1;
}

.pg-tabs {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}

.pg-tab {
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--pg-ink);
    white-space: nowrap;
}

.pg-tab:hover {
    color: var(--pg-ink);
    background: var(--pg-sand);
}

.pg-tab.active {
    background: var(--pg-ink);
    color: var(--pg-on-ink);
}

.pg-nav-end {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.pg-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--pg-paper);
    color: var(--pg-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: filter .15s;
}

.pg-icon-btn:hover { color: var(--pg-ink); filter: brightness(.96); }
.pg-icon-btn.active { background: var(--pg-ink); color: var(--pg-on-ink); }

.pg-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 16px 5px 5px;
    border-radius: 999px;
    background: var(--pg-paper);
    color: var(--pg-ink);
}

.pg-user-pill:hover { color: var(--pg-ink); filter: brightness(.97); }
.pg-user-pill-name { font-weight: 600; font-size: .9375rem; }
.pg-user-pill-rating { font-size: .875rem; color: var(--pg-muted); }

.pg-main {
    flex: 1;
    width: 100%;
    max-width: 1344px;
    margin: 0 auto;
    padding: 4px 32px 32px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.pg-tabbar { display: none; }

/* ---------------------------------------------------------------------------
   Avatars
   ------------------------------------------------------------------------- */

.pg-avatar {
    position: relative;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--pg-ink);
    flex-shrink: 0;
    background: var(--pg-sand);
}

.pg-avatar.tone-coral { background: var(--pg-coral-tint); }
.pg-avatar.tone-mint { background: var(--pg-mint-tint); }
.pg-avatar.tone-gold { background: var(--pg-gold-tint); }
.pg-avatar.tone-sand { background: var(--pg-sand); }
.pg-avatar.tone-you { background: var(--pg-mint); color: #2A2522; }
.pg-avatar.tone-coral-solid { background: var(--pg-coral); color: #2A2522; }
.pg-avatar.tone-gold-solid { background: var(--pg-gold); color: #2A2522; }
.pg-avatar.tone-white { background: var(--pg-paper); }

.pg-presence {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--pg-paper);
    background: var(--pg-mint-dot);
}

.pg-presence.is-busy { background: var(--pg-gold); }

/* ---------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 999px;
    border: 0;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.2;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: filter .15s, opacity .15s, background .15s;
    color: var(--pg-ink);
    background: var(--pg-sand);
}

.pg-btn:hover:not(:disabled) { filter: brightness(.94); color: inherit; }
.pg-btn:disabled, .pg-btn[aria-disabled="true"] { cursor: default; }
.pg-btn .ms { font-size: 1.25rem; }

.pg-btn-ink { background: var(--pg-ink); color: var(--pg-on-ink); }
.pg-btn-ink:hover:not(:disabled) { color: var(--pg-on-ink); }
.pg-btn-coral { background: var(--pg-coral); color: #2A2522; }
.pg-btn-coral:hover:not(:disabled) { color: #2A2522; }
.pg-btn-mint { background: var(--pg-mint); color: #2A2522; }
.pg-btn-mint:hover:not(:disabled) { color: #2A2522; }
.pg-btn-cream { background: var(--pg-cream); color: var(--pg-ink); }
.pg-btn-coral-tint { background: var(--pg-coral-tint); color: var(--pg-ink); }
.pg-btn-white { background: var(--pg-paper); color: var(--pg-ink); }
.pg-btn-sand { background: var(--pg-sand); color: var(--pg-ink); }

.pg-btn-outline {
    background: transparent;
    border: 2px solid var(--pg-ink);
    padding: 12px 22px;
}

.pg-btn-text {
    background: transparent;
    padding: 10px 14px;
    color: var(--pg-muted);
}

.pg-btn-danger-text { background: transparent; color: var(--pg-coral-ink); }

.pg-btn-danger-outline {
    background: transparent;
    border: 2px solid var(--pg-coral-soft-line);
    color: var(--pg-coral-ink);
    border-radius: 16px;
    padding: 11px;
    font-size: .9375rem;
}

.pg-btn-lg { padding: 18px 30px; font-size: 1.125rem; }
.pg-btn-outline.pg-btn-lg { padding: 16px 28px; }
.pg-btn-sm { padding: 8px 14px; font-size: .875rem; }
.pg-btn-md { padding: 11px 18px; font-size: .9375rem; }

.pg-btn-block {
    width: 100%;
    height: 56px;
    border-radius: 18px;
    font-size: 1.0625rem;
    padding: 0 20px;
}

.pg-btn-square { border-radius: 16px; }

.pg-btn-round {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.pg-btn.is-faded { opacity: .45; cursor: default; }
.pg-btn-sand.is-faded { opacity: 1; color: var(--pg-dead-badge); }
.pg-btn.is-faded:hover { filter: none; }

.pg-link-btn {
    background: none;
    border: 0;
    padding: 0;
    font-weight: 600;
    color: var(--pg-coral-ink);
    cursor: pointer;
}

.pg-link-btn:hover { color: var(--pg-ink); }

/* ---------------------------------------------------------------------------
   Cards, rows, chips, badges
   ------------------------------------------------------------------------- */

.pg-card {
    background: var(--pg-paper);
    border-radius: 28px;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
}

html[data-contrast="high"] .pg-card,
html[data-contrast="high"] .pg-stat,
html[data-contrast="high"] .pg-board {
    box-shadow: inset 0 0 0 2px var(--pg-line);
}

.pg-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.pg-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--pg-divider);
}

.pg-row:last-child { border-bottom: 0; }
.pg-row-main { flex: 1; min-width: 0; }
.pg-row-title { font-weight: 600; font-size: 1rem; }
.pg-row.is-faded { opacity: .6; }

.pg-chip {
    padding: 7px 13px;
    border-radius: 999px;
    border: 0;
    background: var(--pg-sand);
    color: var(--pg-ink);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
}

.pg-chip:hover { filter: brightness(.96); }
.pg-chip.is-active { background: var(--pg-ink); color: var(--pg-badge-fg); }
.pg-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.pg-badge {
    padding: 5px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: .8125rem;
    white-space: nowrap;
    background: var(--pg-sand);
    color: var(--pg-muted);
}

.pg-badge-won { background: var(--pg-mint-tint); color: var(--pg-mint-ink); }
.pg-badge-lost { background: var(--pg-coral-tint); color: var(--pg-coral-ink); }
.pg-badge-count { padding: 2px 9px; background: var(--pg-coral); color: #2A2522; font-weight: 800; }

.pg-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--pg-mint-tint);
    color: var(--pg-mint-ink);
    font-weight: 600;
    font-size: .875rem;
    white-space: nowrap;
}

.pg-live::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pg-mint-dot);
}

.pg-live.is-warn { background: var(--pg-gold-tint); color: var(--pg-gold-ink); }
.pg-live.is-warn::before { background: var(--pg-gold); }
.pg-live.is-off { background: var(--pg-sand); color: var(--pg-muted); }
.pg-live.is-off::before { background: var(--pg-dead-badge); }

.pg-icon-tile {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--pg-sand);
    color: var(--pg-ink);
}

.pg-icon-tile.tone-coral { background: var(--pg-coral-tint); color: var(--pg-coral-ink); }
.pg-icon-tile.tone-mint { background: var(--pg-mint-tint); color: var(--pg-mint-ink); }
.pg-icon-tile.tone-gold { background: var(--pg-gold-tint); color: var(--pg-gold-ink); }
.pg-icon-tile .ms { font-size: 1.5rem; }

/* ---------------------------------------------------------------------------
   Form controls
   ------------------------------------------------------------------------- */

.pg-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pg-field > label {
    font-size: .875rem;
    font-weight: 600;
}

.pg-input {
    height: 54px;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--pg-paper);
    border: 2px solid var(--pg-line);
    padding: 0 16px;
    font-size: 1rem;
    color: var(--pg-ink);
    font-family: inherit;
    width: 100%;
    outline: none;
}

.pg-input::placeholder { color: var(--pg-placeholder); }
.pg-input:focus { border-color: var(--pg-ink); }
.pg-input.is-code { font-size: 1.125rem; letter-spacing: .2em; text-transform: uppercase; }

.pg-input-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    box-sizing: border-box;
    border-radius: 16px;
    border: 2px solid var(--pg-line);
    background: var(--pg-paper);
    padding: 0 14px;
    color: var(--pg-placeholder);
    flex: 1;
}

.pg-input-icon:focus-within { border-color: var(--pg-ink); }

.pg-input-icon input {
    border: 0;
    outline: none;
    background: transparent;
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    color: var(--pg-ink);
    font-family: inherit;
}

.pg-input-icon input::placeholder { color: var(--pg-placeholder); }
.pg-help { font-size: .8125rem; color: var(--pg-muted); }

.pg-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--pg-coral-tint);
    color: var(--pg-coral-sub);
    font-size: .9375rem;
    font-weight: 600;
}

.pg-alert .ms { font-size: 1.25rem; }
.pg-alert.is-info { background: var(--pg-mint-tint); color: var(--pg-mint-sub); }

/* Segmented control */
.pg-seg {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: var(--pg-sand);
    border-radius: 14px;
    padding: 4px;
}

.pg-seg button {
    border: 0;
    background: transparent;
    padding: 9px 6px;
    border-radius: 11px;
    font-weight: 600;
    font-size: .875rem;
    color: var(--pg-muted);
    cursor: pointer;
    text-align: center;
}

.pg-seg button.is-active {
    background: var(--pg-paper);
    color: var(--pg-ink);
    box-shadow: var(--pg-shadow-seg);
}

/* Switch: 52x30 track, 24px knob; on = mint, off = toggleOff */
.pg-switch {
    position: relative;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 999px;
    border: 0;
    padding: 0;
    background: var(--pg-toggle-off);
    cursor: pointer;
    transition: background .2s;
}

.pg-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
}

.pg-switch[aria-checked="true"] { background: var(--pg-mint); }
.pg-switch[aria-checked="true"]::after { transform: translateX(22px); }

/* ---------------------------------------------------------------------------
   Hand tiles: the core component. Ring is always a 4px border (transparent when
   idle) so the layout never shifts.
   ------------------------------------------------------------------------- */

.pg-hand {
    --tile-w: 156px;
    --tile-h: 162px;
    --tile-r: 34px;
    --art-h: 106px;
    --badge: 40px;
    --badge-off: -10px;
    position: relative;
    width: var(--tile-w);
    height: var(--tile-h);
    box-sizing: border-box;
    border-radius: var(--tile-r);
    border: 4px solid transparent;
    background: var(--pg-mint-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    cursor: default;
    transition: border-color .2s, transform .2s, box-shadow .2s, background .2s;
}

.pg-hand.is-small {
    --tile-w: 146px;
    --tile-h: 154px;
    --tile-r: 32px;
    --art-h: 98px;
    --badge: 38px;
    --badge-off: -8px;
}

.pg-hand.is-opp { background: var(--pg-coral-tint); }
.pg-hand.is-dead { background: var(--pg-dead-tile); }
.pg-hand.is-clickable { cursor: pointer; }
.pg-hand.is-clickable:hover { transform: scale(1.03); }

.pg-hand img {
    height: var(--art-h);
    pointer-events: none;
    filter: var(--pg-art-filter);
    user-select: none;
}

.pg-hand.is-dead img { opacity: .35; }

/* Art orientation: your left hand is mirrored; the opponent faces you. */
.pg-hand.art-mirror img { transform: scaleX(-1); }
.pg-hand.art-flip img { transform: rotate(180deg); }
.pg-hand.art-flip-mirror img { transform: rotate(180deg) scaleX(-1); }

.pg-hand-badge {
    position: absolute;
    top: var(--badge-off);
    right: var(--badge-off);
    width: var(--badge);
    height: var(--badge);
    border-radius: 50%;
    background: var(--pg-ink);
    color: var(--pg-badge-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1875rem;
    line-height: 1;
}

.pg-hand.is-small .pg-hand-badge { font-size: 1.125rem; }
.pg-hand.is-dead .pg-hand-badge { background: var(--pg-dead-badge); color: #fff; }

.pg-hand-pill {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--pg-paper);
    color: var(--pg-ink);
    font-weight: 600;
    font-size: .875rem;
    white-space: nowrap;
    line-height: 1.3;
}

.pg-hand.is-small .pg-hand-pill { font-size: .8125rem; padding: 4px 11px; }

.ring-ready { border-color: var(--pg-mint); }
.ring-selected { border-color: var(--pg-ink); transform: translateY(-10px); box-shadow: var(--pg-shadow-lift); }
.ring-selected.is-clickable:hover { transform: translateY(-10px) scale(1.03); }
.ring-revive { border-color: var(--pg-mint); border-style: dashed; }
.ring-target { border-color: var(--pg-coral-ring); border-style: dashed; }
.ring-hit-you { border-color: var(--pg-mint); }
.ring-hit-them { border-color: var(--pg-coral); }

.pill-attacking { background: var(--pg-ink); color: var(--pg-badge-fg); }
.pill-revive { background: var(--pg-mint); color: #2A2522; }
.pill-preview { background: var(--pg-paper); border-color: var(--pg-coral-ring); color: var(--pg-coral-ink); }
.pill-knockout, .pill-hit-them, .pill-ko-them { background: var(--pg-coral); color: #2A2522; }
.pill-hit-you, .pill-ko-you { background: var(--pg-mint); color: #2A2522; }
.pill-out { background: var(--pg-paper); color: var(--pg-muted); }

html[data-motion="reduce"] .pg-hand,
html[data-motion="reduce"] .pg-hand:hover,
html[data-motion="reduce"] .ring-selected {
    transition: none;
    transform: none;
}

html[data-motion="reduce"] .ring-selected { box-shadow: none; }

/* Standalone decorative tiles (logo art, hero, game-over, tutorial) */
.pg-tile {
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.pg-tile img { filter: var(--pg-art-filter); }
.pg-tile.tone-mint { background: var(--pg-mint); }
.pg-tile.tone-coral { background: var(--pg-coral); }
.pg-tile.tone-mint-tint { background: var(--pg-mint-tint); }
.pg-tile.tone-coral-tint { background: var(--pg-coral-tint); }
.pg-tile.tone-cream { background: #FBF6EE; }
.pg-tile.tone-cream img { filter: none; }
.pg-tile.tone-ink { background: #2A2522; }
.pg-tile.tone-ink img { filter: invert(1); }
.pg-tile.tone-sand { background: var(--pg-sand); }
.pg-tile.tone-mint img, .pg-tile.tone-coral img { filter: none; }

/* ---------------------------------------------------------------------------
   Board: seat pills, status card, actions
   ------------------------------------------------------------------------- */

.pg-board {
    background: var(--pg-paper);
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 22px 16px;
    position: relative;
    min-height: 640px;
    overflow: hidden;
}

.pg-board-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.pg-board-side.is-mine { gap: 20px; }

.pg-hands {
    display: flex;
    gap: 24px;
}

.pg-seat-pill {
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: .9375rem;
    white-space: nowrap;
}

.pg-seat-pill.is-opp { background: var(--pg-coral-tint); color: var(--pg-coral-ink); }
.pg-seat-pill.is-opp.is-active { background: var(--pg-coral); color: #2A2522; }
.pg-seat-pill.is-me { background: var(--pg-mint-tint); color: var(--pg-mint-ink); }
.pg-seat-pill.is-me.is-active { background: var(--pg-ink); color: var(--pg-badge-fg); }

.pg-status {
    padding: 14px 26px;
    border-radius: 22px;
    background: var(--pg-cream);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 420px;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.pg-status-title {
    font-weight: 800;
    font-size: 1.625rem;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.pg-status-sub { font-size: .9375rem; color: var(--pg-muted); }
.pg-status.tone-split { background: var(--pg-mint-tint); }
.pg-status.tone-split .pg-status-sub { color: var(--pg-mint-sub); }
.pg-status.tone-waiting { background: var(--pg-coral-tint); }
.pg-status.tone-waiting .pg-status-sub { color: var(--pg-coral-sub); }

.pg-board-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.pg-board-actions .pg-btn { padding: 12px 20px; }

/* Moves log */
.pg-moves {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow: auto;
}

.pg-move {
    display: flex;
    gap: 10px;
    font-size: .875rem;
    line-height: 1.35;
}

.pg-move-dot {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6875rem;
    font-weight: 800;
    background: var(--pg-coral-tint);
}

.pg-move-dot.is-you { background: var(--pg-mint-tint); }

/* ---------------------------------------------------------------------------
   Overlays: game-over modal (web), sheet (narrow), toasts
   ------------------------------------------------------------------------- */

.pg-overlay {
    position: absolute;
    inset: 0;
    background: var(--pg-scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    padding: 20px;
}

.pg-modal {
    width: 520px;
    max-width: 100%;
    background: var(--pg-paper);
    border-radius: 36px;
    padding: 36px;
    box-sizing: border-box;
    box-shadow: var(--pg-shadow-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.pg-modal-title {
    font-size: 3.25rem;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1;
}

.pg-ach {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 20px;
    background: var(--pg-gold-tint);
    text-align: left;
    box-sizing: border-box;
}

.pg-ach-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--pg-gold);
    color: #2A2522;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pg-ach-title { font-weight: 800; font-size: 1rem; }
.pg-ach-sub { font-size: .875rem; color: var(--pg-gold-sub); }

.pg-toasts {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 32px));
}

.pg-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: var(--pg-paper);
    box-shadow: var(--pg-shadow-modal);
    border: 0;
    text-align: left;
    color: var(--pg-ink);
    cursor: pointer;
}

.pg-toast .pg-icon-tile { width: 40px; height: 40px; border-radius: 12px; }
.pg-toast-title { font-weight: 800; font-size: .9375rem; }
.pg-toast-body { font-size: .8125rem; color: var(--pg-muted); }
.pg-toast.tone-achievement { background: var(--pg-gold-tint); }
.pg-toast.tone-achievement .pg-icon-tile { background: var(--pg-gold); color: #2A2522; }
.pg-toast.tone-error .pg-icon-tile { background: var(--pg-coral-tint); color: var(--pg-coral-ink); }
.pg-toast.tone-success .pg-icon-tile { background: var(--pg-mint-tint); color: var(--pg-mint-ink); }

/* ---------------------------------------------------------------------------
   Stats, achievements, progress
   ------------------------------------------------------------------------- */

.pg-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pg-stat {
    background: var(--pg-paper);
    border-radius: 22px;
    padding: 18px 20px;
}

.pg-stat-label { font-size: .875rem; color: var(--pg-muted); }

.pg-stat-value {
    font-size: 2.125rem;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.25;
}

.pg-progress {
    height: 8px;
    border-radius: 4px;
    background: var(--pg-sand);
    overflow: hidden;
}

.pg-progress > div {
    height: 8px;
    background: var(--pg-gold);
}

.pg-ach-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pg-ach-row .pg-icon-tile {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--pg-gold-tint);
    color: var(--pg-gold-icon);
}

.pg-ach-row.is-locked { opacity: .5; }
.pg-ach-row.is-locked .pg-icon-tile { background: var(--pg-sand); color: var(--pg-ink); }
.pg-ach-name { font-weight: 600; font-size: .9375rem; }

/* Code tiles (private match) */
.pg-code {
    display: flex;
    gap: 8px;
}

.pg-code span {
    width: 52px;
    height: 64px;
    border-radius: 14px;
    background: var(--pg-mint-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.875rem;
    font-weight: 800;
}

/* Empty state */
.pg-empty {
    text-align: center;
    color: var(--pg-muted);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.pg-empty .ms { font-size: 2.25rem; color: var(--pg-placeholder); }
.pg-empty-title { font-weight: 800; color: var(--pg-ink); }

.pg-skeleton {
    background: linear-gradient(90deg, var(--pg-sand), var(--pg-cream), var(--pg-sand));
    background-size: 200% 100%;
    animation: pg-shimmer 1.4s infinite;
    border-radius: 12px;
    min-height: 18px;
}

@keyframes pg-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

html[data-motion="reduce"] .pg-skeleton { animation: none; }

/* Page loader (outside Blazor's tree, removed by js/chopsticks.js) */
#page-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--pg-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .3s;
}

#page-loader.is-done { opacity: 0; pointer-events: none; }

#page-loader .pg-logo-tiles span {
    width: 46px;
    height: 52px;
    border-radius: 15px;
    animation: pg-bob 1s ease-in-out infinite alternate;
}

#page-loader .pg-logo-tiles span:last-child { animation-delay: .25s; margin-left: -9px; }

@keyframes pg-bob {
    from { translate: 0 0; }
    to { translate: 0 -8px; }
}

/* ---------------------------------------------------------------------------
   Responsive. Below 960px the game rail stacks under the board and tiles use the
   mobile sizes; below 760px the app takes the mobile layout and tab bar.
   ------------------------------------------------------------------------- */

@media (max-width: 960px) {
    .pg-hand {
        --tile-w: 146px;
        --tile-h: 154px;
        --tile-r: 32px;
        --art-h: 98px;
        --badge: 38px;
        --badge-off: -8px;
    }

    .pg-hands { gap: 18px; }
    .pg-status { min-width: 0; width: 100%; }
    .pg-board { min-height: 0; }
}

@media (max-width: 760px) {
    .pg-nav { padding: 0 20px; height: 64px; gap: 12px; }
    .pg-tabs, .pg-nav-end .pg-hide-narrow { display: none; }
    .pg-wordmark { font-size: 1.3125rem; }
    .pg-logo-tiles span { width: 24px; height: 28px; border-radius: 8px; }
    .pg-logo-tiles span:last-child { margin-left: -5px; }
    .pg-main { padding: 4px 20px 108px; }
    .pg-h1 { font-size: 1.875rem; }
    .pg-display { font-size: 3.25rem; }
    .pg-modal-title { font-size: 2.625rem; }
    .pg-status { border-radius: 20px; padding: 14px 18px; }
    .pg-status-title { font-size: 1.3125rem; letter-spacing: -.01em; }
    .pg-status-sub { font-size: .875rem; }
    .pg-card { padding: 16px; border-radius: 24px; }
    .pg-stat { padding: 14px 16px; border-radius: 20px; }
    .pg-stat-value { font-size: 1.75rem; }
    .pg-code span { width: auto; flex: 1; height: 52px; font-size: 1.5rem; border-radius: 12px; }
    .pg-code { gap: 6px; }
    .pg-toasts { right: 16px; left: 16px; bottom: 100px; max-width: none; }

    .pg-tabbar {
        display: grid;
        grid-template-columns: repeat(var(--tabs, 5), 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 84px;
        padding: 10px 8px env(safe-area-inset-bottom, 0);
        box-sizing: border-box;
        background: var(--pg-paper);
        border-radius: 28px 28px 0 0;
        z-index: 1030;
        box-shadow: 0 -6px 24px rgba(42, 37, 34, .06);
    }

    .pg-tabbar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--pg-placeholder);
        font-size: .75rem;
        font-weight: 600;
    }

    .pg-tabbar a .ms { font-size: 1.5rem; }
    .pg-tabbar a.active { color: var(--pg-ink); }

    .pg-overlay.is-sheet {
        align-items: flex-end;
        padding: 0;
    }

    .pg-overlay.is-sheet .pg-modal {
        width: 100%;
        border-radius: 36px 36px 0 0;
        padding: 28px 24px 40px;
        gap: 14px;
        box-shadow: var(--pg-shadow-sheet);
    }

    .pg-overlay.is-sheet .pg-modal::before {
        content: "";
        width: 44px;
        height: 5px;
        border-radius: 3px;
        background: var(--pg-line);
        margin-top: -12px;
    }

    .pg-board-hide-narrow { display: none !important; }
}

@media (max-width: 380px) {
    .pg-hand {
        --tile-w: 132px;
        --tile-h: 140px;
        --tile-r: 30px;
        --art-h: 88px;
    }

    .pg-hands { gap: 14px; }
}

@media (max-width: 760px) {
    /* Game screens bring their own back / restart header on phones. */
    .pg-shell.is-immersive .pg-nav { display: none; }
    .pg-shell.is-immersive .pg-main { padding-bottom: 24px; }
}

/* Sign in / create account (B02) */
.auth-title {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
}

.auth-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--pg-placeholder);
    font-size: .875rem;
}

.auth-or span {
    flex: 1;
    height: 1px;
    background: var(--pg-line);
}

.auth-switch {
    font-size: .9375rem;
    text-align: center;
    color: var(--pg-muted);
}

.auth-switch a { font-weight: 600; }

@media (max-width: 760px) {
    .auth-title { font-size: 2rem; }
}

/* Tutorial illustrations (TutorialHand) */
.tut-hand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.tut-hand-caption {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--pg-muted);
}

.tut-hand-caption.is-mine { color: var(--pg-mint-ink); }
.tut-hand-caption.is-opp { color: var(--pg-coral-ink); }
.tut-hand .tut-no-lift { transform: none; box-shadow: none; }
.tut-split { cursor: default; }

@media (max-width: 760px) {
    /* M03: your pill under your tiles, then Split (wide) and Undo (104px) as the bottom row. */
    .pg-board-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 104px;
        gap: 10px;
        width: 100%;
        padding: 0 4px;
        box-sizing: border-box;
    }

    .pg-board-actions .pg-seat-pill {
        grid-column: 1 / -1;
        justify-self: center;
        font-size: .875rem;
        padding: 5px 12px;
        margin-bottom: 8px;
    }

    .pg-board-actions .pg-btn {
        height: 58px;
        border-radius: 20px;
        font-size: 1.0625rem;
        padding: 0 12px;
    }

    .pg-board-actions .pg-btn-sand {
        background: var(--pg-paper);
    }

    .pg-board-actions .pg-btn:nth-child(2):last-child {
        grid-column: 1 / -1;
    }
}
