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; }

/* Keine Wischgesten der Seite: sonst schiebt z. B. der Telegram-Browser den Dialog weg */
html, body, #gameFrame { touch-action: none; overscroll-behavior: none; }
#result-body, #hs-list { touch-action: pan-y; overscroll-behavior: contain; }

/* Wie 1XL: geblurrter Hintergrund neben dem Hochformat-Frame auf breiten Bildschirmen */
#desktop-backdrop {
    position: fixed; inset: -40px; z-index: 0;
    background: url('assets/bg_002.jpg') center/cover no-repeat;
    filter: blur(28px) brightness(.5);
    pointer-events: none;
}

#gameFrame {
    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); }

/* ── Start ── */
#start-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; }
#start-screen .poster { flex: 1 1 auto; min-height: 0; max-width: 100%; object-fit: contain; -webkit-user-drag: none; }
.start-controls { flex: none; height: 150px; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; }
.start-loading-hint { font-size: 28px; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .3; transform: scale(1); } 50% { opacity: .75; transform: scale(1.12); } }

/* ── Bereit ── */
#ready-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 0 28px; text-align: center; }
#ready-screen h2 { color: #ffcc00; font-size: 30px; margin: 0; line-height: 1.2; }
.ready-odo { width: 220px; }
.ready-info { margin: 0; opacity: .75; font-size: 16px; line-height: 1.4; }

/* ── Runde ── */
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#hud {
    position: absolute; left: 0; right: 0; top: 0; height: 110px;
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 12px 12px 0; box-sizing: border-box;
    pointer-events: none;
    background: linear-gradient(#000 40%, transparent);
}
#timer {
    font: bold 34px Arial, sans-serif; color: #ffcc00;
    min-width: 84px;
    text-shadow: 0 2px 6px #000;
}
#timer.hurry { color: #ff4d4d; animation: pulse .5s ease-in-out infinite; }
#current-word {
    flex: 1; text-align: center; padding-top: 6px;
    font: bold 26px Arial, sans-serif; letter-spacing: .08em; color: #ffcc00;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#ida-box { position: relative; width: 84px; }
#ida { width: 84px; display: block; }
#ida.hop { animation: hop .45s ease-out; }
@keyframes hop { 30% { transform: translateY(-10px) rotate(-4deg); } 60% { transform: translateY(0) rotate(2deg); } }
#ida-bubble {
    position: absolute; right: 70px; top: 76px; width: 210px;
    background: #fff; color: #000;
    font: bold 15px Arial, sans-serif; line-height: 1.3;
    padding: 10px 12px; border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
    z-index: 2;
}
#ida-bubble::after {
    content: ''; position: absolute; right: -8px; top: -6px;
    border: 10px solid transparent; border-left-color: #fff; border-bottom-color: #fff;
    transform: rotate(-20deg);
}
#ida-bubble.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#sentence-line {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; gap: 6px; padding: 10px 12px 18px;
    overflow-x: auto; scrollbar-width: none;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(0, 0, 0, .85) 45%);
}
.chip {
    flex: none;
    background: rgba(255, 204, 0, .92); color: #000;
    font: bold 15px Arial, sans-serif;
    padding: 5px 9px; border-radius: 8px;
    animation: drop .35s ease-out;
}
@keyframes drop { from { transform: translateY(-40px) scale(1.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Rundenende ── */
#sentenced-overlay {
    position: absolute; inset: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .6);
}
#sentenced-overlay span {
    font: 900 50px 'Arial Black', Arial, sans-serif; color: #ffcc00;
    transform: rotate(-8deg);
    text-shadow: 0 0 0 #000, 4px 4px 0 #aa8800, 0 0 30px rgba(255, 204, 0, .5);
}
#sentenced-overlay.go span { animation: slam .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes slam { from { transform: rotate(-8deg) scale(4); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }

