/* ============================================================
   WITCH HUNT — Game Styles
   ============================================================ */

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: #050510;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: white;
    -webkit-user-select: none;
    user-select: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0; left: 0;
    z-index: 0;
    touch-action: none;
}

#game-ui {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
    touch-action: none;
}

#game-ui > * {
    pointer-events: auto;
}

/* --- Fade Overlay --- */
#fade-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    opacity: 1;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

/* ============================================================
   LAUNCHER / TITLE SCREEN
   ============================================================ */
#launcher {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    background: radial-gradient(ellipse at center, #0d0d2b 0%, #050510 70%);
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
}

#launcher h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(32px, 8vw, 72px);
    font-weight: 900;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: #ff6633;
    text-shadow:
        0 0 20px rgba(255, 102, 51, 0.6),
        0 0 60px rgba(255, 51, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.8);
    margin-bottom: 10px;
    animation: titlePulse 4s ease-in-out infinite;
}

#launcher .subtitle {
    font-size: clamp(12px, 3vw, 18px);
    color: #8899aa;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 40px;
}

.episode-btn {
    display: block;
    width: 280px;
    padding: 16px 28px;
    margin: 8px 0;
    font-size: 16px;
    font-weight: 800;
    border: 2px solid rgba(255, 102, 51, 0.4);
    border-radius: 12px;
    background: rgba(255, 102, 51, 0.08);
    color: #ff8855;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.episode-btn:hover {
    background: rgba(255, 102, 51, 0.2);
    border-color: #ff6633;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 51, 0, 0.3);
}

.episode-btn:active {
    transform: scale(0.97);
}

