/* Jass — DIE BEIZ AM STAMMTISCH. Where every value comes from:
 *   cards     the public-domain 1850 Hasle-bei-Burgdorf deck (assets/cards), the brightest thing on screen
 *   --coat-red   sampled from the court coats, rgb(169,103,76) median, deepened to #b04a30 for ink on paper
 *   --coat-blue  the coats' indigo (the Under's sleeve, the banner stripes), #2c4677; the Jassteppich
 *                is that indigo taken down to felt (#22324f)
 *   --ochre      the bells' and hats' yellow, rgb(197,178,99), lifted to #e2b84a: THE signal — "you may act"
 *   --paper      the cards' paper, rgb(206,196,170), kept a step DARKER on plates (#cbbd9d) so cards win
 *   room         smoked fir panelling (Täfer) of a Swiss Beiz; rim = scrubbed fir; slate = black-green
 *                slate in a beech frame; chalk #ece6d6
 *   type      Ultra (the court cards' banner capitals: wordmark and banners only), Alegreya Sans (UI),
 *             Kalam (the chalk hand) — all OFL, self-hosted in assets/fonts (README there)
 */
@font-face { font-family: 'Ultra'; src: url('assets/fonts/Ultra-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; font-weight: 400; src: url('assets/fonts/AlegreyaSans-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; font-weight: 500; src: url('assets/fonts/AlegreyaSans-500.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; font-weight: 700; src: url('assets/fonts/AlegreyaSans-700.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; font-weight: 800; src: url('assets/fonts/AlegreyaSans-800.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Kalam'; font-weight: 400; src: url('assets/fonts/Kalam-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Kalam'; font-weight: 700; src: url('assets/fonts/Kalam-700.woff2') format('woff2'); font-display: swap; }

:root {
    --room: #150e09;
    --room-2: #22160e;
    --room-3: #2d1d12;
    --fir: #b98a55;
    --fir-dark: #7e5530;
    --mat: #22324f;
    --mat-lit: #2f4672;
    --stitch: rgba(226, 184, 74, 0.55);
    --paper: #cbbd9d;
    --paper-2: #bfb08d;
    --paper-hi: #d6c9aa;
    --paper-edge: #8d7a58;
    --ink: #2a211b;
    --ink-soft: #54473a;
    --coat-red: #b04a30;
    --coat-red-hi: #d06a4a;
    --coat-blue: #2c4677;
    --coat-blue-hi: #6f8fc9;
    --ochre: #e2b84a;
    --ochre-deep: #a77b14;
    --ochre-soft: rgba(226, 184, 74, 0.35);
    --slate: #232b29;
    --slate-2: #1a201f;
    --chalk: #ece6d6;
    --chalk-dim: rgba(236, 230, 214, 0.76);
    --beech: #c4925a;
    --beech-dark: #8a5f33;
    --font-mark: 'Ultra', 'Rockwell Extra Bold', Georgia, serif;
    --font-ui: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
    --font-chalk: 'Kalam', 'Comic Sans MS', cursive;
    --shadow-card: 0 2px 3px rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.32);

    /* The shared dialogs (core/back.js's leave question) read these; they are pointed at this
       table's paper so its dialogs are Jass dialogs (rules copied below from the shell). */
    --dk-accent: var(--coat-blue);
    --dk-accent-ink: #f1e9d6;
    --dk-accent-soft: rgba(44, 70, 119, 0.22);
    --dk-dialog-bg: var(--paper);
    --dk-dialog-line: var(--paper-edge);
    --dk-dialog-radius: 6px;
    --dk-font-display: var(--font-mark);
    --dk-font-ui: var(--font-ui);
    --dk-panel-accent: var(--coat-blue);
    --dk-panel-text: var(--ink);
    --dk-scrim: rgba(12, 8, 5, 0.72);
    --dk-scrim-solid: #120c08;
    --dk-start-field: var(--paper-hi);
    --dk-start-field-edge: var(--paper-edge);
    --dk-start-field-ink: var(--ink);
    --dk-start-focus: 2px solid var(--coat-blue);
    --dk-start-disabled: 0.45;
    --dk-z-overlay: 1100;
    --dk-dialog-top: var(--paper-hi);
    --dk-dialog-bottom: var(--paper);
    --dk-back-btn-bg: var(--ochre);
    --dk-back-btn-line: var(--ochre-deep);
    --dk-back-btn-ink: var(--ink);
    --dk-back-alt-line: var(--paper-edge);
    --dk-back-alt-ink: var(--ink);
    --dk-back-focus: var(--coat-blue);
    --dk-z-start: 1200;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
    background: var(--room);
    color: var(--chalk);
    font-family: var(--font-ui);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}
button { font-family: var(--font-ui); color: inherit; }
::selection { background: var(--ochre); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }

/* ── The room: smoked fir boards, one lamp over the table ─────────────────────────────── */
#game {
    position: fixed; inset: 0; z-index: 1; overflow: hidden;
    touch-action: none;
    background:
        radial-gradient(ellipse 52% 50% at 40% 50%, rgba(255, 196, 110, 0.22), rgba(255, 196, 110, 0.06) 55%, transparent 75%),
        radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(0, 0, 0, 0.55) 100%),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0 1px, rgba(255, 220, 170, 0.05) 1px 2px, transparent 2px 86px),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='600'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.3 0.01' numOctaves='4' seed='5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.2 0 0 0 -.35'/%3E%3C/filter%3E%3Crect width='240' height='600' filter='url(%23w)'/%3E%3C/svg%3E") 0 0 / 240px 600px,
        repeating-linear-gradient(90deg, rgba(255, 210, 160, 0.025) 0 22px, rgba(0, 0, 0, 0.05) 22px 43px),
        linear-gradient(180deg, var(--room-3), var(--room-2) 40%, var(--room));
}

/* ── The Stammtisch: a fir rim around the Jassteppich ─────────────────────────────────── */
#table {
    position: absolute; z-index: 2; pointer-events: none;
    border-radius: 22px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='240'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.32' numOctaves='4' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .19 0 0 0 0 .08 1.4 0 0 0 -.45'/%3E%3C/filter%3E%3Crect width='600' height='240' filter='url(%23w)'/%3E%3C/svg%3E") center / 600px 240px,
        linear-gradient(180deg, #c99a63, var(--fir) 40%, #a2733f);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(255, 230, 190, 0.18) inset, 0 -3px 6px rgba(60, 30, 10, 0.4) inset;
}
#mat {
    position: absolute; inset: var(--rim, 14px);
    border-radius: calc(22px - var(--rim, 14px) + 4px);
    background:
        radial-gradient(ellipse 70% 62% at 50% 46%, rgba(120, 150, 210, 0.22), transparent 72%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .62 0 0 0 0 .8 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23f)'/%3E%3C/svg%3E"),
        linear-gradient(180deg, var(--mat-lit), var(--mat) 70%);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5) inset;
}
#mat::after {           /* the stitched ochre border of the mat */
    content: ''; position: absolute; inset: 7px;
    border: 1.5px dashed var(--stitch);
    border-radius: inherit;
}
body.phone #mat::after { inset: 4px; }

/* ── Cards: the box is ours, the face is the 1850 print (or the shared French deck) ───── */
.card {
    position: absolute;
    border-radius: 6px;
    background-color: #cec4aa;
    background-size: 100% 100%;
    box-shadow: var(--shadow-card);
    user-select: none; -webkit-user-select: none;
    touch-action: none;
    overflow: hidden;
    transform-origin: center center;
}
.card.back { background-image: url('assets/cards/back.webp'); background-color: #a9875c; }
.card.fr { background-color: #f4f0e6; border-radius: 5px; }
.card.fr.dk-art { background-color: #fff; }
.hand-card.playable { cursor: pointer; box-shadow: 0 0 0 2px var(--ochre), var(--shadow-card); }
@media (hover: hover) { .hand-card.playable:hover { filter: brightness(1.09); } }
.hand-card.dim { filter: brightness(0.62) saturate(0.55); cursor: not-allowed; }
.hand-card:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.trick-card.won { box-shadow: 0 0 0 3px var(--paper-hi), 0 0 0 4px rgba(42, 33, 27, 0.6), 0 10px 24px rgba(0, 0, 0, 0.55); z-index: 90 !important; }
.trick-card.lost { filter: brightness(0.55) saturate(0.6); }
.trick-card.won, .trick-card.lost { transition: filter 220ms ease, box-shadow 220ms ease; }
.hand-card.flip-in { animation: flip-in 200ms ease-out; }
@keyframes flip-in { from { transform: scaleX(0.1); } to { transform: scaleX(1); } }
.hand-card.shake { animation: shake 320ms ease; }
@keyframes shake { 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }
.card.mini { position: relative; border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.ghost { position: fixed; z-index: 900; pointer-events: none; transform-origin: center center; will-change: transform; }
.ghost .card { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45); }

/* ── Seat tags: little paper labels; a coat-coloured disc names the team ──────────────── */
.seat-tag {
    position: absolute; z-index: 40; pointer-events: none;
    display: flex; flex-direction: column; gap: 1px;
    padding: 4px 9px 4px 8px;
    background: var(--paper);
    color: var(--ink);
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    max-width: 180px;
    transition: box-shadow 200ms ease, translate 200ms ease;
}
.seat-tag .tag-name { font-weight: 800; font-size: 14px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.seat-tag .tag-name::before { content: ''; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--coat-blue); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); }
.seat-tag.team-us .tag-name::before { background: var(--coat-red); }
.seat-tag .tag-sub { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); min-height: 15px; white-space: nowrap; }
.seat-tag .tag-sub span:empty { display: none; }
.seat-tag.active { box-shadow: 0 0 0 2px var(--ochre), 0 4px 12px rgba(0, 0, 0, 0.5); translate: 0 -1px; }
.tag-pile { display: inline-flex; align-items: center; gap: 0; position: relative; margin-left: auto; padding-left: 4px; }
.tag-pile i { display: block; width: 10px; height: 15px; border-radius: 2px; background: url('assets/cards/back.webp') center/cover; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); }
.tag-pile i + i { margin-left: -7px; transform: rotate(8deg); }
.tag-pile b { font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 4px; color: var(--ink); }
.tag-pile.empty i { opacity: 0.3; }
.tag-contract { flex: none; }
body.phone .seat-tag { padding: 2px 6px; }
body.phone .seat-tag .tag-name { font-size: 12px; }
body.phone .seat-tag .tag-sub { font-size: 10.5px; min-height: 13px; gap: 3px; }
body.phone .tag-pile { padding-left: 2px; }

