/* Klimpern app: dark, high-contrast, made for one hand at the table. Shares tokens with bierallee.de. */
:root {
    --bg: #121110;
    --panel: #1c1b19;
    --panel-hover: #24221f;
    --line: #2e2c29;
    --ink: #f1ede6;
    --muted: #a39d93;
    --accent: #f0b232;
    --accent-hover: #f5c45a;
    --accent-ink: #171207;
    --good: #4fbf7a;
    --warn: #e8913a;
    --bad: #e05a4f;
    --display: 'Fraunces', Georgia, serif;
    --radius: 14px;
    color-scheme: dark;
}

html, body { min-height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: 'Inter', system-ui, sans-serif; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; letter-spacing: -.02em; line-height: 1.05; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { -webkit-tap-highlight-color: transparent; }

.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon .fill { fill: currentColor; stroke: none; }

/* Layout */
.kl-page { min-height: 100dvh; display: flex; flex-direction: column; }
.kl-content { flex: 1; }
.kl-wrap { width: min(560px, calc(100% - 32px)); margin-inline: auto; }
.kl-navbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); }
.kl-navbar-brand { font-family: var(--display); font-weight: 900; font-size: 24px; text-decoration: none; }
.kl-brand-dot { color: var(--accent); }
.kl-navbar-home { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; color: var(--muted); text-decoration: none; }
.kl-navbar-home .icon { width: 18px; height: 18px; }
.kl-footer { padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); }