.episode-btn .ep-num {
    font-size: 11px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.episode-btn.locked {
    opacity: 0.35;
    pointer-events: none;
    border-color: #333;
    color: #555;
}

.episode-btn .ep-check {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #44cc44;
    font-size: 20px;
}

.launcher-footer {
    position: absolute;
    bottom: 24px;
    color: #444;
    font-size: 12px;
    letter-spacing: 1px;
}

.continue-btn {
    display: none;
    padding: 12px 32px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 700;
    background: #44cc44;
    color: #111;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.continue-btn:hover {
    background: #55dd55;
    box-shadow: 0 4px 20px rgba(68, 204, 68, 0.4);
}

@keyframes titlePulse {
    0%, 100% { text-shadow: 0 0 20px rgba(255,102,51,0.6), 0 0 60px rgba(255,51,0,0.3), 0 4px 12px rgba(0,0,0,0.8); }
    50% { text-shadow: 0 0 40px rgba(255,102,51,0.8), 0 0 100px rgba(255,51,0,0.5), 0 4px 12px rgba(0,0,0,0.8); }
}

/* ============================================================
   SPEECH BUBBLES
   ============================================================ */
.speech-bubble {
    position: absolute;
    pointer-events: none;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-weight: 700;
    font-size: clamp(13px, 3.5vw, 16px);
    color: #222;
    background: white;
    border: 3px solid #333;
    border-radius: 14px;
    padding: 10px 16px;
    white-space: normal;
    max-width: 75vw;
    text-align: center;
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 50;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
    line-height: 1.3;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -12px; left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid #333;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -9px; left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid white;
    z-index: 1;
}

.speech-speaker {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #888;
    margin-bottom: 3px;
}

.speech-text {
    display: block;
}

/* Witch bubble */
.speech-bubble.witch-bubble {
    background: #2a0040;
    color: #ff66ff;
    border-color: #9900cc;
    text-shadow: 0 0 8px #ff00ff;
}
.speech-bubble.witch-bubble::after { border-top-color: #9900cc; }
.speech-bubble.witch-bubble::before { border-top-color: #2a0040; }
.speech-bubble.witch-bubble .speech-speaker { color: #cc66ff; }

/* Panic bubble */
.speech-bubble.panic-bubble {
    background: #fff3cd;
    color: #cc3300;
    border-color: #cc3300;
    font-size: clamp(15px, 4vw, 18px);
    animation: shake 0.15s infinite alternate;
}
.speech-bubble.panic-bubble::after { border-top-color: #cc3300; }
.speech-bubble.panic-bubble::before { border-top-color: #fff3cd; }

/* Sleep bubble */
.speech-bubble.sleep-bubble {
    background: #1a2a3a;
    color: #88ccff;
    border-color: #446688;
    font-style: italic;
    border-radius: 20px;
    font-weight: normal;
    letter-spacing: 2px;
    animation: floatUp 2s infinite alternate ease-in-out;
}
.speech-bubble.sleep-bubble::after { border-top-color: #446688; }
.speech-bubble.sleep-bubble::before { border-top-color: #1a2a3a; }

@keyframes shake {
    from { transform: translate(-50%, -100%) rotate(-1deg); }
    to   { transform: translate(-50%, -100%) rotate(1deg); }
}
@keyframes floatUp {
    from { transform: translate(-50%, -100%) translateY(0px); }
    to   { transform: translate(-50%, -100%) translateY(-10px); }
}

/* Tap to continue hint */
.tap-to-continue {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
    animation: tapBlink 1.2s infinite;
}

@keyframes tapBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============================================================
   PROMPT BANNER
   ============================================================ */
#prompt-banner {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    font-size: clamp(16px, 4.5vw, 24px);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #ffdd44;
    text-shadow:
        0 0 10px rgba(255, 221, 68, 0.6),
        0 2px 8px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 28px;
    border: 2px solid rgba(255, 221, 68, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.4s, transform 0.4s;
    z-index: 60;
    pointer-events: none;
    text-align: center;
    max-width: 90vw;
}

#prompt-banner.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   DRAGGABLE ITEMS
   ============================================================ */
.draggable-item {
    position: absolute;
    z-index: 70;
    cursor: grab;
    touch-action: none;
    transition: transform 0.1s;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}

.draggable-item:active,
.draggable-item.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    filter: drop-shadow(0 8px 20px rgba(255, 170, 0, 0.5));
    z-index: 80;
}

/* Log visual (DOM draggable) */
.drag-log {
    width: 80px;
    height: 30px;
    background: linear-gradient(135deg, #5c3a1e, #4a3520);
    border: 2px solid #3a2510;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2a1a10;
    font-size: 10px;
    font-weight: 700;
    position: relative;
    animation: logGlow 2s infinite alternate;
}

.drag-log::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 10px;
    border: 2px solid rgba(255, 170, 0, 0.3);
    animation: logGlow 2s infinite alternate;
}

@keyframes logGlow {
    0% { box-shadow: 0 0 8px rgba(255,170,0,0.2); }
    100% { box-shadow: 0 0 20px rgba(255,170,0,0.5); }
}

/* ============================================================
   TAP ICONS
   ============================================================ */
.tap-icon {
    position: absolute;
    z-index: 70;
    cursor: pointer;
    animation: tapPulse 1.5s infinite;
}

@keyframes tapPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Match icon */
.match-icon {
    width: 48px;
    height: 48px;
    background: radial-gradient(circle, #ff8800, #cc4400);
    border: 3px solid #ffaa44;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 0 20px rgba(255, 136, 0, 0.6);
    cursor: pointer;
}

/* ============================================================
   FOOTPRINT MARKERS (Sprint phase)
   ============================================================ */
.footprint-marker {
    position: absolute;
    width: 24px;
    height: 32px;
    z-index: 70;
    opacity: 0;
    animation: footprintAppear 0.5s forwards;
    cursor: pointer;
    transform: translate(-50%, -50%);
}

.footprint-marker::before {
    content: '👣';
    font-size: 24px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 100, 0.8));
}

.footprint-marker.active {
    animation: footprintPulse 0.6s infinite;
}

.footprint-marker.used {
    opacity: 0.2 !important;
    pointer-events: none;
}

@keyframes footprintAppear {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes footprintPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); filter: drop-shadow(0 0 8px rgba(255,255,100,0.8)); }
    50% { transform: translate(-50%, -50%) scale(1.3); filter: drop-shadow(0 0 16px rgba(255,255,100,1)); }
}

/* ============================================================
   FLOATING LABELS (for hide spots, clues)
   ============================================================ */
.floating-label {
    position: absolute;
    font-size: 12px;
    font-weight: 700;
    color: #ffdd44;
    text-shadow: 0 0 8px rgba(255,221,68,0.6), 0 2px 4px rgba(0,0,0,0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 55;
    animation: labelFloat 2s infinite alternate ease-in-out;
}

@keyframes labelFloat {
    from { transform: translate(-50%, -50%) translateY(0); }
    to   { transform: translate(-50%, -50%) translateY(-8px); }
}

/* ============================================================
   TITLE CARDS
   ============================================================ */
.title-card {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 90;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
    background: rgba(0,0,0,0.4);
}

.title-card.visible { opacity: 1; }

.title-card h1 {
    font-family: Georgia, serif;
    font-size: clamp(24px, 6vw, 48px);
    font-weight: 900;
    color: #ff6633;
    text-shadow: 0 0 30px rgba(255,102,51,0.5), 0 4px 12px rgba(0,0,0,0.8);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.title-card p {
    font-size: clamp(14px, 3vw, 20px);
    color: #aabbcc;
    margin-top: 12px;
    letter-spacing: 2px;
}

/* ============================================================
   END CARDS
   ============================================================ */
.end-card {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 110;
    opacity: 0;
    transition: opacity 1.5s ease;
    pointer-events: none;
}

.end-card.visible { opacity: 1; }

.end-text {
    font-family: Georgia, serif;
    font-size: clamp(18px, 5vw, 36px);
    font-weight: 700;
    color: #ccddee;
    text-align: center;
    line-height: 1.5;
    max-width: 80vw;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.end-subtext {
    font-size: clamp(12px, 3vw, 18px);
    color: #557766;
    margin-top: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ============================================================
   EPISODE 2 — STEPPING STONES
   ============================================================ */
.stepping-stone {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    z-index: 70;
    cursor: pointer;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: stoneAppear 0.4s forwards;
    pointer-events: auto;
}

.stepping-stone.safe {
    background: radial-gradient(circle, rgba(68,255,68,0.4) 0%, rgba(68,170,68,0.1) 70%);
    border: 2px solid rgba(68,255,68,0.5);
    box-shadow: 0 0 15px rgba(68,255,68,0.3);
}

.stepping-stone.unsafe {
    background: radial-gradient(circle, rgba(34,100,34,0.3) 0%, rgba(34,68,34,0.05) 70%);
    border: 2px solid rgba(34,100,34,0.3);
    animation: stoneFlicker 1.5s infinite;
}

.stepping-stone.active {
    animation: stonePulse 0.6s infinite;
    border-color: rgba(255,255,100,0.8);
    box-shadow: 0 0 25px rgba(255,255,100,0.5);
}

.stepping-stone.used {
    opacity: 0.15 !important;
    pointer-events: none;
    border-color: rgba(68,255,68,0.1);
}

.stepping-stone.sinking {
    animation: stoneSink 0.6s forwards;
}

@keyframes stoneAppear {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes stonePulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 15px rgba(255,255,100,0.4); }
    50% { transform: translate(-50%, -50%) scale(1.2); box-shadow: 0 0 30px rgba(255,255,100,0.8); }
}

@keyframes stoneFlicker {
    0%, 100% { opacity: 0.6; }
    30% { opacity: 0.2; }
    60% { opacity: 0.7; }
    80% { opacity: 0.3; }
}

@keyframes stoneSink {
    from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    to { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
}

/* ============================================================
   EPISODE 2 — INGREDIENTS (Draggable)
   ============================================================ */
.ingredient-item {
    position: absolute;
    z-index: 70;
    cursor: grab;
    touch-action: none;
    width: 70px;
    height: 70px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: rgba(20, 20, 30, 0.85);
    border: 2px solid rgba(100, 200, 100, 0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: transform 0.1s;
    animation: ingredientFloat 3s infinite ease-in-out alternate;
    pointer-events: auto;
}

.ingredient-item .ingredient-label {
    font-size: 9px;
    color: #88cc88;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
    font-weight: 700;
}

.ingredient-item:active,
.ingredient-item.dragging {
    cursor: grabbing;
    transform: scale(1.15);
    border-color: rgba(255, 200, 50, 0.6);
    box-shadow: 0 8px 25px rgba(255, 200, 50, 0.4);
    z-index: 200;
}

.ingredient-item.correct {
    border-color: rgba(255, 204, 68, 0.8);
    background: rgba(40, 40, 10, 0.9);
    animation: none;
    opacity: 0.5;
    pointer-events: none;
}

.ingredient-item.wrong {
    animation: ingredientShake 0.4s ease;
    border-color: rgba(255, 50, 50, 0.8);
}

@keyframes ingredientFloat {
    from { transform: translateY(0); }
    to { transform: translateY(-6px); }
}

@keyframes ingredientShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* Cauldron drop zone */
.cauldron-drop-zone {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 3px dashed rgba(68, 255, 68, 0.5);
    background: radial-gradient(circle, rgba(68,255,68,0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 5;
    animation: cauldronPulse 2s infinite;
}

@keyframes cauldronPulse {
    0%, 100% { border-color: rgba(68,255,68,0.3); box-shadow: 0 0 20px rgba(68,255,68,0.1); }
    50% { border-color: rgba(68,255,68,0.7); box-shadow: 0 0 40px rgba(68,255,68,0.3); }
}

/* Chase dodge warning */
.dodge-warning {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,255,0,0.6), transparent);
    border: 2px solid rgba(0,255,0,0.5);
    z-index: 75;
    animation: dodgeFlash 0.3s infinite alternate;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

@keyframes dodgeFlash {
    from { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
}

/* ============================================================
   KET DLC — SUSPICION METER
   ============================================================ */
.ket-suspicion-meter {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 80;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid rgba(255, 204, 0, 0.3);
    backdrop-filter: blur(6px);
}

.ket-mag-icon {
    font-size: 28px;
    transition: all 0.3s;
    filter: drop-shadow(0 0 6px rgba(255, 204, 0, 0.5));
}

.ket-mag-icon.shattered {
    filter: grayscale(1) opacity(0.3);
}

.ket-mag-icon.shattering {
    animation: ketShatter 0.6s ease-out;
}

@keyframes ketShatter {
    0% { transform: scale(1.5); filter: drop-shadow(0 0 12px red); }
    50% { transform: scale(0.5) rotate(30deg); }
    100% { transform: scale(1); filter: grayscale(1) opacity(0.3); }
}

/* ============================================================
   KET DLC — RED VIGNETTE FLASH
   ============================================================ */
.ket-red-vignette {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 95;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 0, 0, 0.5) 100%);
}

.ket-red-vignette.active { opacity: 1; }

/* ============================================================
   KET DLC — INVESTIGATE BUTTON
   ============================================================ */
.ket-investigate-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid rgba(255, 204, 0, 0.6);
    background: radial-gradient(circle, rgba(255, 170, 0, 0.3) 0%, rgba(200, 120, 0, 0.15) 80%);
    cursor: pointer;
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s, transform 0.3s;
    animation: ketInvestigatePulse 2s infinite;
    pointer-events: auto;
    touch-action: none;
    box-shadow: 0 0 30px rgba(255, 170, 0, 0.3);
}

.ket-investigate-btn.visible {
    opacity: 1;
    transform: scale(1);
}

.ket-investigate-btn:active {
    transform: scale(0.9);
    background: radial-gradient(circle, rgba(255, 204, 0, 0.5) 0%, rgba(200, 120, 0, 0.3) 80%);
}

.ket-invest-icon { font-size: 36px; }
.ket-invest-text {
    font-size: 9px;
    font-weight: 900;
    color: #ffcc00;
    text-transform: uppercase;
    letter-spacing: 2px;
}

@keyframes ketInvestigatePulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 170, 0, 0.2); border-color: rgba(255, 204, 0, 0.4); }
    50% { box-shadow: 0 0 40px rgba(255, 170, 0, 0.5); border-color: rgba(255, 204, 0, 0.8); }
}

/* ============================================================
   KET DLC — CLIPBOARD / QUIZ OVERLAY
   ============================================================ */
.ket-clipboard-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 120;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition: background 0.4s, backdrop-filter 0.4s;
    pointer-events: auto;
}

.ket-clipboard-overlay.active {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.ket-clipboard {
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    background: linear-gradient(135deg, #1a1520 0%, #0d0a14 100%);
    border: 2px solid rgba(255, 204, 0, 0.3);
    border-radius: 20px 20px 0 0;
    padding: 20px 24px 28px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
}

.ket-clipboard-overlay.active .ket-clipboard {
    transform: translateY(0);
}

.ket-clipboard-header {
    font-size: 14px;
    font-weight: 900;
    color: #ffcc00;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 16px;
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.4);
}

.ket-clipboard-prompt {
    font-size: 13px;
    color: #8899aa;
    text-align: center;
    margin-bottom: 8px;
    font-style: italic;
}

.ket-clipboard-question {
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
    color: #eeeedd;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.4;
}

.ket-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ket-option-btn {
    display: block;
    width: 100%;
    padding: 16px 20px;
    font-size: clamp(14px, 3.5vw, 18px);
    font-weight: 700;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: #ddd;
    text-align: left;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
    line-height: 1.3;
}

.ket-option-btn:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.12);
}

.ket-option-btn.correct {
    border-color: #44cc44;
    background: rgba(68, 204, 68, 0.2);
    color: #44ff44;
    box-shadow: 0 0 20px rgba(68, 204, 68, 0.3);
}

.ket-option-btn.wrong {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.2);
    color: #ff6666;
    animation: ketOptionShake 0.4s ease;
}

.ket-option-letter {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    background: rgba(255, 204, 0, 0.15);
    color: #ffcc00;
    font-size: 13px;
    font-weight: 900;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes ketOptionShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* ============================================================
   KET DLC — DETECTIVE HINT POPUP
   ============================================================ */
.ket-hint-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s;
    pointer-events: auto;
}

.ket-hint-overlay.active {
    background: rgba(0, 0, 0, 0.7);
}

.ket-hint-box {
    max-width: 400px;
    width: 85%;
    background: linear-gradient(135deg, #1a2030 0%, #0d1520 100%);
    border: 2px solid rgba(100, 180, 255, 0.4);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.ket-hint-overlay.active .ket-hint-box,
.ket-hint-overlay.active .ket-fridge-note {
    transform: scale(1);
    opacity: 1;
}

.ket-hint-header {
    font-size: 16px;
    font-weight: 900;
    color: #66aaff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.ket-hint-text {
    font-size: clamp(14px, 3.5vw, 17px);
    color: #ccddee;
    line-height: 1.5;
    margin-bottom: 16px;
}

.ket-hint-dismiss {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: rgba(100, 180, 255, 0.2);
    border: 2px solid rgba(100, 180, 255, 0.4);
    border-radius: 10px;
    color: #88ccff;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
}

.ket-hint-dismiss:active {
    transform: scale(0.95);
    background: rgba(100, 180, 255, 0.3);
}

/* ============================================================
   KET DLC — FRIDGE NOTE
   ============================================================ */
.ket-fridge-note {
    max-width: 380px;
    width: 85%;
    background: #ffffcc;
    border: none;
    border-radius: 4px;
    padding: 24px;
    text-align: left;
    transform: scale(0.8) rotate(-2deg);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.ket-hint-overlay.active .ket-fridge-note {
    transform: scale(1) rotate(-1deg);
}

.ket-fridge-note-header {
    font-size: 13px;
    font-weight: 900;
    color: #aa4400;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.ket-fridge-note-text {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
    font-family: 'Comic Sans MS', 'Inter', sans-serif;
}

/* ============================================================
   KET DLC — KEYCARD REWARD
   ============================================================ */
.ket-keycard-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 125;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s;
    pointer-events: none;
}

.ket-keycard-overlay.active {
    background: rgba(0, 0, 0, 0.5);
}

.ket-keycard-popup {
    text-align: center;
    transform: scale(0.5);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
}

.ket-keycard-overlay.active .ket-keycard-popup {
    transform: scale(1);
    opacity: 1;
}

.ket-keycard-visual {
    width: 80px;
    height: 50px;
    border-radius: 8px;
    margin: 0 auto 16px;
    animation: ketKeycardSpin 1.5s ease infinite;
}

.ket-keycard-label {
    font-size: 20px;
    font-weight: 900;
    color: #ffcc00;
    text-shadow: 0 0 12px rgba(255, 204, 0, 0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes ketKeycardSpin {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
}

/* ============================================================
   KET DLC — SUSPECT CARD (Deduction Board)
   ============================================================ */
.ket-suspect-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 125;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s;
    pointer-events: auto;
}

.ket-suspect-overlay.active {
    background: rgba(0, 0, 0, 0.7);
}

.ket-suspect-card {
    max-width: 380px;
    width: 88%;
    background: linear-gradient(135deg, #1a1820 0%, #12101a 100%);
    border: 2px solid rgba(255, 170, 0, 0.35);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
}

.ket-suspect-overlay.active .ket-suspect-card {
    transform: scale(1);
    opacity: 1;
}

.ket-suspect-icon {
    font-size: 42px;
    margin-bottom: 8px;
}

.ket-suspect-name {
    font-size: 22px;
    font-weight: 900;
    color: #ffcc00;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

.ket-suspect-room {
    font-size: 12px;
    color: #8899aa;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.ket-suspect-detail {
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.ket-suspect-alibi,
.ket-suspect-evidence,
.ket-suspect-grammar {
    font-size: 13px;
    color: #aabbcc;
    line-height: 1.5;
    margin-bottom: 6px;
}

.ket-suspect-alibi strong,
.ket-suspect-evidence strong,
.ket-suspect-grammar strong {
    color: #ffcc00;
}

.ket-suspect-review-btn {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: rgba(255, 170, 0, 0.15);
    border: 2px solid rgba(255, 170, 0, 0.4);
    border-radius: 12px;
    color: #ffcc00;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ket-suspect-review-btn:active {
    transform: scale(0.95);
    background: rgba(255, 170, 0, 0.25);
}

/* ============================================================
   KET DLC — INVENTORY
   ============================================================ */
.ket-inventory {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 6px;
    z-index: 75;
    pointer-events: none;
}

.ket-inv-card {
    width: 28px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   KET DLC — ROOM TITLE
   ============================================================ */
.ket-room-title {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 90;
    opacity: 0;
    transition: opacity 0.6s;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.4);
}

.ket-room-title.visible { opacity: 1; }

.ket-room-title h2 {
    font-family: Georgia, serif;
    font-size: clamp(22px, 6vw, 42px);
    font-weight: 900;
    color: #ffcc00;
    text-shadow: 0 0 30px rgba(255, 204, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.8);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.ket-room-title p {
    font-size: clamp(12px, 3vw, 16px);
    color: #8899aa;
    margin-top: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ============================================================
   KET DLC — CAUGHT SCREEN
   ============================================================ */
.ket-caught-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.4s;
    pointer-events: auto;
}

.ket-caught-overlay.active {
    background: rgba(40, 0, 0, 0.85);
}

.ket-caught-content {
    text-align: center;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.4s, opacity 0.4s;
}

.ket-caught-overlay.active .ket-caught-content {
    transform: scale(1);
    opacity: 1;
}

.ket-caught-content h2 {
    font-size: 36px;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
    margin-bottom: 16px;
}

.ket-caught-content p {
    font-size: 16px;
    color: #ccaaaa;
    margin-bottom: 8px;
}

.ket-retry-btn {
    margin-top: 20px;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: rgba(255, 68, 68, 0.2);
    border: 2px solid rgba(255, 68, 68, 0.5);
    border-radius: 12px;
    color: #ff8888;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
}

.ket-retry-btn:active {
    transform: scale(0.95);
    background: rgba(255, 68, 68, 0.3);
}

/* ============================================================
   KET DLC — VICTORY / CASE CLOSED
   ============================================================ */
.ket-victory-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.5s;
    pointer-events: auto;
    overflow-y: auto;
}

.ket-victory-overlay.active {
    background: rgba(0, 5, 15, 0.92);
}

.ket-victory-content {
    max-width: 450px;
    width: 90%;
    text-align: center;
    padding: 24px 20px;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ket-victory-overlay.active .ket-victory-content {
    transform: scale(1);
    opacity: 1;
}

.ket-victory-content h1 {
    font-family: Georgia, serif;
    font-size: clamp(28px, 7vw, 48px);
    color: #ffcc00;
    text-shadow: 0 0 30px rgba(255, 204, 0, 0.5);
    letter-spacing: 4px;
    margin-bottom: 12px;
}

.ket-stars {
    font-size: 36px;
    margin-bottom: 20px;
    letter-spacing: 6px;
}

.ket-victory-stats p {
    font-size: 16px;
    color: #aabbcc;
    margin: 4px 0;
}

.ket-victory-breakdown,
.ket-victory-errors {
    text-align: left;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ket-victory-breakdown h3,
.ket-victory-errors h3 {
    font-size: 13px;
    color: #ffcc00;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.ket-victory-breakdown ul,
.ket-victory-errors ul {
    list-style: none;
    padding: 0;
}

.ket-victory-breakdown li,
.ket-victory-errors li {
    font-size: 14px;
    color: #aabbcc;
    padding: 3px 0;
}

.ket-perfect {
    font-size: 18px;
    color: #44ff44;
    margin-top: 16px;
    text-shadow: 0 0 10px rgba(68, 255, 68, 0.3);
}

.ket-finish-btn {
    margin-top: 20px;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: rgba(255, 204, 0, 0.15);
    border: 2px solid rgba(255, 204, 0, 0.4);
    border-radius: 12px;
    color: #ffcc00;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
}

.ket-finish-btn:active {
    transform: scale(0.95);
    background: rgba(255, 204, 0, 0.25);
}

/* ============================================================
   KET DLC — JOYSTICK
   ============================================================ */
.ket-joystick-zone {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 140px;
    height: 140px;
    z-index: 80;
    pointer-events: auto;
    touch-action: none;
}

.ket-joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    position: relative;
    margin: 10px;
}

.ket-joystick-thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 204, 0, 0.4), rgba(255, 170, 0, 0.15));
    border: 2px solid rgba(255, 204, 0, 0.5);
    pointer-events: none;
}

/* ============================================================
   KET DLC — POI LABELS
   ============================================================ */
.ket-poi-label {
    position: absolute;
    font-size: 11px;
    font-weight: 700;
    color: #ffdd44;
    text-shadow: 0 0 8px rgba(255, 221, 68, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 55;
    animation: labelFloat 2s infinite alternate ease-in-out;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .speech-bubble { max-width: 85vw; padding: 8px 12px; }
    #prompt-banner { padding: 10px 20px; font-size: clamp(13px, 4vw, 18px); }
    .drag-log { width: 64px; height: 24px; }
    .episode-btn { width: 240px; padding: 14px 20px; }
    .ingredient-item { width: 56px; height: 56px; font-size: 22px; }
    .stepping-stone { width: 50px; height: 50px; }

    /* KET responsive */
    .ket-investigate-btn { width: 80px; height: 80px; bottom: 16px; right: 16px; }
    .ket-invest-icon { font-size: 28px; }
    .ket-invest-text { font-size: 8px; }
    .ket-joystick-zone { width: 120px; height: 120px; }
    .ket-joystick-base { width: 100px; height: 100px; }
    .ket-joystick-thumb { width: 40px; height: 40px; }
    .ket-clipboard { padding: 16px 18px 24px; }
    .ket-option-btn { padding: 14px 16px; }
    .ket-suspicion-meter { top: 10px; padding: 6px 12px; }
    .ket-mag-icon { font-size: 22px; }
}

/* ============================================================
   KET — Difficulty Selector
   ============================================================ */

.ket-difficulty-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 100%);
    border: 2px solid #4a3a22;
    border-radius: 16px;
    padding: 30px 24px;
    max-width: 460px;
    width: 90vw;
    text-align: center;
    box-shadow: 0 0 40px rgba(100, 80, 40, 0.3);
}

.ket-difficulty-title {
    font-family: 'Palatino Linotype', 'Georgia', serif;
    color: #ffdd88;
    font-size: 24px;
    margin-bottom: 6px;
    text-shadow: 0 0 10px rgba(255, 200, 100, 0.4);
}

.ket-difficulty-sub {
    color: #aaa;
    font-size: 13px;
    margin-bottom: 20px;
}

.ket-difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ket-diff-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    border: 2px solid #333;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #eee;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ket-diff-btn:hover, .ket-diff-btn:active {
    transform: scale(1.03);
}

.ket-diff-easy { border-color: #4488ff; }
.ket-diff-easy:hover { background: rgba(68, 136, 255, 0.15); box-shadow: 0 0 16px rgba(68, 136, 255, 0.3); }

.ket-diff-normal { border-color: #ffaa33; }
.ket-diff-normal:hover { background: rgba(255, 170, 51, 0.15); box-shadow: 0 0 16px rgba(255, 170, 51, 0.3); }

.ket-diff-hard { border-color: #ff4444; }
.ket-diff-hard:hover { background: rgba(255, 68, 68, 0.15); box-shadow: 0 0 16px rgba(255, 68, 68, 0.3); }

.ket-diff-icon {
    font-size: 20px;
    letter-spacing: 4px;
}

.ket-diff-name {
    font-size: 17px;
    font-weight: bold;
    color: #ffdd88;
}

.ket-diff-desc {
    font-size: 11px;
    color: #999;
}

/* ============================================================
   KET — Notebook Button
   ============================================================ */

.ket-notebook-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #2a2a1a 0%, #1a1a0e 100%);
    border: 2px solid #665522;
    border-radius: 10px;
    color: #ffdd88;
    font-family: 'Palatino Linotype', 'Georgia', serif;
    font-size: 13px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 20;
    box-shadow: 0 2px 12px rgba(100, 80, 40, 0.3);
}

.ket-notebook-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.ket-notebook-btn:hover {
    background: linear-gradient(135deg, #3a3a2a 0%, #2a2a1e 100%);
    box-shadow: 0 0 16px rgba(255, 200, 100, 0.3);
}

.ket-notebook-icon { font-size: 18px; }

/* ============================================================
   KET — Notebook Overlay
   ============================================================ */

.ket-notebook {
    background: linear-gradient(135deg, #1e1e10 0%, #12120a 100%);
    border: 2px solid #665522;
    border-radius: 16px;
    padding: 0;
    max-width: 520px;
    width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(100, 80, 40, 0.3);
}

.ket-notebook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 10px;
    border-bottom: 1px solid #4a3a22;
}

.ket-notebook-header h2 {
    font-family: 'Palatino Linotype', 'Georgia', serif;
    color: #ffdd88;
    font-size: 20px;
    text-shadow: 0 0 8px rgba(255, 200, 100, 0.3);
}

.ket-nb-difficulty {
    background: rgba(255, 200, 100, 0.15);
    color: #ffcc66;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
}

.ket-nb-tabs {
    display: flex;
    border-bottom: 1px solid #333;
    background: rgba(0, 0, 0, 0.2);
}

.ket-nb-tab {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.ket-nb-tab.active {
    color: #ffdd88;
    border-bottom-color: #ffaa33;
    background: rgba(255, 200, 100, 0.06);
}

.ket-nb-tab:hover { color: #ddd; }

.ket-nb-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: 50vh;
}

.ket-nb-empty {
    color: #777;
    font-style: italic;
    text-align: center;
    padding: 30px 10px;
    font-size: 14px;
}

.ket-nb-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(100, 80, 40, 0.15);
    color: #ddd;
    font-size: 13px;
}

.ket-nb-entry:last-child { border-bottom: none; }

.ket-nb-bullet {
    font-size: 16px;
    flex-shrink: 0;
}

.ket-nb-entry strong {
    color: #ffdd88;
}

.ket-nb-detail {
    width: 100%;
    color: #aaa;
    font-size: 12px;
    padding-left: 26px;
    margin-top: 2px;
}

.ket-nb-room {
    margin-left: auto;
    font-size: 10px;
    color: #888;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.ket-nb-suspect {
    flex-direction: column;
}

.ket-notebook .ket-hint-dismiss {
    margin: 12px 20px 16px;
    align-self: center;
}

/* ============================================================
   KET — Responsive: Difficulty & Notebook
   ============================================================ */

@media (max-width: 480px) {
    .ket-difficulty-card { padding: 20px 16px; }
    .ket-difficulty-title { font-size: 20px; }
    .ket-diff-btn { padding: 12px 14px; }
    .ket-diff-name { font-size: 15px; }
    .ket-notebook { max-height: 85vh; }
    .ket-nb-body { padding: 12px 14px; }
    .ket-notebook-btn { top: 10px; right: 10px; padding: 8px 12px; font-size: 11px; }
}

/* ============================================================
   KET — Word Mini-Games
   ============================================================ */

.ket-minigame-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 100%);
    border: 2px solid #4a3a22;
    border-radius: 16px;
    padding: 24px;
    max-width: 420px;
    width: 90vw;
    text-align: center;
    box-shadow: 0 0 40px rgba(100, 80, 40, 0.3);
}

.ket-mg-title {
    font-family: 'Palatino Linotype', 'Georgia', serif;
    color: #ffdd88;
    font-size: 20px;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(255, 200, 100, 0.3);
}

.ket-mg-hint {
    color: #aaa;
    font-size: 13px;
    font-style: italic;
    margin-bottom: 16px;
    padding: 8px;
    background: rgba(255, 200, 100, 0.06);
    border-radius: 8px;
}

/* Unscramble: Answer slots */
.ket-mg-answer-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
    padding: 10px;
}

.ket-mg-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 42px;
    border-bottom: 3px solid #555;
    color: #888;
    font-size: 22px;
    font-family: monospace;
    font-weight: bold;
    transition: all 0.2s;
}

.ket-mg-slot.filled {
    color: #ffdd88;
    border-bottom-color: #ffaa33;
}

.ket-mg-answer-row.ket-mg-success .ket-mg-slot {
    color: #44ff88;
    border-bottom-color: #44ff88;
    animation: ket-mg-pop 0.3s ease;
}

@keyframes ket-mg-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Unscramble: Letter buttons */
.ket-mg-letter-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
}

.ket-mg-letter {
    width: 44px;
    height: 48px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid #555;
    border-radius: 8px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.15s;
}

.ket-mg-letter:hover, .ket-mg-letter:active {
    background: rgba(255, 200, 100, 0.15);
    border-color: #ffaa33;
    transform: scale(1.08);
}

.ket-mg-letter.used {
    opacity: 0.3;
    transform: scale(0.9);
    pointer-events: none;
}

.ket-mg-letter.used.correct {
    background: rgba(68, 255, 136, 0.15);
    border-color: #44ff88;
    opacity: 0.5;
}

.ket-mg-letter.wrong {
    background: rgba(255, 68, 68, 0.3);
    border-color: #ff4444;
    animation: ket-mg-shake 0.3s;
}

@keyframes ket-mg-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.ket-mg-reset {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #444;
    border-radius: 8px;
    color: #aaa;
    padding: 8px 20px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.ket-mg-reset:hover { color: #fff; border-color: #888; }

/* Word Match: word display */
.ket-mg-word-display {
    font-family: 'Palatino Linotype', 'Georgia', serif;
    color: #ffdd88;
    font-size: 28px;
    font-weight: bold;
    margin: 12px 0 20px;
    text-shadow: 0 0 12px rgba(255, 200, 100, 0.4);
}

/* Word Match: option buttons */
.ket-mg-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ket-mg-option {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #444;
    border-radius: 10px;
    color: #ddd;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.ket-mg-option:hover {
    background: rgba(255, 200, 100, 0.1);
    border-color: #888;
}

.ket-mg-option.correct {
    background: rgba(68, 255, 136, 0.15);
    border-color: #44ff88;
    color: #44ff88;
}

.ket-mg-option.wrong {
    background: rgba(255, 68, 68, 0.1);
    border-color: #ff4444;
    color: #ff4444;
    opacity: 0.5;
}

.ket-mg-option:disabled {
    pointer-events: none;
}

/* Responsive mini-games */
@media (max-width: 480px) {
    .ket-minigame-card { padding: 18px 16px; }
    .ket-mg-title { font-size: 17px; }
    .ket-mg-letter { width: 38px; height: 42px; font-size: 18px; }
    .ket-mg-slot { width: 30px; height: 36px; font-size: 18px; }
    .ket-mg-word-display { font-size: 24px; }
    .ket-mg-option { padding: 10px 14px; font-size: 13px; }
}

/* ============================================================
   NAME ENTRY (first-run modal)
   ============================================================ */
.wh-name-overlay {
    position: fixed; inset: 0;
    z-index: 400;
    background: radial-gradient(ellipse at center, #15152e 0%, #050510 80%);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    -webkit-tap-highlight-color: transparent;
}
.wh-name-overlay.active { opacity: 1; }
.wh-name-card {
    width: min(420px, 92vw);
    background: linear-gradient(180deg, #1f1f3a 0%, #14142a 100%);
    border: 2px solid rgba(255, 102, 51, 0.4);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
}
.wh-name-card h2 {
    font-family: Georgia, serif;
    font-size: 22px;
    color: #ff8855;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.wh-name-card p {
    color: #aab; font-size: 14px; margin-bottom: 14px;
}
.wh-name-card .wh-name-teacher {
    margin-top: 14px; margin-bottom: 6px;
    color: #99a; font-size: 13px;
}
.wh-name-card .wh-optional { color: #667; font-style: italic; }
.wh-name-card input {
    width: 100%;
    padding: 14px 16px;
    font-size: 17px;
    background: #0a0a18;
    border: 2px solid #333;
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}
.wh-name-card input:focus { border-color: #ff6633; }
.wh-name-error {
    color: #ff6644;
    font-size: 13px;
    min-height: 18px;
    margin: 8px 0 12px 0;
}
.wh-name-submit {
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #050510;
    background: linear-gradient(180deg, #ffaa44, #ff6633);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 102, 51, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.wh-name-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(255, 102, 51, 0.5); }
.wh-name-submit:active { transform: scale(0.97); }
.wh-name-submit:disabled { opacity: 0.6; cursor: wait; }

/* ============================================================
   HUD (player name + lives + score)
   ============================================================ */
.wh-hud {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 50;
    background: rgba(10, 10, 24, 0.78);
    border: 1.5px solid rgba(255, 102, 51, 0.35);
    border-radius: 12px;
    padding: 8px 12px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    backdrop-filter: blur(6px);
    pointer-events: none;
    user-select: none;
    min-width: 140px;
    text-align: right;
}
.wh-hud-name {
    font-size: 13px;
    font-weight: 700;
    color: #ff9966;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.wh-hud-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.wh-hud-lives {
    font-size: 16px;
    color: #ff5577;
    letter-spacing: 1px;
}
.wh-hud-score {
    font-size: 14px;
    font-weight: 800;
    color: #ffd24a;
}

/* ============================================================
   QUESTION COUNTDOWN TIMER
   ============================================================ */
.wh-qtimer {
    position: absolute;
    top: 12px; left: 50%;
    transform: translateX(-50%) translateY(-12px);
    width: min(360px, 70vw);
    height: 22px;
    background: rgba(10, 10, 24, 0.85);
    border: 1.5px solid rgba(255, 204, 68, 0.5);
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s, border-color 0.25s;
    z-index: 60;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.wh-qtimer.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.wh-qtimer-fill {
    position: absolute; inset: 0;
    width: 100%;
    background: linear-gradient(90deg, #44cc66, #ffcc44);
    transition: background 0.3s;
    transform-origin: left;
}
.wh-qtimer.warn { border-color: #ff7744; }
.wh-qtimer.warn .wh-qtimer-fill { background: linear-gradient(90deg, #ff7744, #ffaa55); }
.wh-qtimer.panic { border-color: #ff4455; animation: wh-qtimer-shake 0.18s linear infinite; }
.wh-qtimer.panic .wh-qtimer-fill { background: linear-gradient(90deg, #ff3344, #ff5566); }
.wh-qtimer-label {
    position: relative;
    z-index: 2;
    text-align: center;
    line-height: 22px;
    font-size: 13px;
    font-weight: 800;
    color: #050510;
    letter-spacing: 1px;
    mix-blend-mode: screen;
}
@keyframes wh-qtimer-shake {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    25%      { transform: translateX(-50%) translateY(0) translate(-2px, 0); }
    75%      { transform: translateX(-50%) translateY(0) translate(2px, 0); }
}

/* ============================================================
   SENTENCE-JUMBLE DRAG PUZZLE
   ============================================================ */
.wh-jumble-card {
    width: min(620px, 92vw);
    max-width: 620px;
}
.wh-jumble-slots {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
    padding: 14px 8px;
    margin: 14px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    min-height: 64px;
}
.wh-jumble-slot {
    min-width: 60px;
    min-height: 44px;
    padding: 8px 10px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
.wh-jumble-slot.correct { border-color: #44cc44; background: rgba(68, 204, 68, 0.18); }
.wh-jumble-slot.wrong   { border-color: #ff5566; background: rgba(255, 85, 102, 0.18); animation: wh-shake 0.4s; }
.wh-jumble-slot.reveal  { border-color: #ffcc44; background: rgba(255, 204, 68, 0.15); }
.wh-jumble-tray {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
    padding: 16px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    min-height: 64px;
}
.wh-jumble-tile {
    padding: 10px 16px;
    min-height: 44px;
    background: linear-gradient(180deg, #4a72d6, #3656a8);
    color: #fff;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 700;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: transform 0.1s, box-shadow 0.15s;
}
.wh-jumble-tile.dragging {
    cursor: grabbing;
    transform: scale(1.08);
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    pointer-events: none;
}
@keyframes wh-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
@media (max-width: 600px) {
    .wh-jumble-tile { padding: 8px 12px; font-size: 15px; }
    .wh-jumble-slot { min-width: 50px; }
}

/* ============================================================
   UNIT 5 — three-bucket sort, reading panel, radio panel
   ============================================================ */
.wh-bucket-row {
    display: flex; gap: 14px; justify-content: stretch;
    margin-top: 14px; flex-wrap: wrap;
}
.wh-bucket-zone {
    flex: 1 1 180px;
    min-height: 140px;
    border: 2px dashed rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
    padding: 12px;
    transition: background 0.2s, border-color 0.2s;
}
.wh-bucket-zone h3 {
    font-size: 13px;
    text-transform: uppercase;
    color: #ffcc44;
    margin: 0 0 10px 0;
    text-align: center;
    letter-spacing: 1px;
}
.wh-bucket-zone.hover { border-color: #ffcc44; background: rgba(255, 204, 68, 0.12); }
.wh-bucket-zone .wh-jumble-tile {
    display: inline-block;
    margin: 4px 4px 0 0;
}
.wh-jumble-tile.placed { background: linear-gradient(180deg, #44cc66, #2d8a44); cursor: default; }
.wh-jumble-tile.wrong  { background: linear-gradient(180deg, #ff5566, #aa2233); animation: wh-shake 0.4s; }

.wh-reading-card {
    background: linear-gradient(180deg, #fff8e0 0%, #ffeac2 100%);
    color: #2a1a08;
    border: 4px double #8a6020;
}
.wh-reading-title {
    font-family: Georgia, 'Times New Roman', serif;
    color: #5a2a08;
    margin: 0 0 12px 0;
    text-align: center;
    font-size: 22px;
}
.wh-reading-para {
    font-size: 15px;
    line-height: 1.55;
    margin-bottom: 12px;
    color: #2a1a08;
}

.wh-radio-card {
    background: linear-gradient(180deg, #1a2a40 0%, #0a1830 100%);
    color: #fff;
    border: 3px solid #4488cc;
    text-align: center;
}
.wh-radio-icon {
    font-size: 56px;
    margin-bottom: 4px;
    animation: wh-radio-pulse 1.2s ease-in-out infinite;
}
.wh-radio-prompt {
    font-size: 15px;
    color: #88bbff;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.wh-radio-passage {
    font-style: italic;
    font-size: 17px;
    line-height: 1.55;
    color: #e8f0ff;
    background: rgba(0,0,0,0.35);
    padding: 14px;
    border-radius: 10px;
}
@keyframes wh-radio-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

/* ============================================================
   UNIT 5 — Cloze conversation
   ============================================================ */
.wh-cloze-card { max-width: 640px; }
.wh-cloze-dialogue {
    background: rgba(255, 248, 220, 0.95);
    color: #2a1a08;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 10px 0;
    line-height: 1.7;
    font-size: 15px;
}
.wh-cloze-line { margin: 6px 0; }
.wh-cloze-line strong { color: #6a3010; }
.wh-cloze-slot {
    display: inline-block;
    min-width: 80px;
    padding: 2px 8px;
    margin: 0 2px;
    background: #fff;
    border-bottom: 2px solid #888;
    border-radius: 4px;
    color: #1a1a1a;
    font-weight: 700;
    font-style: italic;
    text-align: center;
}
.wh-cloze-slot.correct { background: #ccf3d2; border-color: #44aa66; color: #1a4a20; }
.wh-cloze-slot.wrong   { background: #f3ccd2; border-color: #cc4444; color: #4a1010; }
.wh-cloze-bank {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.wh-cloze-tile {
    padding: 8px 14px;
    background: #4488cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.wh-cloze-tile.used { background: #555; opacity: 0.4; cursor: default; }

/* ============================================================
   UNIT 5 — Schwa tapper
   ============================================================ */
.wh-schwa-row {
    display: flex; flex-wrap: wrap; gap: 6px;
    background: rgba(255, 248, 220, 0.95);
    color: #2a1a08;
    padding: 14px;
    border-radius: 10px;
    margin: 10px 0;
    justify-content: center;
}
.wh-schwa-tile {
    padding: 10px 14px;
    background: #fff;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 18px;
    border: 2px solid #aaa;
    border-radius: 8px;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.wh-schwa-tile:hover { background: #e8e8f0; transform: translateY(-1px); }
.wh-schwa-tile.correct { background: #44aa66; color: #fff; border-color: #2d8a44; }
.wh-schwa-tile.wrong   { background: #cc4444; color: #fff; animation: wh-shake 0.4s; }
.wh-schwa-tile.non-tappable { opacity: 0.6; cursor: not-allowed; }
@keyframes wh-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* ============================================================
   UNIT 5 — Email writer
   ============================================================ */
.wh-writer-card {
    background: linear-gradient(180deg, #fff 0%, #f0f2f8 100%);
    color: #1a1a1a;
}
.wh-writer-card .ket-clipboard-header { color: #2a4a8a; }
.wh-writer-card .ket-clipboard-prompt { color: #2a2a2a; font-weight: 600; }
.wh-writer-field {
    margin: 12px 0;
}
.wh-writer-field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #2a4a8a;
    margin-bottom: 6px;
}
.wh-writer-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.5;
    border: 2px solid #aac;
    border-radius: 8px;
    color: #1a1a1a;
    font-family: inherit;
    resize: vertical;
    -webkit-appearance: none;
}
.wh-writer-field textarea:focus { border-color: #4488cc; outline: none; }
.wh-writer-signoff {
    text-align: right;
    font-style: italic;
    color: #555;
    margin-top: 8px;
}

/* ============================================================
   LONDON NPC SPEECH BUBBLES
   ============================================================ */
.wh-npc-bubble {
    position: absolute;
    transform: translate(-50%, -100%);
    background: rgba(255, 252, 240, 0.95);
    color: #1a1a1a;
    padding: 8px 12px;
    border-radius: 12px;
    border: 2px solid #444;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    max-width: 240px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 25;
    transition: opacity 0.5s, transform 0.5s;
    animation: wh-npc-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.wh-npc-bubble strong {
    display: block;
    color: #aa3322;
    font-size: 11px;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wh-npc-bubble.fading { opacity: 0; transform: translate(-50%, -120%); }
.wh-npc-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px; left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(255, 252, 240, 0.95);
}
@keyframes wh-npc-pop {
    0%   { transform: translate(-50%, -90%) scale(0.6); opacity: 0; }
    100% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}

/* ============================================================
   iOS / iPad touch fixes
   ============================================================ */
button, .episode-btn, .ket-option-btn, .wh-name-submit {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
@supports (-webkit-touch-callout: none) {
    /* iOS-only — ensure overlays don't cover the canvas raycast targets */
    #game-ui { pointer-events: none; }
    #game-ui > * { pointer-events: auto; }
    #fade-overlay { pointer-events: none; }
}

