html, body {
    margin: 0; height: 100%; overflow: hidden;
    background: #000; color: #fff;
    font-family: Arial, sans-serif;
    display: flex; align-items: center; justify-content: center;
    overscroll-behavior: none;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
[hidden] { display: none !important; }
html, body, #frame { touch-action: none; overscroll-behavior: none; }

/* geblurrter Hintergrund neben dem Hochformat-Frame auf breiten Bildschirmen, wie bei Sentenced/1XL */
#desktop-backdrop {
    position: fixed; inset: -40px; z-index: 0;
    background: radial-gradient(circle at 50% 20%, #332b00, #000 70%);
    pointer-events: none;
}

#frame {
    position: relative; z-index: 1; flex: none;
    width: 390px; height: 844px;
    background: #000; overflow: hidden;
    transform-origin: center center;
}

.screen { position: absolute; inset: 0; }

.btn {
    font: bold 20px Arial, sans-serif;
    padding: 14px 34px;
    border: none; border-radius: 10px;
    background: #ffcc00; color: #000;
    box-shadow: 0 4px #aa8800;
    cursor: pointer;
}
.btn:active { box-shadow: none; transform: translateY(4px); }
.btn-quiet { background: transparent; color: #ffcc00; box-shadow: none; border: 2px solid #ffcc00; }

/* Ton an/aus: nur auf Start- und Auswertungsscreen sichtbar (in der Runde ist die Ecke durch den
   Abbrechen-Knopf und Ida belegt, siehe show() in main.js) */
#sound-toggle {
    position: absolute; top: 10px; left: 10px; z-index: 30;
    width: 36px; height: 36px; padding: 0;
    border: 2px solid #ffcc00; border-radius: 50%;
    background: rgba(0, 0, 0, .55); color: #fff;
    font-size: 17px; line-height: 1; cursor: pointer;
}
#sound-toggle.off { opacity: .6; }

/* Sprachumschalter: oben rechts, wie Ton-Knopf nur zwischen den Runden sichtbar */
#lang-switch {
    position: absolute; top: 10px; right: 10px; z-index: 30;
    display: flex; border: 2px solid #ffcc00; border-radius: 16px; overflow: hidden;
    background: rgba(0, 0, 0, .55);
}
.lang-btn {
    font: bold 14px Arial, sans-serif; letter-spacing: .04em;
    padding: 6px 12px; border: 0; background: transparent; color: #ffcc00; cursor: pointer;
}
.lang-btn.active { background: #ffcc00; color: #000; }

/* ── Start ── */
#start-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 0 24px; text-align: center; gap: 14px; box-sizing: border-box;
}
.chars { display: flex; gap: 6px; align-items: flex-end; }
.chars .char { width: 130px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .6)); }
#start-screen h1 { color: #ffcc00; font-size: 26px; line-height: 1.25; margin: 4px 0; }
#start-screen h1 .hl { font-size: 34px; }
#start-screen .info { opacity: .8; font-size: 15px; line-height: 1.4; margin: 0 0 6px; }
.best-line { color: #ffcc00; font-size: 14px; opacity: .85; margin-top: 4px; }

.mode-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; width: 100%; }
.mode-tab {
    flex: 1 1 40%; font: bold 12px Arial, sans-serif; line-height: 1.25;
    padding: 8px 4px; border-radius: 16px; border: 2px solid #ffcc00;
    background: transparent; color: #ffcc00; cursor: pointer;
}
.mode-tab.active { background: #ffcc00; color: #000; }

/* ── Runde ── */
#game-screen { display: flex; flex-direction: column; align-items: center; box-sizing: border-box; padding: 14px 16px 20px; }
#hud { width: 100%; display: flex; justify-content: space-between; align-items: center; }
#quit-button {
    width: 32px; height: 32px; padding: 0; margin-right: 4px;
    border: 2px solid #666; border-radius: 50%;
    background: transparent; color: #999;
    font-size: 15px; line-height: 1; cursor: pointer;
}
#quit-button:active { background: rgba(255, 255, 255, .1); }
#timer { font: bold 32px Arial, sans-serif; color: #ffcc00; }
#timer.hurry { color: #ff4d4d; animation: pulse .5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
#score { font: bold 32px Arial, sans-serif; color: #fff; }
#score-suffix { font-size: 15px; color: #999; }

