/* Bela web page: the look of the app – dark green panels with gold edges on the card-covered table,
   Caladea for titles and scores, Inter for text, a calligraphic italic for player names. */

@font-face { font-family: "Caladea"; src: url("../fonts/Caladea-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Caladea"; src: url("../fonts/Caladea-Bold.ttf") format("truetype"); font-weight: 700; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Regular.otf") format("opentype"); font-weight: 400; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-SemiBold.otf") format("opentype"); font-weight: 600; }
@font-face { font-family: "Rukopis"; src: url("../fonts/texgyrepagella-bolditalic.otf") format("opentype"); }

:root {
    --green: #153F2E;
    --green-panel: rgba(21, 63, 46, 0.93);
    --green-hover: #1F5A42;
    --green-dark: #0E2A1F;
    --gold: #E3B03A;
    --gold-soft: rgba(227, 176, 58, 0.6);
    --gold-light: #F2C46A;
    --cream: #F2EBDA;
    --cream-2: #F2E6C8;
    --muted: #B9CCC0;
    --muted-2: #9FB5A8;
    --red-dark: #4A1A16;
    --red-edge: #C9574A;
    --card-w: clamp(44px, min(9.5vw, 13vh), 112px);
    /* The places on the table get the height left over by the top bar, the message and the hand, so on a
       short screen nothing overlaps. */
    --slot-w: clamp(36px, min(8.5vw, (100vh - 430px) / 3.2), 100px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: linear-gradient(rgba(28, 16, 8, 0.55), rgba(28, 16, 8, 0.55)), url("../img/bela_table_base.webp") center / cover fixed, #2a1a0e;
    color: var(--cream);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 15px;
}

/* The table (card-covered wood, darkened so the game on top stands out) is the body background above. */

.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; gap: 8px; }
.loading-title { font-family: "Caladea", serif; font-weight: 700; font-size: 56px; color: var(--gold); letter-spacing: 4px; }
.loading-text { color: var(--muted); }

#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 10px 16px;
    background: var(--red-dark); color: var(--cream);
    border-top: 2px solid var(--red-edge);
    z-index: 1000;
}
#blazor-error-ui a { color: var(--gold-light); }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ---------- common pieces ---------- */

.panel {
    background: var(--green-panel);
    border: 2px solid var(--gold);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    padding: 14px 18px;
}

.panel-title, .field-label {
    color: var(--gold);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 2px;
    margin-bottom: 10px;
    display: block;
}
.panel-title.spaced { margin-top: 20px; }

