/* ===== RESET & VARIABLEN ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0d1117;
    --bg2: #161b22;
    --bg3: #1c2128;
    --bg-hover: #242b35;
    --accent: #7c6aef;
    --accent-dim: rgba(124, 106, 239, 0.15);
    --green: #2ea043;
    --green-dim: rgba(46, 160, 67, 0.15);
    --red: #da3633;
    --red-dim: rgba(218, 54, 51, 0.15);
    --gold: #ffd700;
    --gold-dim: rgba(255, 215, 0, 0.12);
    --text: #e6edf3;
    --text2: #8b949e;
    --text3: #484f58;
    --border: #30363d;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --r: 12px;
    --r-sm: 8px;
    --t: 0.2s ease;
}

[data-theme="light"] {
    --bg: #f6f8fa;
    --bg2: #ffffff;
    --bg3: #f0f2f5;
    --bg-hover: #e8ebef;
    --accent: #6c5ce7;
    --accent-dim: rgba(108, 92, 231, 0.12);
    --green: #2ea043;
    --green-dim: rgba(46, 160, 67, 0.1);
    --red: #cf222e;
    --red-dim: rgba(207, 34, 46, 0.1);
    --gold: #d4a017;
    --gold-dim: rgba(212, 160, 23, 0.1);
    --text: #24292f;
    --text2: #57606a;
    --text3: #8b949e;
    --border: #d0d7de;
    --card-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 540px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== VIEW SYSTEM ===== */
.view {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
}

.view.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* ===== HEADER ===== */
header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.timer-display {
    font-size: 0.75rem;
    color: var(--text2);
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    padding: 2px 6px;
    background: var(--bg3);
    border-radius: 6px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    min-width: 44px;
    text-align: center;
}

.timer-display.running {
    color: var(--accent);
}

.round-pill {
    background: var(--accent);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.btn-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    background: var(--bg3);
    border: none;
    border-radius: 50%;
    color: var(--text2);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon:active { transform: scale(0.9); }

/* ===== GROSSE RUNDENANZEIGE ===== */
.big-round-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0 8px;
}

.big-round-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.big-round-num {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
    min-width: 44px;
    text-align: center;
    background: var(--bg2);
    padding: 6px 16px;
    border-radius: var(--r);
    border: 1.5px solid var(--border);
}

/* ===== ROUND TRACKER ===== */
.round-tracker {
    padding: 0;
    margin-top: 8px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.round-tracker:empty {
    display: none;
}

.rt-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
}

.rt-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rt-counter-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 10px;
    border-radius: 12px;
}

.rt-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 12px;
}

/* Spieler-Chips */
.rt-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 24px;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.25s ease;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
}

.rt-chip-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
}

.rt-chip-name {
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fertig */
.rt-chip-done {
    background: var(--green-dim);
    color: var(--green);
    border: 1.5px solid rgba(46, 160, 67, 0.25);
}

.rt-chip-check {
    font-size: 0.75rem;
    line-height: 1;
}

/* Fehlt - dezent aber sichtbar */
.rt-chip-wait {
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
    cursor: pointer;
}

.rt-chip-wait:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.rt-chip-wait:active {
    transform: scale(0.95);
}

.rt-chip-arrow {
    font-size: 0.6rem;
    color: var(--text3);
}

/* Alle fertig */
.rt-all-done {
    text-align: center;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--green);
    padding: 0 14px 10px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text2);
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* ===== SPIELER-KARTEN ===== */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0 0;
}

.p-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    transition: border-color var(--t), box-shadow var(--t);
    box-shadow: var(--card-shadow);
    position: relative;
}

.p-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--player-color, var(--accent));
    border-radius: var(--r) 0 0 var(--r);
}

.p-card:hover { border-color: var(--text3); }

.p-card.is-winning {
    border-color: var(--gold);
}

.p-card-main {
    display: flex;
    align-items: center;
    padding: 12px 14px 12px 18px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: background var(--t);
    min-height: 44px;
}

