/* ============================================================
   VocTHrainer v2 – Stylesheet
   Modernes, responsives Design mit CSS Custom Properties,
   automatischem Dark Mode und nativen <dialog>-Modals.
   ============================================================ */

/* Akzentfarben nach der thailändischen Flagge:
   Blau #2D2A4A (im Streifen original; als Akzent in klarere,
   blauere Töne übersetzt), Rot #A51931 (Sekundärakzent).
   Grün/Rot für richtig/falsch bleiben semantisch erhalten. */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --text: #1c2430;
    --text-muted: #5c6675;
    --border: #d9dee6;
    --accent: #24439b;
    --accent-hover: #1a337c;
    --accent-soft: #e2e9f8;
    --accent-2: #6d3ac9;          /* Violett für Verläufe */
    --accent-glow: rgba(36, 67, 155, .32);
    --flag-red: #a51931;
    --flag-red-soft: #f8e3e7;
    --flag-blue: #2d2a4a;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --success: #15803d;
    --success-soft: #dcfce7;
    --amber: #d9750c;
    --amber-soft: #fff3d6;
    --surface-glass: rgba(255, 255, 255, .86);
    --red-glow: rgba(165, 25, 49, .10);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 16px rgba(16, 24, 40, .06);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-thai: "Noto Sans Thai", "Leelawadee UI", "Thonburi", var(--font);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141f;
        --surface: #171f30;
        --surface-2: #202c44;
        --text: #e7ebf3;
        --text-muted: #94a2bc;
        --border: #314061;
        --accent: #8aa8ea;
        --accent-hover: #a7bef2;
        --accent-soft: #24345e;
        --accent-2: #b197fc;
        --accent-glow: rgba(138, 168, 234, .3);
        --flag-red: #e4677e;
        --flag-red-soft: #4c1a26;
        --flag-blue: #2d2a4a;
        --danger: #f87171;
        --danger-soft: #4c1414;
        --success: #4ade80;
        --success-soft: #14401f;
        --amber: #ffc078;
        --amber-soft: #45350f;
        --surface-glass: rgba(23, 31, 48, .82);
        --red-glow: rgba(228, 103, 126, .12);
        --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

/* Sanft treibende Farb-Orbs im Hintergrund (Flaggenblau + Flaggenrot) */
body::before {
    content: '';
    position: fixed;
    inset: -10%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(620px 420px at 12% -4%, var(--accent-glow), transparent 65%),
        radial-gradient(520px 380px at 96% 12%, var(--red-glow), transparent 62%),
        radial-gradient(720px 520px at 45% 112%, var(--accent-glow), transparent 65%);
    opacity: .55;
    animation: ambient-drift 20s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(0, -26px, 0) scale(1.05); }
}

.thai { font-family: var(--font-thai); }

h1, h2, h3 { line-height: 1.25; }

a { color: var(--accent); }

button { font-family: inherit; }

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface-glass);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* Schmaler Streifen in den Proportionen der thailändischen Flagge (1:1:2:1:1) */
.site-header::before {
    content: '';
    display: block;
    height: 6px;
    background: linear-gradient(to bottom,
        #a51931 0 16.7%,
        #f4f5f8 16.7% 33.3%,
        #2d2a4a 33.3% 66.7%,
        #f4f5f8 66.7% 83.3%,
        #a51931 83.3% 100%);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
}

/* Logo: sanft schwebende Flagge mit Glow + animierter Verlaufs-Schriftzug */
.brand-flag { display: flex; animation: flag-float 5s ease-in-out infinite; }
.brand-flag svg {
    display: block;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
    filter: drop-shadow(0 2px 8px var(--accent-glow));
    transition: transform .25s cubic-bezier(.2, 1.2, .4, 1);
}
.brand:hover .brand-flag svg { transform: rotate(-5deg) scale(1.12); }

@keyframes flag-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2.5px) rotate(-1deg); }
}

.brand-name {
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--flag-red), var(--accent-2), var(--accent));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: brand-gradient 9s linear infinite;
}

@keyframes brand-gradient {
    to { background-position: 300% 0; }
}

/* Inline-SVG-Icons: plattformunabhängig identische Darstellung */
.icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }

/* Platzierungen "Top contributor" (statt Medaillen-Emojis) */
.rank {
    display: inline-flex;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: #3a2c00;
    background: #e2b93b;
    flex-shrink: 0;
}
.rank-2 { background: #c0c6cf; color: #2c333d; }
.rank-3 { background: #d29a6b; color: #3d2410; }

.account-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.account-link .account-name { text-decoration: underline; }

/* Lautsprecher in Word-Game-Antworten (wählt die Antwort nicht aus) */
.option-speak {
    display: inline-flex;
    margin-left: 8px;
    padding: 2px;
    opacity: .5;
    vertical-align: middle;
    cursor: pointer;
}
.option-speak:hover { opacity: 1; color: var(--accent); }

.header-widgets {
    display: flex;
    gap: 28px;
    flex: 1;
    min-width: 260px;
}

.header-widget h2 {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}

.header-widget .widget-body {
    font-size: 13px;
    margin-top: 2px;
}

.header-widget .widget-body .thai { font-size: 15px; }

.header-account {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.site-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.site-nav a {
    position: relative;
    overflow: hidden;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color .2s ease;
}

/* Glow, der vom unteren Strich nach oben strahlt */
.site-nav a::before {
    content: '';
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: 0;
    height: 100%;
    background: linear-gradient(to top, var(--accent-glow), transparent 78%);
    opacity: 0;
    transform: scaleY(.3);
    transform-origin: bottom;
    transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .3, 1);
    pointer-events: none;
}

/* Verlaufs-Unterstrich, der weich aus der Mitte wächst */
.site-nav a::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transform: scaleX(0);
    transform-origin: center;
    opacity: .55;
    transition: transform .3s cubic-bezier(.2, .8, .3, 1), opacity .3s ease;
}

.site-nav a:hover { color: var(--text); }
.site-nav a:hover::before { opacity: 1; transform: scaleY(1); }
.site-nav a:hover::after { transform: scaleX(1); }

/* Klick: kräftigerer Lichtschein, sofort */
.site-nav a:active::before {
    transition: transform .12s ease;
    opacity: 1;
    transform: scaleY(1);
    background: linear-gradient(to top, var(--accent-glow) 0%, var(--accent-glow) 35%, transparent 90%);
}

.site-nav a.active { color: var(--accent); }
.site-nav a.active::after { transform: scaleX(1); opacity: 1; }

/* ---------- Layout ---------- */

.view {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.site-footer .footer-legal a {
    color: var(--text-muted);
    text-decoration: underline;
}
.site-footer .footer-legal a:hover { color: var(--accent); }

.card {
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.card + .card { margin-top: 16px; }

/* Weiches Eingleiten beim Seitenwechsel (leicht gestaffelt) */
.view > * { animation: view-in .4s cubic-bezier(.2, .9, .3, 1) both; }
.view > *:nth-child(2) { animation-delay: .06s; }
.view > *:nth-child(3) { animation-delay: .12s; }
.view > *:nth-child(n+4) { animation-delay: .18s; }

@keyframes view-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.page-title {
    margin: 0 0 16px;
    font-size: 24px;
    width: fit-content;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, transform .12s, box-shadow .15s, filter .15s;
}

.btn:hover {
    background: var(--surface-2);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(16, 24, 40, .12);
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.is-busy { opacity: .55; cursor: progress; }

.btn-primary {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 10px var(--accent-glow);
}
@media (prefers-color-scheme: dark) {
    .btn-primary { color: #0f1729; }
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    border-color: transparent;
    filter: brightness(1.08);
    box-shadow: 0 5px 18px var(--accent-glow);
}

/* Schimmer-Lichtstreifen, der beim Hover über den Button läuft */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .38), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}
.btn-primary:hover::after { left: 130%; transition: left .55s ease; }

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); }

.btn-sm { padding: 4px 9px; font-size: 13px; }

.btn-icon {
    padding: 4px 8px;
    font-size: 15px;
    line-height: 1;
    background: transparent;
    border: 1px solid transparent;
}
.btn-icon:hover { background: var(--surface-2); border-color: var(--border); }

/* ---------- Forms ---------- */

label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 4px; }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    box-shadow: 0 0 0 4px var(--accent-glow);
    transition: box-shadow .18s;
}

textarea { resize: vertical; }

.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 16px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
}
.checkbox-row input { width: auto; }

