/* ==========================================================================
   Stichkreis — norbert-wielage.de/stichkreis/
   Eingepasst in das Design der Hauptseite: Raleway, durchgehend helle
   Flächen, das Blau der Seite als Akzent. Die fünf Farben der Karten bleiben
   unterscheidbar, sind aber auf weisse Karten abgestimmt. Keine externen
   Ressourcen ausser der Domain-Schrift.
   ========================================================================== */

@font-face {
    font-family: "raleway";
    font-display: swap;
    font-weight: 100 900;
    font-style: normal;
    src: url("/fonts/raleway/raleway-variable.woff2") format("woff2"),
         url("/fonts/raleway/raleway-variable.woff") format("woff");
}

:root {
    color-scheme: light;

    /* Tokens der Hauptseite (nw-home.css) */
    --bg: #f5f8fc;
    --surface: #ffffff;
    --surface-2: #eef3fa;
    --ink: #0f1b2d;
    --text: #3c4a5e;
    --muted: #6b7a8d;
    --dim: #8a97a8;
    --line: #e6edf6;
    --line-strong: #d7e1ef;

    /* Akzent: das Blau der Hauptseite, fuer weisse Schrift eine Nuance dunkler */
    --accent: #0f6bb5;
    --accent-deep: #0b5691;
    --accent-hover: #1573c0;
    --accent-soft: #dbe9f7;
    --accent-tint: rgba(46, 163, 242, 0.10);
    --ring: #0f6bb5;   /* deckend: ein Fokusring braucht 3:1 auf hellem Grund */

    --gold: #9b7407;
    --danger: #c24736;

    /* Die fuenf Farben - auf weissem Kartengrund lesbar, das Blau der
       Oberflaeche bleibt der Oberflaeche vorbehalten (Gezeiten ist tuerkis). */
    --ember: #c24736;
    --tide: #17798b;
    --grove: #25784a;
    --light: #8a6706;
    --aether: #7649bd;

    --radius: 1rem;
    --shadow: 0 14px 34px -18px rgba(15, 27, 45, 0.35);
    --shadow-sm: 0 2px 10px -4px rgba(15, 27, 45, 0.18);
    font-family: "raleway", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
    min-width: 20rem;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Eigener Stacking-Context: Sonst verschwinden die Zierringe (z-index -1)
       hinter dem deckenden body-Hintergrund. */
    isolation: isolate;
}

button, input { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

button:disabled { cursor: not-allowed; }

.skip-link {
    position: fixed;
    z-index: 100;
    top: calc(var(--nwb-h, 0px) + 0.75rem);
    left: 0.75rem;
    transform: translateY(-200%);
    padding: 0.75rem 1rem;
    color: #fff;
    background: var(--accent);
    border-radius: 0.5rem;
    font-weight: 800;
}

.skip-link:focus { transform: translateY(0); }

/* Dezente Ringe im Hintergrund - kaum sichtbar, nur ein Hauch Tiefe. */
.ambient {
    position: fixed;
    z-index: -1;
    width: 38rem;
    height: 38rem;
    border: 1px solid rgba(15, 107, 181, 0.07);
    border-radius: 50%;
    pointer-events: none;
}

.ambient::before,
.ambient::after {
    content: "";
    position: absolute;
    inset: 11%;
    border: inherit;
    border-radius: inherit;
}

.ambient::after { inset: 28%; }
.ambient-one { top: -19rem; left: -13rem; }
.ambient-two { right: -20rem; bottom: -24rem; }

/* Sitzt unter der eingeblendeten Domain-Leiste (nwbar setzt --nwb-h). */
.site-header {
    position: sticky;
    top: var(--nwb-h, 0px);
    z-index: 40;   /* ueber dem Spielstand-Fenster (30), das beim Scrollen darunter wandert */
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 4rem;
    margin: 0 auto;
    padding: 0 max(1rem, calc((100vw - 92rem) / 2));
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.5rem 0.5rem 0;
    border: 0;
    color: var(--ink);
    background: transparent;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    cursor: pointer;
}

.brand-mark {
    position: relative;
    display: block;
    width: 2rem;
    height: 2rem;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 0.55rem;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
}

.brand-mark i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.3rem;
    height: 0.3rem;
    border-radius: 50%;
    background: var(--accent);
    transform: rotate(calc(var(--i, 0) * 72deg)) translateY(-0.82rem);
    transform-origin: 0 0;
}

.brand-mark i:nth-child(1) { --i: 0; background: var(--ember); }
.brand-mark i:nth-child(2) { --i: 1; background: var(--tide); }
.brand-mark i:nth-child(3) { --i: 2; background: var(--grove); }
.brand-mark i:nth-child(4) { --i: 3; background: var(--light); }
.brand-mark i:nth-child(5) { --i: 4; background: var(--aether); }

.header-actions { display: flex; align-items: center; gap: 0.65rem; }

.text-button,
.sound-button,
.icon-button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.text-button {
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.93rem;
    font-weight: 600;
}

.text-button:hover { color: var(--accent-deep); background: var(--accent-tint); }

.sound-button,
.icon-button {
    display: inline-grid;
    width: 2.4rem;
    height: 2.4rem;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--muted);
    background: var(--surface);
}

