/* The Christmas calendar (EX-1673): playing cards dealt on a card table. Markup: designs/kort.php. */
/* Julehånda (EX-1674): the player's seat with the five cards of the hand sits on the rail. Its styles are at the end. */
/* Layout: a card table seen from above. Title, plaque and buttons on the rail, 24 cards dealt inside a gold inlay, rules along the near edge. */
/* The two typefaces are served from designs/fonts/, not from Google Fonts: on our servers Cloudflare
   rewrites a Google Fonts link and left Rozha One out. Jost is one variable file per character set.
   The character ranges are the ones Google Fonts uses for "latin" and "latin-ext". */
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('fonts/jost-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('fonts/jost-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Rozha One'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/rozha-one-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rozha One'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/rozha-one-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
    color-scheme: dark;
    --felt-hi: #23815a;
    --felt: #125a3f;
    --felt-lo: #041d15;
    --gold-hi: #fbe7ad;
    --gold: #dcb45e;
    --gold-lo: #96691f;
    --crimson: #b3121d;
    --oxblood: #7a0c17;
    --ivory: #fbf4e1;
    --ink: #17110b;
    --red: #b3121d;
    --foil: linear-gradient(170deg, var(--gold-hi) 0%, var(--gold) 38%, #f6dc98 55%, var(--gold-lo) 100%);
    --f-display: 'Rozha One', 'Bodoni MT', Georgia, serif;
    --f-text: 'Jost', 'Century Gothic', 'Trebuchet MS', sans-serif;
    --cols: 8;
    --rows: 3;
    /* The table never gets lower than this. In a lower window the page scrolls instead of shrinking the cards. */
    --main-min: calc(var(--rows) * 10.5rem + 3rem);
    --gap: clamp(8px, 1.5vh, 18px);
    --gap-x: clamp(10px, 1.5vw, 30px);
}
@media (max-aspect-ratio: 5/4) { :root { --cols: 6; --rows: 4; } }
@media (min-aspect-ratio: 30/10) { :root { --cols: 12; --rows: 2; } }
@media (max-width: 900px) { :root { --cols: 4; --rows: 6; } }
@media (max-width: 560px) { :root { --cols: 3; --rows: 8; --gap: 12px; --gap-x: 12px; } }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    background: var(--felt-lo);
    color: var(--ivory);
    font: 400 1rem/1.45 var(--f-text);
    overflow-x: hidden;
}
h1, h2, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { font: inherit; }

/* ─── The felt ─── */
.room {
    position: relative;
    isolation: isolate;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(var(--main-min), 1fr) auto;
    gap: clamp(10px, 1.8vh, 22px);
    padding-block: clamp(14px, 2.4vh, 30px) clamp(10px, 1.6vh, 18px);
    padding-inline: max(16px, 2.6vw, env(safe-area-inset-left, 0px));
    background:
        radial-gradient(70% 55% at 50% 30%, rgb(255 226 160 / 0.16), transparent 70%),
        radial-gradient(120% 95% at 50% 38%, var(--felt-hi) 0%, var(--felt) 42%, #0a3526 72%, var(--felt-lo) 100%);
    overflow: hidden;
}
.room.has-tools { grid-template-rows: auto auto minmax(var(--main-min), 1fr) auto; }
.room::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.55;
    mix-blend-mode: overlay;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 -.05'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23f)'/%3E%3C/svg%3E");
}