.p-card-main:active { background: var(--bg-hover); }

.p-card-info {
    flex: 1;
    min-width: 0;
}

.p-card-name-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.p-card-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-edit-name {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 50%;
    color: var(--text3);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
    flex-shrink: 0;
    padding: 0;
}

.btn-edit-name:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-edit-name:active {
    transform: scale(0.9);
}

.p-card-badge-pending {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--text2);
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.p-card-badge-done {
    font-size: 0.72rem;
    color: var(--green);
    font-weight: 700;
    flex-shrink: 0;
}

/* Pending-Karte dezent hervorheben */
.p-card.p-card-pending {
    border-color: var(--text3);
}

.p-card-remaining {
    font-size: 0.76rem;
    color: var(--text3);
    margin-top: 1px;
}

.p-card-reached {
    font-size: 0.76rem;
    color: var(--gold);
    font-weight: 600;
    margin-top: 1px;
}

.p-card-score {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--accent);
    min-width: 50px;
    text-align: right;
    margin-left: 10px;
}

.p-card.is-winning .p-card-score { color: var(--gold); }

/* Rang-Badge */
.p-card-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text2);
    flex-shrink: 0;
    margin-right: 6px;
}

.p-card-rank.top { font-size: 1.3rem; }

/* Fortschrittsbalken */
.progress-wrap {
    position: relative;
    height: 18px;
    background: var(--bg);
    margin: 0 14px 0 18px;
    border-radius: 9px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #9d8df1);
    border-radius: 9px;
    transition: width 0.5s ease;
    min-width: 0;
}