/* Aussprache-Sonderzeichen (5 Tonzeichen) */
.specialchars {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.specialchars button {
    font-size: 19px;
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    color: var(--text);
}
.specialchars button:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Toolbar (Vocabulary list) ---------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
}
.toolbar .field { margin-bottom: 0; }
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar select, .toolbar input { width: auto; min-width: 130px; }
.toolbar input[type="search"] { width: 100%; }

/* ---------- Vocabulary table ---------- */

.table-wrap { overflow-x: auto; }

table.voc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.voc-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.voc-table th.sorted { color: var(--accent); }

.voc-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.voc-table tr.notes-row td {
    background: var(--surface-2);
    white-space: pre-wrap;
    font-size: 17px; /* gleiche Größe wie die Thai-Vokabel in der Übersicht */
    border-left: 3px solid var(--accent);
}

.voc-table .thai { font-size: 17px; }

/* Feste Spalten (Notizen | Audio | Bearbeiten | Löschen), damit die
   Icons über alle Zeilen exakt untereinander stehen. */
.voc-actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 34px;
    gap: 2px;
    justify-items: center;
    align-items: center;
}
.voc-actions .action-slot { width: 32px; height: 30px; padding: 4px 0; }

.badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    margin: 1px 2px 1px 0;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.red { background: var(--flag-red-soft); color: var(--flag-red); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.pagination .info { margin-left: auto; font-size: 13px; color: var(--text-muted); }

/* ---------- Dialogs ---------- */

dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 0;
    max-width: min(720px, calc(100vw - 32px));
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}

dialog::backdrop { background: rgba(10, 14, 20, .55); backdrop-filter: blur(3px); }

dialog[open] { animation: dialog-in .28s cubic-bezier(.2, 1.1, .35, 1.05); }

@keyframes dialog-in {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.dialog-head h3 { margin: 0; font-size: 17px; }

.dialog-body { padding: 20px; max-height: 70vh; overflow-y: auto; }

.dialog-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}
.dialog-foot .left { margin-right: auto; }

/* ---------- Toasts ---------- */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    max-width: min(380px, calc(100vw - 40px));
}