.sound-button[aria-pressed="true"] { color: var(--accent-deep); border-color: var(--accent); }

main { min-height: calc(100vh - 4rem - var(--nwb-h, 0px)); }

.home-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(20rem, 0.72fr);
    align-items: center;
    gap: clamp(2rem, 8vw, 8rem);
    width: min(76rem, calc(100% - 3rem));
    min-height: calc(100vh - 4rem - var(--nwb-h, 0px));
    margin: 0 auto;
    padding: 3rem 0 5rem;
}

.home-intro { position: relative; padding-left: clamp(0rem, 4vw, 4rem); }

.eyebrow {
    margin: 0 0 1rem;
    color: var(--accent-deep);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

.home-intro h1,
.lobby-main h1 {
    margin-bottom: 1.4rem;
    color: var(--ink);
    font-size: clamp(2.6rem, 5.4vw, 4.6rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.03em;
}

.home-intro h1 em {
    color: var(--accent);
    font-style: normal;
    font-weight: 800;
}

.home-copy,
.lobby-copy {
    max-width: 37rem;
    color: var(--text);
    font-size: 1.08rem;
    line-height: 1.72;
}

.quick-facts {
    display: flex;
    gap: 0;
    margin: 2.5rem 0 0;
    padding: 0;
    list-style: none;
}

.quick-facts li {
    display: grid;
    min-width: 7.8rem;
    padding: 0.2rem 1.4rem;
    border-left: 1px solid var(--line-strong);
}

.quick-facts li:first-child { padding-left: 0; border-left: 0; }
.quick-facts strong { color: var(--ink); font-size: 1.45rem; font-weight: 800; }
.quick-facts span { margin-top: 0.25rem; color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }

.orbit-emblem {
    position: absolute;
    z-index: -1;
    top: 50%;
    left: 34%;
    width: clamp(22rem, 38vw, 33rem);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    opacity: 0.45;
}

.orbit {
    position: absolute;
    inset: 0;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
}

.orbit-b { inset: 15%; border-style: dashed; animation: orbit-spin 40s linear infinite reverse; }

.orbit-emblem .core {
    position: absolute;
    inset: 35%;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
    color: var(--accent-soft);
    font-size: 3rem;
}

.orbit-emblem .node {
    position: absolute;
    display: grid;
    width: 2.7rem;
    height: 2.7rem;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: var(--surface);
    font-style: normal;
}

.node-1 { top: -1.3rem; left: calc(50% - 1.3rem); color: var(--ember); }
.node-2 { top: 30%; right: -1.3rem; color: var(--tide); }
.node-3 { right: 15%; bottom: 2%; color: var(--grove); }
.node-4 { bottom: 2%; left: 15%; color: var(--light); }
.node-5 { top: 30%; left: -1.3rem; color: var(--aether); }

@keyframes orbit-spin { to { transform: rotate(360deg); } }

.entry-card,
.panel {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.entry-card { padding: 0.65rem; border-radius: 1.5rem; }

.entry-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0.25rem;
    border-radius: 0.9rem;
    background: var(--surface-2);
}

.entry-tabs button {
    min-height: 2.75rem;
    border: 0;
    border-radius: 0.7rem;
    color: var(--muted);
    background: transparent;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.entry-tabs button.active { color: var(--accent-deep); background: var(--surface); box-shadow: var(--shadow-sm); }

.entry-form { display: grid; gap: 1.15rem; padding: 2rem 1.4rem 1.25rem; }

.field-group { display: grid; gap: 0.5rem; }
.field-group label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.field-group input {
    width: 100%;
    min-height: 3.4rem;
    padding: 0 1rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 0.75rem;
    color: var(--ink);
    background: var(--surface);
}

.field-group input::placeholder { color: #a4b1c2; }
.field-group input:focus { border-color: var(--accent); }
.field-group .code-input { text-transform: uppercase; letter-spacing: 0.25em; font-weight: 800; }

.primary-button,
.secondary-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    min-height: 3.5rem;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    transition: background 150ms ease, transform 100ms ease;
}

.primary-button {
    border: 0;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 3px 0 var(--accent-deep);
}

.primary-button:hover:not(:disabled) { background: var(--accent-hover); }
.primary-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-deep); }
.primary-button b { font-size: 1.25rem; transition: transform 180ms ease; }
.primary-button:hover:not(:disabled) b { transform: translateX(0.2rem); }
.primary-button:disabled { color: #fff; background: #a9bfd6; box-shadow: none; opacity: 0.8; }
.primary-button.compact { min-height: 3rem; padding-inline: 1.2rem; font-size: 0.9rem; }

.secondary-button { min-height: 2.75rem; border: 1.5px solid rgba(15, 27, 45, 0.22); color: var(--ink); background: var(--surface); font-size: 0.85rem; }
.secondary-button:hover { background: rgba(15, 27, 45, 0.06); }
/* Hausregel-Schalter im Eroeffnen-Formular. */
.option-toggle { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface-2); cursor: pointer; }
.option-toggle input { margin: 0.2rem 0 0; accent-color: var(--accent); flex: none; }
.option-toggle span { display: grid; gap: 0.15rem; }
.option-toggle strong { color: var(--ink); font-size: 0.88rem; }
.option-toggle small { color: var(--muted); font-size: 0.76rem; line-height: 1.45; }

.form-hint, .privacy-note { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; text-align: center; }
.privacy-note { padding: 0.8rem; border-top: 1px solid var(--line); }

.lobby-shell {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(16rem, 0.7fr);
    gap: 1.25rem;
    width: min(76rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 3rem 0 5rem;
}

.panel { border-radius: var(--radius); }
.lobby-main { padding: clamp(1.5rem, 4vw, 3.5rem); }
.lobby-main h1 { margin-bottom: 1rem; font-size: clamp(2.2rem, 4.6vw, 3.6rem); }
.lobby-copy { max-width: 42rem; }

.invite-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1rem 1rem 1rem 1.3rem;
    border: 1px solid var(--accent-soft);
    border-radius: 1rem;
    background: var(--surface-2);
}

.invite-box div { display: grid; gap: 0.15rem; }
.invite-box span { color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.invite-box strong { color: var(--accent-deep); font-size: 1.7rem; font-weight: 800; letter-spacing: 0.18em; }

.seat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
.seat { position: relative; display: flex; align-items: center; min-height: 4.25rem; padding: 0.7rem 0.85rem; border: 1px solid var(--line); border-radius: 0.9rem; background: var(--surface); }
.seat.empty { color: var(--dim); border-style: dashed; border-color: var(--line-strong); background: transparent; }
.seat.empty > span { width: 2.7rem; color: var(--line-strong); font-size: 1.3rem; font-weight: 800; }
.seat.empty p { margin: 0; font-size: 0.8rem; }
.seat.occupied { gap: 0.7rem; box-shadow: var(--shadow-sm); }
.seat.occupied.you { border-color: var(--accent); background: var(--accent-tint); }
.avatar { display: grid; flex: 0 0 auto; width: 2.6rem; height: 2.6rem; place-items: center; border: 1px solid var(--accent-soft); border-radius: 50%; color: var(--accent-deep); background: var(--accent-soft); font-size: 1.05rem; font-weight: 800; }
.seat.occupied > div:nth-child(2) { display: grid; min-width: 0; }
.seat strong { overflow: hidden; color: var(--ink); font-size: 0.9rem; text-overflow: ellipsis; white-space: nowrap; }
.seat.occupied span { margin-top: 0.15rem; color: var(--muted); font-size: 0.75rem; }
.presence { width: 0.5rem; height: 0.5rem; margin-left: auto; border-radius: 50%; background: #c9d4e4; box-shadow: 0 0 0 0.2rem rgba(201, 212, 228, 0.3); }
.presence.online { background: #3a8256; box-shadow: 0 0 0 0.2rem rgba(58, 130, 86, 0.15); }
.lobby-actions { display: grid; grid-template-columns: minmax(13rem, 18rem) 1fr; align-items: center; gap: 1.25rem; margin-top: 2rem; }
.lobby-actions p { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.waiting-pulse { display: flex; align-items: center; gap: 0.7rem; color: var(--muted); font-size: 0.9rem; }
.waiting-pulse i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--accent); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.8); } }

.lobby-aside { align-self: start; padding: 1.5rem; }
.suit-stack { display: grid; gap: 0.45rem; }
.suit-chip { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 0.75rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--surface-2); }
.suit-chip b { display: grid; width: 1.5rem; place-items: center; color: var(--suit); }
.suit-chip span { color: var(--text); font-size: 0.85rem; font-weight: 600; }
.suit-ember { --suit: var(--ember); }
.suit-tide { --suit: var(--tide); }
.suit-grove { --suit: var(--grove); }
.suit-light { --suit: var(--light); }
.suit-aether { --suit: var(--aether); }
.aside-rule { display: grid; gap: 0.25rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.aside-rule strong { color: var(--ink); font-size: 1.05rem; font-weight: 800; }
.aside-rule span { color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.leave-link { width: 100%; margin-top: 1.5rem; padding-inline: 0; text-align: left; }

.game-shell {
    width: min(92rem, calc(100% - 2rem));
    min-height: calc(100vh - 4rem - var(--nwb-h, 0px));
    margin: 0 auto;
    padding: 1rem 0 13.5rem;
}

.game-statusbar {
    display: grid;
    grid-template-columns: auto minmax(8rem, 1fr) auto auto auto;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0;
}

.round-indicator { display: flex; align-items: baseline; gap: 0.55rem; }
.round-indicator > span, .influence-pill > span, .room-pill > span, .score-button > span { color: var(--muted); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.round-indicator strong { color: var(--ink); font-size: 1.65rem; font-weight: 800; }
.round-indicator small { margin-left: 0.2rem; color: var(--muted); font-size: 0.7rem; font-weight: 600; }
.progress-track { height: 3px; border-radius: 999px; background: var(--line-strong); }
.progress-track i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 300ms ease; }
.influence-pill, .room-pill, .score-button { display: flex; align-items: center; gap: 0.55rem; min-height: 2.4rem; padding: 0.4rem 0.8rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); }
.influence-pill b { color: var(--suit); font-size: 0.85rem; font-weight: 800; }
.room-pill { color: inherit; cursor: pointer; }
.room-pill b { color: var(--ink); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.1em; }

/* ---- Spielstand: ein Knopf, der beim Ueberfahren, per Tastatur oder
   Antippen die Gesamttabelle einblendet - ohne Platz zu belegen. ---- */
.score-menu { position: relative; }
.score-button { cursor: pointer; color: inherit; }
.score-button b { color: var(--accent-deep); font-size: 0.85rem; font-weight: 800; }
.score-menu.open .score-button { border-color: var(--accent); background: var(--accent-tint); }
.score-popover {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.5rem);
    right: 0;
    display: none;
    width: max-content;
    max-width: min(46rem, calc(100vw - 2rem));
    max-height: min(70vh, 32rem);
    overflow: auto;
    padding: 0.9rem 1rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}