.progress-fill.reached {
    background: linear-gradient(90deg, var(--gold), #ffed4a);
}

.progress-label {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Letzte-Runde Info */
.p-card-last-bar {
    font-size: 0.72rem;
    color: var(--text3);
    padding: 5px 14px 0 18px;
    text-align: right;
}

/* Button Row */
.p-card-btns {
    display: flex;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.p-card-btns button {
    flex: 1;
    padding: 10px 4px;
    min-height: 44px;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background var(--t), color var(--t);
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

.p-card-btns button:hover { background: var(--bg-hover); color: var(--text); }
.p-card-btns button:active { background: var(--bg3); }
.p-card-btns button + button { border-left: 1px solid var(--border); }

.p-card-btns button.btn-enter {
    color: var(--accent);
    font-weight: 600;
}

.p-card-btns button.btn-enter-hl {
    color: var(--accent);
    font-weight: 700;
    background: var(--accent-dim);
}

/* ===== SPIELER HINZUFUEGEN ===== */
.add-player {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.add-player input {
    flex: 1;
    padding: 12px 16px;
    min-height: 48px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--t);
}

.add-player input:focus { border-color: var(--accent); }
.add-player input::placeholder { color: var(--text3); }

.btn-add {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--t);
    flex-shrink: 0;
}

.btn-add:active { opacity: 0.8; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    min-height: 44px;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; pointer-events: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text2); }
.btn-outline:hover { border-color: var(--text2); }
.btn-danger-outline { background: transparent; border: 1.5px solid var(--red); color: var(--red); }
.btn-gold { background: var(--gold); color: #000; font-weight: 700; }

.dash-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.dash-actions .btn { flex: 1; min-width: 100px; font-size: 0.82rem; padding: 10px 8px; }

/* ===== REGELN ===== */
.rules-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin: 20px 0 30px;
}

.rules-box summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.rules-box summary::-webkit-details-marker { display: none; }

.rules-box summary::after {
    content: '\25B8';
    margin-left: auto;
    transition: transform var(--t);
}

.rules-box[open] summary::after { transform: rotate(90deg); }

.rules-inner {
    padding: 0 16px 16px;
    color: var(--text2);
    font-size: 0.88rem;
    line-height: 1.6;
}

.rules-inner h4 { color: var(--text); margin: 0; font-size: 0.9rem; }
.rules-inner ol, .rules-inner ul { padding-left: 18px; margin: 6px 0 0; }
.rules-inner li { margin: 4px 0; }
.rules-inner p { margin: 4px 0; }

/* Rule sections */
.rule-section {
    background: var(--bg);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    margin-top: 12px;
}

.rule-section-tips {
    background: var(--accent-dim);
    border: 1px solid rgba(124, 106, 239, 0.25);
}

.rule-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.rule-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    line-height: 1;
}

.rule-bust {
    color: var(--red);
    font-weight: 700;
}

.rule-important {
    color: var(--gold);
    font-weight: 600;
    font-size: 0.82rem;
    margin: 0 0 8px !important;
}

/* Card chips for rules */
.rule-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.rule-card-type {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rule-card-label {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rule-card-chips {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.rule-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

.chip-num {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(124, 106, 239, 0.3);
}

.chip-dots {
    color: var(--text3);
    padding: 3px 4px;
    min-width: auto;
    font-weight: 400;
}

.chip-plus {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(46, 160, 67, 0.3);
}

.chip-plus-hl {
    background: var(--gold-dim);
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.35);
}

.chip-x2 {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(218, 54, 51, 0.3);
}

.rule-card-note {
    font-size: 0.74rem;
    color: var(--text3);
}

/* Scoring steps */
.rule-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.step-num {
    width: 24px;
    height: 24px;
    min-width: 24px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    margin-top: 1px;
}

.step-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.step-text strong {
    color: var(--text);
    font-size: 0.85rem;
}

.step-sub {
    font-size: 0.76rem;
    color: var(--text3);
}

/* Example calculation */
.rule-example {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px;
    margin-top: 4px;
}

.example-hand {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
}

.example-calc {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8rem;
}

.calc-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.calc-step {
    color: var(--accent);
    font-weight: 700;
    min-width: 18px;
}

.calc-result {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

/* ===== STATISTIKEN ===== */
.stats-bar {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    margin: 20px 0 12px;
    box-shadow: var(--card-shadow);
}

.stats-title {
    font-size: 0.82rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.stat-card {
    text-align: center;
    padding: 8px 4px;
    background: var(--bg);
    border-radius: var(--r-sm);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-value.stat-bust { color: var(--red); }

.stat-label {
    font-size: 0.65rem;
    color: var(--text3);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-best-name {
    font-size: 0.78rem;
    color: var(--gold);
    text-align: center;
    margin-top: 8px;
}

/* ===== CHART ===== */
.chart-wrap {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    margin: 12px 0;
    box-shadow: var(--card-shadow);
}

.chart-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.score-chart {
    display: block;
    min-width: 280px;
    width: 100%;
    height: 180px;
}

.chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-dot {
    stroke-width: 2;
    stroke: var(--bg2);
}

.chart-goal-line {
    stroke: var(--gold);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    opacity: 0.6;
}

.chart-axis-text {
    font-size: 10px;
    fill: var(--text3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chart-grid-line {
    stroke: var(--border);
    stroke-width: 0.5;
    opacity: 0.4;
}

/* ===== ZIEL-EINSTELLUNG ===== */
.goal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 4px;
    flex-wrap: wrap;
}

.goal-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.goal-buttons {
    display: flex;
    gap: 5px;
    flex: 1;
}

.goal-btn {
    padding: 6px 10px;
    min-height: 32px;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    color: var(--text2);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
}

.goal-btn:active { transform: scale(0.95); }

.goal-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.goal-custom {
    display: flex;
    align-items: center;
    gap: 4px;
}

.goal-custom input {
    width: 58px;
    padding: 5px 6px;
    min-height: 32px;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color var(--t);
    -moz-appearance: textfield;
}

.goal-custom input::-webkit-outer-spin-button,
.goal-custom input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.goal-custom input:focus { border-color: var(--accent); }

.goal-custom span {
    font-size: 0.75rem;
    color: var(--text3);
}

/* ===== EINGABE-ANSICHT ===== */
.input-top {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.input-top-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.input-top h2 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    display: inline-block;
}

.btn-x {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background: var(--bg3);
    border: none;
    border-radius: 50%;
    color: var(--text2);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
    flex-shrink: 0;
}

.btn-x:hover { background: var(--bg-hover); color: var(--text); }

.score-live { text-align: right; flex-shrink: 0; }
.score-live small { display: block; font-size: 0.7rem; color: var(--text2); }

.score-live span {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    transition: color var(--t);
}

.score-live span.bust { color: var(--red); }

.input-scroll {
    max-width: 540px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

.calc-display {
    text-align: center;
    padding: 10px 8px;
    font-size: 0.8rem;
    color: var(--text2);
    min-height: 36px;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    word-break: break-all;
}

.inp-section { margin-top: 14px; }

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.inp-section h3 {
    font-size: 0.85rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.section-head h3 { margin-bottom: 0; }

.hint {
    font-size: 0.72rem;
    color: var(--text3);
    margin-top: 8px;
    padding-left: 2px;
}

.counter-pill {
    background: var(--bg3);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    color: var(--text2);
    font-weight: 600;
    transition: all var(--t);
}

.counter-pill.full {
    background: var(--gold-dim);
    color: var(--gold);
}

/* === Zahlenkarten Grid === */
.num-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.num-btn {
    position: relative;
    padding: 14px 0;
    min-height: 48px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
    text-align: center;
}

.num-btn:active { transform: scale(0.93); }

.num-btn.selected {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.num-btn.locked {
    opacity: 0.2;
    pointer-events: none;
}

/* === Modifikatoren Grid === */
.mod-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mod-btn {
    padding: 12px 0;
    min-height: 48px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    text-align: center;
}

.mod-btn:active { transform: scale(0.93); }

.mod-btn.active {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

.mod-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    background: var(--accent);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.mod-btn.active .mod-badge { display: flex; }

/* === Bonus Bar === */
.bonus-bar {
    margin: 16px 0;
    padding: 14px;
    background: var(--gold-dim);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--r-sm);
    text-align: center;
    font-weight: 700;
    color: var(--gold);
}

/* === Verzockt Button === */
.btn-bust {
    display: block;
    width: 100%;
    margin: 20px 0 12px;
    padding: 16px;
    min-height: 52px;
    background: var(--bg2);
    border: 2px solid var(--red);
    border-radius: var(--r);
    color: var(--red);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
}

.btn-bust:active { transform: scale(0.97); }

.btn-bust.active {
    background: var(--red);
    color: #fff;
}

/* === Speichern Button === */
.btn-save {
    display: block;
    width: 100%;
    padding: 16px;
    min-height: 52px;
    background: var(--green);
    border: none;
    border-radius: var(--r);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
}

.btn-save:active { transform: scale(0.97); opacity: 0.9; }

/* ===== GEWINNER-ANSICHT ===== */
.winner-wrap {
    text-align: center;
    padding: 40px 20px;
    max-width: 540px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.trophy {
    font-size: 5rem;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.winner-wrap h1 {
    font-size: 2rem;
    color: var(--gold);
    margin: 16px 0 8px;
}

.winner-wrap > p {
    color: var(--text2);
    margin-bottom: 24px;
}

.leaderboard {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 4px 0;
    margin-bottom: 24px;
    text-align: left;
}

.lb-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.lb-item:last-child { border-bottom: none; }
.lb-rank { width: 36px; font-size: 1.2rem; flex-shrink: 0; }
.lb-name { flex: 1; font-weight: 600; }

.lb-score {
    font-weight: 800;
    color: var(--accent);
    font-size: 1.1rem;
}

.lb-item:first-child .lb-score { color: var(--gold); }

.lb-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.winner-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.winner-btns .btn { width: 100%; min-height: 48px; }

/* ===== CONFETTI ===== */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    pointer-events: none;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0;
    }
}

/* ===== VERLAUF-ANSICHT ===== */
.hist-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.hist-header-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.hist-header h2 { font-size: 1.1rem; }

.hist-list {
    padding-top: 16px;
    padding-bottom: 40px;
}

.hist-total {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: var(--r-sm);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    margin-bottom: 14px;
}

.hist-total-val {
    font-size: 1.4rem;
    color: var(--accent);
}

.hist-item {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
}

.hist-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.hist-round-label { font-size: 0.82rem; color: var(--text2); }

.hist-row-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hist-score {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent);
}

.hist-score.bust { color: var(--red); }

.hist-edit-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 50%;
    color: var(--text2);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
    flex-shrink: 0;
}

.hist-edit-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.hist-edit-btn:active { transform: scale(0.9); }

.hist-detail {
    font-size: 0.75rem;
    color: var(--text3);
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.hist-empty {
    text-align: center;
    color: var(--text2);
    padding: 40px 0;
}

/* ===== RUNDENTABELLE ===== */
.rt-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.rt-header h2 { flex: 1; font-size: 1.1rem; min-width: 0; }

.rt-scroll {
    padding-top: 16px;
    padding-bottom: 40px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.round-table-wrap {
    min-width: 100%;
}

.round-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.round-table th,
.round-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.round-table th {
    background: var(--bg3);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 52px;
    z-index: 5;
}

.round-table td {
    background: var(--bg2);
}

.round-table .rt-round-label {
    font-weight: 600;
    color: var(--text2);
    text-align: left;
}

.round-table .rt-bust {
    color: var(--red);
    font-weight: 600;
}

.round-table .rt-total-row td {
    background: var(--bg3);
    font-weight: 800;
    font-size: 0.95rem;
    border-top: 2px solid var(--border);
}

.rt-header-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.rt-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ===== SPEICHER-STATUS ===== */
.save-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 4px;
    font-size: 0.72rem;
    color: var(--text3);
}

.save-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

.save-status.saving .save-dot {
    animation: pulse-dot 0.5s ease;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.6); opacity: 0.6; }
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== ARCHIV ===== */
.archive-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.archive-header h2 { flex: 1; font-size: 1.1rem; min-width: 0; }

.archive-list {
    padding-top: 16px;
    padding-bottom: 40px;
}

.archive-empty {
    text-align: center;
    color: var(--text2);
    padding: 50px 20px;
}

.archive-empty-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 10px;
}

.archive-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.archive-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 8px;
}

.archive-card-info {
    flex: 1;
    min-width: 0;
}

.archive-card-winner {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive-card-meta {
    font-size: 0.72rem;
    color: var(--text3);
    margin-top: 2px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.archive-card-score {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent);
    flex-shrink: 0;
}

.archive-card-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px 12px;
}

.archive-player-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}

.archive-player-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.archive-player-name {
    flex: 1;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive-player-pts {
    font-weight: 700;
    color: var(--text);
}

.archive-player-row:first-child .archive-player-pts {
    color: var(--gold);
}

.archive-card-actions {
    display: flex;
    border-top: 1px solid var(--border);
}

.archive-card-actions button {
    flex: 1;
    padding: 10px;
    min-height: 40px;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.archive-card-actions button:hover { background: var(--bg-hover); color: var(--text); }
.archive-card-actions button:active { background: var(--bg3); }
.archive-card-actions button + button { border-left: 1px solid var(--border); }
.archive-card-actions button.btn-del { color: var(--red); }

.archive-clear {
    text-align: center;
    margin-top: 12px;
}

/* ===== SHARE SHEET ===== */
.share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeOverlay 0.2s ease;
}

.share-overlay.active {
    display: flex;
}

@keyframes fadeOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.share-sheet {
    background: var(--bg2);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 540px;
    padding: 12px 20px 24px;
    animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.share-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 14px;
}

.share-sheet-title {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 14px;
    color: var(--text);
}

.share-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text2);
    white-space: pre-line;
    max-height: 200px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.share-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 14px 4px 10px;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
    color: var(--text);
}

.share-opt:hover {
    border-color: var(--text3);
    background: var(--bg-hover);
}

.share-opt:active {
    transform: scale(0.93);
}

.share-opt-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.share-opt-wa { background: #25D366; color: #fff; }
.share-opt-tg { background: #0088cc; color: #fff; }
.share-opt-sms { background: #34C759; color: #fff; }
.share-opt-copy { background: var(--accent); color: #fff; }
.share-opt-more { background: var(--bg3); color: var(--text2); border: 1.5px solid var(--border); }
.share-opt-img { background: #ff6b9d; color: #fff; }

.share-opt-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text2);
    white-space: nowrap;
}

/* Share Tabs */
.share-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--bg);
    border-radius: var(--r-sm);
    padding: 3px;
}

.share-tab {
    flex: 1;
    padding: 8px 6px;
    min-height: 36px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text2);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

.share-tab:hover { color: var(--text); }

.share-tab.active {
    background: var(--bg2);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Modus-Toggle: Text / Bild */
.share-mode-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--bg);
    border-radius: var(--r-sm);
    padding: 3px;
}

.share-mode-btn {
    flex: 1;
    padding: 8px 6px;
    min-height: 36px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text2);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
    -webkit-user-select: none;
    user-select: none;
}

.share-mode-btn:hover { color: var(--text); }

.share-mode-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 4px rgba(124, 106, 239, 0.35);
}

/* Bild-Vorschau Sektion */
.share-image-section {
    margin-bottom: 14px;
}

.share-img-preview-wrap {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 8px;
    margin-top: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.share-img-preview-wrap.loading .share-img-loading {
    display: flex;
}

.share-img-preview-wrap.loading .share-img-preview {
    opacity: 0.3;
}

.share-img-loading {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text2);
    font-size: 0.8rem;
    z-index: 2;
}

.share-img-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.share-img-preview {
    max-width: 100%;
    max-height: 280px;
    border-radius: 6px;
    object-fit: contain;
    transition: opacity 0.2s;
}

.share-img-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.share-img-btn {
    flex: 1;
    padding: 12px 8px;
    min-height: 44px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--r-sm);
}

/* Bild-Stil Auswahl */
.share-style-section {
    margin-bottom: 14px;
}

.share-style-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.share-style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.share-style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 4px 6px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--t);
    color: var(--text2);
    font-size: 0.68rem;
    font-weight: 600;
    -webkit-user-select: none;
    user-select: none;
}