/* Buttons and fields */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 24px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: 600 16px 'Inter', sans-serif; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; }
.button:hover { background: var(--panel-hover); color: var(--ink); }
.button-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button-accent:hover { background: var(--accent-hover); color: var(--accent-ink); }
.button-quiet { background: transparent; }
.button-small { min-height: 40px; padding: 0 16px; font-size: 14px; }
.button-block { display: flex; width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button .icon { width: 20px; height: 20px; }
.link-button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--muted); font: 500 14px 'Inter', sans-serif; cursor: pointer; }
.link-button:hover { color: var(--ink); }
.link-button .icon { width: 18px; height: 18px; }
.field { display: block; width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: 400 16px/1.4 'Inter', sans-serif; }
.field::placeholder { color: var(--muted); }
.field:focus { outline: 0; border-color: var(--muted); }
select.field { appearance: none; padding-right: 36px; background: var(--panel) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a39d93' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat right 12px center / 14px; }
textarea.field { resize: vertical; }
.field-hint { margin: 8px 2px 0; font-size: 13px; color: var(--muted); }
.notes-list { list-style: none; margin: 10px 0 0; padding: 0; }
.notes-toggle { margin-top: 2px; color: var(--accent); }
.notes-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.note-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note-text { overflow-wrap: anywhere; }
.note-remove { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 600 13px 'Inter', sans-serif; cursor: pointer; }
.note-remove .icon { width: 18px; height: 18px; }
.note-remove.is-confirm { background: var(--accent); color: var(--accent-ink); }
.section-label { display: block; margin: 28px 2px 10px; font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.notice { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); font-size: 15px; }
.notice > div { flex: 1; }
.notice-danger { border-color: var(--bad); }
.notice-danger .icon { color: var(--bad); }
.notice-pause { border-color: var(--accent); }
.notice-pause .icon { color: var(--accent); }

/* Menu */
.kl-hero { padding: 40px 0 28px; }
.eyebrow { margin: 0 0 14px; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kl-hero-title { margin: 0 0 16px; font-size: clamp(40px, 11vw, 56px); line-height: .98; }
.kl-hero-sub { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.5; }
.menu-actions { display: grid; gap: 12px; margin-bottom: 8px; }
.resume { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 24px 0 12px; padding: 20px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); text-align: left; cursor: pointer; transition: background-color .15s; }
.resume:hover { background: var(--accent-hover); }
.resume .eyebrow { margin: 0; color: var(--accent-ink); opacity: .7; }
.resume-names { font-family: var(--display); font-weight: 900; font-size: 24px; line-height: 1.15; letter-spacing: -.01em; overflow-wrap: anywhere; }
.resume-meta { font-size: 14px; opacity: .8; }
.menu-new { margin-bottom: 8px; }
.saved-games { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.saved-game { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; cursor: pointer; }
.saved-game:hover .saved-game-names { color: var(--accent); }
.saved-game-names { font-family: var(--display); font-weight: 900; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.saved-game-meta { font-size: 14px; color: var(--muted); }
.menu-empty { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); }
.menu-empty h2 { margin: 0 0 8px; font-size: 24px; color: var(--ink); }

/* Setup */
.page-title { margin: 32px 0 6px; font-size: 36px; }
.page-sub { margin: 0 0 24px; color: var(--muted); }
.input-group { display: flex; gap: 8px; }
.input-group .field { flex: 1; min-width: 0; }
.input-group .button { flex: none; width: 52px; padding: 0; }
.form-error { margin: 8px 0 0; color: var(--bad); font-size: 14px; }
.players { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.player-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.player-name { font-weight: 600; font-size: 17px; }
.player-role { font-size: 13px; color: var(--accent); }
.player-controls { display: flex; align-items: center; gap: 8px; }
.player-controls select.field { width: auto; min-height: 44px; font-size: 14px; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--muted); cursor: pointer; }
.icon-button:hover { color: var(--bad); }
.players-empty { padding: 20px 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.setup-actions { margin: 24px 0 8px; display: grid; gap: 8px; justify-items: center; }

/* Game: whose turn */
.turn { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 0 14px; }
.turn-top { display: flex; align-items: center; justify-content: space-between; }
.turn-label { font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.turn-who { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.turn-name { font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1.05; letter-spacing: -.02em; overflow-wrap: anywhere; }
.turn-points { flex: none; color: var(--muted); }
.turn-points strong { color: var(--ink); font-size: 24px; }
.turn-next { margin-top: 4px; font-size: 14px; color: var(--muted); }
.turn-last { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-actions { display: flex; align-items: center; gap: 8px; }
.top-button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: 600 14px 'Inter', sans-serif; cursor: pointer; }
.top-button .icon { width: 18px; height: 18px; }
.top-button:hover { border-color: var(--muted); }
.top-button.is-confirm { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.top-button-icon { width: 44px; padding: 0; justify-content: center; }

/* Game menu sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); animation: fade-in .25s ease-out both; }
.sheet-backdrop.is-closing { animation: fade-out .22s ease-in both; }
.sheet { animation: sheet-in .32s cubic-bezier(.16, 1, .3, 1) both; }
.sheet.is-closing { animation: sheet-out .22s ease-in both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 85dvh; overflow-y: auto; padding: 4px 0 calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; background: var(--panel); }
.sheet .section-label { margin-top: 18px; }
.sheet-links { display: flex; flex-direction: column; margin: 12px 0 16px; border-top: 1px solid var(--line); }
.sheet-links a, .sheet-links button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: 500 16px 'Inter', sans-serif; text-align: left; text-decoration: none; cursor: pointer; }
.sheet-links .icon { color: var(--muted); }
.sheet-links button.is-confirm { color: var(--accent); }
.sheet-links button.is-confirm .icon { color: var(--accent); }

/* Game: throws */
.game { padding-bottom: 16px; }
.throw { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); text-align: left; font: 600 16px 'Inter', sans-serif; cursor: pointer; transition: background-color .15s, border-color .15s; }
.throw:hover { background: var(--panel-hover); }
.throw:active { border-color: var(--muted); }
.throw-text { display: flex; flex-direction: column; min-width: 0; }
.throw-text small { font-weight: 400; font-size: 13px; color: var(--muted); }
.throw-primary { min-height: 84px; margin-top: 16px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 18px; }
.throw-primary:hover { background: var(--accent-hover); }
.throw-primary .throw-text small { color: var(--accent-ink); opacity: .72; }
.throw-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.12); flex: none; }
.throw-icon .icon { width: 26px; height: 26px; }
.throw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.throw-grid .throw { min-height: 76px; padding-left: 12px; border-left-width: 4px; }
.throw-grid .icon { width: 28px; height: 28px; }
.tone-good { border-left-color: var(--good); } .tone-good .icon { color: var(--good); }
.tone-warn { border-left-color: var(--warn); } .tone-warn .icon { color: var(--warn); }
.tone-bad { border-left-color: var(--bad); } .tone-bad .icon { color: var(--bad); }

/* Game: extras and panels */
.extras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.extra { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; padding: 6px 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: 600 13px 'Inter', sans-serif; text-align: center; cursor: pointer; }
.extra:hover { background: var(--panel-hover); }
.extra small { max-width: 100%; min-height: 1.2em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 11px; color: var(--accent); }
.extra.is-open { border-color: var(--accent); color: var(--accent); }
.extra.is-set { border-color: var(--accent); }
.panel { margin-top: 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.panel-title { margin: 0 0 4px; font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 600; letter-spacing: 0; }
.panel-hint, .panel-step { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.panel-step { margin-top: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: 500 14px 'Inter', sans-serif; cursor: pointer; }
.chip .icon { width: 16px; height: 16px; }
.chip:hover { border-color: var(--muted); }
.chip.is-active { border-color: var(--accent); background: rgba(240,178,50,.14); color: var(--accent); }
.chip-count { font-size: 12px; color: var(--muted); }
.chip-call { border-color: var(--good); color: var(--good); }
.chip-contra { border-color: var(--bad); color: var(--bad); }
.chip-penalty { border-color: var(--warn); color: var(--warn); }
.custom-penalty { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin: 16px 0 8px; }
.custom-penalty select.field { width: auto; }
/* Game: scores, notes, end */
.scores { list-style: none; margin: 0; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.scores li { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.scores li:last-child { border-bottom: 0; }
.scores li.is-current .score-name { color: var(--accent); }
.score-name { font-weight: 600; }
.role { margin-left: 6px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; color: var(--muted); }
.score-detail { font-size: 13px; color: var(--muted); }
.score-total { font-size: 18px; min-width: 2ch; text-align: right; }
.scores-legend { margin: 8px 2px 0; font-size: 12px; color: var(--muted); }
.kl-page-game .game { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

/* Protocol page actions */
.protocol-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Blazor internals */
#blazor-error-ui { color-scheme: light only; background: #fff3cd; color: #1d1b18; bottom: 0; box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem calc(.7rem + env(safe-area-inset-bottom)); position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { padding: 1rem; background: var(--bad); color: #fff; }
.blazor-error-boundary::after { content: "Ein Fehler ist aufgetreten."; }

@media (min-width: 720px) {
    .turn-name { font-size: 48px; }
}
@media (prefers-reduced-motion: reduce) {
    .button, .throw { transition: none; }
    .sheet, .sheet-backdrop, .sheet.is-closing, .sheet-backdrop.is-closing { animation-duration: .01s; }
}
@media print {
    .kl-navbar, .kl-footer { display: none; }
}