/* Unsichtbare Bruecke, damit der Zeiger vom Knopf zur Tabelle wandern kann. */
.score-popover::before { content: ""; position: absolute; top: -0.6rem; right: 0; left: 0; height: 0.6rem; }
.score-menu.open .score-popover { display: block; }
/* Ueberfahren mit der Maus reicht: app.js setzt .hover nur fuer den Zeigertyp
   "mouse" (Pointer-Events), damit auf Touch nach dem Tippen nichts kleben
   bleibt und keine Media-Query raten muss. Tastatur und Tipp oeffnen ueber den
   Knopf (Klasse .open). */
.score-menu.hover .score-button { border-color: var(--accent); background: var(--accent-tint); }
.score-menu.hover .score-popover { display: block; }
.score-popover h3 { margin: 0 0 0.6rem; color: var(--ink); font-size: 0.95rem; font-weight: 800; }
.score-table { border-collapse: collapse; font-size: 0.82rem; white-space: nowrap; }
.score-table th, .score-table td { padding: 0.35rem 0.5rem; text-align: right; border-bottom: 1px solid var(--line); }
.score-table th { color: var(--muted); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.score-table th:nth-child(2), .score-table td:nth-child(2) { text-align: left; }
.score-table td.name { max-width: 11rem; overflow: hidden; color: var(--ink); font-weight: 700; text-overflow: ellipsis; }
.score-table td.rank { color: var(--muted); }
.score-table td.pts { font-variant-numeric: tabular-nums; }
.score-table td.exact { color: var(--grove); }
.score-table td.miss { color: var(--danger); }
.score-table td.pending { color: var(--muted); }
.score-table td.total { color: var(--ink); font-size: 0.9rem; font-weight: 800; }
.score-table tr.you td { background: var(--accent-tint); }
.score-table tr.you td.name::after { content: " (du)"; color: var(--muted); font-weight: 500; }
.score-table tbody tr:last-child td { border-bottom: 0; }
.score-legend { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; white-space: normal; max-width: 34rem; }

.opponent-rail {
    display: grid;
    grid-template-columns: repeat(7, minmax(8rem, 1fr));
    gap: 0.55rem;
    margin-top: 0.5rem;
}

.player-tile { position: relative; min-width: 0; padding: 0.7rem; border: 1px solid var(--line); border-radius: 0.85rem; background: var(--surface); box-shadow: var(--shadow-sm); transition: 180ms ease; }
.player-tile.is-turn { border-color: var(--accent); background: var(--accent-tint); box-shadow: 0 0 0 3px rgba(46, 163, 242, 0.2); transform: translateY(0.15rem); }
.player-head { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.player-head .avatar { width: 2.15rem; height: 2.15rem; font-size: 0.85rem; }
.player-head > div:nth-child(2) { display: grid; min-width: 0; }
.player-head strong { overflow: hidden; color: var(--ink); font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.player-head span { color: var(--muted); font-size: 0.68rem; }
.player-meta { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 0.25rem; margin-top: 0.7rem; padding-top: 0.55rem; border-top: 1px solid var(--line); }
.player-meta div { min-width: 0; font-size: 0.68rem; }
.player-meta strong { color: var(--ink); font-size: 0.8rem; }
.player-meta span { color: var(--muted); }
.player-meta .sealed { color: var(--accent-deep); font-weight: 700; }
.player-meta .bidding { color: var(--accent-deep); font-weight: 700; }
.card-count { position: relative; display: flex; align-items: center; gap: 0.2rem; }
.card-count i { width: 0.75rem; height: 1rem; border: 1px solid var(--dim); border-radius: 0.12rem; transform: rotate(-6deg); }
.card-count b { color: var(--text); }
.dealer-token { position: absolute; top: -0.35rem; right: -0.2rem; display: grid; width: 1.2rem; height: 1.2rem; place-items: center; border: 1px solid var(--accent-deep); border-radius: 50%; color: #fff; background: var(--accent); font-size: 0.58rem; font-weight: 900; }

.table-zone {
    position: relative;
    display: grid;
    min-height: 30rem;
    margin: 0.8rem 2.5%;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 1.25rem;
    background: linear-gradient(180deg, #f9fbfe 0%, var(--surface-2) 100%);
    box-shadow: inset 0 1px 0 #fff, 0 14px 34px -22px rgba(15, 27, 45, 0.3);
}

.table-ring { position: absolute; width: min(54rem, 78vw); aspect-ratio: 2.05; border: 1px solid rgba(15, 107, 181, 0.14); border-radius: 50%; }
.table-ring::before, .table-ring::after { content: ""; position: absolute; inset: 7%; border: inherit; border-radius: inherit; }
.table-ring::after { inset: 16%; border-style: dashed; opacity: 0.55; }
.phase-copy { position: absolute; top: 1.35rem; left: 50%; display: grid; width: min(32rem, 90%); transform: translateX(-50%); text-align: center; }
.phase-copy > span { color: var(--accent-deep); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.phase-copy > strong { margin-top: 0.35rem; color: var(--ink); font-size: clamp(1.2rem, 2.1vw, 1.7rem); font-weight: 800; letter-spacing: -0.01em; }
.phase-copy > small { margin-top: 0.25rem; color: var(--muted); font-size: 0.75rem; }

.trick-area { position: absolute; top: 6.7rem; left: 50%; display: flex; align-items: center; justify-content: center; width: min(34rem, 90%); min-height: 10rem; transform: translateX(-50%); }
.table-empty, .last-trick-note { display: grid; justify-items: center; gap: 0.35rem; color: var(--dim); font-size: 0.75rem; }
.table-empty i { color: var(--line-strong); font-size: 2.1rem; font-style: normal; }
.last-trick-note strong { color: var(--ink); font-size: 1rem; font-weight: 800; }
.played-card-wrap { position: relative; width: 6rem; height: 8.35rem; margin-left: -1.3rem; }
.played-card-wrap:first-child { margin-left: 0; }
.played-card-wrap.play-index-0 { transform: rotate(-7deg) translateY(0.7rem); }
.played-card-wrap.play-index-1 { transform: rotate(-4deg) translateY(0.35rem); }
.played-card-wrap.play-index-2 { transform: rotate(-1deg); }
.played-card-wrap.play-index-3 { transform: rotate(2deg) translateY(0.15rem); }
.played-card-wrap.play-index-4 { transform: rotate(5deg) translateY(0.4rem); }
.played-card-wrap.play-index-5 { transform: rotate(8deg) translateY(0.65rem); }
.played-card-wrap.play-index-6 { transform: rotate(11deg) translateY(0.9rem); }
.played-card-wrap.play-index-7 { transform: rotate(14deg) translateY(1.15rem); }
.played-card-wrap > span:last-child { position: absolute; right: 0; bottom: -1.25rem; left: 0; overflow: hidden; color: var(--muted); font-size: 0.66rem; font-weight: 600; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.played-card-wrap > .card-corner,
.played-card-wrap > .card-symbol,
.played-card-wrap > .card-name,
.played-card-wrap > .special-arc { position: absolute; z-index: 2; }
.played-card-wrap {
    border: 1.5px solid var(--line-strong);
    border-radius: 0.55rem;
    color: var(--suit, var(--ink));
    background: var(--surface);
    box-shadow: 0 6px 18px -6px rgba(15, 27, 45, 0.3);
}
/* Nova und Leere: hell, aber als Sonderkarten erkennbar. */
.played-card-wrap.nova-card { color: var(--accent-deep); border-color: var(--accent); background: linear-gradient(160deg, #ffffff, var(--accent-soft)); }
.played-card-wrap.void-card { color: var(--muted); border-color: var(--line-strong); background: linear-gradient(160deg, #ffffff, #eef1f5); }

.prediction-card,
.waiting-card,
.result-card {
    position: absolute;
    z-index: 7;
    bottom: 0.55rem;
    left: 50%;
    width: min(42rem, 95%);
    transform: translateX(-50%);
    border: 1px solid var(--line-strong);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.prediction-card { display: grid; grid-template-columns: 1.25fr 1fr auto; align-items: end; gap: 1rem; padding: 1rem; }
.prediction-card.no-risk { grid-template-columns: 1fr auto; }
.prediction-card fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.prediction-card legend { margin-bottom: 0.45rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.bid-options { display: flex; gap: 0.35rem; max-width: 100%; overflow-x: auto; padding: 0.15rem; }
.bid-option input { position: absolute; opacity: 0; pointer-events: none; }
.bid-option span { display: grid; width: 2.35rem; height: 2.35rem; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 50%; color: var(--text); background: var(--surface); font-weight: 700; cursor: pointer; }
.bid-option input:checked + span { border-color: var(--accent); color: #fff; background: var(--accent); }
.bid-option input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }
.bid-option.forbidden span { border-style: dashed; border-color: var(--line-strong); color: var(--dim); background: transparent; text-decoration: line-through; cursor: not-allowed; }
.bid-hint { display: block; margin-top: 0.45rem; color: var(--muted); font-size: 0.72rem; line-height: 1.4; }
.bid-hint strong { color: var(--accent-deep); }
.risk-toggle { display: flex; align-items: center; gap: 0.65rem; min-height: 2.5rem; cursor: pointer; }
.risk-toggle.disabled { opacity: 0.5; cursor: not-allowed; }
.risk-toggle input { position: absolute; opacity: 0; }
.toggle-knob { position: relative; width: 2.7rem; height: 1.45rem; border: 1.5px solid var(--line-strong); border-radius: 99px; background: var(--surface-2); }
.toggle-knob::after { content: ""; position: absolute; top: 0.15rem; left: 0.15rem; width: 0.95rem; height: 0.95rem; border-radius: 50%; background: var(--dim); transition: 160ms ease; }
.risk-toggle input:checked + .toggle-knob { border-color: var(--gold); background: #fbf3dc; }
.risk-toggle input:checked + .toggle-knob::after { left: 1.4rem; background: var(--gold); }
.risk-toggle input:focus-visible + .toggle-knob { outline: 3px solid var(--ring); outline-offset: 2px; }
.risk-toggle > span:last-child { display: grid; }
.risk-toggle strong { color: var(--ink); font-size: 0.78rem; }
.risk-toggle small { color: var(--muted); font-size: 0.66rem; }
.waiting-card { display: flex; align-items: center; justify-content: center; gap: 0.8rem; padding: 1rem; }
.waiting-card .seal { display: grid; width: 2.4rem; height: 2.4rem; place-items: center; border: 1.5px solid var(--accent); border-radius: 50%; color: var(--accent-deep); background: var(--accent-soft); }
.waiting-card div { display: grid; }
.waiting-card strong { color: var(--ink); font-size: 1rem; font-weight: 800; }
.waiting-card small { margin-top: 0.2rem; color: var(--muted); font-size: 0.72rem; }

.result-card { display: grid; grid-template-columns: minmax(10rem, 0.65fr) minmax(16rem, 1.35fr) auto; align-items: center; gap: 1rem; padding: 0.9rem; }
.result-heading { display: grid; }
.result-heading span { color: var(--accent-deep); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.result-heading strong { margin-top: 0.2rem; color: var(--ink); font-size: 1rem; font-weight: 800; }
.score-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.25rem; }
.score-row { display: grid; grid-template-columns: 1rem 1fr auto auto; gap: 0.45rem; align-items: center; min-width: 0; padding: 0.25rem 0.4rem; border-radius: 0.4rem; font-size: 0.75rem; }
.score-row.you { background: var(--accent-tint); }
.score-row .rank { color: var(--muted); }
.score-row > strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.score-row .round-score { color: var(--accent-deep); font-weight: 700; }
.score-row > b { font-size: 0.82rem; }
.result-wait { margin: 0; color: var(--muted); font-size: 0.78rem; }

.self-strip {
    position: fixed;
    z-index: 14;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: minmax(11rem, 1fr) repeat(3, auto) auto;
    align-items: center;
    gap: 1.5rem;
    min-height: 4.4rem;
    padding: 0.55rem max(1rem, calc((100vw - 92rem) / 2));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
}

.self-strip.active-turn { border-top-color: var(--accent); box-shadow: 0 -8px 24px -18px rgba(15, 107, 181, 0.4); }
.self-summary { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.self-summary > div:last-child, .self-stat { display: grid; }
.self-summary span, .self-stat span { color: var(--muted); font-size: 0.61rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.self-summary strong { overflow: hidden; margin-top: 0.12rem; color: var(--ink); font-size: 0.85rem; text-overflow: ellipsis; white-space: nowrap; }
.self-stat { min-width: 3.3rem; padding-left: 1rem; border-left: 1px solid var(--line); }
.self-stat strong { margin-top: 0.05rem; color: var(--ink); font-size: 1.1rem; font-weight: 800; }
.menu-button { width: 2.3rem; height: 2.3rem; }

.hand-area {
    position: fixed;
    z-index: 12;
    right: 0;
    bottom: 4.35rem;
    left: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 9rem;
    padding: 0 1rem;
    pointer-events: none;
}

.hand-card {
    position: relative;
    width: 6.45rem;
    height: 9rem;
    margin-left: clamp(-2.4rem, -2vw, -0.8rem);
    border: 1.5px solid var(--line-strong);
    border-radius: 0.62rem 0.62rem 0 0;
    color: var(--suit, var(--ink));
    background: var(--surface);
    box-shadow: 0 -2px 14px -4px rgba(15, 27, 45, 0.25);
    transform: translateY(1.15rem);
    transition: transform 150ms ease, filter 150ms ease, opacity 150ms ease;
    pointer-events: auto;
}

.hand-card:first-child { margin-left: 0; }
.hand-card.card-index-0 { transform: translateY(1.15rem) rotate(-2.7deg); }
.hand-card.card-index-1 { transform: translateY(1.15rem) rotate(-2.1deg); }
.hand-card.card-index-2 { transform: translateY(1.15rem) rotate(-1.5deg); }
.hand-card.card-index-3 { transform: translateY(1.15rem) rotate(-0.9deg); }
.hand-card.card-index-4 { transform: translateY(1.15rem) rotate(-0.3deg); }
.hand-card.card-index-5 { transform: translateY(1.15rem) rotate(0.3deg); }
.hand-card.card-index-6 { transform: translateY(1.15rem) rotate(0.9deg); }
.hand-card.card-index-7 { transform: translateY(1.15rem) rotate(1.5deg); }
.hand-card.card-index-8 { transform: translateY(1.15rem) rotate(2.1deg); }
.hand-card.card-index-9 { transform: translateY(1.15rem) rotate(2.7deg); }
.hand-card.playable { cursor: pointer; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), 0 -2px 14px -4px rgba(15, 27, 45, 0.25); }
.hand-card.playable:hover, .hand-card.playable:focus-visible { z-index: 4; transform: translateY(-0.6rem) rotate(0); }
.hand-card.illegal { filter: grayscale(0.6); opacity: 0.45; }
.hand-card:disabled:not(.illegal) { cursor: default; }
.hand-card.nova-card { color: var(--accent-deep); border-color: var(--accent); background: linear-gradient(160deg, #ffffff, var(--accent-soft)); }
.hand-card.void-card { color: var(--muted); background: linear-gradient(160deg, #ffffff, #eef1f5); }
.card-corner { display: grid; justify-items: center; line-height: 1; }
.card-corner b { font-size: 1rem; font-weight: 800; }
.card-corner i { margin-top: 0.18rem; font-size: 0.68rem; font-style: normal; }
.card-corner.top { top: 0.48rem; left: 0.5rem; }
.card-corner.bottom { right: 0.5rem; bottom: 0.48rem; transform: rotate(180deg); }
.card-symbol { top: 42%; left: 50%; transform: translate(-50%, -50%); font-size: 2.3rem; }
.card-name { right: 0; bottom: 1.15rem; left: 0; color: currentColor; font-size: 0.55rem; font-weight: 800; letter-spacing: 0.12em; text-align: center; text-transform: uppercase; }
.hand-card > .card-corner, .hand-card > .card-symbol, .hand-card > .card-name, .hand-card > small, .hand-card > .special-arc { position: absolute; }
.hand-card > small { right: 0; bottom: 0.8rem; left: 0; color: var(--muted); font-size: 0.52rem; text-align: center; }
.special-arc { inset: 0.7rem; border: 1px solid currentColor; border-radius: 50%; opacity: 0.25; }
.special-arc::before { content: ""; position: absolute; inset: 22%; border: inherit; border-radius: inherit; }
.empty-hand { align-self: center; color: var(--muted); font-size: 0.8rem; }

.toast-region { position: fixed; z-index: 100; top: calc(var(--nwb-h, 0px) + 4.75rem); right: 1rem; display: grid; width: min(23rem, calc(100% - 2rem)); }
.toast { padding: 0.85rem 1rem; border: 1px solid rgba(194, 71, 54, 0.4); border-radius: 0.75rem; color: #8f2f20; background: #fdecea; box-shadow: var(--shadow); font-size: 0.85rem; line-height: 1.5; animation: toast-in 180ms ease-out; }
.toast-success { border-color: rgba(42, 136, 80, 0.4); color: #1f5a36; background: #e6f3ea; }
.toast-info { border-color: var(--accent-soft); color: var(--accent-deep); background: var(--accent-soft); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-0.5rem); } }

.rules-dialog {
    width: min(46rem, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 1.3rem;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 40px 80px -40px rgba(15, 27, 45, 0.45);
}
.rules-dialog::backdrop { background: rgba(15, 27, 45, 0.45); backdrop-filter: blur(4px); }
.dialog-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: start; justify-content: space-between; padding: 1.5rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.dialog-head .eyebrow { margin-bottom: 0.3rem; }
.dialog-head h2 { margin: 0; color: var(--ink); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.dialog-head .icon-button { font-size: 1.35rem; }
.rules-body { padding: 1.5rem; }
.rules-body section { display: grid; grid-template-columns: 2.4rem 1fr; gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.rule-number { color: var(--accent); font-size: 1rem; font-weight: 800; }
.rules-body h3 { margin-bottom: 0.35rem; color: var(--ink); font-size: 0.95rem; }
.rules-body p { margin-bottom: 0; color: var(--text); font-size: 0.88rem; line-height: 1.65; }
.special-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-top: 1.25rem; }
.mini-card { display: grid; grid-template-columns: auto 1fr; column-gap: 0.7rem; padding: 0.9rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface-2); }
.mini-card > strong { grid-row: span 2; align-self: center; font-size: 1.8rem; }
.mini-card > span { color: var(--ink); font-weight: 800; }
.mini-card > small { color: var(--muted); }
.nova-card > strong { color: var(--accent-deep); }
.void-card > strong { color: var(--muted); }
.noscript { margin: 2rem; padding: 1rem; border: 1px solid var(--danger); border-radius: 0.75rem; color: #8f2f20; background: #fdecea; }

@media (max-width: 64rem) {
    .home-shell { gap: 3rem; }
    .opponent-rail { grid-template-columns: repeat(4, 1fr); }
    .player-tile:nth-child(n+5) { margin-top: 0; }
    .table-zone { min-height: 32rem; }
    .prediction-card { grid-template-columns: 1fr auto; }
    .prediction-card fieldset { grid-column: 1 / -1; }
    .result-card { grid-template-columns: 1fr auto; }
    .score-list { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 48rem) {
    .site-header { min-height: 3.6rem; }
    main { min-height: calc(100vh - 3.6rem - var(--nwb-h, 0px)); }
    .home-shell { grid-template-columns: 1fr; min-height: auto; padding-top: 3rem; }
    .home-intro { padding-left: 0; }
    .home-intro h1 { font-size: clamp(2.4rem, 10vw, 3.8rem); }
    .orbit-emblem { left: 50%; width: 26rem; }
    .entry-card { width: min(100%, 31rem); justify-self: center; }
    .lobby-shell { grid-template-columns: 1fr; padding-top: 1.5rem; }
    .lobby-aside { order: 2; }
    .game-shell { width: calc(100% - 1rem); padding-top: 0.5rem; }
    .game-statusbar { grid-template-columns: auto 1fr auto auto; gap: 0.55rem; }
    .progress-track { grid-column: 1 / -1; grid-row: 2; }
    .room-pill > span, .score-button > span { display: none; }
    .influence-pill { justify-self: start; }
    /* Auf schmalen Bildschirmen als feste Tafel unter der Kopfzeile ueber die volle
       Breite - am Knopf verankert liefe sie rechts aus dem Bild. */
    .score-popover { position: fixed; top: calc(var(--nwb-h, 0px) + 4.1rem); right: 0.5rem; left: 0.5rem; width: auto; max-width: none; max-height: calc(100vh - var(--nwb-h, 0px) - 4.1rem - 13rem); }
    .score-popover::before { display: none; }
    .opponent-rail { display: flex; margin-right: -0.5rem; overflow-x: auto; padding: 0.25rem 0.5rem 0.4rem 0; scroll-snap-type: x mandatory; }
    .player-tile { flex: 0 0 9.2rem; scroll-snap-align: start; }
    .table-zone { min-height: 31rem; margin-inline: 0; }
    .table-ring { width: 46rem; max-width: none; }
    .phase-copy { top: 1rem; }
    .trick-area { top: 6rem; }
    .played-card-wrap { width: 5.2rem; height: 7.3rem; }
    .prediction-card { bottom: 0.3rem; grid-template-columns: 1fr; gap: 0.75rem; }
    .prediction-card fieldset { grid-column: auto; }
    .prediction-card .primary-button { width: 100%; }
    .risk-toggle { justify-self: start; }
    .result-card { bottom: 0.3rem; grid-template-columns: 1fr; max-height: 16rem; overflow-y: auto; }
    .result-card .primary-button { width: 100%; }
    .score-list { grid-column: auto; grid-row: auto; }
    .self-strip { grid-template-columns: minmax(8rem, 1fr) repeat(3, auto) auto; gap: 0.6rem; min-height: 4rem; padding: 0.45rem 0.55rem; }
    .self-summary .avatar { display: none; }
    .self-stat { min-width: 2.3rem; padding-left: 0.5rem; }
    .self-stat span { font-size: 0.52rem; }
    .hand-area { bottom: 3.95rem; justify-content: flex-start; height: 8.4rem; overflow-x: auto; padding-left: max(1rem, calc((100vw - 42rem) / 2)); }
    .hand-card { flex: 0 0 5.7rem; height: 8rem; margin-left: -1.5rem; }
    .hand-card:first-child { margin-left: 0; }
    .game-shell { padding-bottom: 12.4rem; }
}

@media (max-width: 32rem) {
    .brand { font-size: 0.95rem; }
    .brand-mark { width: 1.75rem; height: 1.75rem; }
    .header-actions .text-button { font-size: 0.8rem; }
    .sound-button { display: none; }
    .home-shell { width: calc(100% - 1.5rem); padding-top: 2rem; }
    .home-copy { font-size: 1rem; }
    .quick-facts { justify-content: space-between; }
    .quick-facts li { min-width: 0; padding-inline: 0.75rem; }
    .quick-facts span { font-size: 0.58rem; }
    .entry-form { padding-inline: 0.75rem; }
    .lobby-shell { width: calc(100% - 1rem); }
    .lobby-main { padding: 1.15rem; }
    .seat-grid { grid-template-columns: 1fr; }
    .invite-box { align-items: stretch; flex-direction: column; }
    .lobby-actions { grid-template-columns: 1fr; }
    .game-statusbar { grid-template-columns: auto 1fr auto; }
    .room-pill { display: none; }
    .influence-pill { justify-self: end; }
    .played-card-wrap { width: 4.6rem; height: 6.45rem; margin-left: -1.7rem; }
    .played-card-wrap .card-symbol { font-size: 1.7rem; }
    .prediction-card { width: 100%; }
    .score-list { grid-template-columns: 1fr; }
    .self-strip { grid-template-columns: 1fr repeat(3, auto); }
    .self-summary span { display: none; }
    .self-summary strong { font-size: 0.7rem; }
    .menu-button { display: none; }
    .hand-card { flex-basis: 5.4rem; margin-left: -1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (forced-colors: active) {
    .hand-card, .played-card-wrap { border: 2px solid CanvasText; }
    .presence.online { outline: 2px solid CanvasText; }
}