/* ─── Rail: title, plaque, buttons ─── */
.rail {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(14px, 2.5vw, 48px);
}
.brand { font-size: clamp(0.8rem, 0.95vw, 1rem); letter-spacing: 0.14em; color: rgb(251 244 225 / 0.72); }
.title {
    font: 400 clamp(2.1rem, 3.3vw, 3.7rem)/1.05 var(--f-display);
    white-space: nowrap;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 0 rgb(0 0 0 / 0.45));
    text-wrap: balance;
}
.plaque {
    justify-self: center;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 2px clamp(14px, 1.6vw, 28px);
    padding: clamp(10px, 1.4vh, 16px) clamp(16px, 1.8vw, 30px);
    border-radius: 14px;
    background: linear-gradient(#0b3929, #062619);
    border: 1px solid rgb(220 180 94 / 0.75);
    box-shadow: inset 0 0 0 4px #062a1c, inset 0 0 0 5px rgb(220 180 94 / 0.35), 0 10px 26px rgb(0 0 0 / 0.4);
}
.xmas-status { font: 400 clamp(1.05rem, 1.5vw, 1.6rem)/1.15 var(--f-display); color: var(--gold-hi); text-wrap: balance; }
.xmas-viewer { grid-column: 1; font-size: clamp(0.84rem, 0.95vw, 1rem); color: rgb(251 244 225 / 0.8); max-width: 44ch; }
.xmas-clock {
    grid-column: 2;
    grid-row: 1 / span 2;
    font: 400 clamp(2rem, 3.4vw, 3.6rem)/1 var(--f-display);
    font-variant-numeric: tabular-nums lining-nums;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.xmas-clock__face { display: flex; }
.xmas-clock [data-u] { min-width: 1.22em; text-align: center; }
.xmas-clock i { font-style: normal; }
.xmas-clock.is-long { font-size: clamp(1.15rem, 1.7vw, 1.8rem); }
.xmas-note { grid-column: 2; grid-row: 1 / span 2; max-width: 22ch; color: var(--gold-hi); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.btn {
    appearance: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0.62em 1.2em;
    border-radius: 999px;
    font: 500 clamp(0.92rem, 1.05vw, 1.1rem)/1.1 var(--f-text);
    border: 1px solid rgb(220 180 94 / 0.8);
    background: rgb(4 29 21 / 0.55);
    color: var(--gold-hi);
    transition: box-shadow 160ms ease-out, scale 160ms ease-out, background-color 160ms ease-out;
}
.btn--gold { background: var(--foil); color: #2b1a04; border-color: #fff1c4; font-weight: 600; box-shadow: 0 6px 16px rgb(0 0 0 / 0.35); }
.btn:hover { background-color: rgb(220 180 94 / 0.18); box-shadow: 0 0 0 3px rgb(220 180 94 / 0.25), 0 8px 20px rgb(0 0 0 / 0.4); }
.btn:active { scale: 0.97; }
:where(a, button):focus-visible { outline: 3px solid #fff; outline-offset: 3px; }



/* ─── The table and the deal ─── */
.table {
    container-type: size;
    position: relative;
    min-height: 0;
    display: grid;
    /* The deal in the middle. The two side columns are the felt that is left beside it. */
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-content: center;
    align-items: center;
    border-radius: clamp(18px, 2.4vw, 40px);
    border: 2px solid rgb(220 180 94 / 0.6);
    box-shadow: inset 0 0 0 6px rgb(4 29 21 / 0.001), inset 0 0 90px rgb(0 0 0 / 0.28);
}
.table::before {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: clamp(13px, 2vw, 34px);
    border: 1px solid rgb(220 180 94 / 0.32);
    pointer-events: none;
}
.deck {
    --pad: clamp(12px, 3.2cqh, 30px);
    --card-h: min((100cqh - var(--pad) * 2 - var(--gap) * (var(--rows) - 1)) / var(--rows), (100cqi - var(--pad) * 2 - var(--gap-x) * (var(--cols) - 1)) / var(--cols) * 1.4);
    display: grid;
    grid-template-columns: repeat(var(--cols), calc(var(--card-h) / 1.4));
    grid-auto-rows: var(--card-h);
    gap: var(--gap) var(--gap-x);
}
.cell { position: relative; display: grid; }
.card {
    container-type: size;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: pointer;
    perspective: 700px;
    border-radius: 7.5cqi;
    -webkit-tap-highlight-color: transparent;
    transition: translate 260ms cubic-bezier(0.2, 0.8, 0.2, 1), scale 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card { --suit-color: var(--ink); }
.card--red { --suit-color: var(--red); }
.card::before {
    content: '';
    position: absolute;
    inset: 5% 4% -2%;
    border-radius: 8%;
    background: rgb(0 0 0 / 0.6);
    filter: blur(7px);
    translate: 0 5px;
    transition: translate 260ms ease-out, opacity 260ms ease-out, filter 260ms ease-out;
}
.card__body {
    position: absolute;
    inset: 0;
    display: block;
    transform-style: preserve-3d;
    transform: rotateY(var(--flip, 180deg));
    transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cell--open .card__body { --flip: 0deg; }
.card__face, .card__back {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    border-radius: 7.5cqi;
    backface-visibility: hidden;
    background: linear-gradient(165deg, #fffaf0, var(--ivory) 55%, #efe4c6);
    box-shadow: inset 0 0 0 1px rgb(60 40 10 / 0.18), 0 1px 0 #cfc3a2, 0 2px 0 #b9ad8c;
}
.card__back { transform: rotateY(180deg); }

/* Back: oxblood with a gold lattice and the day in a medallion. */
.card__art {
    position: absolute;
    inset: 5.5cqi;
    border-radius: 4.5cqi;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 50%, transparent 0 34%, rgb(30 0 6 / 0.5) 100%),
        repeating-linear-gradient(60deg, transparent 0 5.2cqi, rgb(251 231 173 / 0.3) 5.2cqi 5.9cqi),
        repeating-linear-gradient(-60deg, transparent 0 5.2cqi, rgb(251 231 173 / 0.3) 5.2cqi 5.9cqi),
        linear-gradient(160deg, #bd1626, var(--oxblood));
    box-shadow: inset 0 0 0 1.2cqi var(--oxblood), inset 0 0 0 1.8cqi rgb(251 231 173 / 0.75);
}
.card__art::before, .card__art::after {
    content: '';
    position: absolute;
    left: calc(50% - 5.5cqi);
    width: 11cqi;
    height: 11cqi;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24' stroke='%23fbe7ad' stroke-width='1.7' stroke-linecap='round' fill='none'%3E%3Cg id='a'%3E%3Cpath d='M0-10V10M-3-7.2 0-4.4 3-7.2M-3 7.2 0 4.4 3 7.2'/%3E%3C/g%3E%3Cuse href='%23a' transform='rotate(60)'/%3E%3Cuse href='%23a' transform='rotate(120)'/%3E%3C/svg%3E") center / contain no-repeat;
    filter: drop-shadow(0 1px 0 rgb(0 0 0 / 0.4));
}
.card__art::before { top: 6cqi; }
.card__art::after { bottom: 6cqi; }
.card__medal {
    display: grid;
    place-items: center;
    width: 52cqi;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #a81323, #5d0711);
    box-shadow: 0 0 0 0.9cqi var(--gold), 0 0 0 2.6cqi var(--oxblood), 0 0 0 3.3cqi rgb(251 231 173 / 0.8), 0 1.5cqi 4cqi 3cqi rgb(0 0 0 / 0.35);
}
.card__medal b {
    font: 400 30cqi/1 var(--f-display);
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0.6cqi 0 rgb(0 0 0 / 0.45));
    translate: 0 -1cqi;
}

/* Face: index in the corners, the winner where the court figure would be. */
.card__face { color: var(--suit-color); display: grid; place-content: center; justify-items: center; padding: 0 6cqi; text-align: center; }
.card__index { position: absolute; top: 4cqi; left: 5cqi; display: grid; justify-items: center; line-height: 0.95; }
.card__index b { font: 400 17cqi/0.9 var(--f-display); }
.card__index i { font-style: normal; font-size: 12cqi; line-height: 1; }
.card__index--flip { top: auto; left: auto; bottom: 4cqi; right: 5cqi; rotate: 180deg; }
.card__pip { position: absolute; inset: 0; display: grid; place-content: center; font-size: 80cqi; line-height: 1; opacity: 0.08; }
.card__label { font: 500 7.8cqi/1 var(--f-text); letter-spacing: 0.08em; color: rgb(23 17 11 / 0.62); }
.card__name {
    font: 400 min(19.5cqi, 126cqi / var(--len))/1.1 var(--f-display);
    color: var(--ink);
    margin-top: 2.5cqi;
    white-space: nowrap;
}
.card__rule { width: 34cqi; height: 0; margin: 4cqi 0 3.4cqi; border-top: 1px solid currentColor; box-shadow: 0 2px 0 -0.5px currentColor; opacity: 0.7; }
.card__prize { font: 600 min(9.8cqi, 1.12rem)/1.2 var(--f-text); color: var(--ink); text-wrap: balance; }
.card__glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgb(255 255 255 / 0.75), rgb(255 255 255 / 0.12) 38%, transparent 62%);
    mix-blend-mode: soft-light;
    transition: opacity 240ms ease-out;
}

/* Tonight: the card is lifted off the felt, with a gold edge. */
.cell--tonight .card { translate: 0 -1.5cqh; rotate: -3deg; }
.cell--tonight .card::before { translate: 6px 22px; filter: blur(16px); opacity: 0.6; }
.cell--tonight .card__back { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 22px 4px rgb(251 215 130 / 0.75), 0 0 70px 10px rgb(251 200 90 / 0.4); }
.card__tag {
    position: absolute;
    left: 50%;
    bottom: 10cqi;
    translate: -50% 0;
    padding: 1.6cqi 5cqi 1.9cqi;
    white-space: nowrap;
    font: 600 min(8.2cqi, 1rem)/1.1 var(--f-text);
    color: #2b1a04;
    background: var(--foil);
    border-radius: 1.4cqi;
    box-shadow: 0 2px 6px rgb(0 0 0 / 0.5);
}
.card__sheen {
    position: absolute;
    inset: -20% -80%;
    background: linear-gradient(105deg, transparent 42%, rgb(255 244 210 / 0.5) 50%, transparent 58%);
    translate: -60% 0;
    pointer-events: none;
}
/* Luke 24: black and gold. */
.cell--xmas .card__art {
    background:
        radial-gradient(circle at 50% 50%, transparent 0 34%, rgb(0 0 0 / 0.55) 100%),
        repeating-linear-gradient(60deg, transparent 0 5.2cqi, rgb(251 231 173 / 0.34) 5.2cqi 5.9cqi),
        repeating-linear-gradient(-60deg, transparent 0 5.2cqi, rgb(251 231 173 / 0.34) 5.2cqi 5.9cqi),
        linear-gradient(160deg, #26232a, #0b0a0d);
    box-shadow: inset 0 0 0 1.2cqi #0b0a0d, inset 0 0 0 1.8cqi var(--gold);
}
.cell--xmas .card__medal { background: var(--foil); box-shadow: 0 0 0 0.9cqi #0b0a0d, 0 0 0 2.6cqi var(--gold), 0 1.5cqi 4cqi 3cqi rgb(0 0 0 / 0.5); }
.cell--xmas .card__medal b { background: none; color: #1c1206; filter: none; }
.cell--xmas .card__back, .cell--xmas .card__face { background: var(--foil); }
.cell--xmas .card__face::before { content: ''; position: absolute; inset: 3cqi; border-radius: 5.5cqi; background: linear-gradient(165deg, #fffaf0, var(--ivory) 55%, #efe4c6); }
.cell--xmas .card__face > * { position: relative; }
.cell--xmas .card__face > .card__index, .cell--xmas .card__face > .card__pip, .cell--xmas .card__face > .card__glare { position: absolute; }
.card__name--wrap { white-space: normal; text-wrap: balance; overflow-wrap: anywhere; line-height: 1.12; font-size: min(13cqi, 150cqi / var(--len)); }
.cell--xmas .card__prize { font-size: min(7.4cqi, 0.95rem); }

@media (hover: hover) {
    .card:hover { translate: 0 -8px; scale: 1.05; z-index: 2; }
    .card:hover::before { translate: 0 22px; filter: blur(15px); opacity: 0.55; }
    .card:hover .card__glare { opacity: 1; }
    .cell--tonight .card:hover { translate: 0 calc(-1.5cqh - 8px); }
}
.card:active { scale: 0.98; }

/* On the felt beside the deal: the rest of the deck, and the pot. Each lies in the strip of felt
   on its side of the cards. It is sized by that strip and only shown when the strip is wide
   enough, so it never lies on a card. */
.felt { container-type: inline-size; min-width: 0; display: grid; justify-items: start; pointer-events: none; }
.felt--far { justify-items: end; }
.prop { display: none; position: relative; width: var(--prop-w); margin-inline: min(44px, (100cqi - var(--prop-w)) / 2); }
@container (min-width: 136px) {
    .prop--deck { display: block; }
    .prop--chips { display: grid; }
}
.prop--deck { --prop-w: clamp(72px, 100cqi - 64px, 104px); aspect-ratio: 5 / 7; rotate: -8deg; }
.prop--deck i {
    position: absolute;
    inset: 0;
    border-radius: 8%;
    background: linear-gradient(165deg, #fffaf0, #efe4c6);
    box-shadow: 0 2px 5px rgb(0 0 0 / 0.45);
}
.prop--deck i::before {
    content: '';
    position: absolute;
    inset: 6%;
    border-radius: 5%;
    background:
        repeating-linear-gradient(60deg, transparent 0 5px, rgb(251 231 173 / 0.3) 5px 6px),
        repeating-linear-gradient(-60deg, transparent 0 5px, rgb(251 231 173 / 0.3) 5px 6px),
        linear-gradient(160deg, #bd1626, var(--oxblood));
}
.prop--deck i:nth-child(1) { translate: 7px 9px; rotate: 5deg; }
.prop--deck i:nth-child(2) { translate: 4px 5px; rotate: -3deg; }
.prop--deck i:nth-child(3) { translate: 2px 2px; rotate: 1.5deg; }
.prop--chips { --prop-w: clamp(46px, 100cqi - 84px, 74px); gap: clamp(18px, 3cqh, 34px); }
.chips { position: relative; aspect-ratio: 1; }
.chips i {
    --chip: var(--crimson);
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle, var(--chip) 0 44%, #fff6dc 45% 48%, var(--chip) 49% 58%, transparent 59%),
        repeating-conic-gradient(#fff6dc 0 20deg, var(--chip) 20deg 45deg);
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35), 0 3px 4px rgb(0 0 0 / 0.5);
}
.chips i:nth-child(1) { translate: 5px 7px; }
.chips i:nth-child(2) { translate: 2px 4px; rotate: 31deg; }
.chips i:nth-child(3) { translate: -1px 1px; rotate: 12deg; }
.chips--green i { --chip: #0e6b47; }
.chips--black i { --chip: #17131a; }
.chips--gold i { --chip: #b98a2d; }

/* ─── Rules along the near edge ─── */
.foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 28px;
    font-size: clamp(0.84rem, 0.95vw, 1rem);
    color: rgb(251 244 225 / 0.78);
}
.rules { display: flex; flex-wrap: wrap; gap: 4px 30px; }
.rules li { display: flex; gap: 0.6em; align-items: baseline; max-width: 56ch; }
.rules li::before { content: '♦\FE0E'; color: var(--gold); font-size: 0.8em; }

@keyframes deal { from { translate: -34vw -46vh; rotate: -28deg; opacity: 0; } }
@keyframes turn { from { transform: rotateY(180deg); } }
@keyframes sheen { 0%, 55% { translate: -60% 0; } 85%, 100% { translate: 60% 0; } }
@keyframes hover-float { 50% { translate: 0 calc(-1.5cqh - 6px); } }
@media (prefers-reduced-motion: no-preference) {
    .cell { animation: deal 520ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--i) * 34ms); }
    .cell--open .card__body { animation: turn 620ms cubic-bezier(0.3, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--i) * 34ms + 620ms); }
    .card__sheen { animation: sheen 3.6s ease-in-out infinite; }
    .cell--tonight .card:not(:hover) { animation: hover-float 3.2s ease-in-out infinite; }
    body.is-calm :is(.card__sheen, .card) { animation-play-state: paused; }
}

/* ─── Dialogs: one big card, face up ─── */
.dlg {
    --suit-color: var(--ink);
    width: min(86vw, 22rem);
    padding: 0;
    border: 0;
    background: none;
    overflow: visible;
    color: var(--ink);
    perspective: 1200px;
}
.dlg.is-red { --suit-color: var(--red); }
.dlg::backdrop { background: rgb(2 16 11 / 0.8); backdrop-filter: blur(4px); }
.dlg__card {
    position: relative;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.35rem;
    aspect-ratio: 5 / 7;
    padding: 3.2rem 1.6rem;
    border-radius: 1.4rem;
    text-align: center;
    background: linear-gradient(165deg, #fffaf0, var(--ivory) 55%, #efe4c6);
    box-shadow: inset 0 0 0 1px rgb(60 40 10 / 0.2), 0 2px 0 #cfc3a2, 0 30px 70px rgb(0 0 0 / 0.6);
    color: var(--suit-color);
}
.dlg.is-xmas .dlg__card { box-shadow: inset 0 0 0 5px var(--gold), inset 0 0 0 6px #fff1c4, 0 30px 70px rgb(0 0 0 / 0.6); }
/* A window too low for the door card (browser zoom, a phone on its side): the card keeps its size and its
   shape, and the whole dialog scrolls. The room around the card is for its shadow. */
@media (max-height: 37.5rem) {
    .dlg:not(.dlg--list) {
        box-sizing: content-box;
        max-height: calc(100dvh - 2rem);
        padding: 0.5rem 1.5rem 1rem;
        overflow: hidden auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgb(220 180 94 / 0.8) rgb(4 29 21 / 0.55);
    }
}
.dlg__index { position: absolute; top: 0.9rem; left: 1.1rem; display: grid; justify-items: center; }
.dlg__index b { font: 400 3rem/0.9 var(--f-display); }
.dlg__index i { font-style: normal; font-size: 2rem; line-height: 1; }
.dlg__index--flip { top: auto; left: auto; bottom: 0.9rem; right: 1.1rem; rotate: 180deg; }
.dlg__date { font: 500 1.05rem/1.2 var(--f-text); color: rgb(23 17 11 / 0.7); }
.dlg__label { font: 500 0.95rem/1.2 var(--f-text); letter-spacing: 0.08em; color: rgb(23 17 11 / 0.62); margin-top: 0.8rem; }
.dlg__winner { font: 400 clamp(1.5rem, min(9vw, 21rem / var(--len, 10) * 1.5), 2.6rem)/1.1 var(--f-display); color: var(--ink); text-wrap: balance; overflow-wrap: anywhere; }
.dlg__rule { width: 5rem; border-top: 1px solid currentColor; box-shadow: 0 3px 0 -1px currentColor; margin: 0.7rem 0 0.6rem; opacity: 0.7; }
.dlg__prize { font: 600 1.3rem/1.25 var(--f-text); color: var(--ink); text-wrap: balance; }
.dlg__note { font: 400 1.5rem/1.25 var(--f-display); color: var(--ink); text-wrap: balance; max-width: 13ch; margin-top: 0.6rem; }
.dlg__close { display: flex; justify-content: center; margin-top: 1.1rem; }
.dlg--list { width: min(92vw, 34rem); }
.dlg--list .dlg__card { aspect-ratio: auto; padding: 2rem 1.6rem 1.6rem; color: var(--ink); }
.dlg__title { font: 400 clamp(1.5rem, 5vw, 2rem)/1.1 var(--f-display); text-wrap: balance; }
.dlg__intro { color: rgb(23 17 11 / 0.75); max-width: 38ch; text-wrap: balance; }
.dlg__list { columns: 2; column-gap: 2rem; width: 100%; text-align: left; font-size: 1.05rem; font-weight: 500; margin-top: 0.6rem; }
.dlg__list li { display: flex; gap: 0.6em; padding: 0.24em 0; border-bottom: 1px solid rgb(23 17 11 / 0.14); break-inside: avoid; }
.dlg__list li::before { content: '♦\FE0E'; color: var(--red); }
.dlg__list li:nth-child(even)::before { content: '♠\FE0E'; color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
    .dlg { transition: opacity 200ms ease-out, display 420ms, overlay 420ms; transition-behavior: allow-discrete; opacity: 0; }
    .dlg .dlg__card { transition: rotate 420ms cubic-bezier(0.2, 0.8, 0.2, 1), scale 420ms cubic-bezier(0.2, 0.8, 0.2, 1); rotate: y -70deg; scale: 0.8; }
    .dlg[open] { opacity: 1; }
    .dlg[open] .dlg__card { rotate: y 0deg; scale: 1; }
    @starting-style {
        .dlg[open] { opacity: 0; }
        .dlg[open] .dlg__card { rotate: y 70deg; scale: 0.8; }
    }
}

/* ─── Small pieces ─── */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.motion-btn {
    appearance: none;
    cursor: pointer;
    padding: 0.4em 0.9em;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: none;
    color: inherit;
    font: inherit;
    opacity: 0.85;
    transition: opacity 150ms ease-out, scale 150ms ease-out;
}
.motion-btn:hover { opacity: 1; }
.motion-btn:active { scale: 0.97; }
.motion-btn { flex: none; white-space: nowrap; }
.foot { flex-wrap: nowrap; align-items: flex-end; }
.rules { flex: 1 1 auto; min-width: 0; }
.prizes__body { min-width: 0; overflow-wrap: anywhere; }
.prizes__note { display: block; font-size: 0.82em; font-weight: 400; opacity: 0.75; }
.prizes__item--won .prizes__text { text-decoration: line-through; text-decoration-thickness: 1px; opacity: 0.6; }
.prizes__item--xmas .prizes__text { font-weight: 700; }
/* A winner's name is a link to the profile. It reads as the text around it until it is pointed at. */
.who { color: inherit; text-decoration: none; }
.who:hover, .who:focus-visible { color: var(--crimson); text-decoration: underline; }
/* The white ring of the page cannot be seen on the light card */
.who:focus-visible { outline-color: var(--ink); outline-offset: 2px; }

/* ─── Phones and narrow windows: the table scrolls ─── */
@media (max-width: 900px) {
    .rail { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .title { white-space: normal; }
    .plaque { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .xmas-clock, .xmas-note { grid-column: 1; grid-row: auto; }
    .actions { justify-content: center; }
    .table { container-type: inline-size; }
    .deck {
        --pad: 14px;
        --card-h: calc((100cqi - var(--pad) * 2 - var(--gap-x) * (var(--cols) - 1)) / var(--cols) * 1.4);
        padding-block: var(--pad);
    }
    .cell--tonight .card { translate: 0 -6px; }
    .foot { justify-content: center; flex-wrap: wrap; }
    .room { --main-min: 0px; }
}

/* ─── Julehånda (EX-1674): the player's seat on the rail ─── */
/* One playing card of the hand. --w is its width, set by what holds the card. */
.pc {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: var(--w, 56px);
    height: calc(var(--w, 56px) * 1.4);
    border-radius: calc(var(--w, 56px) * 0.08);
    background: linear-gradient(165deg, #fffaf0, var(--ivory) 55%, #efe4c6);
    box-shadow: inset 0 0 0 1px rgb(60 40 10 / 0.18), 0 1px 0 #cfc3a2, 0 2px 0 #b9ad8c, 0 10px 16px rgb(0 0 0 / 0.42);
    color: var(--ink);
}
.pc--red { color: var(--red); }
.pc__idx { position: absolute; top: calc(var(--w, 56px) * 0.06); left: calc(var(--w, 56px) * 0.08); display: grid; justify-items: center; }
.pc__idx b { font: 400 calc(var(--w, 56px) * 0.27)/0.9 var(--f-display); letter-spacing: -0.03em; }
.pc__idx i { font-style: normal; font-size: calc(var(--w, 56px) * 0.19); line-height: 1; }
.pc__idx--flip { top: auto; left: auto; bottom: calc(var(--w, 56px) * 0.06); right: calc(var(--w, 56px) * 0.08); rotate: 180deg; }
.pc__pip { font-size: calc(var(--w, 56px) * 0.56); line-height: 1; }
/* A place in the hand that no card lies in yet */
.pc--none { background: rgb(4 29 21 / 0.35); box-shadow: none; border: 1.5px dashed rgb(220 180 94 / 0.5); }
/* Face down: the blue deck. The boxes of the calendar are the red deck. */
.pc--back::before {
    content: '';
    position: absolute;
    inset: calc(var(--w, 56px) * 0.06);
    border-radius: calc(var(--w, 56px) * 0.05);
    background:
        radial-gradient(circle at 50% 50%, transparent 0 34%, rgb(0 6 30 / 0.5) 100%),
        repeating-linear-gradient(60deg, transparent 0 calc(var(--w, 56px) * 0.052), rgb(251 231 173 / 0.3) calc(var(--w, 56px) * 0.052) calc(var(--w, 56px) * 0.059)),
        repeating-linear-gradient(-60deg, transparent 0 calc(var(--w, 56px) * 0.052), rgb(251 231 173 / 0.3) calc(var(--w, 56px) * 0.052) calc(var(--w, 56px) * 0.059)),
        linear-gradient(160deg, #1f4f94, #0c2147);
    box-shadow: inset 0 0 0 calc(var(--w, 56px) * 0.012) #0c2147, inset 0 0 0 calc(var(--w, 56px) * 0.02) rgb(251 231 173 / 0.75);
}
.pc--back { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 18px 3px rgb(251 215 130 / 0.7), 0 0 50px 8px rgb(251 200 90 / 0.35); }
.pc__medal {
    position: relative;
    display: grid;
    place-items: center;
    width: 52%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #2a5fae, #0a1c3d);
    box-shadow: 0 0 0 calc(var(--w, 56px) * 0.012) var(--gold), 0 0 0 calc(var(--w, 56px) * 0.032) #0c2147, 0 0 0 calc(var(--w, 56px) * 0.042) rgb(251 231 173 / 0.8);
}
.pc__medal b { font: 400 calc(var(--w, 56px) * 0.3)/1 var(--f-display); background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* The seat sits across the gold edge of the table: half on the felt, half on the rail. Its
   height follows the cards alone (--seat-h), so the table and the rail each know how much room to
   give it: the seat never lies on a box, and never hangs below the window. */
.has-hand {
    --w: clamp(46px, 3.5vw, 58px);
    --seat-h: calc(var(--w) * 1.4 + 18px);
}
.has-hand .table { padding-bottom: calc(var(--seat-h) / 2 + 12px); }
.seat {
    position: absolute;
    /* Centred with auto margins, not with left: 50%: that would give the seat half the table to lay
       itself out in, and its texts would wrap */
    left: 0;
    right: 0;
    top: calc(100% - var(--seat-h) / 2);
    width: max-content;
    max-width: calc(100% - 28px);
    height: var(--seat-h);
    margin-inline: auto;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: clamp(16px, 2vw, 34px);
    padding: 8px clamp(18px, 2vw, 30px);
    border-radius: 20px;
    background: linear-gradient(#0b3929, #062619);
    border: 1px solid rgb(220 180 94 / 0.6);
    box-shadow: inset 0 0 0 4px #062a1c, inset 0 0 0 5px rgb(220 180 94 / 0.35), 0 12px 28px rgb(0 0 0 / 0.5);
    white-space: nowrap;
}
.seat__label { font: 500 0.92rem/1.2 var(--f-text); color: rgb(251 244 225 / 0.78); }
.seat__name, .seat__linename {
    font: 400 clamp(1.35rem, 1.8vw, 1.9rem)/1.08 var(--f-display);
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 0 rgb(0 0 0 / 0.4));
}
.seat__linename { display: none; }
.seat__meta { font-size: 0.9rem; line-height: 1.3; color: rgb(251 244 225 / 0.78); }
.seat__intro { white-space: normal; max-width: 36ch; text-wrap: balance; }
/* The five cards, held as a fan */
.seat__cards { display: flex; align-items: flex-end; }
.seat__cards li {
    margin-left: calc(var(--w) * -0.16);
    transform-origin: 50% 130%;
    rotate: calc((var(--k) - 2) * 4.5deg);
    translate: 0 calc((var(--k) - 2) * (var(--k) - 2) * 2.5px);
}
.seat__cards li:first-child { margin-left: 0; }
.seat__split { padding-left: clamp(16px, 2vw, 34px); border-left: 1px solid rgb(220 180 94 / 0.35); }
.seat__new { display: flex; align-items: center; gap: 12px; }
.seat__new .pc { --w: clamp(38px, 2.8vw, 46px); }
.seat__newtext { font: 500 0.95rem/1.25 var(--f-text); color: var(--gold-hi); }
.seat__others { display: grid; gap: 2px; max-width: 20ch; white-space: normal; }
.seat__others b { font: 400 1.25rem/1.1 var(--f-display); color: var(--gold-hi); }
/* A narrower table: the seat sheds what the player can do without */
@container (max-width: 1180px) { .seat__others { display: none; } }
@container (max-width: 940px) { .seat__info .seat__meta:not(.seat__intro) { display: none; } }

/* The rules: the seat stands where they stood, so they open from a button on the rail */
.has-hand .foot { min-height: calc(var(--seat-h) / 2); align-items: flex-end; justify-content: space-between; }
.has-hand .rules { display: none; }
.rulesbox { display: flex; align-items: center; gap: 14px; min-width: 0; }
.rulesbox__hint { display: none; max-width: 28ch; font-size: 0.88rem; line-height: 1.3; color: var(--gold-hi); }
@media (min-width: 1700px) { .rulesbox__hint { display: block; } }
.rules-btn { position: relative; flex: none; border-color: var(--gold-hi); }
/* Until the player has opened the rules once, the button carries a ring that draws the eye */
.rules-btn.is-new { box-shadow: 0 0 0 3px rgb(220 180 94 / 0.3), 0 0 18px 2px rgb(251 215 130 / 0.45); }
.rules-btn.is-new::after {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: inherit;
    border: 2px solid var(--gold-hi);
    opacity: 0;
    pointer-events: none;
}
@keyframes rules-ring { 0% { opacity: 0.9; scale: 0.94; } 70%, 100% { opacity: 0; scale: 1.14; } }
@media (prefers-reduced-motion: no-preference) {
    .rules-btn.is-new::after { animation: rules-ring 2.4s ease-out infinite; }
    body.is-calm .rules-btn.is-new::after { animation-play-state: paused; }
}
.dlg--rules { width: min(92vw, 40rem); }
/* A long list scrolls inside the card, so the close button under it stays in view in a low window (browser
   zoom, a small laptop, a phone). The dialog itself must not clip: the card's shadow reaches outside it. */
.dlg--list .dlg__card { max-height: calc(100dvh - 6.5rem); overflow-y: auto; align-content: start; }
.dlg--rules .dlg__card { justify-items: stretch; }
.dlg--rules .dlg__title { justify-self: center; }
.dlg__sub { font: 400 1.25rem/1.1 var(--f-display); margin-top: 0.9rem; text-align: left; }
.dlg--rules .dlg__list { columns: 1; margin-top: 0.2rem; font-size: 1rem; font-weight: 400; }

/* ─── The test tools of Julehånda (DEV and THOR only) ─── */
.sim { width: min(94vw, 42rem); color-scheme: light; }
.sim .dlg__card { justify-items: stretch; text-align: left; gap: 0.3rem; }
.sim .dlg__title, .sim .dlg__intro { justify-self: center; text-align: center; }
.sim__notice { margin-top: 0.4rem; padding: 0.5em 0.8em; border-radius: 10px; background: #ffd54a; color: #111; font-weight: 600; }
.sim__group { margin-top: 0.8rem; font: 600 0.95rem/1.2 var(--f-text); letter-spacing: 0.06em; color: rgb(23 17 11 / 0.7); }
.sim__row { display: grid; gap: 3px; padding: 0.5rem 0; border-bottom: 1px solid rgb(23 17 11 / 0.14); }
.sim__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 500; }
.sim__btn {
    appearance: none;
    cursor: pointer;
    padding: 0.5em 0.95em;
    border-radius: 999px;
    border: 1px solid #2b1a04;
    background: #2b1a04;
    color: #fff6dc;
    font: 600 0.95rem/1.1 var(--f-text);
}
.sim__btn:hover:not(:disabled) { background: #4a2d08; }
.sim__btn:disabled { opacity: 0.45; cursor: not-allowed; }
.sim__number, .sim__select { padding: 0.32em 0.5em; border-radius: 8px; border: 1px solid rgb(23 17 11 / 0.45); background: #fff; color: var(--ink); font: inherit; }
.sim__number { width: 4.6em; }
.sim__help { font-size: 0.88rem; line-height: 1.35; color: rgb(23 17 11 / 0.74); }
.sim__help--foot { margin-top: 0.7rem; }
.sim__msg { min-height: 1.5em; margin-top: 0.4rem; font-weight: 600; color: #14532d; }
.sim__msg.is-error { color: var(--red); }
@media (pointer: coarse) {
    .sim__btn, .rules-btn, .sim__number, .sim__select { min-block-size: 44px; }
}

/* ─── Phones and narrow windows: the hand is one line that stays at the bottom of the screen ─── */
@media (max-width: 900px) {
    .has-hand .table { padding-bottom: 0; }
    .room.has-hand { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
    /* A box or a button that gets the focus is scrolled clear of the line */
    html:has(.has-hand) { scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
    .has-hand .foot { min-height: 0; }
    .has-hand .rules { display: flex; }
    .has-hand { --w: 30px; }
    .seat {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-width: none;
        height: auto;
        margin-inline: 0;
        justify-content: space-between;
        gap: 10px;
        padding: 10px max(14px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
        border-width: 1px 0 0;
        border-radius: 18px 18px 0 0;
        box-shadow: inset 0 1px 0 rgb(220 180 94 / 0.3), 0 -10px 26px rgb(0 0 0 / 0.5);
    }
    .seat__info, .seat__others { display: none; }
    .seat__linename { display: block; font-size: 1.25rem; }
    /* Small cards in a row: only the rank over the suit */
    .seat__cards { align-items: center; gap: 4px; }
    .seat__cards li, .seat__cards li:first-child { margin-left: 0; rotate: none; translate: none; }
    .seat .pc { box-shadow: inset 0 0 0 1px rgb(60 40 10 / 0.18), 0 1px 0 #b9ad8c, 0 3px 6px rgb(0 0 0 / 0.4); }
    .seat .pc--none { box-shadow: none; }
    .seat .pc__idx { position: static; }
    .seat .pc__idx b { font-size: calc(var(--w) * 0.5); line-height: 0.95; }
    .seat .pc__idx i { font-size: calc(var(--w) * 0.42); line-height: 0.95; }
    .seat .pc__idx--flip, .seat .pc__pip { display: none; }
    .seat__new { padding: 0; border: 0; }
    .seat__new .pc { display: none; }
    .seat__newtext { padding: 0.5em 0.9em; border-radius: 999px; background: var(--foil); color: #2b1a04; font-weight: 600; font-size: 0.9rem; }
}

/* ─── Julehånda: the dialog for a new card ─── */
/* On the seat: the text over the button, beside the card that waits */
.seat__new { display: grid; grid-template-columns: auto auto; align-content: center; align-items: center; gap: 4px 12px; }
.seat__new .pc { grid-row: 1 / span 2; }
.seat__turn { padding: 0.45em 1em; justify-self: start; }

.ncd { width: min(94vw, 47rem); padding: 0; border: 0; background: none; color: var(--ivory); overflow: visible; }
.ncd::backdrop { background: rgb(2 16 11 / 0.8); backdrop-filter: blur(4px); }
.ncd__panel {
    display: grid;
    justify-items: center;
    gap: 14px;
    max-height: calc(100dvh - 6.5rem);
    padding: clamp(18px, 3vw, 30px);
    overflow-y: auto;
    border-radius: 22px;
    background: radial-gradient(120% 90% at 50% 0%, #17694a, #0b3929 55%, #062619);
    border: 1px solid rgb(220 180 94 / 0.8);
    box-shadow: inset 0 0 0 4px #062a1c, inset 0 0 0 5px rgb(220 180 94 / 0.35), 0 30px 70px rgb(0 0 0 / 0.6);
    text-align: center;
}
.ncd__title {
    font: 400 clamp(1.55rem, 4.6vw, 2.15rem)/1.1 var(--f-display);
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-wrap: balance;
}
.ncd__lead { max-width: 48ch; color: rgb(251 244 225 / 0.84); text-wrap: balance; }
.ncd__deal { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 18px clamp(18px, 3.4vw, 40px); margin-top: 6px; }
.ncd__col { display: grid; justify-items: center; gap: 10px; }
.ncd__cap { font-size: 0.92rem; color: rgb(251 244 225 / 0.8); }
.ncd__new { --w: clamp(84px, 22vw, 112px); display: block; }
.ncd__new .pc { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 18px 3px rgb(251 215 130 / 0.7), 0 0 50px 8px rgb(251 200 90 / 0.35); }
/* The five cards of the hand are buttons: the one that is pressed goes out */
.ncd__pick { --w: clamp(50px, 14.4vw, 88px); display: flex; gap: clamp(5px, 1.4vw, 10px); padding-top: 34px; }
.ncd__pick .pc { padding: 0; border: 0; cursor: pointer; font: inherit; transition: translate 160ms ease-out, box-shadow 160ms ease-out; }
.ncd__pick .pc.is-out { translate: 0 -16px; box-shadow: 0 0 0 3px var(--gold-hi), 0 0 22px 4px rgb(251 215 130 / 0.7), 0 16px 22px rgb(0 0 0 / 0.5); }
.ncd__pick .pc.is-out::after {
    content: attr(data-label);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    translate: -50% 0;
    padding: 0.12em 0.65em 0.18em;
    border-radius: 999px;
    background: var(--foil);
    color: #2b1a04;
    font: 600 0.8rem/1.3 var(--f-text);
    white-space: nowrap;
}
@media (hover: hover) {
    .ncd__pick .pc:hover:not(.is-out):not(:disabled) { translate: 0 -6px; }
}
.ncd__outcome { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 10px 14px; margin-top: 4px; }
.ncd__outcome p { min-width: 9.5rem; padding: 0.5em 1em 0.6em; border-radius: 12px; background: rgb(4 29 21 / 0.6); border: 1px solid rgb(220 180 94 / 0.35); font-size: 0.9rem; color: rgb(251 244 225 / 0.8); }
.ncd__outcome b { display: block; font: 400 1.3rem/1.15 var(--f-display); color: var(--ivory); }
.ncd__outcome p.is-better { background: rgb(220 180 94 / 0.16); border-color: var(--gold); }
.ncd__outcome p.is-better b { color: var(--gold-hi); }
.ncd__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 4px; }
/* The two rows of buttons take turns: the hidden attribute must win over the display set here */
.ncd__actions[hidden], .ncd__confirm[hidden] { display: none; }
.ncd .btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.ncd__confirm { display: grid; justify-items: center; gap: 10px; }
/* Hold a button down to choose at once: it fills from the left while it is held, and
   designs/calendar.js sends the choice when the time is out. A press that is let go sooner is a
   click, and the dialog asks first. The text of the button must not be marked by a long press.
   The button takes the whole touch (touch-action: none): a finger that slides a little while it
   holds must not start a scroll of the dialog, for the browser then takes the touch and the
   hold ends. */
.btn--hold {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.btn--hold::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgb(220 180 94 / 0.45);
    transform-origin: left center;
    scale: 0 1;
    opacity: 0;
}
.btn--gold.btn--hold::before { background: rgb(255 255 255 / 0.55); }
/* Without motion the whole button lights up at once. The time is the same. */
.btn--hold.is-holding::before { scale: 1 1; opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
    .btn--hold.is-holding::before { transition: scale var(--hold-ms, 900ms) linear; }
}
.ncd__ask { font: 400 1.25rem/1.25 var(--f-display); color: var(--gold-hi); text-wrap: balance; }
.ncd__note { max-width: 44ch; font-size: 0.88rem; color: rgb(251 244 225 / 0.7); text-wrap: balance; }
/* A line of text is as tall as the room that is kept for it, so a line that comes moves nothing.
   When the dialog scrolls to the line (designs/calendar.js), the edge of the dialog shows under it. */
.ncd__msg { min-height: 1.4em; line-height: 1.4; scroll-margin-bottom: 30px; font-weight: 600; color: var(--gold-hi); }
.ncd__msg.is-error { color: #ffb4a8; }
@media (prefers-reduced-motion: no-preference) {
    .ncd { transition: opacity 200ms ease-out, display 300ms, overlay 300ms; transition-behavior: allow-discrete; opacity: 0; }
    .ncd[open] { opacity: 1; }
    @starting-style {
        .ncd[open] { opacity: 0; }
    }
}
@media (pointer: coarse) {
    .seat__turn, .ncd .btn { min-block-size: 44px; }
}
@media (max-width: 900px) {
    /* On the line at the bottom of a phone the button says it all */
    .seat__new { display: flex; }
    .seat__new:has(.seat__turn) .seat__newtext { display: none; }
    .seat__turn { padding: 0.55em 0.9em; font-size: 0.9rem; }
}

/* ─── Julehånda: Christmas Eve, every hand ─── */
/* A small card: only the rank over the suit */
.pc--mini { box-shadow: inset 0 0 0 1px rgb(60 40 10 / 0.18), 0 1px 0 #b9ad8c, 0 3px 6px rgb(0 0 0 / 0.4); }
.pc--mini .pc__idx { position: static; }
.pc--mini .pc__idx b { font-size: calc(var(--w, 56px) * 0.5); line-height: 0.95; }
.pc--mini .pc__idx i { font-size: calc(var(--w, 56px) * 0.42); line-height: 0.95; }
.pc--mini .pc__idx--flip, .pc--mini .pc__pip { display: none; }

/* On the seat after the lock: the button under the line that says the hands are locked */
.seat--locked .seat__others { justify-items: start; gap: 6px; max-width: none; }
/* A narrower table sheds the block, but never the only way to the list: the button stays, without the text over it */
@container (max-width: 1180px) {
    .seat--locked .seat__others { display: flex; padding: 0; border: 0; }
    .seat--locked .seat__others b { display: none; }
}

.res { width: min(94vw, 44rem); }
.res__list { width: 100%; display: grid; gap: 8px; margin-top: 4px; text-align: left; }
.res__row {
    --w: clamp(30px, 7.4vw, 46px);
    display: grid;
    grid-template-columns: 2.4rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 14px;
    padding: 8px 14px;
    border-radius: 14px;
    background: rgb(4 29 21 / 0.55);
    border: 1px solid rgb(220 180 94 / 0.3);
}
.res__row.is-winner { border-color: var(--gold); background: rgb(220 180 94 / 0.16); }
.res__row.is-you { box-shadow: inset 0 0 0 1px rgb(251 244 225 / 0.55); }
.res__place { font: 400 1.9rem/1 var(--f-display); text-align: center; background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }
.res__who { display: grid; gap: 2px; min-width: 0; }
.res__name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font: 400 1.3rem/1.1 var(--f-display); color: var(--ivory); overflow-wrap: anywhere; }
.res__mark { padding: 0.1em 0.6em 0.16em; border-radius: 999px; background: var(--foil); color: #2b1a04; font: 600 0.74rem/1.3 var(--f-text); white-space: nowrap; }
.res__mark--you { background: none; box-shadow: inset 0 0 0 1px rgb(251 244 225 / 0.7); color: var(--ivory); }
.res__hand { font-size: 0.92rem; color: var(--gold-hi); }
.res__cards { display: flex; gap: 4px; }
.res__you { font-weight: 600; color: var(--gold-hi); }
@media (max-width: 900px) {
    /* On the line at the bottom of a phone: the button that opens the list, without the text over it */
    .seat--locked .seat__others { display: flex; padding: 0; border: 0; }
    .seat--locked .seat__others b { display: none; }
}
@media (max-width: 560px) {
    .res__row { grid-template-columns: 2rem minmax(0, 1fr); }
    .res__cards { grid-column: 1 / -1; justify-content: center; }
}

/* ─── The scrollbars of the dialogs: thin, and in the colours of the table ─── */
/* The standard properties come first. A browser without scrollbar-color gets the ::-webkit-scrollbar rules below. */
.ncd__panel, .res__list { --scrollbar-thumb: rgb(220 180 94 / 0.8); --scrollbar-track: rgb(4 29 21 / 0.55); }
.dlg--list .dlg__card { --scrollbar-thumb: rgb(23 17 11 / 0.55); --scrollbar-track: rgb(23 17 11 / 0.08); }
.ncd__panel, .res__list, .dlg--list .dlg__card {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    overscroll-behavior: contain;
}
@supports not (scrollbar-color: auto) {
    .ncd__panel, .res__list, .dlg--list .dlg__card { scrollbar-width: auto; }
    .ncd__panel::-webkit-scrollbar, .res__list::-webkit-scrollbar, .dlg--list .dlg__card::-webkit-scrollbar { width: 8px; height: 8px; }
    .ncd__panel::-webkit-scrollbar-thumb, .res__list::-webkit-scrollbar-thumb, .dlg--list .dlg__card::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; }
    .ncd__panel::-webkit-scrollbar-track, .res__list::-webkit-scrollbar-track, .dlg--list .dlg__card::-webkit-scrollbar-track { background: var(--scrollbar-track); }
}

/* Every hand: the list scrolls, not the whole panel. The title and the prize stay in view, and the
   scrollbar lies inside the gold frame instead of on its rounded edge. On a very low window the panel
   still scrolls as a last resort. */
.res .ncd__panel { display: flex; flex-direction: column; align-items: center; }
.res .ncd__panel > * { flex: none; }
.res .res__list {
    flex: 1 1 auto;
    min-height: min(11rem, 40dvh);
    align-content: start;
    padding-inline: 4px;
    overflow-y: auto;
    scrollbar-gutter: stable both-edges;
    border-radius: 14px;
}
.res__list:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