.share-style-btn:hover { border-color: var(--text3); }
.share-style-btn:active { transform: scale(0.95); }

.share-style-btn.active {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

/* Mini-Previews fuer Stile */
.share-style-preview {
    width: 44px;
    height: 32px;
    border-radius: 4px;
    background: var(--bg2);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.ss-card::before {
    content: '';
    position: absolute;
    top: 3px; left: 3px; right: 3px;
    height: 6px;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.5;
}
.ss-card::after {
    content: '';
    position: absolute;
    top: 12px; left: 3px; right: 12px;
    height: 3px;
    background: var(--text3);
    border-radius: 1px;
    box-shadow: 0 5px 0 var(--text3), 0 10px 0 var(--text3);
    opacity: 0.4;
}

.ss-compact::before {
    content: '';
    position: absolute;
    top: 4px; left: 3px;
    width: 12px; height: 24px;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.3;
}
.ss-compact::after {
    content: '';
    position: absolute;
    top: 4px; left: 18px;
    width: 22px; height: 3px;
    background: var(--text3);
    border-radius: 1px;
    box-shadow: 0 5px 0 var(--text3), 0 10px 0 var(--text3), 0 15px 0 var(--text3);
    opacity: 0.4;
}

.ss-podium::before {
    content: '';
    position: absolute;
    bottom: 3px; left: 5px;
    width: 8px; height: 18px;
    background: var(--gold);
    border-radius: 2px 2px 0 0;
    opacity: 0.5;
    box-shadow: 10px 4px 0 var(--accent), 20px 8px 0 var(--green);
}

.ss-table::before {
    content: '';
    position: absolute;
    top: 3px; left: 3px; right: 3px;
    height: 1px;
    background: var(--text3);
    box-shadow: 0 6px 0 var(--text3), 0 12px 0 var(--text3), 0 18px 0 var(--text3);
    opacity: 0.3;
}
.ss-table::after {
    content: '';
    position: absolute;
    top: 3px; left: 16px;
    width: 1px; height: 26px;
    background: var(--text3);
    box-shadow: 10px 0 0 var(--text3);
    opacity: 0.3;
}

/* RT Header + Archive Header Actions */
.rt-header-actions,
.archive-header-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.share-options-half {
    grid-template-columns: repeat(2, 1fr);
}

.share-options-third {
    grid-template-columns: 1fr;
    max-width: 50%;
}

.share-sheet-close {
    display: block;
    width: 100%;
    padding: 14px;
    min-height: 48px;
    margin-top: 6px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    color: var(--text2);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}

.share-sheet-close:hover {
    background: var(--bg-hover);
}

/* ===== DASHBOARD CONTROLS ===== */
.dash-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0 4px;
}

.quick-select {
    padding: 6px 28px 6px 10px;
    min-height: 32px;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    color: var(--text2);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--t);
}