.btn {
    background: var(--green);
    color: var(--cream);
    border: 1.5px solid var(--gold);
    border-radius: 12px;
    font-family: "Inter", sans-serif;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 16px;
    min-height: 38px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
    transition: background 0.12s, transform 0.12s;
}
.btn:hover:not(:disabled) { background: var(--green-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.big { font-size: 17px; min-height: 46px; padding: 10px 22px; }
.btn.small { font-size: 13px; min-height: 30px; padding: 4px 10px; }
.btn.top { font-size: 13px; min-height: 32px; width: 112px; border-radius: 10px; color: white; }
.btn.no { background: var(--red-dark); border-color: var(--red-edge); }
.btn.no:hover:not(:disabled) { background: #6a2620; }
.btn.choice.selected { background: var(--gold); color: #1E2A24; }

.text-input {
    background: var(--green-dark);
    color: var(--cream);
    border: 1.5px solid #4D7A66;
    border-radius: 10px;
    padding: 9px 12px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    width: 100%;
    outline: none;
}
.text-input:focus { border-color: var(--gold); }

.person-name { font-family: "Rukopis", "Caladea", serif; font-size: 1.12em; color: var(--gold); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.4; margin: 8px 0; }
.hint.center, .center { text-align: center; }
.muted { color: var(--muted-2); }
.small { font-size: 12px; }
.status-line, .notice-line, .error-line {
    text-align: center;
    margin: 8px auto;
    padding: 6px 14px;
    border-radius: 10px;
    max-width: 640px;
}
.status-line { background: rgba(0, 0, 0, 0.45); color: var(--gold-light); }
.notice-line { background: rgba(0, 0, 0, 0.45); color: var(--cream); }
.error-line { background: var(--red-dark); border: 1px solid var(--red-edge); color: var(--cream); }

/* ---------- lobby ---------- */

.lobby { max-width: 980px; margin: 0 auto; padding: 24px 16px 40px; }
.lobby-head { text-align: center; margin-bottom: 18px; }
.lobby-icon { width: 90px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6)); }
.lobby-head h1 {
    font-family: "Caladea", serif; font-weight: 700; font-size: 60px; letter-spacing: 6px;
    color: var(--gold); margin: 0; text-shadow: 0 3px 6px rgba(0, 0, 0, 0.7);
}
.lobby-sub { color: var(--cream-2); text-shadow: 1px 1px 3px black; }
.lobby > .panel { max-width: 420px; margin: 0 auto 16px; }
.lobby-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lobby-columns .panel { display: flex; flex-direction: column; gap: 8px; }
.choice-row { display: flex; gap: 8px; }
.choice-row .btn { flex: 1; padding: 8px 6px; }
.table-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.table-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--green-hover); border: 1.5px solid var(--gold); border-radius: 10px; padding: 8px 12px;
}
.table-row.started { background: rgba(14, 42, 31, 0.6); border-color: #4D7A66; }
.table-row-text { display: flex; flex-direction: column; }
.table-row-meta { color: var(--muted); font-size: 13px; }
.code-row { display: flex; gap: 8px; }
.text-input.code { text-transform: uppercase; letter-spacing: 4px; font-weight: 600; }

/* ---------- the game ---------- */

.game {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    padding: 12px;
    gap: 6px;
    overflow: hidden;
}

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.info-panel { padding: 8px 16px 10px; }
.score-table { border-collapse: collapse; }
.score-table th { color: var(--gold); font-size: 10px; letter-spacing: 1.5px; font-weight: 600; text-align: right; padding: 0 0 0 18px; }
.score-table td { padding: 0 0 0 18px; }
.score-table td:first-child { padding-left: 0; }
.side-name { font-family: "Caladea", serif; font-weight: 700; font-size: 19px; color: var(--cream-2); }
.side-total { font-family: "Caladea", serif; font-weight: 700; font-size: 25px; text-align: right; color: white; }
.side-total.leading { color: var(--gold); }
.side-hand { font-weight: 600; font-size: 16px; text-align: right; color: var(--cream-2); }
.info-line {
    display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center;
    border-top: 1px solid var(--gold-soft); margin-top: 6px; padding-top: 6px; font-size: 14px;
}
.trump { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: white; }
.trump img { width: 24px; height: 24px; }
.games { color: var(--gold); font-weight: 600; font-size: 13px; }
.target { color: var(--cream-2); font-size: 13px; }
.table-title { font-family: "Caladea", serif; font-weight: 700; font-size: 22px; color: var(--gold); letter-spacing: 2px; }
.code-badge { font-weight: 600; letter-spacing: 3px; color: var(--gold-light); }

.top-buttons { display: flex; flex-direction: column; gap: 6px; }
.chat-button { position: relative; }
.badge {
    position: absolute; top: -7px; right: -7px;
    background: #D92A2A; color: white; border: 1.5px solid var(--cream);
    border-radius: 10px; min-width: 20px; height: 20px; padding: 0 5px;
    font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

/* Waiting room */
.waiting { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; }
.waiting-panel { width: min(520px, 100%); display: flex; flex-direction: column; gap: 10px; }
.code-box { text-align: center; }
.code-big { font-family: "Caladea", serif; font-weight: 700; font-size: 44px; letter-spacing: 10px; color: var(--gold-light); }
.seat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.seat-row {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    background: rgba(14, 42, 31, 0.35); border: 1.5px solid #4D7A66; border-radius: 10px; padding: 8px 14px;
    color: var(--muted-2);
}
.seat-row.taken { background: var(--green-hover); border-color: var(--gold); color: var(--cream); font-weight: 600; }

/* The felt: one card place per player */
.felt {
    flex: 1 1 auto;
    min-height: 0;
    /* The felt measures the height it is given, and the card places are sized to fit it (two places, each
       with name, note and card, stand above each other in the middle), so nothing below is ever covered. */
    container-type: size;
    --slot-w: clamp(32px, min(8.5vw, (100cqh - 100px) / 3.25), 100px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 3vw, 24px);
}
.felt-column { display: flex; flex-direction: column; align-items: center; gap: 6px; width: calc(var(--slot-w) + 40px); }
.felt-column.middle { gap: 2px; }
.felt.triangle .felt-column.left, .felt.triangle .felt-column.right { align-self: flex-start; margin-top: 2vh; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot.hidden { visibility: hidden; height: 0; }
.felt.triangle .slot.hidden { height: auto; }
.slot-name {
    font-family: "Rukopis", "Caladea", serif; font-size: 17px; color: white;
    text-shadow: 1px 1px 3px black; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.slot.on-turn .slot-name, .slot.on-turn .slot-note { color: var(--gold-light); }
.slot-note { font-weight: 600; font-size: 12px; height: 17px; color: #D9CFB4; text-shadow: 1px 1px 3px black; white-space: nowrap; }
.slot-card {
    width: var(--slot-w);
    aspect-ratio: 100 / 161;
    margin: 4px 0;
    border: 1.5px dashed var(--gold-soft);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.16);
    position: relative;
}
.place-3 .slot-card { transform: rotate(-7deg); }
.place-2 .slot-card { transform: rotate(3deg); }
.place-1 .slot-card { transform: rotate(6deg); }
.place-0 .slot-card { transform: rotate(-2deg); }
.slot.on-turn.place-0 .slot-card { border: 2.5px solid var(--gold); background: rgba(227, 176, 58, 0.25); }
.slot-card img {
    position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px);
    object-fit: contain; filter: drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.55));
    animation: throw-in 0.32s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.thrown.from-0 { --from-x: 0px; --from-y: 240px; --spin: -20deg; }
.thrown.from-1 { --from-x: 280px; --from-y: 0px; --spin: 25deg; }
.thrown.from-2 { --from-x: 0px; --from-y: -240px; --spin: 18deg; }
.thrown.from-3 { --from-x: -280px; --from-y: 0px; --spin: -28deg; }
@keyframes throw-in {
    from { transform: translate(var(--from-x), var(--from-y)) rotate(var(--spin)) scale(1.12); opacity: 0.3; }
    35% { opacity: 1; }
    to { transform: none; opacity: 1; }
}

/* Message, bars and the hand */
.bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.message-box {
    max-width: 680px; width: fit-content; text-align: center; padding: 8px 18px;
    font-weight: 600; font-size: 15px; line-height: 1.35; border-width: 1.5px; border-radius: 16px;
}
.declaration { color: var(--cream-2); font-weight: 400; font-size: 13px; margin-top: 3px; }
.action-bar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; font-weight: 600; border-width: 1.5px; }
.bid-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn.suit { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; }
.btn.suit img { width: 30px; height: 30px; }
.btn.pass { min-width: 90px; }

.hand {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    padding: 14px 4px 0;
    min-height: calc(var(--card-w) * 1.61 + 14px);
}
.hand-card {
    flex: 0 1 var(--card-w);
    min-width: 0;
    transition: transform 0.12s;
    position: relative;
}
.hand-card img {
    width: var(--card-w);
    display: block;
    filter: drop-shadow(1px 3px 4px rgba(0, 0, 0, 0.6));
    user-select: none;
    -webkit-user-drag: none;
}
.hand-card + .hand-card { margin-left: 4px; }
.hand-card.first-talon { margin-left: 18px; }
.hand.playing .hand-card.legal { cursor: pointer; }
.hand.playing .hand-card.legal:hover { transform: translateY(-14px); }
.hand.playing .hand-card { touch-action: none; }
/* A card that may not be played: red for a moment when it is tried (the others are not dimmed). */
.hand-card.denied { animation: denied 0.65s ease; }
.hand-card.denied img { filter: drop-shadow(0 0 6px rgba(230, 40, 40, 0.9)) sepia(1) saturate(6) hue-rotate(-30deg) brightness(0.85); }
@keyframes denied { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
/* The card being dragged follows the pointer, solid, and shrinks towards this player's place. */
.drag-ghost {
    position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; display: block;
    filter: drop-shadow(3px 8px 8px rgba(0, 0, 0, 0.55)); user-select: none;
}

/* ---------- panels over the table ---------- */

.overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
    display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.overlay.light { background: rgba(0, 0, 0, 0.35); cursor: pointer; }
.dialog {
    width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px;
    border-radius: 22px; padding: 20px 28px 22px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}
.dialog.wide { width: min(760px, 100%); max-height: 90vh; }
.dialog-title {
    font-family: "Caladea", serif; font-weight: 700; font-size: 30px; letter-spacing: 3px;
    color: var(--gold); text-align: center; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}
.dialog-title.small { font-size: 20px; text-align: left; }
.dialog-text { text-align: center; font-weight: 600; font-size: 16px; }
.dialog-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.call-panel { width: min(560px, 100%); text-align: center; border-radius: 22px; padding: 18px 26px; }
.call-title { font-family: "Caladea", serif; font-weight: 700; font-size: 32px; letter-spacing: 3px; color: var(--gold); }
.call-row { margin: 10px 0; }
.call-text { color: var(--cream-2); font-size: 14px; margin: 2px 0 6px; }
.call-cards { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.call-cards img { width: clamp(44px, 8vw, 66px); filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.5)); }
.call-footer { white-space: pre-line; font-weight: 600; margin-top: 10px; border-top: 1px solid var(--gold-soft); padding-top: 8px; }

.sheet-scroll { overflow: auto; max-height: 60vh; }
.sheet { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet th { color: var(--gold); font-weight: 600; text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--gold-soft); }
.sheet td { text-align: right; padding: 4px 8px; border-bottom: 1px solid rgba(227, 176, 58, 0.15); }
.sheet tr.fell td { color: #FF8A80; background: rgba(200, 40, 40, 0.18); }
.sheet tr.sum td { font-family: "Caladea", serif; font-weight: 700; font-size: 18px; color: var(--gold); border-bottom: none; }
.sheet-suit { width: 18px; height: 18px; vertical-align: middle; }

.chat-panel {
    position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(340px, calc(100vw - 24px));
    display: flex; flex-direction: column; gap: 8px; z-index: 40;
    transform: translateX(calc(100% + 30px)); transition: transform 0.2s ease-out;
}
.chat-panel.open { transform: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; }
.icon-button { background: none; border: none; color: var(--cream); font-size: 18px; cursor: pointer; padding: 4px 8px; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.chat-line {
    align-self: flex-start; max-width: 260px; background: var(--green-hover);
    border-radius: 10px; padding: 6px 10px; font-size: 14px; overflow-wrap: anywhere;
}
.chat-line.mine { align-self: flex-end; background: #2A3E2A; }
.chat-line.mine .person-name { color: var(--gold-light); }
.chat-line .person-name { margin-right: 8px; }
.chat-notice { text-align: center; color: var(--muted-2); font-size: 12px; font-style: italic; }
.chat-input { display: flex; gap: 8px; }

/* ---------- narrow screens (phones) ---------- */

@media (max-width: 720px) {
    .lobby-columns { grid-template-columns: 1fr; }
    .lobby-head h1 { font-size: 44px; }
    .game { padding: 8px; }
    .side-name { font-size: 16px; }
    .side-total { font-size: 20px; }
    .score-table th, .score-table td { padding-left: 10px; }
    .btn.top { width: 84px; }
    .slot-name { font-size: 14px; max-width: 100px; }
    .slot-note { font-size: 11px; }
    :root { --card-w: clamp(44px, min(16vw, 13vh), 112px); }
    .felt { --slot-w: clamp(32px, min(21vw, (100cqh - 100px) / 3.25), 100px); }
    .felt-column { width: calc(var(--slot-w) + 24px); }
    .hand-card + .hand-card { margin-left: 0; }
    .btn.suit { padding: 4px 10px; }
    .btn.suit img { width: 24px; height: 24px; }
}

/* ---------- start screen (as in the Windows app) ---------- */

.start-screen {
    position: relative; z-index: 1; min-height: 100vh; box-sizing: border-box; padding: 16px; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.start-title {
    font-family: "Caladea", serif; font-weight: 700; font-size: clamp(56px, 18vw, 88px);
    letter-spacing: 14px; margin: 0 -14px 0 0; color: white; line-height: 1.1;
    text-shadow: 2px 3px 6px rgba(0, 0, 0, 0.7);
}
.start-suits { display: flex; gap: 26px; height: 48px; align-items: center; }
.start-suits img { width: 40px; height: 40px; object-fit: contain; animation: start-breathe 2.4s ease-in-out infinite; }
@keyframes start-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* The fan: every card turns around a point below the cards; hover lifts a card outwards along its direction. */
.start-fan-box { width: 480px; max-width: 100%; height: 250px; margin-top: 6px; display: flex; justify-content: center; }
.start-fan { position: relative; width: 480px; height: 250px; flex: none; }
.fan-card {
    position: absolute; left: 50%; bottom: 0; width: 112px; height: 180px; margin-left: -56px;
    object-fit: contain; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
    transform-origin: 50% 160%;
    transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(var(--a, 0deg)) translateY(var(--lift, 0px)) scaleX(var(--sx, 1));
    transition: transform var(--d, 120ms) ease-in-out, opacity var(--d, 120ms) ease-in;
    filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.5));
}
.start-fan:not(.busy) .fan-card:hover { --lift: -22px; }
.start-fan.busy .fan-card { cursor: default; }

/* Nova igra, drawn like the app's picture: dark green with a gold inner line, a darker raised bottom edge and
   a soft shadow. Sizes are in em, so the whole button scales with the font size on narrow screens. */
.start-button {
    position: relative; box-sizing: border-box; font-size: min(37px, 8.8vw);
    width: 7.9em; height: 2.27em; margin: 0.62em 0 1.1em; padding: 0 0.6em 0 0.55em;
    display: flex; align-items: center; justify-content: center; gap: 0.55em;
    background: #154031; border: none; border-radius: 0.46em; color: white; cursor: pointer;
    font-family: "Inter", system-ui, sans-serif; font-weight: 600; letter-spacing: -0.01em;
    box-shadow: 0 0.22em 0 #0b2219, 0 0.25em 0 #081a12, 0 0.55em 1.1em rgba(0, 0, 0, 0.35);
    user-select: none; -webkit-tap-highlight-color: transparent;
    transition: transform 120ms ease, opacity 150ms ease;
}
.start-button::before {
    content: ""; position: absolute; inset: 0.2em; border: max(2px, 0.07em) solid #E3B03A; border-radius: 0.3em; pointer-events: none;
}
.start-button img { width: 1.45em; height: auto; flex: none; }
.start-button span { line-height: 1; margin-top: -0.05em; }
.start-button:hover { transform: scale(1.05); }
.start-button:focus-visible { outline: 3px solid #E3B03A; outline-offset: 4px; }
.start-button.pressed { transform: scale(0.95); }
.start-button.gone { opacity: 0; pointer-events: none; }

.start-tip {
    width: 540px; max-width: 100%; box-sizing: border-box; margin-top: 4px; padding: 10px 16px;
    background: rgba(21, 63, 46, 0.9); border: 1.5px solid #E3B03A; border-radius: 12px;
    color: white; font-size: 14px; line-height: 1.2; text-align: center; cursor: pointer; user-select: none;
}
.start-tip-text { transition: opacity 120ms ease; }
.start-tip-text.fading { opacity: 0; }
.start-tip-head { font-family: "Caladea", serif; font-weight: 700; font-size: 17px; color: #E3B03A; }

@media (max-width: 520px) {
    .start-fan-box { height: 200px; }
    .start-fan { transform: scale(0.78); transform-origin: 50% 100%; margin-top: -50px; }
    .start-suits { gap: 18px; }
}

/* Cards tossed onto the table behind the start screen. The layer draws the table picture itself (like the
   page background) with the cards on it, and the tint goes over both, so the cards look part of the table.
   .throw-table has the size the picture gets with "cover", so card positions in % of it match the picture. */
.throw-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; background: url("../img/bela_table_base.webp") center / cover, #2a1a0e; }
.throw-tint { position: fixed; inset: 0; pointer-events: none; background: rgba(28, 16, 8, 0.55); }
.throw-table {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: max(100vw, calc(100vh * 1300 / 1400)); aspect-ratio: 1300 / 1400;
}
.thrown-card {
    position: absolute; height: auto; transform: rotate(var(--r));
    filter: drop-shadow(3px 5px 6px rgba(0, 0, 0, 0.4));
    animation: toss-in 700ms cubic-bezier(0.33, 1, 0.68, 1) both;
    transition: opacity 2.5s ease-in-out;
}
.thrown-card.fading { opacity: 0; }
@keyframes toss-in { from { transform: translate(var(--fx), var(--fy)) rotate(var(--fr)); } }

/* ---------- the end of the match ---------- */

.winner-panel { width: min(480px, 100%); align-items: center; text-align: center; gap: 8px; max-height: calc(100vh - 32px); overflow-y: auto; }
.winner-panel .btn { width: 100%; }
.winner-panel .dialog-buttons { width: 100%; }
.winner-icon { width: 64px; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.6)); }
.winner-label { color: var(--cream-2); font-size: 15px; letter-spacing: 2px; text-transform: uppercase; }
.winner-name {
    font-family: "Caladea", serif; font-weight: 700; font-size: clamp(30px, 8vw, 44px); line-height: 1.1;
    color: var(--gold); text-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
}
.winner-score { font-family: "Caladea", serif; font-weight: 700; font-size: 22px; color: white; }
.match-chart { width: 100%; margin: 4px 0 6px; }
.match-chart svg { width: 100%; height: auto; display: block; background: rgba(0, 0, 0, 0.18); border-radius: 10px; }
.match-chart .axis { stroke: rgba(240, 230, 210, 0.35); stroke-width: 1; }
.match-chart .target-line { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.match-chart .tick { fill: var(--cream-2); font-size: 10px; font-family: "Inter", sans-serif; }
.match-chart .series { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 6px; font-size: 13px; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- phones: the table fits the screen, nothing covers the cards ---------- */

@media (max-width: 720px) {
    .topbar { gap: 6px; }
    .info-panel { padding: 6px 10px 8px; min-width: 0; }
    .info-line { gap: 2px 10px; font-size: 12px; }
    .games, .target { font-size: 11px; }
    .top-buttons { gap: 4px; }
    .btn.top { width: auto; min-width: 70px; padding: 6px 10px; font-size: 13px; }
    .message-box { font-size: 13px; padding: 6px 12px; line-height: 1.3; }
    .declaration { font-size: 12px; }
    .bid-bar { gap: 6px; }
    .hand { padding-top: 10px; min-height: calc(var(--card-w) * 1.61 + 10px); }
    .dialog { padding: 16px 16px 18px; }
    .dialog-title { font-size: 24px; }
}
@media (max-height: 640px) {
    .game { padding: 6px; gap: 4px; }
    .slot-note { height: 14px; font-size: 11px; }
    .slot-card { margin: 2px 0; }
    .message-box { padding: 4px 12px; font-size: 13px; }
}

/* Screens sit above the thrown-cards background (ThrowLayer). */
.lobby, .game { position: relative; z-index: 1; }

/* Wide screens: the scores and buttons float in the top corners, so the table can use the full height
   (the middle of the table, where the top player's card lies, stays free). */
@media (min-width: 1100px) {

    .topbar { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 5; pointer-events: none; }
    .topbar > * { pointer-events: auto; }
    .game > .status-line { margin-top: 0; }
}

/* =====================================================================================================
   Modern look (same background, cards, suit signs and colours): glass panels with a fine gold line,
   rounded buttons with a gold main button, name plates with a time ring, a slim message bar,
   and a small traditional ornament of the four suit signs.
   ===================================================================================================== */

:root {
    --gold-line: rgba(227, 176, 58, 0.55);
    --gold-faint: rgba(227, 176, 58, 0.2);
    --glass: linear-gradient(180deg, rgba(27, 77, 56, 0.88), rgba(14, 42, 31, 0.9));
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
    --them: #E0675A;
}

.panel {
    background: var(--glass); border: 1px solid var(--gold-line); border-radius: 18px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);

}
.panel-title, .field-label { font-size: 11px; letter-spacing: 0.14em; }

.ornament { display: flex; align-items: center; gap: 8px; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line), transparent); }
.ornament img { width: 14px; height: 14px; opacity: 0.9; }

/* Buttons: rounded; the main action is gold. */
.btn {
    border-radius: 999px; border: 1px solid var(--gold-line); background: rgba(12, 36, 26, 0.6);
    padding: 9px 18px; transition: transform 0.12s, background 0.12s, box-shadow 0.12s;
}
.btn:hover:not(:disabled) { background: rgba(31, 90, 66, 0.95); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn.primary { background: linear-gradient(180deg, #F2C46A, #D9A12C); color: #1E2A20; border-color: #F5D58C; box-shadow: 0 3px 0 #9C7219, 0 6px 14px rgba(0, 0, 0, 0.35); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #F7D07E, #E0AB37); box-shadow: 0 4px 0 #9C7219, 0 8px 16px rgba(0, 0, 0, 0.35); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 #9C7219; }
.btn.no { background: rgba(74, 26, 22, 0.7); border-color: rgba(224, 103, 90, 0.7); }
.btn.top { width: auto; min-height: 36px; padding: 7px 14px; display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; }
.btn.top svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn.suit { border-radius: 999px; }
.badge { top: -5px; right: -5px; }

/* Segmented choices (players, public or private). */
.choice-row.seg { gap: 0; padding: 4px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--gold-faint); }
.choice-row.seg .btn.choice { border: none; background: transparent; color: var(--muted); box-shadow: none; transform: none; padding: 8px 6px; }
.choice-row.seg .btn.choice:hover:not(.selected) { background: rgba(255, 255, 255, 0.06); color: var(--cream); }
.choice-row.seg .btn.choice.selected { background: linear-gradient(180deg, #F2C46A, #D9A12C); color: #1E2A20; }

.text-input { border-radius: 12px; border: 1px solid rgba(227, 176, 58, 0.35); background: rgba(0, 0, 0, 0.28); padding: 10px 14px; }
.text-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 176, 58, 0.15); }

/* Lobby */
.lobby-head h1 { color: white; letter-spacing: 12px; margin-right: -12px; text-shadow: 0 3px 8px rgba(0, 0, 0, 0.6); }
.lobby-icon { width: 76px; }
.lobby-sub { color: var(--muted); text-shadow: none; }
.lobby-head .ornament { max-width: 300px; margin: 10px auto 0; }
.lobby-columns .panel { gap: 12px; padding: 18px 20px; }
.table-row { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--gold-faint); border-radius: 14px; padding: 10px 12px; }
.table-row.started { background: rgba(0, 0, 0, 0.15); border-color: rgba(255, 255, 255, 0.08); }
.table-row-text .person-name { font-family: "Inter", sans-serif; font-weight: 600; font-size: 15px; color: var(--cream); }
.table-row-meta { font-size: 12px; }
.seat-dots { display: flex; gap: 4px; margin-top: 5px; }
.seat-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.seat-dots i.full { background: var(--gold); }

/* Waiting room */
.seat-row { border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(0, 0, 0, 0.22); }
.seat-row.taken { background: rgba(27, 77, 56, 0.8); border-color: var(--gold-line); }
.code-big { letter-spacing: 12px; }

/* Score panel: total and this deal for each side, with a thin bar on the way to the target. */
.info-panel { padding: 12px 16px; min-width: 260px; }
.score-row { display: grid; grid-template-columns: 1fr auto 38px; align-items: baseline; column-gap: 12px; }
.score-row + .score-row { margin-top: 6px; }
.score-row .side-name { font-size: 18px; color: var(--cream); }
.score-row .side-total { font-size: 26px; font-variant-numeric: tabular-nums; }
.score-row.leading .side-total { color: var(--gold-light); }
.score-row .side-hand { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.track { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 4px; }
.track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #B98A25, var(--gold-light)); transition: width 0.4s; }
.score-row:not(.side-0) .track i { background: linear-gradient(90deg, #9E4036, var(--them)); }
.info-line { justify-content: space-between; border-top-color: var(--gold-faint); margin-top: 10px; padding-top: 9px; gap: 6px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--gold-faint); font-size: 13px; font-weight: 600; }
.chip img { width: 20px; height: 20px; }
.target { color: var(--muted); font-size: 12px; }
.top-buttons { flex-direction: row; gap: 8px; }

/* Name plates on the table; this player's plate is under their card place. */
.plate {
    display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; max-width: 100%;
    border-radius: 999px; background: rgba(12, 36, 26, 0.75); border: 1px solid var(--gold-faint); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.place-0 .plate { order: 2; }
.slot.on-turn .plate { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 176, 58, 0.18), 0 4px 14px rgba(0, 0, 0, 0.35); }
.avatar {
    position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: #1B4D38; font: 700 15px "Caladea", serif; color: var(--gold-light);
}
.ring { position: absolute; inset: -4px; width: 38px; height: 38px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 2.5; }
.ring-back { stroke: rgba(227, 176, 58, 0.2); }
.ring-time {
    stroke: var(--gold); stroke-dasharray: 106.8; stroke-linecap: round; stroke-dashoffset: var(--from, 0);
    animation-name: ring-run, ring-warn; animation-timing-function: linear, ease; animation-fill-mode: forwards, forwards;
}
@keyframes ring-run { from { stroke-dashoffset: var(--from, 0); } to { stroke-dashoffset: 106.8; } }
@keyframes ring-warn { to { stroke: #E0675A; } }
.plate-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.plate .slot-name { font-size: 16px; text-shadow: none; max-width: 130px; }
.plate .slot-note { height: auto; min-height: 0; font-size: 11px; font-weight: 600; color: var(--muted); text-shadow: none; }
.plate .slot-note:empty { display: none; }
.slot.on-turn .slot-note { color: var(--gold-light); }
.slot-card { border: 1.5px dashed rgba(227, 176, 58, 0.35); border-radius: 12px; background: radial-gradient(ellipse at center, rgba(227, 176, 58, 0.08), rgba(0, 0, 0, 0.12)); }
.slot.on-turn.place-0 .slot-card { border: 1.5px solid var(--gold); background: radial-gradient(ellipse at center, rgba(227, 176, 58, 0.22), rgba(0, 0, 0, 0.1)); }

/* The message: a slim bar with the trump sign. */
.message-box { display: flex; align-items: center; gap: 12px; text-align: left; border-radius: 999px; padding: 8px 20px 8px 10px; }
.message-box:not(:has(.message-mark)) { padding-left: 20px; text-align: center; }
.message-mark { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--gold-faint); }
.message-mark img { width: 20px; height: 20px; }
.declaration { color: var(--muted); }

/* Dialogs and the end of the match */
.dialog { border-radius: 22px; }
.overlay { background: rgba(0, 0, 0, 0.55); }
.winner-icon { width: 58px; }
.winner-label { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; color: var(--gold); }
.winner-name { color: var(--gold-light); }
.winner-panel .ornament { width: 100%; }
.match-chart svg { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--gold-faint); border-radius: 14px; }
.match-chart .series-fill { fill-opacity: 0.14; stroke: none; }
.chart-legend i { border-radius: 50%; }

/* Start screen: the tip of the day in the same glass style. */
.start-tip {
    background: var(--glass); border: 1px solid var(--gold-line); border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Phones: icon-only top buttons, smaller score panel, the message as a rounded box. */
@media (max-width: 720px) {
    .info-panel { min-width: 0; padding: 9px 12px; }
    .score-row { column-gap: 8px; grid-template-columns: 1fr auto 32px; }
    .score-row .side-name { font-size: 15px; }
    .score-row .side-total { font-size: 21px; }
    .top-buttons { flex-direction: column; gap: 6px; }
    .btn.top { width: 40px; height: 40px; min-height: 0; padding: 0; justify-content: center; }
    .btn.top span { display: none; }
    .message-box { border-radius: 18px; }
    .plate .slot-name { max-width: 96px; font-size: 14px; }
}

/* =====================================================================================================
   Soft text shadow, the new lobby parts (profile, Brza igra, daily bonus and challenges, leaderboard,
   friends, invitations), the fair-shuffle check, and scaling up on big screens.
   ===================================================================================================== */

body { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.btn.primary, .choice-row.seg .btn.choice.selected { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3); }
.text-input { text-shadow: none; }

/* Profile */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--gold-faint); }
.stat b { font: 700 22px "Caladea", serif; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.code-chip {
    font: 700 14px "Inter", sans-serif; letter-spacing: 0.18em; padding: 3px 10px; margin-left: 4px; cursor: pointer;
    color: var(--gold-light); background: rgba(0, 0, 0, 0.3); border: 1px dashed var(--gold-line); border-radius: 999px;
}
.code-chip:hover { background: rgba(227, 176, 58, 0.15); }

/* Brza igra */
.quick-panel { justify-content: space-between; }
.quick-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 20px; min-height: 56px; }
.quick-button svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.quick-count { text-align: center; padding: 10px 14px; border-radius: 14px; background: rgba(227, 176, 58, 0.12); border: 1px solid var(--gold-line); }
.quick-count b { color: var(--gold-light); font-size: 1.2em; font-variant-numeric: tabular-nums; }

/* Invitation */
.invite-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    max-width: 640px; margin: 0 auto 16px; padding: 12px 16px; border-color: var(--gold);
    animation: invite-in 0.4s ease;
}
.invite-buttons { display: flex; gap: 8px; }
@keyframes invite-in { from { opacity: 0; transform: translateY(-8px); } }

/* Three panels in a row (daily, leaderboard, friends) */
.lobby { max-width: 1100px; }
.lobby-columns + .lobby-columns, .lobby-columns + .error-line { margin-top: 16px; }
.lobby-columns.three { grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
@media (max-width: 960px) { .lobby-columns.three { grid-template-columns: 1fr 1fr; } }

.bonus-button { width: 100%; }
.bonus-done { text-align: center; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); color: var(--gold-light); font-weight: 600; }
.challenge-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.challenge { padding: 8px 12px 6px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(255, 255, 255, 0.06); }
.challenge.done { border-color: var(--gold-line); }
.challenge-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 14px; }
.challenge .reward { color: var(--gold-light); }
.challenge-count { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }

.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); text-align: left; padding: 4px 6px; }
.board td { padding: 6px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.board td.rank { color: var(--gold); font-weight: 700; width: 28px; }
.board tr.me td { background: rgba(227, 176, 58, 0.12); }

.friend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); }
.friend-row .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); flex: none; }
.friend-row .dot.on { background: #6FD08C; box-shadow: 0 0 6px #6FD08C; }
.friend-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.friend-text .person-name { font-family: "Inter", sans-serif; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.icon { padding: 4px 9px; min-width: 0; }
.error-text { color: #F2A196; }
.small { font-size: 12px; }

/* The fair shuffle */
.fair-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 4px 0; }
.fair-line svg { width: 20px; height: 20px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.fair-line code, .fair-code code { font-family: ui-monospace, Consolas, monospace; color: var(--cream); }
.fair-line span { flex: 1; }
.fair-verdict { text-align: center; font: 700 24px "Caladea", serif; padding: 8px; border-radius: 14px; }
.fair-verdict.ok { color: #8FE0A6; background: rgba(60, 160, 90, 0.15); }
.fair-verdict.bad { color: #F2A196; background: rgba(160, 50, 40, 0.2); }
.fair-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.fair-checks li { padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); }
.fair-checks li.ok { border-left: 3px solid #6FD08C; }
.fair-checks li.bad { border-left: 3px solid #E0675A; }
.fair-details { font-size: 13px; overflow: auto; max-height: calc(40vh / var(--ui)); }
.fair-details summary { cursor: pointer; color: var(--gold-light); margin-bottom: 6px; }
.fair-code { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.fair-code span { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; }
.fair-code code { word-break: break-all; font-size: 12px; }
.fair-deal { padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.fair-hand { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.fair-hand > span:first-child { width: 90px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fair-cards { display: flex; flex-wrap: wrap; gap: 2px; }
.fair-cards img { width: 26px; border-radius: 3px; }

/* Phones */
@media (max-width: 720px) {
    .lobby-columns.three { grid-template-columns: 1fr; }
    .quick-button { font-size: 18px; min-height: 50px; }
    .stat b { font-size: 19px; }
    .invite-bar { margin: 0 0 12px; }
    .fair-hand > span:first-child { width: 64px; }
}

/* Big screens: the same layout, larger. --ui scales panels, buttons and texts (CSS zoom); the cards and the
   card places on the table grow with the screen through their own limits. Inside a zoomed element vh is zoomed
   too, so heights given in vh are divided by --ui. */
:root { --ui: 1; }
@media (min-width: 1500px) and (min-height: 860px) { :root { --ui: 1.15; } }
@media (min-width: 1800px) and (min-height: 980px) { :root { --ui: 1.3; } }
@media (min-width: 2300px) and (min-height: 1250px) { :root { --ui: 1.65; } }
@media (min-width: 3000px) and (min-height: 1650px) { :root { --ui: 2.2; } }

:root { --card-w: clamp(44px, min(9.5vw, 13vh), calc(112px * var(--ui))); }
.felt { --slot-w: clamp(32px, min(8.5vw, (100cqh - 100px * var(--ui)) / 3.25), calc(100px * var(--ui))); }
@media (max-width: 720px) {
    :root { --card-w: clamp(44px, min(16vw, 13vh), 112px); }
    .felt { --slot-w: clamp(32px, min(21vw, (100cqh - 100px) / 3.25), 100px); }
}

.lobby, .topbar, .plate, .message-box, .bid-bar, .action-bar, .waiting-panel, .dialog, .chat-panel,
.start-screen > *, .call-panel { zoom: var(--ui); }
.dialog.wide { max-height: calc(90vh / var(--ui)); }
.sheet-scroll { max-height: calc(60vh / var(--ui)); }
.winner-panel { max-height: calc((100vh - 32px) / var(--ui)); }

/* The last card of the hand is shown whole, so the hand never runs off the right edge of a narrow screen. */
.hand-card:last-child { flex-shrink: 0; }
@media (max-width: 720px) { .hand-card.first-talon { margin-left: 10px; } }

/* =====================================================================================================
   Smooth play (above all on phones): no blur behind panels, the dragged card on its own layer, cheap shadows
   on phones, and the hand in two rows of bigger cards on phones.
   ===================================================================================================== */

.drag-ghost { filter: none; box-shadow: 3px 10px 14px rgba(0, 0, 0, 0.45); border-radius: 7% / 4.5%; will-change: transform; }
.hand-break { display: none; }

@media (max-width: 720px), (pointer: coarse) {
    /* Shadow filters are drawn again on every frame of a movement; box shadows are not. */
    .hand-card img, .slot-card img { filter: none; box-shadow: 1px 3px 6px rgba(0, 0, 0, 0.5); border-radius: 7% / 4.5%; }
    .thrown-card { filter: none; }
    .hand.playing .hand-card.legal:hover { transform: none; }
}

@media (max-width: 720px) {
    .hand.two-rows {
        flex-wrap: wrap; padding: 6px 6px 0; box-sizing: border-box;
        min-height: 0;
        --cell: min(calc((100% - var(--per-row) * 4px) / var(--per-row)), 96px, 14vh);
    }
    .hand.two-rows .hand-break { display: block; flex-basis: 100%; height: 0; }
    .hand.two-rows .hand-card { flex: 0 0 var(--cell); margin: 0 2px; }
    .hand.two-rows .hand-card img { width: 100%; }
    .hand.two-rows .hand-card.first-talon { margin-left: 2px; }
    /* The second row lies over the lower part of the first; the corner of every card stays visible. */
    .hand.two-rows .hand-card.row-2 { margin-top: calc(var(--cell) * -0.55); }
}

/* Nova igra: the six cards (face down) circle round the middle twice, gather, and fly out to the four sides one
   after another. Each card runs two CSS animations; --s is its place on the circle, --dx/--dy where it goes. */
.start-fan.orbit .fan-card {
    transform-origin: 50% 50%; filter: none; transition: none;
    animation: fan-orbit var(--orbit) cubic-bezier(0.45, 0.05, 0.4, 1) both, fan-deal var(--deal) cubic-bezier(0.5, 0, 0.9, 0.5) var(--deal-at) forwards;
    will-change: transform, opacity;
}
@keyframes fan-orbit {
    0% { transform: rotate(0deg) translateY(0px) scale(1); }
    18% { transform: rotate(calc(var(--s) + 70deg)) translateY(-78px) scale(0.85); }
    82% { transform: rotate(calc(var(--s) + 650deg)) translateY(-78px) scale(0.85); }
    100% { transform: rotate(calc(var(--s) + 720deg)) translateY(0px) scale(0.9); }
}
@keyframes fan-deal {
    from { transform: rotate(var(--s)) translateY(0px) scale(0.9); opacity: 1; }
    to { transform: translate(var(--dx), var(--dy)) rotate(var(--dr)) scale(0.55); opacity: 0; }
}

/* Phones: a compact top bar (buttons in a row), a smaller hand with more overlap, and so more room for the
   table, whose card places never get very small. */
@media (max-width: 720px) {
    .info-panel { padding: 7px 10px; }
    .score-row .side-name { font-size: 14px; }
    .score-row .side-total { font-size: 18px; }
    .score-row .side-hand { font-size: 12px; }
    .score-row + .score-row { margin-top: 2px; }
    .track { height: 3px; margin-top: 2px; }
    .info-line { margin-top: 6px; padding-top: 6px; }
    .chip { font-size: 12px; padding: 3px 8px 3px 5px; }
    .chip img { width: 16px; height: 16px; }
    .top-buttons { flex-direction: row; gap: 5px; flex: none; align-self: flex-start; }
    .topbar .info-panel { flex: 1 1 auto; min-width: 0; }
    .score-row .side-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .chip { white-space: nowrap; }
    .btn.top { width: 36px; height: 36px; min-width: 0; }
    .hand.two-rows { --cell: min(calc((100% - var(--per-row) * 4px) / var(--per-row)), 74px, 10.5vh); }
    .hand.two-rows .hand-card.row-2 { margin-top: calc(var(--cell) * -0.85); }
    .felt { --slot-w: clamp(46px, min(21vw, (100cqh - 90px) / 3.1), 100px); }
}

/* The fair-shuffle check: why the deck was not stacked, step by step. */
.fair-why { padding: 10px 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--gold-faint); }
.fair-why-title { font: 700 16px "Caladea", serif; color: var(--gold-light); margin: 2px 0 6px; }
.fair-why ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; line-height: 1.45; }
.fair-why b { color: var(--cream); }
.fair-panel { overflow-y: auto; }

/* Accounts, privacy statement, chat: mute and report. */
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.account-row .hint { margin: 0; flex: 1 1 180px; }
.account-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.account-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--gold-faint); }
.link-button { background: none; border: none; padding: 0; color: var(--gold-light); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.lobby-foot { text-align: center; margin-top: 18px; }
.start-privacy { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; opacity: 0.75; }
.privacy-panel { overflow-y: auto; }
.privacy-text { font-size: 14px; line-height: 1.5; }
.privacy-text h3 { font: 700 16px "Caladea", serif; color: var(--gold-light); margin: 14px 0 4px; }
.privacy-text p { margin: 6px 0; }
.privacy-text ul { margin: 4px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.delete-confirm { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(120, 30, 25, 0.35); border: 1px solid rgba(224, 103, 90, 0.6); }
.chat-who { background: none; border: none; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline dotted; }
.chat-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.chat-note { font-size: 12px; color: var(--muted); padding: 4px 12px; }