/* ── Auswertung ── */
#result-screen { display: flex; flex-direction: column; align-items: center; padding: 30px 22px 28px; box-sizing: border-box; gap: 10px; }
#result-screen h2 { margin: 0; color: #ffcc00; font-size: 30px; }
#result-body { flex: 1; min-height: 0; width: 100%; overflow-y: auto; text-align: center; }
.sentence { font-size: 22px; line-height: 1.4; margin: 10px 0; }
.sentence .ok { color: #fff; }
.sentence .loose { color: #9aa; font-style: italic; }
.sentence .bad { color: #777; text-decoration: line-through; }
.verdict { color: #ffcc00; font-weight: bold; font-size: 20px; margin: 4px 0 12px; }
.score-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.score-table td { padding: 4px 6px; border-bottom: 1px solid #222; }
.score-table td:first-child { text-align: left; font-weight: bold; }
.score-table td:nth-child(2) { color: #999; }
.score-table td:last-child { text-align: right; }
.score-table tr.invalid td { color: #666; }
.score-table tr.sum td { color: #ffcc00; border-bottom: none; }
.big-total { font: 900 54px 'Arial Black', Arial, sans-serif; color: #ffcc00; margin: 14px 0 0; }
.big-total small { font-size: 20px; }
.muted { opacity: .6; }

/* ── Sprachumschalter (oben rechts, nur zwischen den Runden) ── */
#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; }

/* ── Ton an/aus (oben links; im Spiel unter dem Timer) ── */
#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; }
#gameFrame.playing #sound-toggle { top: 58px; }

/* ── Bestenliste ── */
.btn-small { font-size: 15px; padding: 8px 20px; }
.btn-quiet { background: transparent; color: #ffcc00; box-shadow: none; border: 2px solid #ffcc00; }
#result-screen .hs-open { margin-top: -2px; }

#hs-entry { width: 100%; box-sizing: border-box; padding: 12px; border: 2px solid #ffcc00; border-radius: 12px; background: #111; text-align: center; }
#hs-entry p { margin: 0 0 8px; }
#hs-entry-title { color: #ffcc00; font-weight: bold; font-size: 17px; }
#hs-name { width: 100%; box-sizing: border-box; font: bold 18px Arial, sans-serif; padding: 9px 10px; border-radius: 8px; border: 2px solid #555; background: #000; color: #fff; text-align: center; }
#hs-name:focus { border-color: #ffcc00; outline: none; }
.hs-note { font-size: 12px; opacity: .6; line-height: 1.35; }
.hs-error { color: #ff6b6b; font-size: 14px; min-height: 0; }
.hs-error:empty { display: none; }
.hs-entry-buttons { display: flex; gap: 10px; justify-content: center; }

#hs-overlay { position: absolute; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; padding: 16px 12px 12px; box-sizing: border-box; }
.hs-head { display: flex; align-items: center; justify-content: space-between; }
.hs-head h2 { margin: 0; color: #ffcc00; font-size: 28px; }
#hs-close { width: 38px; height: 38px; border-radius: 50%; border: 2px solid #ffcc00; background: transparent; color: #ffcc00; font-size: 18px; cursor: pointer; }
.hs-tabs { display: flex; gap: 8px; margin: 12px 0 8px; }
.hs-tab { flex: 1; font: bold 15px Arial, sans-serif; padding: 8px 0; border-radius: 8px; border: 2px solid #ffcc00; background: transparent; color: #ffcc00; cursor: pointer; }
.hs-tab.active { background: #ffcc00; color: #000; }
#hs-list { flex: 1; min-height: 0; overflow-y: auto; text-align: left; }
#hs-list .muted { text-align: center; margin-top: 30px; }
.hs-row { display: grid; grid-template-columns: 34px 1fr auto; column-gap: 8px; padding: 7px 6px; border-bottom: 1px solid #222; align-items: baseline; }
.hs-row.mine { background: rgba(255, 204, 0, .18); border-radius: 8px; }
.hs-rank { color: #999; font-weight: bold; text-align: right; }
.hs-name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-score { color: #ffcc00; font-weight: bold; }
.hs-sentence { grid-column: 2 / 4; font-size: 13px; opacity: .7; line-height: 1.3; font-style: italic; }
.hs-note a { color: #ffcc00; }