.quick-select:focus { border-color: var(--accent); }

.layout-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 2px;
}

.lt-btn {
    width: 30px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 16px;
    color: var(--text3);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--t);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lt-btn.active { background: var(--accent-dim); color: var(--accent); }
.lt-btn:hover:not(.active) { color: var(--text2); }

/* ===== GRID LAYOUT ===== */
.players-list.layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.players-list.layout-grid .p-card-btns { flex-wrap: wrap; }
.players-list.layout-grid .p-card-btns button { font-size: 0.7rem; padding: 8px 2px; }
.players-list.layout-grid .p-card-score { font-size: 1.3rem; }
.players-list.layout-grid .p-card-rank { width: 26px; height: 26px; font-size: 0.95rem; }

/* ===== ROUND TABLE LAYOUT ===== */
.table-circle-wrap {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    aspect-ratio: 1 / 1;
}

.table-circle-bg {
    position: absolute;
    top: 18%;
    left: 18%;
    width: 64%;
    height: 64%;
    border-radius: 50%;
    background: var(--bg2);
    border: 3px solid var(--border);
    box-shadow: inset 0 2px 20px rgba(0,0,0,0.2), var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-circle-label {
    text-align: center;
    color: var(--text3);
    font-size: 0.8rem;
    font-weight: 600;
}

.table-circle-num {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1.1;
}

.table-seat {
    position: absolute;
    width: 76px;
    text-align: center;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.table-seat:active { transform: translate(-50%, -50%) scale(0.9); }

.table-seat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid var(--player-color, var(--accent));
    background: var(--bg2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-weight: 800;
    font-size: 1rem;
    color: var(--player-color, var(--accent));
    box-shadow: 0 0 12px rgba(124, 106, 239, 0.15);
    transition: all var(--t);
}

.table-seat-avatar.is-winning {
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
}

.table-seat-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 76px;
}

.table-seat-score {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
}

.table-seat-score.is-winning { color: var(--gold); }

.table-seat-rank {
    font-size: 0.6rem;
    color: var(--text3);
}

/* ===== SETTINGS VIEW ===== */
.settings-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.settings-header h2 {
    flex: 1;
    font-size: 1.1rem;
}

.settings-content {
    padding-top: 16px;
    padding-bottom: 40px;
}

.settings-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--card-shadow);
}