.toast {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
    font-size: 14px;
    animation: toast-in .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Trainer ---------- */

.trainer-card {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

.trainer-progress {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Frage-/Antwort-Schriften: so groß wie auf der jeweiligen
   Bildschirmbreite sinnvoll lesbar (responsive über clamp) */
.trainer-question {
    font-size: clamp(30px, 5.5vw, 60px);
    line-height: 1.35;
    margin: 18px 0 6px;
    word-break: break-word;
}

.game-question {
    font-size: clamp(26px, 4.2vw, 46px);
    white-space: pre-wrap;
}

.trainer-hint { color: var(--text-muted); font-size: clamp(18px, 2.2vw, 26px); min-height: 24px; }

/* Anklickbares Thai-Wort (vorlesen lassen) */
.trainer-question.clickable { cursor: pointer; }
.trainer-question.clickable:hover { color: var(--accent); }
.trainer-question .speak-hint { font-size: 18px; opacity: .45; vertical-align: middle; }
.trainer-question.clickable:hover .speak-hint { opacity: 1; }

.trainer-audio-btn {
    font-size: 40px;
    background: var(--accent-soft);
    border: 2px solid var(--accent);
    border-radius: 50%;
    width: 88px;
    height: 88px;
    cursor: pointer;
    margin: 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s;
    animation: audio-pulse 2.4s ease-out infinite;
}
.trainer-audio-btn:hover { transform: scale(1.08); }

/* Pulsierender Glow-Ring um den Audio-Button */
@keyframes audio-pulse {
    0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
    60%  { box-shadow: 0 0 0 22px rgba(0, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    font-size: clamp(19px, 2.3vw, 28px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    color: var(--text);
    transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.choice-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 16px var(--accent-glow);
}

/* Antwort-Buchstabe (A, B, C, …) */
.choice-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2d4fb0, #7048c9);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.choice-btn.correct .choice-letter { background: linear-gradient(135deg, #15803d, #4ade80); }
.choice-btn.wrong .choice-letter { background: linear-gradient(135deg, #b91c1c, #f87171); }

/* Antwort-Inhalt (Text und/oder Bild), Zeilenumbrüche erhalten */
.choice-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    white-space: pre-wrap;
}
.choice-btn.correct { background: var(--success-soft); border-color: var(--success); }
.choice-btn.wrong { background: var(--danger-soft); border-color: var(--danger); }

.answer-feedback {
    min-height: 52px;
    margin-top: 16px;
    font-size: clamp(17px, 2vw, 23px);
}
.answer-feedback .ok { color: var(--success); font-weight: 700; }
.answer-feedback .nope { color: var(--danger); font-weight: 700; }

.result-summary {
    font-size: clamp(44px, 7vw, 72px);
    font-weight: 800;
    margin: 8px 0;
    width: fit-content;
    margin-inline: auto;
    background: linear-gradient(120deg, var(--accent), var(--accent-2), var(--flag-red));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pop-in .55s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes pop-in {
    from { transform: scale(.55); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 18px 0;
}
.stat-tile {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    transition: transform .15s;
}
.stat-tile:hover { transform: translateY(-2px); }
.stat-tile .num { font-size: 26px; font-weight: 800; }
.stat-tile .lbl { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* Bunte Kacheln: blau / grün / bernstein / rot */
.stat-tiles .stat-tile:nth-child(1) { background: var(--accent-soft); }
.stat-tiles .stat-tile:nth-child(1) .num { color: var(--accent); }
.stat-tiles .stat-tile:nth-child(2) { background: var(--success-soft); }
.stat-tiles .stat-tile:nth-child(2) .num { color: var(--success); }
.stat-tiles .stat-tile:nth-child(3) { background: var(--amber-soft); }
.stat-tiles .stat-tile:nth-child(3) .num { color: var(--amber); }
.stat-tiles .stat-tile:nth-child(4) { background: var(--danger-soft); }
.stat-tiles .stat-tile:nth-child(4) .num { color: var(--danger); }

/* ---------- Word games ---------- */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.game-card { transition: transform .15s, box-shadow .15s; }
.game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
}
.game-card h3 { margin: 0 0 6px; }
.game-card .desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
    white-space: pre-wrap;
}
.game-card .meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.game-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Spielansicht der Word Games: volle Inhaltsbreite (wie Vocabulary),
   damit lange Fragen/Antworten kaum umbrechen */
.trainer-card.game-play {
    max-width: none;
}

.game-question-img {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius);
    margin: 10px auto;
    display: block;
    cursor: zoom-in;
    transition: transform .15s, box-shadow .15s;
}
.game-question-img:hover {
    transform: scale(1.015);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.choice-btn img { cursor: zoom-in; }

/* Bild-Lightbox */
dialog.lightbox {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: min(94vw, 1400px);
    cursor: zoom-out;
}
dialog.lightbox::backdrop {
    background: rgba(8, 10, 16, .78);
    backdrop-filter: blur(4px);
}
dialog.lightbox img {
    display: block;
    max-width: 100%;
    max-height: 88vh;
    margin: 0 auto;
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

.choice-btn img {
    max-width: 100%;
    max-height: 160px;
    display: block;
    border-radius: var(--radius-sm);
}

.gap-marker {
    display: inline-block;
    min-width: 70px;
    border-bottom: 3px solid var(--accent);
    margin: 0 4px;
}

/* Wizard */
.wizard-question {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    background: var(--surface);
}
.wizard-question-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.wizard-question-head h4 { margin: 0; }
.wizard-question-head .controls { display: flex; gap: 4px; }

.option-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.option-row input[type="text"] { flex: 1; }
.option-row .answer-input {
    flex: 1;
    min-height: 38px;
    resize: vertical;
}
.option-row input[type="radio"] { width: auto; }

.paste-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    min-width: 110px;
    transition: border-color .15s;
}
.paste-zone:focus, .paste-zone.armed {
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}
.paste-zone { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.paste-zone img { max-width: 100%; max-height: 90px; border-radius: 4px; display: block; margin: 0 auto 4px; }
.paste-zone.small { min-width: 90px; max-width: 130px; }

/* ---------- Admin / Stats tables ---------- */

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
}
.data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
    .header-widgets { order: 3; width: 100%; gap: 16px; }
    .toolbar select, .toolbar input { min-width: 100px; }
}

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
