/* ==========================================================
   Lese-Abenteuer – Styles
   Bewusst ohne CSS-Grid, Flexbox-gap und CSS-Variablen,
   damit Safari 12 (iPadOS 12.5) und der Kindle-Browser
   alles gleich darstellen. Layout: inline-block + table.
   ========================================================== */

* { -webkit-box-sizing: border-box; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: #f0f9ff;
    color: #1e293b;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
}

input, textarea, select { -webkit-user-select: text; user-select: text; }

button {
    font-family: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.hidden { display: none !important; }
.center { text-align: center; }
.small { font-size: 14px; }
.muted { color: #64748b; }
.link { color: #0369a1; }
hr { border: 0; border-top: 2px solid #e2e8f0; margin: 20px 0; }

/* ---------- Grundlayout ---------- */

.page {
    max-width: 820px;
    margin: 0 auto;
    padding: 16px;
}

.card {
    background: #fff;
    border: 4px solid #bae6fd;
    -webkit-border-radius: 24px;
    border-radius: 24px;
    -webkit-box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.title { color: #0369a1; margin: 0 0 12px 0; }
.title-inline { margin: 0; font-size: 22px; }

.big-emoji { font-size: 50px; margin-bottom: 8px; }
.huge-emoji { font-size: 80px; line-height: 1.2; margin: 10px 0; }

/* ---------- Header (table statt flex) ---------- */

.header {
    display: table;
    width: 100%;
    background: #fff;
    border-bottom: 2px solid #bae6fd;
    padding: 8px 12px;
}
.header-cell { display: table-cell; vertical-align: middle; }
.header-right { text-align: right; white-space: nowrap; font-size: 0; }
.brand { font-weight: bold; font-size: 18px; color: #0369a1; text-decoration: none; }

.pill {
    display: inline-block;
    font-size: 16px;
    font-weight: bold;
    padding: 8px 12px;
    margin-left: 6px;
    border: 0;
    -webkit-border-radius: 14px;
    border-radius: 14px;
    background: #e2e8f0;
    color: #1e293b;
}
.pill-star { background: #f59e0b; color: #fff; }
.pill-red { background: #fee2e2; color: #991b1b; }

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

.btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 14px 18px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background: #0ea5e9;
    border: 0;
    -webkit-border-radius: 16px;
    border-radius: 16px;
    -webkit-box-shadow: 0 4px 10px rgba(14,165,233,0.3);
    box-shadow: 0 4px 10px rgba(14,165,233,0.3);
}
.btn:active { opacity: 0.85; }
.btn-green  { background: #10b981; -webkit-box-shadow: 0 4px 10px rgba(16,185,129,0.3); box-shadow: 0 4px 10px rgba(16,185,129,0.3); }
.btn-amber  { background: #f59e0b; -webkit-box-shadow: 0 4px 10px rgba(245,158,11,0.3); box-shadow: 0 4px 10px rgba(245,158,11,0.3); }
.btn-violet { background: #8b5cf6; -webkit-box-shadow: 0 4px 10px rgba(139,92,246,0.3); box-shadow: 0 4px 10px rgba(139,92,246,0.3); }
.btn-red    { background: #ef4444; }

.btn-small {
    display: inline-block;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: bold;
    color: #1e293b;
    background: #fff;
    border: 2px solid #cbd5e1;
    -webkit-border-radius: 12px;
    border-radius: 12px;
    margin: 4px 2px;
}
.btn-mini {
    display: inline-block;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: bold;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #1e293b;
    -webkit-border-radius: 8px;
    border-radius: 8px;
    margin: 2px;
}
.btn-mini-blue { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.btn-mini-red  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-mini-green{ background: #16a34a; color: #fff; border-color: #16a34a; }

/* ---------- Formulare ---------- */

.input {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 18px;
    font-family: inherit;
    border: 2px solid #cbd5e1;
    -webkit-border-radius: 14px;
    border-radius: 14px;
    margin: 8px 0 12px 0;
    background: #fff;
    color: #1e293b;
}
input.input { text-align: center; }
.mono { font-family: Menlo, Courier, monospace; font-size: 14px; text-align: left; }
.label { display: block; font-weight: bold; color: #475569; margin-bottom: 4px; }
.field-label { display: block; font-weight: bold; font-size: 13px; margin-top: 8px; text-align: left; }
.field { display: block; width: 100%; padding: 8px; font-size: 16px; font-family: inherit; border: 1px solid #cbd5e1; -webkit-border-radius: 8px; border-radius: 8px; background: #fff; }
.error { color: #dc2626; font-weight: bold; }
.status { font-weight: bold; margin: 8px 0 0 0; min-height: 1em; }
.status-ok { color: #059669; }
.status-err { color: #dc2626; }

/* ---------- Tabs ---------- */

.tabs { background: #e2e8f0; padding: 4px; -webkit-border-radius: 14px; border-radius: 14px; margin-bottom: 18px; font-size: 0; }
.tab {
    display: inline-block;
    width: 50%;
    padding: 10px;
    font-size: 16px;
    font-weight: bold;
    border: 0;
    background: transparent;
    color: #64748b;
    -webkit-border-radius: 10px;
    border-radius: 10px;
}
.tab.active { background: #fff; color: #0369a1; }

/* ---------- Kinder-Login ---------- */

.pin-row { margin: 16px 0; font-size: 0; }
.pin-slot {
    display: inline-block;
    vertical-align: middle;
    width: 64px;
    height: 64px;
    line-height: 58px;
    margin: 0 6px;
    font-size: 34px;
    border: 3px dashed #7dd3fc;
    background: #f0f9ff;
    -webkit-border-radius: 16px;
    border-radius: 16px;
}
.pin-slot.filled { border-style: solid; border-color: #10b981; background: #ecfdf5; }
.pin-clear {
    display: inline-block;
    vertical-align: middle;
    width: 54px;
    height: 64px;
    margin-left: 6px;
    font-size: 24px;
    background: #fef3c7;
    border: 2px solid #f59e0b;
    -webkit-border-radius: 14px;
    border-radius: 14px;
}

.keypad { font-size: 0; margin: 10px -1%; }
.keypad-btn {
    display: inline-block;
    vertical-align: top;
    width: 31.333%;
    margin: 1%;
    padding: 12px 4px;
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    -webkit-border-radius: 20px;
    border-radius: 20px;
    color: #1e293b;
}
.keypad-emoji { display: block; font-size: 40px; line-height: 1.2; }
.keypad-label { display: block; font-size: 13px; font-weight: bold; color: #475569; margin-top: 4px; }

/* ---------- Startseite ---------- */

.letters { margin-bottom: 8px; }
.letter {
    display: inline-block;
    margin: 4px;
    padding: 6px 12px;
    font-size: 22px;
    font-weight: bold;
    color: #0369a1;
    background: #e0f2fe;
    border: 2px solid #7dd3fc;
    -webkit-border-radius: 12px;
    border-radius: 12px;
}
.mode-row { font-size: 0; margin: 10px -1% 0 -1%; }
.mode-btn { display: inline-block; width: 31.333%; margin: 1%; font-size: 19px; padding: 16px 6px; }
.mode-btn[disabled] { opacity: 0.4; }
.count { display: block; font-size: 13px; font-weight: normal; opacity: 0.9; }

/* ---------- Training ---------- */

.bar { overflow: hidden; margin-bottom: 10px; text-align: left; }
.bar > * { float: left; }
.bar > .bar-right { float: right; }
.bar .btn-small { margin: 0; white-space: nowrap; }
.bar .title-inline { line-height: 42px; }
#progressText { font-weight: bold; line-height: 42px; }

.progress { height: 10px; background: #e2e8f0; -webkit-border-radius: 5px; border-radius: 5px; margin-bottom: 12px; overflow: hidden; }
.progress-fill { height: 10px; width: 0; background: #10b981; }

.reading-card { position: relative; padding-top: 50px; }
.badge {
    position: absolute;
    top: 14px;
    left: 18px;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    background: #f1f5f9;
    color: #64748b;
    padding: 5px 10px;
    -webkit-border-radius: 20px;
    border-radius: 20px;
    border: 0;
}
.badge-btn { left: auto; right: 18px; background: #e0f2fe; color: #0369a1; text-transform: none; padding: 7px 12px; }

.reading-wrap { display: table; width: 100%; height: 220px; table-layout: fixed; }
.reading {
    display: table-cell;
    vertical-align: middle;
    text-align: center;
    font-size: 72px;
    font-weight: bold;
    line-height: 1.35;
    letter-spacing: 0.04em;
    word-wrap: break-word;
    color: #0f172a;
}
.reading-satz { font-size: 42px; letter-spacing: 0.02em; line-height: 1.6; }

/* Silbenfärbung (Fibel: blau/rot) */
.silbe-blau { color: #1d4ed8; }
.silbe-rot  { color: #dc2626; }

/* Silbenbögen (funktioniert auch schwarz-weiß) */
.bogen {
    display: inline-block;
    padding: 0 0.04em 0.08em 0.04em;
    margin: 0 0.03em 0.12em 0.03em;
    border-bottom: 0.07em solid #334155;
    -webkit-border-radius: 0 0 50% 50%;
    border-radius: 0 0 50% 50%;
    line-height: 1.1;
}

.icon-box {
    display: inline-block;
    padding: 0 10px;
    margin: 0 4px;
    background: #e0f2fe;
    border: 2px solid #7dd3fc;
    -webkit-border-radius: 14px;
    border-radius: 14px;
    line-height: 1.3;
}
.icon-word { display: none; }

.rate-row { font-size: 0; margin: 0 -1%; }
.rate-btn { display: inline-block; width: 48%; margin: 1%; font-size: 22px; padding: 20px 6px; }

.done-text { font-size: 20px; }

/* ---------- Sticker ---------- */

.sticker-grid { font-size: 0; margin: 10px -1% 0 -1%; }
.sticker {
    display: inline-block;
    vertical-align: top;
    width: 23%;
    margin: 1%;
    padding: 10px 4px;
    background: #fff;
    border: 2px solid #f59e0b;
    -webkit-border-radius: 16px;
    border-radius: 16px;
    text-align: center;
}
.sticker-locked { background: #f1f5f9; border-color: #cbd5e1; opacity: 0.5; }
.sticker-emoji { font-size: 36px; line-height: 1.2; }
.sticker-name { font-size: 12px; font-weight: bold; margin-top: 4px; }

/* ---------- Modal (table-Zentrierung) ---------- */

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    display: table;
    background: rgba(0,0,0,0.6);
    z-index: 100;
}
.modal-cell { display: table-cell; vertical-align: middle; padding: 16px; }
.modal-card { max-width: 340px; margin: 0 auto; border-color: #f59e0b; }
.modal-name { font-weight: bold; font-size: 20px; margin-bottom: 12px; }

/* ---------- Eltern-Bereich ---------- */

.section { text-align: left; margin-bottom: 22px; }
.section h3 { font-size: 17px; margin: 0 0 8px 0; padding-bottom: 5px; border-bottom: 1px solid #cbd5e1; color: #0f172a; }
.section-blue { background: #f0f9ff; border: 2px solid #bae6fd; -webkit-border-radius: 12px; border-radius: 12px; padding: 14px; }
.section-blue h3 { border: 0; color: #0369a1; }

.lesson {
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    -webkit-border-radius: 16px;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 14px;
    text-align: left;
}
.lesson-edit { border-color: #0284c7; background: #f0f9ff; }
.lesson-head { border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; margin-bottom: 8px; }
.lesson-title { font-size: 16px; color: #0369a1; display: block; margin-bottom: 6px; }
.lesson-body { font-size: 14px; color: #334155; line-height: 1.6; }
.lesson-body b { color: #0f172a; }

.stat-row { font-size: 15px; padding: 6px 0; border-bottom: 1px solid #e2e8f0; }
.stat-num { color: #b45309; font-weight: bold; }

/* ---------- Kleine Bildschirme ---------- */

@media (max-width: 520px) {
    .page { padding: 10px; }
    .card { padding: 16px; -webkit-border-radius: 18px; border-radius: 18px; }
    .brand-text { display: none; }
    .reading { font-size: 54px; }
    .reading-satz { font-size: 30px; }
    .reading-wrap { height: 180px; }
    .mode-btn { width: 98%; }
    .sticker { width: 31.333%; }
    .pin-slot { width: 54px; height: 54px; line-height: 48px; font-size: 28px; margin: 0 4px; }
    .pin-clear { height: 54px; width: 46px; }
}

/* ==========================================================
   E-INK-MODUS (Kindle & Co.)
   Schwarz-weiß, kein Schatten, keine Transparenz, große Kontraste.
   ========================================================== */

.eink body { background: #fff; color: #000; }
.eink .card,
.eink .lesson,
.eink .section-blue { border-color: #000; background: #fff; -webkit-box-shadow: none; box-shadow: none; }
.eink .header { border-bottom: 3px solid #000; }
.eink .brand, .eink .title, .eink .link, .eink .lesson-title { color: #000; }
.eink .muted, .eink .keypad-label { color: #000; }

.eink .btn,
.eink .btn-green, .eink .btn-amber, .eink .btn-violet, .eink .btn-red {
    background: #fff;
    color: #000;
    border: 3px solid #000;
    -webkit-box-shadow: none;
    box-shadow: none;
}
.eink .btn:active { background: #000; color: #fff; opacity: 1; }
.eink .rate-btn[data-correct="1"] { background: #000; color: #fff; }

.eink .pill, .eink .pill-star, .eink .pill-red,
.eink .btn-small, .eink .btn-mini, .eink .badge, .eink .badge-btn,
.eink .tab.active, .eink .pin-clear {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}
.eink .tabs { background: #fff; border: 2px solid #000; }
.eink .tab.active { background: #000; color: #fff; }

.eink .keypad-btn, .eink .pin-slot, .eink .letter, .eink .icon-box, .eink .sticker {
    background: #fff;
    border-color: #000;
    color: #000;
}
.eink .pin-slot.filled { border-width: 4px; background: #fff; }
.eink .sticker-locked { opacity: 1; border-style: dashed; }

.eink .progress { background: #fff; border: 2px solid #000; }
.eink .progress-fill { background: #000; }

.eink .reading { color: #000; }
.eink .silbe-blau { color: #000; }
.eink .silbe-rot  { color: #555; }
.eink .bogen { border-bottom-color: #000; }

/* Auf E-Ink werden Emojis evtl. nicht angezeigt → Wort klein darunter */
.eink .icon-word { display: block; font-size: 0.35em; font-weight: normal; line-height: 1.1; }

.eink .modal { background: #fff; }
.eink .error, .eink .status-err, .eink .status-ok, .eink .stat-num { color: #000; text-decoration: underline; }