.settings-section h3 {
    font-size: 0.82rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.setting-row:last-child { border-bottom: none; }

.setting-row-col {
    flex-direction: column;
    align-items: flex-start;
}

.setting-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.setting-label-full {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.setting-hint {
    font-size: 0.74rem;
    color: var(--text3);
    margin-bottom: 10px;
    line-height: 1.4;
}

.setting-select {
    padding: 8px 30px 8px 12px;
    min-height: 36px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.setting-select:focus { border-color: var(--accent); }

.setting-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg);
    border-radius: var(--r-sm);
    padding: 3px;
}

.stoggle-btn {
    padding: 6px 12px;
    min-height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text2);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
    white-space: nowrap;
}

.stoggle-btn.active {
    background: var(--accent);
    color: #fff;
}

.stoggle-btn:hover:not(.active) { color: var(--text); }

/* Color presets */
.color-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.color-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 6px 8px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--t);
    color: var(--text2);
    font-size: 0.72rem;
    font-weight: 600;
    -webkit-user-select: none;
    user-select: none;
}

.color-preset-btn:active { transform: scale(0.95); }

.color-preset-btn.active {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

.color-preset-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.1);
}

/* Custom colors */
.custom-colors-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.color-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.color-picker-item label {
    font-size: 0.7rem;
    color: var(--text2);
    font-weight: 600;
}