/* ── Contract card: what is played, by whom, and the hand so far ──────────────────────── */
.contract-card {
    position: absolute; z-index: 30;
    padding: 8px 12px 9px;
    background: var(--paper);
    color: var(--ink);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.cc-head { display: flex; align-items: center; gap: 8px; }
.cc-title { font-weight: 800; font-size: 17px; line-height: 1.15; }
.cc-sub { font-size: 13px; color: var(--ink-soft); margin-top: 1px; }
.cc-points { display: flex; gap: 12px; margin-top: 4px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-points .us { color: var(--coat-red); }
.cc-points .them { color: var(--coat-blue); }
body.phone .contract-card { padding: 4px 8px; }
body.phone .cc-title { font-size: 13px; }
body.phone .cc-sub { font-size: 11px; }
body.phone .cc-points { font-size: 11px; margin-top: 1px; }

.c-icon { display: inline-grid; place-items: center; flex: none; }
.c-icon img { width: 100%; height: 100%; object-fit: contain; }
.c-icon.c-draw { color: var(--coat-blue); }
.c-icon.fr svg { width: 88%; height: 88%; }
.c-icon.fr-h, .c-icon.fr-d { color: #b3261e; }
.c-icon.fr-c, .c-icon.fr-s { color: #1d1d1d; }

/* ── Status line: a paper slip above the hand ─────────────────────────────────────────── */
#status-line {
    position: fixed; z-index: 70; pointer-events: none;
    transform: translate(-50%, -100%);
    padding: 3px 12px;
    background: var(--paper);
    color: var(--ink);
    border-radius: 3px;
    font-weight: 700; font-size: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0; transition: opacity 180ms ease;
}
#status-line.show { opacity: 1; }
#status-line.alerting { background: var(--paper-hi); }
#status-msg.msg-alert { color: var(--coat-red); }
body.phone #status-line { font-size: 13px; }
body:not(.in-game) #status-line { display: none; }

/* ── Paper plates: the questions, the Weis shown, the hand's account ──────────────────── */
.paper-plate {
    position: fixed; z-index: 800;
    padding: 14px 16px 16px;
    background:
        linear-gradient(180deg, rgba(255, 250, 235, 0.35), transparent 30%),
        var(--paper);
    color: var(--ink);
    border-radius: 5px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(80, 60, 30, 0.35);
    max-height: calc(100dvh - 8px);
    overflow-y: auto;
}
.ask-title { font-family: var(--font-mark); font-size: 21px; letter-spacing: 0.02em; color: var(--coat-blue); line-height: 1.15; }
.ask-lead { font-size: 15px; color: var(--ink-soft); margin: 3px 0 10px; }
.ask-lead:empty { display: none; }
.ask-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-top: 8px; }
.ask-opt {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center;
    column-gap: 8px; text-align: left;
    min-height: 50px; padding: 6px 10px;
    background: var(--paper-hi);
    color: var(--ink);
    border: 1px solid var(--paper-edge);
    border-radius: 4px;
    font-size: 16px; font-weight: 700;
    cursor: pointer; touch-action: manipulation;
    transition: background-color 140ms ease, border-color 140ms ease, translate 140ms ease;
}
.ask-opt .c-icon { grid-row: 1 / 3; }
.ask-opt .ask-main { line-height: 1.1; }
.ask-opt .ask-sub { font-size: 12px; font-weight: 500; color: var(--ink-soft); grid-column: 2; }
.ask-opt:not(:has(.c-icon)) { grid-template-columns: 1fr; text-align: center; }
.ask-opt:not(:has(.c-icon)) .ask-sub { grid-column: 1; }
@media (hover: hover) { .ask-opt:hover { border-color: var(--ochre-deep); background: #ded2b5; } }
.ask-opt:active { translate: 0 1px; }
.ask-opt.primary { background: var(--ochre); border-color: var(--ochre-deep); }
@media (hover: hover) { .ask-opt.primary:hover { background: #ebc75f; } }
.ask-opt.shove { background: transparent; border-style: dashed; }
.ask-opt:focus-visible { outline: 2px solid var(--coat-blue); outline-offset: 2px; }

.weis-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.weis-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.weis-label { font-size: 14px; font-weight: 700; min-width: 140px; }
.weis-cards { display: flex; gap: 0; }
.ask-plate > .weis-cards { justify-content: center; margin: 4px 0; gap: 6px; }
.weis-plate, .end-plate { opacity: 0; translate: 0 8px; transition: opacity 220ms ease, translate 260ms cubic-bezier(.16, 1, .3, 1); }
.weis-plate.on, .end-plate.on { opacity: 1; translate: 0 0; }

.end-contract { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-weight: 700; }
.end-table { display: grid; grid-template-columns: auto 1fr 1fr; gap: 3px 12px; font-variant-numeric: tabular-nums; }
.end-team { font-weight: 800; font-size: 13px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.end-team.us { color: var(--coat-red); }
.end-team.them { color: var(--coat-blue); }
.end-k { font-size: 14px; color: var(--ink-soft); }
.end-v { font-size: 16px; font-weight: 700; text-align: right; }
.end-k.tot, .end-v.tot { border-top: 1px solid var(--paper-edge); padding-top: 3px; color: var(--ink); }
.end-note { margin-top: 8px; font-size: 14px; font-weight: 600; }
.end-note.good { color: var(--coat-red); font-weight: 800; }
.end-next { width: 100%; margin-top: 12px; grid-template-columns: 1fr; text-align: center; justify-items: center; }

/* ── Speech: a seat says "Gschobe!", "Trumpf Rosen", "Weis!", "Stöck!" ──────────────── */
.say {
    position: fixed; z-index: 850; pointer-events: none;
    display: flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    background: var(--paper-hi);
    color: var(--ink);
    border-radius: 14px;
    font-weight: 800; font-size: 16px; white-space: nowrap;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%) scale(0.86);
    opacity: 0;
    transition: opacity 180ms ease, transform 260ms cubic-bezier(.2, 1.4, .4, 1);
}
.say.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ── Welcome ──────────────────────────────────────────────────────────────────────────── */
#welcome { position: fixed; inset: 0; z-index: 1190; display: grid; place-items: center; pointer-events: auto; }
#welcome .welcome-plate {
    position: relative; text-align: center; padding: 18px 28px 20px; max-width: min(520px, 92vw);
    opacity: 0; translate: 0 10px; transition: opacity 300ms ease, translate 400ms cubic-bezier(.16, 1, .3, 1);
}
#welcome.show .welcome-plate { opacity: 1; translate: 0 0; }
.welcome-title { font-family: var(--font-mark); font-size: 26px; color: var(--coat-red); line-height: 1.15; }
.welcome-line { margin-top: 6px; font-size: 17px; }

/* ── The court-card banner (wordmark, titles) ─────────────────────────────────────────── */
.banner {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 18px;
    background:
        linear-gradient(180deg, var(--coat-blue) 0 24%, var(--ochre) 24% 31%, var(--coat-blue) 31% 69%, var(--ochre) 69% 76%, var(--coat-blue) 76%);
    border-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}
.banner-label {
    display: inline-block;
    padding: 1px 12px 0;
    background: var(--paper-hi);
    color: var(--ink);
    font-family: var(--font-mark); font-size: 20px; letter-spacing: 0.08em; text-transform: uppercase;
    line-height: 1.25;
    border: 1px solid rgba(40, 30, 20, 0.6);
    white-space: nowrap;
}
.banner.big { padding: 7px 34px; }
.banner.big .banner-label { font-size: 46px; padding: 2px 22px 0; }

/* ── Header: a smoked fir board ───────────────────────────────────────────────────────── */
#header-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 300;
    height: 52px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 0 8px;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 140px),
        linear-gradient(180deg, #2f2015, #20150d);
    border-bottom: 2px solid #120b06;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
body:not(.in-game) #header-bar { display: none; }
.hb-left, .hb-right { display: flex; align-items: center; gap: 4px; }
.hb-mark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.hb-mark .banner { padding: 3px 12px; }
.hb-mark .banner-label { font-size: 17px; }
.hb-btn {
    width: 44px; height: 44px; display: grid; place-items: center;
    background: transparent; color: #e6d7b8;
    border: 1px solid transparent; border-radius: 8px;
    cursor: pointer; touch-action: manipulation;
    transition: background-color 140ms ease, color 140ms ease;
}
.hb-btn svg { pointer-events: none; }
@media (hover: hover) { .hb-btn:hover { background: rgba(255, 230, 190, 0.08); color: #fff3d8; } }
.hb-btn.active { background: rgba(203, 189, 157, 0.18); color: var(--paper-hi); border-color: rgba(203, 189, 157, 0.45); }
.slate-chip { width: 56px; padding: 2px; background: linear-gradient(var(--slate), var(--slate-2)); border: 3px solid var(--beech); border-radius: 4px; }
.slate-chip[hidden] { display: none; }
.slate-chip svg { width: 100%; height: 100%; }

#ai-indicator {
    position: relative; height: 44px; min-width: 44px;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.2); color: #d9c8a5;
    border: 1px solid rgba(226, 184, 74, 0.22); border-radius: 22px;
    font-size: 13px; font-weight: 700; white-space: nowrap;
    cursor: pointer; touch-action: manipulation;
}
.ai-lamp { width: 9px; height: 9px; border-radius: 50%; background: #8a7a62; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4); }
.ai-heuristic .ai-lamp { background: var(--paper-hi); box-shadow: 0 0 0 1px rgba(255, 240, 210, 0.4); }
.ai-onnx .ai-lamp { background: #9fd38a; }
.ai-pending .ai-lamp { background: #8a7a62; animation: lamp 1.2s ease-in-out infinite; }
@keyframes lamp { 50% { opacity: 0.35; } }
.ai-detail {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 400;
    width: 260px; padding: 10px 12px;
    background: var(--paper); color: var(--ink); border-radius: 4px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
    font-weight: 500; white-space: normal; text-align: left; cursor: default;
}
#ai-indicator.tip-open .ai-detail { display: block; }
@media (hover: hover) { #ai-indicator:hover .ai-detail { display: block; } }
.ai-detail-head { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.ai-detail-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.ai-detail-row span:first-child { color: var(--ink-soft); }
.ai-detail-why { margin-top: 6px; font-size: 12.5px; color: var(--ink-soft); }
#ai-eval-btn { position: relative; }
#ai-eval-btn[data-ai]::after { content: ''; position: absolute; right: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: #8a7a62; display: none; }
#ai-eval-btn[data-ai="heuristic"]::after { background: var(--paper-hi); }

/* PHONE: no bar. The tools stand in two columns at the screen edges, the AI lamp rides on the
   AI-decisions button, the name rides as a small banner under the left column. */
body.phone #header-bar { height: 0; padding: 0; background: none; border: 0; box-shadow: none; pointer-events: none; }
body.phone .hb-left, body.phone .hb-right {
    position: fixed; top: 4px; flex-direction: column; gap: 4px; pointer-events: auto;
}
body.phone .hb-left { left: 2px; }
body.phone .hb-right { right: 2px; }
body.phone .hb-btn { background: rgba(32, 21, 13, 0.82); border-color: rgba(226, 184, 74, 0.2); border-radius: 50%; }
body.phone .slate-chip { border-radius: 5px; width: 44px; height: 44px; padding: 1px; }
body.phone #ai-indicator { display: none; }
body.phone #ai-eval-btn[data-ai]::after { display: block; }
body.phone .hb-mark { display: none; }

/* ── The Jasstafel ────────────────────────────────────────────────────────────────────── */
.slate-frame {
    padding: 11px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='240'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.016 0.42' numOctaves='4' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .22 0 0 0 0 .1 1.1 0 0 0 -.4'/%3E%3C/filter%3E%3Crect width='600' height='240' filter='url(%23w)'/%3E%3C/svg%3E") center / 600px 240px,
        linear-gradient(160deg, #d29f66, var(--beech) 45%, #b07c45);
    border-radius: 6px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 235, 200, 0.35) inset, 0 -2px 4px rgba(70, 40, 15, 0.45) inset;
}
.slate-face {
    position: relative; width: 100%; height: 100%;
    background:
        radial-gradient(ellipse 40% 26% at 30% 28%, rgba(236, 230, 214, 0.07), transparent 70%),
        radial-gradient(ellipse 34% 22% at 72% 74%, rgba(236, 230, 214, 0.06), transparent 70%),
        radial-gradient(ellipse at 50% 50%, var(--slate) 40%, var(--slate-2));
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65) inset;
}
#slate { position: fixed; z-index: 20; }
#slate[hidden] { display: none; }
#slate .slate-face { display: grid; place-items: center; padding: 4px; }
.slate-svg { display: block; width: 100%; height: 100%; }
.slate-svg .ch { fill: none; stroke: var(--chalk); stroke-width: 2.3; stroke-linecap: round; opacity: 0.92; }
.slate-svg .zline { stroke-width: 2.7; opacity: 0.86; }
.slate-svg .divider { stroke-width: 1.6; opacity: 0.45; }
.slate-svg .faint { stroke-width: 1; opacity: 0.2; }
.slate-svg text { fill: var(--chalk); font-family: var(--font-chalk); }
.slate-svg .chd { font-size: 19px; font-weight: 700; }
.slate-svg .chd.rest { font-size: 14px; fill: var(--chalk-dim); font-weight: 400; }
.slate-svg .chd.cell { font-size: 15px; }
.slate-svg .chd.tot { font-size: 18px; }
.slate-svg .chn { font-size: 14px; fill: var(--chalk-dim); }
.slate-svg .cht { font-size: 22px; fill: var(--chalk); font-weight: 700; }
.slate-svg .chs { font-size: 10.5px; fill: var(--chalk-dim); }
.slate-svg .chf { font-size: 13px; font-weight: 700; }
.slate-svg .chr { font-size: 13.5px; fill: var(--chalk-dim); }
.slate-svg .fresh { stroke-dasharray: 1; stroke-dashoffset: 1; animation: chalk-draw 300ms ease-out forwards; animation-delay: var(--d, 0ms); }
.slate-svg .fresh-t { animation: chalk-in 500ms ease-out both; }
@keyframes chalk-draw { to { stroke-dashoffset: 0; } }
@keyframes chalk-in { from { opacity: 0; } to { opacity: 1; } }

#slate-big { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(12, 8, 5, 0.7); }
#slate-big[hidden] { display: none; }
.big-slate { position: relative; width: min(560px, 92vw, calc((100dvh - 24px) * 1.25)); }
.big-slate .slate-face { padding: 10px; }
.big-slate .sheet-close { position: absolute; right: -6px; top: -6px; z-index: 2; background: var(--paper); color: var(--ink); }

/* ── Panels: paper sheets from a Jassblock ────────────────────────────────────────────── */
.side-panel, .paper-sheet {
    position: fixed; z-index: 500;
    background: var(--paper); color: var(--ink);
    border-radius: 4px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.side-panel { z-index: 900; top: 60px; right: 10px; width: min(360px, calc(100vw - 20px)); max-height: calc(100dvh - 72px); display: flex; flex-direction: column; }
body.phone .side-panel { top: 6px; right: 52px; max-height: calc(100dvh - 12px); width: min(340px, calc(100vw - 110px)); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; font-family: var(--font-mark); font-size: 17px; color: var(--coat-blue); border-bottom: 1px solid var(--paper-edge); }
.panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 14px 10px; flex: 1 1 auto; font-size: 14px; }
.panel-foot { padding: 7px 14px 9px; font-size: 12px; color: var(--ink-soft); border-top: 1px solid var(--paper-edge); }
.panel-foot:empty { display: none; }
.panel-empty { color: var(--ink-soft); padding: 8px 0; }
.sheet-close { width: 44px; height: 44px; display: grid; place-items: center; background: transparent; color: var(--ink); border: 0; border-radius: 50%; cursor: pointer; touch-action: manipulation; }
@media (hover: hover) { .sheet-close:hover { background: rgba(0, 0, 0, 0.07); } }
.log-line { display: flex; align-items: center; gap: 6px; padding: 2px 0; line-height: 1.3; }
.log-who { font-weight: 700; min-width: 64px; }
.log-card { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px 0 3px; background: var(--paper-hi); border-radius: 3px; font-weight: 700; }
.log-trick { color: var(--coat-blue); font-weight: 700; }
.log-hand { font-weight: 800; }
.log-good { color: var(--coat-red); font-weight: 800; }
.log-divider { border-top: 1px dashed var(--paper-edge); margin: 6px 0; }
.ai-entry { padding: 6px 0 8px; border-bottom: 1px dashed var(--paper-edge); }
.ai-head { font-weight: 800; margin-bottom: 3px; }
.ai-row { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 2px 6px; border-radius: 3px; font-variant-numeric: tabular-nums; }
.ai-bar { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--f) * 100%); background: rgba(44, 70, 119, 0.12); border-radius: 3px; pointer-events: none; }
.ai-row.chosen .ai-bar { background: rgba(44, 70, 119, 0.3); }
.ai-row.chosen .ai-label { font-weight: 800; }
.ai-row.chosen .ai-label::before { content: ''; display: inline-block; width: 0; height: 0; margin-right: 5px; border-left: 6px solid var(--ink); border-top: 4px solid transparent; border-bottom: 4px solid transparent; vertical-align: 1px; }
.ai-label, .ai-score { position: relative; }
.ai-why { position: relative; grid-column: 1 / 3; font-size: 11.5px; color: var(--ink-soft); }

#rules-popup { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 94vw); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 14px 20px 18px; z-index: 1300; }
#rules-popup h2 { font-family: var(--font-mark); font-weight: 400; font-size: 22px; color: var(--coat-blue); margin: 4px 40px 8px 0; }
#rules-popup p { font-size: 15px; line-height: 1.45; margin-bottom: 8px; max-width: 70ch; }
#rules-popup .sheet-close { position: absolute; right: 4px; top: 4px; }

/* ── Game over: the slate taken off the wall ──────────────────────────────────────────── */
.overlay-scrim { position: fixed; inset: 0; z-index: 1150; background: rgba(12, 8, 5, 0.66); }
.over-card { position: absolute; left: 50%; top: 50%; width: min(460px, 94vw); transform: translate(-50%, -50%); transform-origin: center; }
.over-card .slate-face { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 16px 18px; }
.over-title .banner-label { font-size: 26px; }
.over-slate { width: 100%; }
.over-note { font-family: var(--font-chalk); font-size: 26px; font-weight: 700; color: var(--chalk); transform: rotate(-4deg); }
.over-btns { display: flex; gap: 10px; width: 100%; }
.over-btns .door { flex: 1 1 0; }

/* ── Start: the slate on the Stammtisch wall ──────────────────────────────────────────── *
 * One slate face, a grid: the banner across the top, the settings left, the doors right. The
 * doors' column has a FIXED width and the settings take minmax(0, 1fr), so nothing a language or a
 * mode writes can push a door off the slate. The settings are two sides stacked in one cell (the
 * game's and the house rules), so the slate is as tall as its taller side whichever is showing.  */
#start-screen {
    position: fixed; inset: 0; z-index: 1200;
    display: grid; place-items: center;
    background:
        radial-gradient(ellipse 55% 50% at 50% 46%, rgba(255, 200, 120, 0.16), transparent 70%),
        radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.6) 100%),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.42) 0 1px, transparent 1px 86px),
        linear-gradient(180deg, var(--room-3), var(--room-2) 40%, var(--room));
}
.start-card { position: absolute; left: 50%; top: 50%; width: 820px; transform: translate(-50%, -50%); transform-origin: center center; }
.start-face {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 236px;
    grid-template-areas: "mark mark" "set doors";
    column-gap: 26px; row-gap: 10px;
    padding: 18px 24px 18px;
}
.start-mark { grid-area: mark; display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 4px; }
.start-tagline { font-family: var(--font-chalk); font-size: 17px; color: var(--chalk-dim); white-space: nowrap; filter: url(#chalk-css); }
.start-settings { grid-area: set; display: flex; flex-direction: column; min-width: 0; }
.set-pages { display: grid; min-width: 0; }
.set-page { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; transition: opacity 180ms ease, translate 220ms cubic-bezier(.16, 1, .3, 1); }
.set-page.away { visibility: hidden; opacity: 0; translate: 0 6px; }
.set-house.away { translate: 0 -6px; }
.chalk-row { display: grid; grid-template-columns: 138px minmax(0, 1fr); align-items: center; column-gap: 10px; min-height: 48px; }
.chalk-label { font-family: var(--font-chalk); font-size: 16px; line-height: 1.12; color: var(--chalk-dim); filter: url(#chalk-css); overflow-wrap: normal; }
.chalk-seg { display: flex; flex-wrap: nowrap; gap: 4px; min-width: 0; }
.chalk-opt {
    position: relative; min-height: 46px; min-width: 46px;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3px 14px;
    background: transparent; color: var(--chalk-dim);
    border: 0; border-radius: 0;
    font-family: var(--font-chalk); font-size: 17px; line-height: 1.1; white-space: nowrap;
    cursor: pointer; touch-action: manipulation;
    filter: url(#chalk-css);
    transition: color 150ms ease;
}
.chalk-opt .opt-sub { font-size: 13px; line-height: 1.1; }
@media (hover: hover) { .chalk-opt:hover { color: var(--chalk); } }
.chalk-opt.on { color: var(--chalk); font-weight: 700; }
.chalk-opt.on::before {   /* the chalk ring around the chosen word, a little wider than the word */
    content: ''; position: absolute; inset: 3px -2px 2px -3px;
    border: 2px solid var(--chalk);
    border-radius: 48% 52% 45% 55% / 58% 44% 56% 42%;
    transform: rotate(-2deg);
    opacity: 0.85;
}
.chalk-opt:focus-visible { outline: 2px dashed var(--ochre); outline-offset: 0; }
/* Karten: two real cards, the 1850 Schellen-Under and the French jack, each with its caption */
.deck-row { min-height: 66px; }
.chalk-opt.deck-opt { flex-direction: row; gap: 9px; padding: 4px 14px 4px 10px; filter: none; }   /* the cards stay crisp: only the chalk is grained */
.deck-opt .deck-cap, .chalk-opt.deck-opt.on::before { filter: url(#chalk-css); }
.chalk-opt.deck-opt.on::before { border-radius: 14px 18px 12px 20px / 18px 12px 20px 14px; inset: 1px -2px 1px -2px; }
.deck-card {
    flex: none; display: block; position: relative;
    width: 36px; height: 56px; --card-w: 36px;
    border-radius: 3px;
    background: #cec4aa center / 100% 100% no-repeat;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 9px rgba(0, 0, 0, 0.35);
    transform: rotate(-3deg);
}
.deck-card.fr { height: 52px; background-color: #fff; transform: rotate(3deg); }
.chalk-opt.deck-opt:not(.on) .deck-card { filter: brightness(0.72) saturate(0.7); }
/* Hausregeln …: one chalked line; folded it says which house rules differ from the defaults */
.house-toggle {
    display: grid; grid-template-columns: 18px auto minmax(0, 1fr); align-items: center; column-gap: 8px;
    min-height: 48px; margin-top: 4px; padding: 4px 6px 4px 0;
    background: transparent; color: var(--chalk-dim); border: 0;
    border-top: 1px dashed rgba(236, 230, 214, 0.22);
    font-family: var(--font-chalk); font-size: 16px; line-height: 1.15; text-align: left;
    cursor: pointer; touch-action: manipulation;
    filter: url(#chalk-css);
}
.house-toggle .house-chev { transition: rotate 200ms ease; }
.house-toggle[aria-expanded="true"] .house-chev { rotate: 180deg; }
.house-word { white-space: nowrap; }
.house-sum { color: var(--chalk); font-weight: 700; text-wrap: balance; }
.house-toggle[aria-expanded="true"] .house-sum { visibility: hidden; }
@media (hover: hover) { .house-toggle:hover { color: var(--chalk); } }
.house-toggle:focus-visible { outline: 2px dashed var(--ochre); outline-offset: 2px; }

.start-doors { grid-area: doors; display: flex; flex-direction: column; gap: 10px; padding-top: 2px; min-width: 0; }
.door {
    min-height: 48px; padding: 8px 14px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    background: transparent; color: var(--chalk);
    border: 2px solid rgba(236, 230, 214, 0.55);
    border-radius: 3px;
    font-family: var(--font-ui); font-size: 17px; font-weight: 700; line-height: 1.15; text-align: center;
    cursor: pointer; touch-action: manipulation;
    transition: border-color 140ms ease, background-color 140ms ease, translate 140ms ease;
}
@media (hover: hover) { .door:hover { border-color: var(--chalk); background: rgba(236, 230, 214, 0.06); } }
.door:active { translate: 0 1px; }
.door-primary {    /* the paper banner of a court card — the lit door */
    min-height: 68px;
    background: var(--paper-hi);
    color: var(--ink);
    border: 0;
    box-shadow: 0 0 0 5px var(--coat-blue), 0 0 0 7px var(--ochre), 0 0 0 9px var(--coat-blue), 0 8px 18px rgba(0, 0, 0, 0.5);
    margin: 9px 9px 12px;
}
.door-primary .door-main { font-family: var(--font-mark); font-size: 21px; letter-spacing: 0.03em; text-transform: uppercase; line-height: 1.1; }
.door-primary .door-sub { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
@media (hover: hover) { .door-primary:hover { background: #e3d7bb; } }
.door-quiet { text-decoration: none; border-color: transparent; flex-direction: row; gap: 8px; font-weight: 500; color: var(--chalk-dim); }
.door-quiet svg { flex: none; }
.over-btns .door-primary { margin: 9px 9px 6px; min-height: 52px; font-family: var(--font-mark); font-size: 20px; letter-spacing: 0.04em; }
.over-btns .door:not(.door-primary) { color: var(--chalk); }

/* the language corner: chalked codes, the chosen one ringed (an underline smeared under the grain) */
.start-langs { position: absolute; top: 12px; right: 16px; z-index: 2; }
.lang-list { display: flex; gap: 0; }
.lang-opt {
    position: relative; min-width: 46px; min-height: 46px;
    background: transparent; color: var(--chalk-dim); border: 0;
    font-family: var(--font-chalk); font-size: 15px; cursor: pointer; touch-action: manipulation;
    filter: url(#chalk-css);
}
.lang-opt.on { color: var(--chalk); font-weight: 700; }
.lang-opt.on::before { content: ''; position: absolute; inset: 8px 4px 9px 3px; border: 2px solid var(--chalk); border-radius: 50% 46% 52% 44% / 54% 48% 52% 46%; transform: rotate(-4deg); opacity: 0.85; }
.lang-opt:focus-visible, .lang-fold:focus-visible { outline: 2px dashed var(--ochre); outline-offset: -2px; }
.lang-fold { display: none; }

/* Short landscape (phones at 640×300 … 844×390): no row of its own for the banner — it heads the
   doors' column, the four language codes fold into one chalk button beside it. Every control is
   tall enough that, scaled to the screen, it still takes a 44px finger. */
@media (max-height: 460px) {
    .start-card { width: 700px; }
    .start-face {
        grid-template-columns: minmax(0, 1fr) 214px;
        grid-template-areas: "set mark" "set doors";
        grid-template-rows: auto 1fr;
        column-gap: 18px; row-gap: 6px;
        padding: 10px 14px 10px 16px;
    }
    .start-mark { align-items: flex-start; margin: 0; padding-right: 56px; }
    .start-tagline { display: none; }
    .banner.big { padding: 4px 16px; }
    .banner.big .banner-label { font-size: 27px; padding: 1px 12px 0; }
    .chalk-row { min-height: 52px; grid-template-columns: 100px minmax(0, 1fr); column-gap: 6px; }
    .chalk-label { font-size: 15px; }
    .chalk-opt { min-height: 52px; font-size: 18px; padding: 2px 11px; }
    .chalk-opt .opt-sub { font-size: 13.5px; }
    .deck-row { min-height: 60px; }
    .deck-card { width: 32px; height: 50px; --card-w: 32px; }
    .deck-card.fr { height: 46px; }
    .house-toggle { min-height: 52px; font-size: 15px; margin-top: 2px; }
    .start-doors { gap: 6px; padding-top: 0; }
    .door { min-height: 52px; font-size: 16px; padding: 4px 10px; }
    .door-primary { min-height: 58px; margin: 9px 9px 9px; }
    .door-quiet { min-height: 50px; }
    .start-langs { top: 8px; right: 10px; }
    .lang-fold {
        display: grid; place-items: center; position: relative;
        min-width: 52px; min-height: 52px;
        background: transparent; color: var(--chalk); border: 0;
        font-family: var(--font-chalk); font-size: 17px; font-weight: 700; cursor: pointer; touch-action: manipulation;
        filter: url(#chalk-css);
    }
    .lang-fold::before { content: ''; position: absolute; inset: 10px 6px 11px 5px; border: 2px solid var(--chalk); border-radius: 50% 46% 52% 44% / 54% 48% 52% 46%; transform: rotate(-4deg); opacity: 0.8; }
    .lang-list {
        display: none; position: absolute; right: 0; top: calc(100% + 4px); flex-direction: column;
        padding: 4px; background: var(--slate-2); border: 3px solid var(--beech); border-radius: 4px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
    }
    .start-langs.open .lang-list { display: flex; }
    .lang-opt { min-width: 56px; min-height: 52px; font-size: 17px; }
}
@media (max-height: 460px) and (pointer: coarse) {
    .chalk-row, .chalk-opt, .house-toggle, .door { min-height: 54px; }
    .chalk-opt { min-width: 56px; }
    .lang-fold { min-width: 56px; min-height: 56px; }
}

/* ── Turn the phone ───────────────────────────────────────────────────────────────────── */
#rotate-cover { display: none; }
@media (orientation: portrait) and (max-width: 560px) and (pointer: coarse) {
    #rotate-cover {
        display: grid; place-items: center; position: fixed; inset: 0; z-index: 3000;
        background: var(--room); color: var(--chalk); font-family: var(--font-chalk); font-size: 22px; text-align: center; padding: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .seat-tag, .trick-card.won, .trick-card.lost, .say, .weis-plate, .end-plate, #welcome .welcome-plate, #status-line { transition: none; }
    .hand-card.flip-in, .hand-card.shake, .ai-pending .ai-lamp { animation: none; }
    .slate-svg .fresh { animation-duration: 1ms; }
}

/* ════════════════════════════════════════════════════════════════════════════════════════
 * The platform's dialog shell (core/back.js's question reads these tokens); the rules
 * below are the shell's, copied from games/core/deckades.css (which Jass does not link — line 1
 * of that sheet blocks on Google Fonts) and drawn through the --dk-* tokens pointed at this
 * table's paper above. Then the Jass skin.
 * ════════════════════════════════════════════════════════════════════════════════════════ */
.overlay {
    position: fixed; inset: 0;
    z-index: var(--dk-z-overlay);
    display: grid; place-items: center;
    padding: 16px;
    background: var(--dk-scrim);
}
.overlay.hidden { display: none; }

.panel {
    position: relative;
    /* BORDER-BOX, or `max-height` is a lie by exactly this padding. max-height caps the CONTENT
       box under the default sizing, so a panel that grows to its cap renders at the cap plus
       22px top, 22px bottom and its two borders — measured on Joan's Monk dialog at 844x390:
       max-height 358px, rendered 404px, hanging 7px off each end of a 390px window with its
       actions half off the bottom. Every dialog on the platform shares this rule, and every one
       of them overflows a short window by the same 46px. */
    box-sizing: border-box;
    background: var(--dk-dialog-bg);
    border: 1px solid var(--dk-dialog-line);
    border-radius: var(--dk-dialog-radius);
    padding: 22px 24px;
    width: min(440px, 94vw);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    text-align: center;
    color: var(--dk-panel-text);
    font-family: var(--dk-font-ui);
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.7);
}
.panel h2 {
    font-family: var(--dk-font-display); font-weight: 700;
    font-size: 24px; color: var(--dk-panel-accent, var(--dk-accent)); margin-bottom: 12px;
}
.over-line { font-size: 15px; line-height: 1.6; margin-bottom: 10px; }

.primary-btn {
    margin-top: 16px; width: 100%; min-height: 48px;
    border: 1px solid var(--dk-accent);
    border-radius: 10px;
    background: var(--dk-accent); color: #fff;
    font-family: var(--dk-font-ui);
    font-size: 16px; font-weight: 700;
    cursor: pointer; touch-action: manipulation;
    transition: filter 0.15s;
}
.primary-btn:hover { filter: brightness(1.15); }
/* It had no focus style at all: a keyboard on a game-over dialog got the browser's 1px
   near-black ring on a dark panel. The accent ring, offset so it clears the fill. */
.primary-btn:focus-visible { outline: 2px solid var(--dk-accent); outline-offset: 3px; }

/* THE SECOND ANSWER IN A DIALOG. `.alt` is on every Cancel, every "back to the main menu"
 * and every lobby back button on the platform — 67 call sites across nine games — and until
 * 2026-09-06 this sheet had no rule for it at all. It was a modifier class that styled
 * nothing: both buttons came out as filled accent, so every dialog asked its question with
 * two primary actions arguing, and where one of them is the destructive answer the accident
 * and the safe path looked identical.
 *
 * The shape is the one DESIGN.md has described as the platform's secondary since the system
 * was written down, and the one .start-secondary already uses on the start screen:
 * transparent, panel ink, an accent-tinted edge, 600 rather than 700, filling with the accent
 * wash on hover. Nothing else about the button moves — same height, same radius, same width —
 * so a dialog's two buttons still read as a pair.
 *
 * FOUR GAMES HAD ALREADY WRITTEN THIS LOCALLY (Dalmuti, Mogler, Tablić and Wizard), in four
 * slightly different ways, which is the copy-paste drift this sheet exists to prevent and is
 * the reason the rule belongs here rather than in a fifth game's stylesheet. Their own rules
 * are declared later — a game's sheet is linked after this one — so they keep exactly what
 * they have and nothing about them changes. */
.primary-btn.alt {
    background: transparent;
    color: var(--dk-panel-text);
    border-color: var(--dk-accent-soft);
    font-weight: 600;
}
/* Hover only where there is a mouse: on touch it sticks after a tap and the button reads as
   disabled (critique, 2026-10-08). */
@media (hover: hover) { .primary-btn.alt:hover { background: var(--dk-accent-soft); filter: none; } }

/* The Jass skin on the shared dialogs: paper, ink, a court-card title. */
.jass-panel { background: var(--paper); color: var(--ink); border: 0; border-radius: 5px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); }
.jass-panel h2 { font-family: var(--font-mark); font-weight: 400; color: var(--coat-blue); letter-spacing: 0.02em; }
.jass-panel .primary-btn { background: var(--ochre); border-color: var(--ochre-deep); color: var(--ink); border-radius: 4px; }
.jass-panel .primary-btn.alt { background: transparent; border-color: var(--paper-edge); color: var(--ink); }

body.phone .ask-title { font-size: 16px; }
body.phone .paper-plate { padding: 8px 12px 10px; }
body.phone .ask-lead { font-size: 13px; margin: 1px 0 4px; }
body.phone .ask-opts { gap: 5px; margin-top: 4px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
body.phone .ask-opt { min-height: 44px; font-size: 14px; padding: 3px 8px; }
body.phone .weis-label { font-size: 12.5px; min-width: 0; }

/* ── Tutorial: the lesson slip, the veil, the pinned answer ──────────────────────────────
 * The slip is one of the table's paper plates (the cards' paper, a step darker), ruled down its
 * left edge in the coats' red like a Jass card's border; the title is set in the court cards'
 * capitals in indigo. Next is indigo; ochre appears only on a DO step ("your move") and on the
 * pinned card or answer — the table's one sign for "you may act". */
.tut-slip {
    position: fixed; z-index: 1010; left: 8px; top: 60px;
    display: none; flex-direction: column; gap: 4px;
    padding: 9px 12px 10px 18px;
    background:
        linear-gradient(90deg, var(--coat-red) 0 5px, transparent 5px),
        linear-gradient(180deg, rgba(255, 250, 235, 0.38), transparent 34%),
        var(--paper);
    color: var(--ink);
    border-radius: 5px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(80, 60, 30, 0.4);
    overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; translate: 0 6px;
    transition: opacity 200ms ease, translate 260ms cubic-bezier(.16, 1, .3, 1), left 260ms cubic-bezier(.16, 1, .3, 1), top 260ms cubic-bezier(.16, 1, .3, 1);
}
.tut-slip.on { display: flex; opacity: 1; translate: 0 0; }
@starting-style { .tut-slip.on { opacity: 0; translate: 0 6px; } }
.tut-slip.nudge { animation: tut-nudge 360ms cubic-bezier(.25, 1, .5, 1); }
@keyframes tut-nudge { 30% { translate: -5px 0; } 60% { translate: 4px 0; } }
.tut-head { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.tut-tag { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--coat-red); }
.tut-where { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tut-leave {
    margin-left: auto; display: grid; place-items: center; width: 32px; height: 32px; margin-right: -6px;
    background: transparent; border: 0; border-radius: 50%; color: var(--ink-soft); cursor: pointer;
}
@media (hover: hover) { .tut-leave:hover { background: rgba(42, 33, 27, 0.08); color: var(--ink); } }
.tut-title { font-family: var(--font-mark); font-weight: 400; font-size: 19px; line-height: 1.15; letter-spacing: 0.02em; color: var(--coat-blue); text-wrap: balance; }
.tut-say { font-size: 15.5px; line-height: 1.38; text-wrap: pretty; }
.tut-cards { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0; }
.tut-cards[hidden] { display: none; }
.tut-cards .card { position: relative; flex: none; }
.tut-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.tut-do {
    padding: 3px 10px; border-radius: 3px;
    background: var(--ochre); color: var(--ink);
    font-size: 13px; font-weight: 800; letter-spacing: 0.02em;
}
.tut-do[hidden] { display: none; }
.tut-do.hey { background: var(--coat-red); color: var(--paper-hi); }
.tut-buttons { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.tut-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-height: 44px; min-width: 44px; padding: 4px 14px;
    border-radius: 4px; border: 1px solid var(--paper-edge);
    background: var(--paper-hi); color: var(--ink);
    font-size: 15px; font-weight: 700; cursor: pointer; touch-action: manipulation;
    transition: background-color 140ms ease, border-color 140ms ease, translate 140ms ease;
}
.tut-btn:active { translate: 0 1px; }
.tut-btn:focus-visible { outline: 2px solid var(--coat-blue); outline-offset: 2px; }
.tut-btn.tut-back { padding-left: 8px; }
.tut-btn.tut-quiet { background: transparent; }
.tut-btn.tut-next { background: var(--coat-blue); border-color: #1d3157; color: var(--paper-hi); min-width: 96px; }
@media (hover: hover) {
    .tut-btn:hover { border-color: var(--ink-soft); background: #ded2b5; }
    .tut-btn.tut-next:hover { background: #355391; }
}
#tut-veil { position: fixed; inset: 0; z-index: 290; pointer-events: none; opacity: 0; transition: opacity 240ms ease; }
#tut-veil.on { opacity: 1; }
#tut-veil svg { display: block; }
#tut-veil .tut-shade { fill: rgba(12, 8, 5, 0.58); }
#tut-veil .tut-rim { fill: none; stroke: rgba(214, 201, 170, 0.75); stroke-width: 1.5; }
#tut-veil .tut-rim.pin { stroke: var(--ochre); stroke-width: 2.5; }
/* the decision plate in a lesson: the answer asked for is lit, the others are there but off */
.ask-opt.tut-off { opacity: 0.42; filter: saturate(0.6); cursor: default; }
.ask-opt.tut-pin:not(.primary) { background: var(--ochre); border-color: var(--ochre-deep); }
body.phone .tut-slip { padding: 6px 10px 7px 15px; gap: 2px; }
body.phone .tut-title { font-size: 15px; }
body.phone .tut-say { font-size: 13px; line-height: 1.3; }
body.phone .tut-head { min-height: 18px; }
body.phone .tut-tag, body.phone .tut-where { font-size: 11px; }
body.phone .tut-leave { width: 30px; height: 30px; }
body.phone .tut-foot { margin-top: 2px; gap: 6px; }
body.phone .tut-btn { min-height: 40px; font-size: 14px; padding: 2px 12px; }
body.phone .tut-btn.tut-next { min-width: 84px; }
@media (max-height: 460px) { .tut-say { font-size: 14px; } }
@media (prefers-reduced-motion: reduce) {
    .tut-slip, #tut-veil { transition: opacity 120ms linear; }
    .tut-slip.nudge { animation: none; }
}
/* the slate lesson on a phone: the big slate steps aside so the slip can stand beside it */
#slate-big.tut-aside { justify-items: end; padding-right: 10px; }
#slate-big.tut-aside .big-slate { width: min(560px, 92vw, calc((100dvh - 24px) * 1.25), calc(100vw - 300px)); }

/* ── Tutorial chooser (tutorial.js chooseTutorial): four or three at the table ─────────────
 * The start screen's slate taken off the wall once more, over the dimmed Stammtisch: the paper
 * banner, a chalked question, and two EQUAL chalk doors — nothing lit, nothing chosen for you
 * (ochre stays the sign for "you may act" and appears only as the keyboard's dashed ring). Each
 * door carries its seat plan in chalk: partners joined across the table, or three alone. */
.tut-pick-layer {
    position: fixed; inset: 0; z-index: 1260;
    display: grid; place-items: center; padding: 8px;
    background:
        radial-gradient(ellipse 55% 50% at 50% 46%, rgba(255, 200, 120, 0.12), transparent 70%),
        rgba(18, 12, 8, 0.84);
}
.tut-pick { box-sizing: border-box; width: min(600px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); display: flex; animation: tut-pick-in 280ms cubic-bezier(.16, 1, .3, 1) both; }
@keyframes tut-pick-in { from { opacity: 0; translate: 0 -10px; rotate: -0.6deg; } }
.tut-pick-face {
    box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; color: var(--chalk); font-family: var(--font-ui);
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "title title title" "lead lead lead" "doors doors doors" "back . .";
    row-gap: 12px; padding: 18px 24px 14px;
}
.tut-pick-title { grid-area: title; display: flex; justify-content: center; margin: 0; font-weight: 400; }
.tut-pick-title .banner-label { font-size: 24px; }
.tut-pick-lead { grid-area: lead; margin: 0; font-family: var(--font-chalk); font-size: 18px; line-height: 1.25; color: var(--chalk-dim); text-align: center; text-wrap: balance; filter: url(#chalk-css); }
.tut-pick-doors { grid-area: doors; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tut-pick-opt { min-height: 132px; padding: 10px 14px 12px; gap: 3px; justify-content: flex-start; }
.tut-pick-opt .door-main { font-size: 18px; text-wrap: balance; }
.tut-pick-opt .door-sub { font-size: 13.5px; font-weight: 600; line-height: 1.25; color: var(--chalk-dim); text-wrap: balance; }
.tut-pick-opt:focus-visible { outline: 2px dashed var(--ochre); outline-offset: 3px; }
.tut-pick-plan { flex: none; margin-bottom: 4px; overflow: visible; filter: url(#chalk-css); }
.tut-pick-plan .pl-table { fill: rgba(236, 230, 214, 0.05); stroke: var(--chalk-dim); stroke-width: 1.8; }
.tut-pick-plan .pl-link { fill: none; stroke: var(--chalk-dim); stroke-width: 1.6; stroke-dasharray: 3 4; stroke-linecap: round; }
.tut-pick-plan .pl-you, .tut-pick-plan .pl-mate { fill: var(--chalk); stroke: var(--chalk); stroke-width: 1.6; }
.tut-pick-plan .pl-opp { fill: none; stroke: var(--chalk); stroke-width: 1.8; }
@media (hover: hover) { .tut-pick-opt:hover .pl-table { fill: rgba(236, 230, 214, 0.1); } }
.tut-pick-back { grid-area: back; justify-self: start; min-height: 46px; padding: 4px 12px 4px 4px; }
.tut-pick-back span { white-space: nowrap; }
.tut-pick-back:focus-visible { outline: 2px dashed var(--ochre); outline-offset: 2px; }
/* short screens (a phone held sideways): Back moves up beside the banner, the plans beside the words */
@media (max-height: 480px) {
    .tut-pick-face { grid-template-columns: 1fr auto 1fr; grid-template-areas: "back title ." "lead lead lead" "doors doors doors"; row-gap: 8px; padding: 10px 14px 12px; }
    .tut-pick-title .banner-label { font-size: 19px; }
    .tut-pick-back { align-self: center; }
    .tut-pick-lead { font-size: 16px; }
    .tut-pick-opt { min-height: 88px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-content: center; justify-items: start; text-align: left; padding: 8px 12px; }
    .tut-pick-plan { grid-row: 1 / 3; margin: 0; width: 44px; height: 44px; }
    .tut-pick-opt .door-main { font-size: 16px; }
    .tut-pick-opt .door-sub { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) { .tut-pick { animation-duration: 1ms; } }

/* ── Coiffeur for three ─────────────────────────────────────────────────────────────────
 * No teams, so no team colours: each player is a plain paper name plate (no coat disc). The
 * declarer of the hand wears a coat-red tab across the top of their plate, the way a court card
 * wears its banner; it goes when the hand is written up. */
.seat-tag.solo .tag-name::before { display: none; }
.seat-tag .tag-role {
    align-self: flex-start; margin: -4px -9px 2px -8px; padding: 1px 8px 1px;
    background: var(--coat-red); color: var(--paper-hi);
    border-radius: 3px 3px 0 0;
    font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.35;
    width: calc(100% + 17px);
}
body.phone .seat-tag .tag-role { margin: -2px -6px 1px; width: calc(100% + 12px); font-size: 10.5px; padding: 0 6px; }
.cc-points.solo .decl { color: var(--coat-red); }
.cc-points.solo .opp { color: var(--ink-soft); }
.ask-plate.barrel .ask-lead { color: var(--coat-red); font-weight: 700; }
.end-table.three { grid-template-columns: auto repeat(3, minmax(0, 1fr)); }
.end-team.solo { color: var(--ink); display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.end-team.solo.decl { color: var(--coat-red); }
.slate-svg .chn.n3 { font-size: 13px; }
.slate-svg .chd.net { font-size: 17px; }
.slate-svg .tal { stroke-width: 2; opacity: 0.95; }
.slate-svg .chd.c3 { font-size: 14px; }
/* the result for three: the slate, then the three of them ranked in chalk */
.over-rank { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 0 6px; font-family: var(--font-chalk); color: var(--chalk-dim); filter: url(#chalk-css); }
.rank-row { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto auto; align-items: baseline; column-gap: 12px; font-size: 18px; }
.rank-row.first { color: var(--chalk); font-weight: 700; font-size: 20px; }
.rank-place { text-align: right; }
.rank-name { overflow-wrap: anywhere; }
.rank-pts, .rank-net { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-note { font-size: 16px; text-align: center; margin-top: 2px; }


/* Game over on a short screen: the slate taken off the wall stands on the LEFT at the screen's
   height, and the verdict, the ranking and the two doors stand beside it — a slate shrunk to fit
   one tall column was unreadable at 640×300. */
@media (max-height: 460px) {
    .over-card { width: min(680px, 96vw); }
    .over-card .slate-face {
        display: grid; grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "slate title" "slate note" "slate rank" "slate btns";
        grid-template-rows: auto auto 1fr auto;
        align-items: center; justify-items: center; column-gap: 14px; row-gap: 6px; padding: 10px 12px 10px;
    }
    .over-slate { grid-area: slate; width: auto; height: calc(100dvh - 60px); max-height: 330px; }
    .over-title { grid-area: title; }
    .over-title .banner-label { font-size: 22px; }
    .over-note { grid-area: note; font-size: 22px; }
    .over-rank { grid-area: rank; align-self: center; }
    .rank-row { font-size: 16px; column-gap: 8px; grid-template-columns: 1.8em minmax(0, 1fr) auto; }
    .rank-row .rank-net { grid-column: 2 / -1; justify-self: end; font-size: 14px; margin-top: -3px; }
    .rank-row.first { font-size: 17px; }
    .over-btns { grid-area: btns; }
    .over-btns .door-primary { min-height: 50px; font-size: 18px; }
}
/* "More games on deckades" (core/moreGames.js), under the doors in chalk. fitOver() sizes the plate
   without it and caps the frame at the screen, so where it does not fit it is a scroll below. */
.over-card.has-more { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--beech-dark) transparent; }
.over-card .dk-more { width: 100%; margin: 6px 0 0; color: var(--chalk); font-family: var(--font-ui); --dk-more-line: rgba(236, 230, 214, 0.26); }
.over-card .dk-more-title { font-family: var(--font-chalk); font-size: 16px; }
.over-card .dk-more a { background: rgba(236, 230, 214, 0.04); }
@media (max-height: 460px) { .over-card .dk-more { grid-column: 1 / -1; } }
/* a long verdict ("Rösli & Ruth gewinnen") wraps inside its banner instead of running off the slate */
.over-title { max-width: 100%; text-align: center; }
.over-title .banner { max-width: 100%; }
.over-title .banner-label { white-space: normal; text-wrap: balance; }
@media (max-height: 460px) { .over-title .banner-label { font-size: 18px; line-height: 1.2; } .over-title .banner { padding: 4px 10px; } }

/* ════════════════════════════════════════════════════════════════════════════════════════
 * Online: the lobby (mpDialog.js). The start screen's own Jasstafel, taken off the wall a second
 * time: the settings chalked and ringed, the room code in the court cards' capitals, the paper
 * banner as the one lit door. The chairs are the game's paper name plates around a small piece of
 * the Jassteppich, drawn from YOUR chair (partners opposite), the two teams in the coats' red
 * (yours) and indigo. A free chair is chalk-outlined: tap it to sit there.
 * ════════════════════════════════════════════════════════════════════════════════════════ */
.jass-mp-layer {
    position: fixed; inset: 0; z-index: 1250;
    display: grid; place-items: center; padding: 8px;
    background:
        radial-gradient(ellipse 55% 50% at 50% 46%, rgba(255, 200, 120, 0.14), transparent 70%),
        radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.6) 100%),
        rgba(18, 12, 8, 0.86);
}
.jass-mp { box-sizing: border-box; width: min(920px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); display: flex; }
.jass-mp[data-view="choose"], .jass-mp[data-view="join"], .jass-mp[data-view="host"] { width: min(560px, calc(100vw - 16px)); }
.jass-mp-face { box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; color: var(--chalk); font-family: var(--font-ui); }
.jass-mp-face.v-choose, .jass-mp-face.v-join, .jass-mp-face.v-host {
    display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 18px 26px 16px;
}
.jass-mp-title { display: flex; justify-content: center; margin: 0 0 2px; font-weight: 400; }
.jass-mp-title .banner-label { font-size: 24px; }
.jass-mp-line { font-family: var(--font-chalk); font-size: 17px; line-height: 1.3; color: var(--chalk-dim); text-align: center; text-wrap: balance; filter: url(#chalk-css); }
.jass-mp-doors { display: flex; flex-direction: column; gap: 10px; }
.jass-mp-doors .door-primary { margin: 9px 9px 6px; }
.jass-mp .door-sub { font-size: 13px; font-weight: 600; color: var(--chalk-dim); }
.jass-mp .door-primary .door-sub { color: var(--ink-soft); }
.jass-mp .door:disabled { opacity: 0.45; cursor: default; translate: none; }
.jass-mp-back { align-self: flex-start; min-height: 46px; padding: 4px 12px 4px 4px; }
.jass-mp-back span { white-space: nowrap; }
.jass-mp-error { font-size: 14.5px; font-weight: 700; color: #f0a089; text-align: center; }
.jass-mp-error:empty { display: none; }
.jass-mp-note { font-family: var(--font-chalk); font-size: 14px; line-height: 1.25; color: var(--chalk-dim); filter: url(#chalk-css); }

/* fields: paper slips on the slate — a name, the five-letter code */
.jass-mp-fields { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
.jass-mp-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jass-mp-input {
    box-sizing: border-box; width: 100%; min-height: 46px; padding: 6px 11px;
    background: var(--paper-hi); color: var(--ink);
    border: 0; border-radius: 3px;
    box-shadow: inset 0 1px 3px rgba(60, 40, 20, 0.35), 0 1px 0 rgba(255, 245, 220, 0.12);
    font: 600 18px/1.1 var(--font-ui);
    caret-color: var(--coat-red);
}
.jass-mp-input::placeholder { color: var(--ink-soft); opacity: 0.75; }
.jass-mp-input::selection { background: var(--coat-blue); color: var(--paper-hi); }
.jass-mp-input.code { font-family: var(--font-mark); font-weight: 400; font-size: 21px; letter-spacing: 0.18em; text-transform: uppercase; }
.jass-mp-input:focus-visible { outline: 2px dashed var(--ochre); outline-offset: 2px; }
.jass-mp-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.jass-mp-actions .door-primary { flex: 0 1 220px; min-height: 54px; margin: 9px; }
.jass-mp-actions .jass-mp-back { align-self: center; }

/* the room: who · the table's rules · the chairs */
.jass-mp-face.v-room {
    display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.15fr) minmax(0, 1.2fr);
    column-gap: 22px; padding: 16px 20px 14px; align-items: start;
}
.jass-mp-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.jass-mp-who { height: 100%; }
.jass-mp-who .jass-mp-back { margin-top: auto; }
.jass-mp-code-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jass-mp-code { font-family: var(--font-mark); font-size: 34px; line-height: 1; letter-spacing: 0.1em; color: var(--chalk); }
.jass-mp-copy {
    min-height: 44px; min-width: 44px; padding: 2px 12px;
    background: transparent; color: var(--chalk); border: 2px solid rgba(236, 230, 214, 0.55); border-radius: 3px;
    font: 700 14px/1 var(--font-ui); cursor: pointer; touch-action: manipulation;
}
@media (hover: hover) { .jass-mp-copy:hover { border-color: var(--chalk); background: rgba(236, 230, 214, 0.06); } }
.jass-mp-copy:focus-visible, .jass-mp-chair:focus-visible { outline: 2px dashed var(--ochre); outline-offset: 2px; }
.jass-mp-settings { display: flex; flex-direction: column; gap: 2px; }
.jass-mp .jass-mp-seg { display: flex; flex-direction: column; align-items: flex-start; min-height: 0; gap: 0; }
.jass-mp .jass-mp-seg .chalk-label { font-size: 14.5px; }
.jass-mp .jass-mp-seg .chalk-seg { flex-wrap: wrap; gap: 0 2px; margin-left: -6px; }
.jass-mp .jass-mp-seg .chalk-opt { min-height: 44px; padding: 2px 10px; font-size: 17px; }
.jass-mp .chalk-opt .opt-short { display: none; }
.jass-mp .chalk-opt[aria-disabled="true"] { cursor: default; }
.jass-mp .chalk-opt[aria-disabled="true"]:not(.on) { opacity: 0.55; }
.jass-mp .chalk-opt:disabled { opacity: 0.3; cursor: default; }
.jass-mp-house { margin-top: 2px; }
.jass-mp-house.ro { cursor: default; grid-template-columns: auto minmax(0, 1fr); }
.jass-mp-house.ro .house-chev { display: none; }
.jass-mp-tablehead { display: flex; flex-direction: column; }
.jass-mp-teamline { font-family: var(--font-chalk); font-size: 13.5px; color: var(--chalk-dim); filter: url(#chalk-css); }

/* the chairs round a patch of the Jassteppich */
.jass-mp-ring { position: relative; height: 196px; }
.jass-mp-felt {
    position: absolute; left: 28%; right: 28%; top: 25%; bottom: 25%;
    border-radius: 10px;
    background: radial-gradient(ellipse at 50% 40%, var(--mat-lit), var(--mat) 72%);
    box-shadow: 0 0 0 5px var(--fir), 0 0 0 6px var(--fir-dark), 0 8px 18px rgba(0, 0, 0, 0.5);
}
.jass-mp-felt::after { content: ""; position: absolute; inset: 5px; border: 1px dashed var(--stitch); border-radius: 7px; }
.jass-mp-chair {
    position: absolute; box-sizing: border-box;
    min-width: 98px; max-width: 47%; min-height: 48px; padding: 4px 10px 5px;
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
    background: linear-gradient(180deg, rgba(255, 250, 235, 0.3), transparent 40%), var(--paper);
    color: var(--ink); border: 0; border-radius: 4px; text-align: left;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(80, 60, 30, 0.35);
    font-family: var(--font-ui); cursor: default; touch-action: manipulation;
}
.jass-mp-chair .chair-name { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 800; line-height: 1.15; white-space: nowrap; }
.jass-mp-chair .chair-tag { font-size: 12px; font-weight: 600; line-height: 1.15; color: var(--ink-soft); white-space: nowrap; }
.jass-mp-chair .chair-tag:empty { display: none; }
.jass-mp-chair.team-us .chair-name::before, .jass-mp-chair.team-them .chair-name::before {
    content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.jass-mp-chair.team-us .chair-name::before { background: var(--coat-red); }
.jass-mp-chair.team-them .chair-name::before { background: var(--coat-blue); }
.jass-mp-chair.me { box-shadow: 0 0 0 2px var(--chalk), 0 3px 8px rgba(0, 0, 0, 0.5); }
.jass-mp-chair.open {
    background: rgba(26, 32, 31, 0.6); color: var(--chalk);
    box-shadow: none; border: 2px dashed rgba(236, 230, 214, 0.5);
    cursor: pointer;
}
.jass-mp-chair.open .chair-name { font-family: var(--font-chalk); font-weight: 700; }
.jass-mp-chair.open .chair-tag { color: var(--chalk-dim); font-family: var(--font-chalk); font-size: 13px; }
@media (hover: hover) { .jass-mp-chair.open:hover { border-color: var(--chalk); background: rgba(236, 230, 214, 0.07); } }
.jass-mp-chair.slot-0 { left: 50%; bottom: 0; translate: -50% 0; }
.jass-mp-chair.slot-2 { left: 50%; top: 0; translate: -50% 0; }
.jass-mp-chair.slot-1 { right: 0; top: 50%; translate: 0 -50%; }
.jass-mp-chair.slot-3 { left: 0; top: 50%; translate: 0 -50%; }
.jass-mp-ring.three .jass-mp-felt { top: 8%; }
.jass-mp-ring.three .jass-mp-chair.slot-1, .jass-mp-ring.three .jass-mp-chair.slot-3 { top: 36%; }
.jass-mp-wait { font-family: var(--font-chalk); font-size: 16px; line-height: 1.25; color: var(--chalk); text-align: center; filter: url(#chalk-css); }
.jass-mp-table .door-primary { margin: 9px 9px 4px; min-height: 56px; }

/* the toast: somebody left, came back, the table closed */
#jass-mp-toast {
    left: 50%; bottom: 14px; top: auto; z-index: 1400; max-width: min(460px, calc(100vw - 24px));
    padding: 9px 16px; font-size: 15px; font-weight: 700; text-align: center;
    translate: -50% 12px; opacity: 0; pointer-events: none;
    transition: opacity 200ms ease, translate 260ms cubic-bezier(.16, 1, .3, 1);
}
#jass-mp-toast.show { opacity: 1; translate: -50% 0; }
/* the hand's account online: Weiter becomes "waiting for …" once pressed */
.end-next.waiting { background: transparent; border-style: dashed; color: var(--ink-soft); cursor: default; }

/* short landscape (844x390 down to the 640x300 floor): the three columns stay, everything tighter;
   controls keep their 44px finger */
@media (max-height: 460px) {
    .jass-mp-face.v-room { grid-template-columns: 128px minmax(0, 1fr) 200px; column-gap: 12px; padding: 8px 12px 8px; }
    .jass-mp-share { display: none; }
    .jass-mp-face.v-room.house-open .jass-mp-table { display: none; }
    .jass-mp-face.v-room.house-open .jass-mp-set { grid-column: 2 / 4; }
    .jass-mp-face.v-room.house-open .jass-mp-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
    .jass-mp-face.v-room.house-open .jass-mp-house { grid-column: 1 / -1; }
    .jass-mp .chalk-opt:has(.opt-short) .opt-main { display: none; }
    .jass-mp .chalk-opt .opt-short { display: inline; font-size: inherit; }
    .jass-mp-face.v-choose, .jass-mp-face.v-join, .jass-mp-face.v-host { gap: 6px; padding: 8px 18px 8px; }
    .jass-mp-title .banner-label { font-size: 19px; }
    .jass-mp-line { font-size: 15px; }
    .jass-mp-doors { gap: 4px; }
    .jass-mp-doors .door-primary { margin: 8px 9px 6px; min-height: 52px; }
    .jass-mp-col { gap: 4px; }
    .jass-mp-code { font-size: 27px; }
    .jass-mp-note { font-size: 12.5px; }
    .jass-mp-input { min-height: 44px; font-size: 16px; }
    .jass-mp .jass-mp-seg .chalk-label { font-size: 13px; line-height: 1; }
    .jass-mp .jass-mp-seg .chalk-opt { min-height: 44px; padding: 0 7px; font-size: 15.5px; }
    .jass-mp .house-toggle { min-height: 44px; font-size: 13.5px; margin-top: 0; }
    .jass-mp-teamline { font-size: 12px; line-height: 1.1; }
    .jass-mp-ring { height: 142px; }
    .jass-mp-chair { min-width: 86px; min-height: 44px; padding: 2px 7px 3px; }
    .jass-mp-chair .chair-name { font-size: 13.5px; }
    .jass-mp-chair .chair-tag { font-size: 11px; }
    .jass-mp-chair.open .chair-tag { font-size: 11.5px; }
    .jass-mp-wait { font-size: 14px; }
    .jass-mp-table .door-primary { margin: 8px 9px 2px; min-height: 48px; }
    .jass-mp-table .door-primary .door-main { font-size: 18px; }
    .jass-mp-actions .door-primary { min-height: 48px; margin: 8px 9px; }
    .jass-mp-back { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { #jass-mp-toast { transition: opacity 120ms linear; } }
#intro { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