#ida-box { position: relative; align-self: flex-start; margin-top: 6px; }
#ida-face { width: 64px; display: block; }
#ida-face.hop { animation: hop .4s ease-out; }
@keyframes hop { 30% { transform: translateY(-8px) rotate(-4deg); } 60% { transform: translateY(0) rotate(2deg); } }
#ida-bubble {
    position: absolute; left: 60px; top: -6px; width: 190px;
    background: #fff; color: #000;
    font: bold 14px Arial, sans-serif; line-height: 1.25;
    padding: 8px 11px; border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
    z-index: 2;
}
#ida-bubble::after {
    content: ''; position: absolute; left: -7px; top: 10px;
    border: 8px solid transparent; border-right-color: #fff;
}
#ida-bubble.pop { animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Belohnung bei genau 8/10/12 Punkten: kurzer Toast unten, unterhalb des eigentlichen Spielfelds, mit Foto */
#reward-toast {
    position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
    display: flex; flex-direction: row; align-items: center; gap: 10px;
    background: #fff; color: #000;
    font: bold 17px Arial, sans-serif; text-align: left; white-space: nowrap;
    padding: 8px 16px 8px 8px; border-radius: 30px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
    z-index: 15; pointer-events: none;
}
#reward-toast img { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; }
#reward-toast.pop { animation: rewardPop 1.8s ease-out; }
@keyframes rewardPop {
    0% { transform: translateX(-50%) translateY(20px); opacity: 0; }
    15% { transform: translateX(-50%) translateY(0); opacity: 1; }
    82% { transform: translateX(-50%) translateY(0); opacity: 1; }
    100% { transform: translateX(-50%) translateY(10px); opacity: 0; }
}

#calc-ui, #clock-ui, #vocab-ui { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#problem-box { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
#problem { font: bold 56px Arial, sans-serif; letter-spacing: .02em; transition: color .15s, transform .15s; }
#problem.right { color: #6bffa0; transform: scale(1.08); }
#problem.wrong { color: #ff5c5c; animation: shake .3s ease-in-out; }
@keyframes shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } 100% { transform: translateX(0); } }
#answer { font: bold 40px Arial, sans-serif; color: #ffcc00; min-height: 48px; letter-spacing: .05em; }

#keypad { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
    font: bold 26px Arial, sans-serif;
    padding: 18px 0; border-radius: 12px; border: none;
    background: #1c1c1c; color: #fff;
    box-shadow: 0 3px #000;
    cursor: pointer;
}
.key:active { box-shadow: none; transform: translateY(3px); }
.key.ok { background: #2ecc71; color: #000; }
.key.back { background: #444; }

/* ── Uhrzeit ── */
#clock-canvas { width: 220px; height: 220px; margin-bottom: 18px; }
#clock-answers { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer-btn {
    font: bold 19px Arial, sans-serif;
    padding: 16px 6px; border-radius: 12px; border: none;
    background: #1c1c1c; color: #fff;
    box-shadow: 0 3px #000;
    cursor: pointer;
}
.answer-btn:active { box-shadow: none; transform: translateY(3px); }
.answer-btn.right { background: #2ecc71; color: #000; }
.answer-btn.wrong { background: #ff5c5c; }
.answer-btn.reveal { background: #2ecc71; color: #000; }
.answer-btn[disabled] { cursor: default; }

/* ── Vokabeln ── */
#vocab-ui { justify-content: flex-start !important; padding-top: 30px; }
#vocab-lang { color: #999; font-size: 14px; font-weight: bold; letter-spacing: .03em; margin-bottom: 10px; }
#vocab-word { font: bold 46px Arial, sans-serif; color: #ffcc00; margin-bottom: 36px; text-align: center; word-break: break-word; }
#vocab-answers { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Auswertung ── */
#result-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0 26px; text-align: center; box-sizing: border-box; }
.ida-result { width: 140px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .6)); }
#result-screen h2 { color: #ffcc00; font-size: 26px; margin: 6px 0 0; }
.big-score { font: 900 60px 'Arial Black', Arial, sans-serif; color: #ffcc00; margin: 4px 0; }
.big-score small { font-size: 20px; color: #fff; }
.new-best { color: #6bffa0; font-weight: bold; font-size: 17px; margin: 0; }
.old-best { color: #999; font-size: 14px; margin: 0 0 10px; }
/* Belohnungsfoto (Kekse/Nudeln/Pudding) auf der Auswertung, ab 8 Punkten (bleibt auch bei 13+ stehen) */
.reward-result {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    margin: 0 0 10px;
}
.reward-result img { width: 90px; height: 90px; object-fit: cover; border-radius: 50%; border: 3px solid #ffcc00; }
.reward-result p { color: #ffcc00; font-weight: bold; font-size: 16px; margin: 0; }

/* Doktor Schnabel als Strafe bei 0-2 Punkten: möglichst schaurig, Jakob mag ihn nicht */
.doctor-schnabel {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    margin: 0 0 10px;
}
.doctor-schnabel img {
    width: 110px; height: 110px; object-fit: cover; border-radius: 50%;
    border: 3px solid #7a0000;
    filter: grayscale(.55) contrast(1.35) brightness(.7) sepia(.25) hue-rotate(-25deg);
    animation: schnabelSpook 1.4s ease-in-out infinite;
}
@keyframes schnabelSpook {
    0%, 100% { box-shadow: 0 0 16px 4px rgba(255, 0, 0, .35); transform: rotate(-1deg); }
    50% { box-shadow: 0 0 34px 12px rgba(255, 0, 0, .7); transform: rotate(1deg); }
}
.doctor-schnabel p { color: #ff4d4d; font-weight: bold; font-size: 16px; margin: 0; text-shadow: 0 0 10px rgba(255, 0, 0, .65); }
#again-button { margin-top: 10px; }