.color-picker-item input[type="color"] {
    width: 44px;
    height: 34px;
    padding: 2px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
}

/* Settings buttons */
.setting-btns {
    display: flex;
    gap: 8px;
    width: 100%;
}

.setting-btns .btn {
    flex: 1;
    font-size: 0.82rem;
    padding: 10px 8px;
}

.setting-file-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-footer {
    text-align: center;
    padding: 16px 0;
}

.settings-version {
    font-size: 0.72rem;
    color: var(--text3);
}

/* Screenshot download link (temp) */
.screenshot-download-wrap {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeOverlay 0.2s ease;
}

.screenshot-result {
    background: var(--bg2);
    border-radius: var(--r);
    padding: 20px;
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.screenshot-result img {
    width: 100%;
    border-radius: var(--r-sm);
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

.screenshot-result-btns {
    display: flex;
    gap: 8px;
}

.screenshot-result-btns .btn {
    flex: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 420px) {
    header h1 { font-size: 1rem; }
    .header-right { gap: 3px; }
    .btn-icon { width: 30px; height: 30px; min-width: 30px; min-height: 30px; font-size: 0.85rem; }
    .timer-display { font-size: 0.7rem; padding: 2px 5px; min-width: 40px; }
    .round-pill { padding: 2px 8px; font-size: 0.7rem; }
    .dash-controls { flex-wrap: wrap; }
    .quick-select { flex: 1; min-width: 0; font-size: 0.72rem; padding: 5px 24px 5px 8px; }
    .stoggle-btn { padding: 5px 9px; font-size: 0.73rem; }
    .setting-row { gap: 8px; }
    .color-picker-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .setting-btns { flex-direction: column; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .goal-buttons { flex-wrap: wrap; }
    .dash-actions { flex-direction: column; }
    .dash-actions .btn { min-width: auto; }
    .share-options { grid-template-columns: repeat(2, 1fr); }
    .share-opt-icon { width: 40px; height: 40px; }
}

@media (max-width: 340px) {
    header { padding: 10px 10px; }
    header h1 { font-size: 0.9rem; }
    .btn-icon { width: 28px; height: 28px; min-width: 28px; min-height: 28px; font-size: 0.78rem; }
    .timer-display { font-size: 0.65rem; padding: 1px 4px; min-width: 36px; }
    .round-pill { padding: 1px 6px; font-size: 0.65rem; }
    .color-presets { grid-template-columns: repeat(2, 1fr); }
    .color-picker-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 600px) {
    .num-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
