/* Moderne, ruhige Oberfläche; das Spielfeld ist ein Blatt Papier mit gedruckten Vorgaben und Einträgen in Tinte. */
:root {
    --bg: #f4f2ee;
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --text: #1c1b1a;
    --text-2: #5f5b55;
    --text-3: #6f6a64;
    --line: #e6e1d8;
    --line-2: #d4cdc0;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: #eef0ff;
    --accent-text: #3730a3;
    --danger: #c2410c;
    --danger-soft: #fdece4;
    --success: #15803d;
    --success-soft: #e7f6ec;
    --warn-soft: #fff6d6;

    --paper: #fdfbf6;
    --paper-peer: #f4efe2;
    --paper-given: #f7f3e8;
    --paper-same: #e4edfb;
    --paper-selected: #fff1a8;
    --paper-hint: #ffe0b3;
    --paper-violation: #ffd9d2;
    --paper-incorrect: #ffb4a6;
    --paper-line: #d9d2c3;
    --paper-line-strong: #4a4640;
    --ink-print: #1f1d1b;
    --ink-pen: #1e4fd8;
    --ink-pencil: #6f6a62;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(28, 27, 26, .06), 0 1px 1px rgba(28, 27, 26, .04);
    --shadow: 0 2px 6px rgba(28, 27, 26, .06), 0 12px 32px rgba(28, 27, 26, .08);
    --shadow-lg: 0 8px 20px rgba(28, 27, 26, .10), 0 30px 60px rgba(28, 27, 26, .16);

    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-hand: "Caveat", "Segoe Print", cursive;
    --cell-size: min(calc((100vw - 48px) / 9), 54px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* Sichtbarer Fokus auf jedem Bedienelement (Tastatur), nicht bei Mausklick. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .tile:focus-visible, .nav a:focus-visible, .lang button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.btn-icon { padding: .3rem .5rem; }
.digit-btn.clear .icon { width: 22px; height: 22px; }
.loading-line { color: var(--text-2); }

h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin: 1.75rem 0 1.25rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 .75rem; }

.loading { padding: 4rem 1rem; text-align: center; color: var(--text-3); }

/* Kopfleiste */
.topbar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: .75rem 1.25rem;
    background: rgba(255, 255, 255, .8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; color: var(--text); }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { color: var(--text-2); padding: .4rem .8rem; border-radius: 999px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.lang { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang span { display: none; }
.lang button {
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-2);
    padding: .3rem .7rem;
    border-radius: 999px;
}
.lang button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.content { max-width: 760px; margin: 0 auto; padding: 0 16px 4rem; }

.notice {
    background: var(--warn-soft);
    border: 1px solid #f3e3a1;
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    margin: 1rem 0;
    color: #6b4f00;
}

/* Schaltflächen */
.btn {
    font: inherit;
    font-weight: 600;
    font-size: .95rem;
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: .6rem 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 44px;
    box-shadow: var(--shadow-sm);
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: #c4bcae; }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.active { background: var(--accent-soft); border-color: #c7caff; color: var(--accent-text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .25); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: #f1c6b3; background: var(--surface); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-small { min-height: 34px; padding: .3rem .8rem; font-size: .85rem; }

/* Startseite */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.tile {
    font: inherit;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 1.1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    min-height: 118px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    color: var(--text);
}
.tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfd0ff; }
.tile.disabled { opacity: .55; cursor: default; }
.tile.resume { grid-column: 1 / -1; background: var(--accent-soft); border-color: #cfd0ff; }
.tile-title { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.tile-sub { color: var(--text-2); font-size: .92rem; }
.tile-note { color: var(--danger); font-size: .85rem; font-weight: 500; }
.pips { display: flex; gap: 5px; }
.pip { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.pip.on { background: var(--accent); }

/* Spielfeld */
.play { display: flex; flex-direction: column; gap: 1.1rem; align-items: center; padding-top: 1.25rem; }
.status-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
    max-width: calc(var(--cell-size) * 9 + 32px);
    justify-content: space-between;
}
.difficulty { font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: .25rem .75rem; border-radius: 999px; font-size: .9rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.35rem; letter-spacing: -.01em; }
.hints { color: var(--text-2); font-size: .95rem; }

/* Das Blatt Papier */
.board-wrap {
    position: relative;
    outline: none;
    padding: 16px;
    background: var(--paper);
    border-radius: 6px;
    box-shadow: var(--shadow), inset 0 0 0 1px rgba(0, 0, 0, .04);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.board-wrap::after {
    /* leichte Wölbung des Blatts */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, .35), transparent 40%, transparent 70%, rgba(0, 0, 0, .025));
}
.board-wrap:focus-visible { outline: none; box-shadow: var(--shadow), 0 0 0 3px var(--accent); }
.board {
    display: grid;
    grid-template-columns: repeat(9, var(--cell-size));
    grid-template-rows: repeat(9, var(--cell-size));
    border: 2px solid var(--paper-line-strong);
    user-select: none;
    position: relative;
    z-index: 1;
}
.cell {
    border-right: 1px solid var(--paper-line);
    border-bottom: 1px solid var(--paper-line);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    line-height: 1;
    background: transparent;
    overflow: hidden;
    transition: background .1s ease;
}
.cell.left { border-left: 2px solid var(--paper-line-strong); }
.cell.top { border-top: 2px solid var(--paper-line-strong); }
.cell:nth-child(9n) { border-right: none; }
.cell.bottom { border-bottom: none; }
.cell.peer { background: var(--paper-peer); }
.cell.same { background: var(--paper-same); }
.cell.selected { background: var(--paper-selected); box-shadow: inset 0 0 0 2px #e4b800; }
.cell.hint-house { box-shadow: inset 0 0 0 2px rgba(79, 70, 229, .45); }
.cell.hint { background: #d4efc3; }
.cell.hint-target { background: var(--paper-hint); }
.cell.hint-target .notes { color: #9a3412; font-weight: 700; }
.hint-legend { display: block; margin-top: .3rem; color: var(--text-3); font-size: .78rem; }
.cell.violation { background: var(--paper-violation); }
.cell.incorrect { background: var(--paper-incorrect); }
.board.readonly .cell { cursor: default; }

/* Vorgaben gedruckt, Einträge mit dem Stift geschrieben */
.cell .digit { font-size: calc(var(--cell-size) * .62); }
.cell.given .digit { font-family: var(--font-ui); font-weight: 600; color: var(--ink-print); }
.cell:not(.given) .digit {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: calc(var(--cell-size) * .86);
    color: var(--ink-pen);
    transform: rotate(-3deg) translateY(2px);
}
.cell.violation:not(.given) .digit, .cell.incorrect:not(.given) .digit { color: #b42318; }

.notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    font-family: var(--font-hand);
    font-size: calc(var(--cell-size) * .29);
    font-weight: 600;
    color: var(--ink-pencil);
    line-height: 1;
    padding: 1px 2px;
    overflow: hidden;
}
.note { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.note.struck { text-decoration: line-through; text-decoration-color: #b42318; opacity: .45; }

.pause-overlay {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: rgba(253, 251, 246, .96);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-2);
    text-align: center;
    padding: 1rem;
    z-index: 2;
}

.digit-pad { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; width: 100%; max-width: calc(var(--cell-size) * 9 + 32px); }
.digit-btn {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.9rem;
    color: var(--ink-pen);
    padding: .2rem 0;
    min-height: 48px;
    border-radius: var(--radius-sm);
}
.digit-btn.clear { font-family: var(--font-ui); font-size: 1.1rem; color: var(--text-2); }
.tools { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; max-width: calc(var(--cell-size) * 9 + 80px); }

.message {
    width: 100%;
    max-width: calc(var(--cell-size) * 9 + 32px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-sm);
}
.message.hint { border-left-color: #e4b800; background: #fffdf2; }
.message.error { border-left-color: var(--danger); background: var(--danger-soft); }
.message.info { border-left-color: var(--success); background: var(--success-soft); }
.profile { color: var(--text-3); font-size: .85rem; text-align: center; max-width: 560px; }
.after-give-up { display: flex; gap: .75rem; justify-content: center; margin-top: 1rem; }

/* Dialoge */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 27, 26, .35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 16px;
}
.modal {
    background: var(--surface);
    border-radius: 20px;
    padding: 1.5rem;
    width: min(100%, 460px);
    box-shadow: var(--shadow-lg);
}
.modal h2 { margin-top: 0; font-size: 1.35rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; flex-wrap: wrap; }
.result { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.25rem; margin: 0; }
.result dt { color: var(--text-2); }
.result dd { margin: 0; text-align: right; font-weight: 500; }
.result small { color: var(--text-3); font-weight: 400; }
.result .points { font-size: 1.6rem; font-weight: 700; color: var(--accent); align-self: center; letter-spacing: -.02em; }

/* Punkte */
.summary .total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    font-size: 1.05rem;
}
.summary .total strong { font-size: 1.6rem; color: var(--accent); letter-spacing: -.02em; }
.per-category { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.per-category li {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
}
.per-category li span:nth-child(2) { color: var(--text-2); }
table.scores {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.25rem 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
table.scores th { text-align: left; padding: .7rem .9rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }
table.scores td { padding: .65rem .9rem; border-bottom: 1px solid var(--line); }
table.scores tr:last-child td { border-bottom: none; }
table.scores tr.given-up td { color: var(--text-3); }

/* Foto-Import */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.upload-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
#photo-input:focus-visible + * label.btn, .upload-actions label.btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.ocr-progress { width: 100%; max-width: 420px; height: 10px; accent-color: var(--accent); }
.muted { color: var(--text-2); font-size: .92rem; }
.correction { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; justify-content: center; }
.correction-photo { width: min(100%, 320px); height: auto; border-radius: 6px; box-shadow: var(--shadow-sm); }
.correction-grid { display: flex; flex-direction: column; gap: 1rem; align-items: center; }

/* Technik-Erklärungen */
.message-actions { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; }
.technique-modal { width: min(100%, 520px); max-height: calc(100vh - 32px); overflow: auto; }
.technique-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.technique-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; box-shadow: var(--shadow-sm); }
.modal .technique-card { border: none; box-shadow: none; padding: 0; }
.technique-card header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.technique-card h3 { margin: 0; font-size: 1.1rem; }
.technique-card p { margin: .5rem 0 0; font-size: .95rem; }
.technique-card p.muted { color: var(--text-3); font-size: .82rem; }
.intro { color: var(--text-2); max-width: 640px; }
.legend { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: .35rem; }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line-2); }
.swatch.pattern { background: #fff1a8; }
.swatch.pattern-alt { background: #cfe2ff; }
.swatch.target { background: #ffe0b3; }

.diagram {
    --dc: min(calc((100vw - 80px) / 9), 36px);
    display: grid;
    grid-template-columns: repeat(9, var(--dc));
    grid-template-rows: repeat(9, var(--dc));
    border: 2px solid var(--paper-line-strong);
    background: var(--paper);
    width: max-content;
    max-width: 100%;
}
.modal .diagram { --dc: min(calc((100vw - 96px) / 9), 44px); }
.d-cell {
    position: relative;
    border-right: 1px solid var(--paper-line);
    border-bottom: 1px solid var(--paper-line);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.d-cell.l { border-left: 2px solid var(--paper-line-strong); }
.d-cell.t { border-top: 2px solid var(--paper-line-strong); }
.d-cell.r { border-right: none; }
.d-cell.b { border-bottom: none; }
.d-cell.pattern { background: #fff1a8; }
.d-cell.pattern-alt { background: #cfe2ff; }
.d-cell.target { background: #ffe0b3; }
.d-digit { font-weight: 600; font-size: calc(var(--dc) * .6); color: var(--ink-print); }
.d-digit.placed { color: #15803d; }
.d-notes { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; height: 100%; font-size: calc(var(--dc) * .3); color: #444; line-height: 1; padding: 1px; }
.d-notes span { display: flex; align-items: center; justify-content: center; }
.d-notes span.struck { color: #b42318; text-decoration: line-through; font-weight: 700; }
.d-label { position: absolute; right: 1px; bottom: 0; font-size: calc(var(--dc) * .26); color: var(--accent-text); font-weight: 700; line-height: 1; }

/* Druckseite */
.print-controls { margin-bottom: 1.25rem; }
.control-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem 1rem; }
.control-grid label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--text-2); }
.control-grid label.check { flex-direction: row; align-items: center; gap: .5rem; align-self: end; min-height: 44px; }
.control-grid select, .control-grid input[type="number"] {
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    padding: .5rem .7rem;
    min-height: 44px;
}
.control-grid input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.print-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.print-actions .count { color: var(--text-2); flex: 1; }
.printed-info { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; color: var(--text-2); font-size: .92rem; margin: .75rem 0 0; }

.preview { display: flex; flex-direction: column; gap: 1.5rem; align-items: center; }
.sheet-wrap { position: relative; overflow: hidden; box-shadow: var(--shadow); border-radius: 2px; }
.sheet {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    background: #fff;
    color: #111;
    padding: 10mm;
    box-sizing: border-box;
    font-family: var(--font-ui);
}
.sheet-grid { display: grid; gap: 6mm; width: 100%; height: 100%; }
.print-slot { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-height: 0; min-width: 0; overflow: hidden; }
.print-caption { font-size: 4mm; line-height: 7mm; height: 7mm; font-weight: 600; color: #222; white-space: nowrap; }
.print-caption.small { font-size: 3mm; line-height: 5mm; height: 5mm; }
.print-footer { font-size: 2.6mm; line-height: 5mm; height: 5mm; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.print-grid {
    display: grid;
    grid-template-columns: repeat(9, var(--pc));
    grid-template-rows: repeat(9, var(--pc));
    border: .5mm solid #111;
}
.pcell {
    border-right: .2mm solid #999;
    border-bottom: .2mm solid #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--pc) * .62);
    font-weight: 600;
    line-height: 1;
}
.pcell.l { border-left: .5mm solid #111; }
.pcell.t { border-top: .5mm solid #111; }
.pcell.r { border-right: none; }
.pcell.b { border-bottom: none; }
.pcell.solved { font-weight: 400; color: #444; }
.pcands {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    font-size: calc(var(--pc) * .27);
    font-weight: 400;
    color: #555;
    line-height: 1;
}
.pcands span { display: flex; align-items: center; justify-content: center; }

/* Die Lösungen sind am Bildschirm nur unscharf zu sehen; lesbar werden sie erst auf Papier. */
.sheet.solutions .print-grid { filter: blur(calc(var(--pc) * .4)); }
.sheet.solutions .print-caption { filter: blur(1.5px); }
.sheet.solutions::after {
    content: attr(data-hint);
    position: absolute;
    left: 50%;
    bottom: 6mm;
    transform: translateX(-50%);
    font-size: 3.5mm;
    color: #777;
    white-space: nowrap;
}

@media print {
    .topbar, .no-print, #blazor-error-ui { display: none !important; }
    .sheet.solutions .print-grid, .sheet.solutions .print-caption { filter: none; }
    .sheet.solutions::after { content: none; }
    html, body { background: #fff; }
    .content { max-width: none; padding: 0; margin: 0; }
    .preview { display: block; }
    .sheet-wrap { width: auto !important; height: auto !important; overflow: visible; box-shadow: none; border-radius: 0; }
    .sheet { position: static; transform: none !important; page-break-after: always; break-after: page; }
    .sheet:last-child { page-break-after: auto; break-after: auto; }
}

#blazor-error-ui {
    background: #fff4d6;
    color: var(--text);
    bottom: 0;
    left: 0;
    display: none;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 1px solid #f3e3a1;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* Die Navigation rutscht auf schmalen Fenstern in eine eigene Zeile, damit die Sprachwahl sichtbar bleibt. */
@media (max-width: 680px) {
    .topbar { flex-wrap: wrap; justify-content: space-between; row-gap: .4rem; }
    .nav { order: 3; flex: 1 0 100%; overflow-x: auto; }
    .nav a { white-space: nowrap; }
}

@media (max-width: 420px) {
    .topbar { gap: .6rem; padding: .6rem .85rem; }
    .nav a { padding: .35rem .6rem; font-size: .9rem; }
    .digit-pad { grid-template-columns: repeat(5, 1fr); }
    .board-wrap { padding: 10px; }
    h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .tile, .cell { transition: none; }
}
