:root {
    --bg1: #2a1a2e;
    --bg2: #3e1e2e;
    --bg3: #4a1f3a;
    --accent: #d67c9c;
    --accent-light: #e092b0;
    --border: #8b4f6b;
    --text: #ffffff;
    --text2: #e0c5d0;
    --panel: rgba(30, 20, 36, 0.88);
    --e: #2fae5f;
    --v: #3b7ddd;
    --a: #f08a24;
    --s: #14a3a3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3));
    color: var(--text);
    user-select: none;
    -webkit-user-select: none;
}

#app { position: fixed; inset: 0; }
#app canvas { display: block; width: 100%; height: 100%; outline: none; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
.hud-top {
    position: fixed;
    top: 12px; left: 12px; right: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    z-index: 10;
}
.hud-title {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 6px 14px;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.progress {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}
.chip {
    background: var(--panel);
    border: 2px solid #5a3a4c;
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 13px;
    color: #9d8592;
    white-space: nowrap;
    transition: all 0.3s;
}
.chip.active { border-color: var(--accent); color: #fff; transform: scale(1.08); box-shadow: 0 0 12px rgba(214,124,156,0.6); }
.chip.done { border-color: var(--e); color: #bfe9cf; }
.chip.done::after { content: ' ✓'; }

.round-btn {
    pointer-events: auto;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    background: var(--panel);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.round-btn:hover { transform: scale(1.1); background: var(--bg3); }
.round-btn.pulse { animation: pulse 1.2s infinite; }

.look-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9;
    background: var(--panel);
    border: 2px solid var(--border);
    color: #fff;
    border-radius: 14px;
    padding: 12px 8px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.75;
    transition: opacity 0.2s, transform 0.2s;
}
.look-btn span { font-size: 11px; }
.look-btn:hover { opacity: 1; }
.look-left { left: 8px; }
.look-right { right: 8px; }
.look-btn.pulse { animation: pulseLook 1.1s infinite; opacity: 1; border-color: var(--accent); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(214,124,156,0.7); }
    50% { box-shadow: 0 0 0 12px rgba(214,124,156,0); }
}
@keyframes pulseLook {
    0%, 100% { box-shadow: 0 0 0 0 rgba(214,124,156,0.8); }
    50% { box-shadow: 0 0 0 14px rgba(214,124,156,0); }
}

/* Byte */
.byte-panel {
    position: fixed;
    left: 14px;
    bottom: 30px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: min(560px, calc(100vw - 28px));
    z-index: 10;
    pointer-events: none;
}
.byte-circle {
    width: 84px; height: 84px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.byte-circle img { height: 88%; image-rendering: pixelated; }
.byte-circle.big { width: 120px; height: 120px; margin: 0 auto 10px; }
.byte-panel.bounce .byte-circle { animation: bounce 0.6s ease; }
@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-14px) scale(1.08); }
    70% { transform: translateY(0) scale(0.97); }
}
.byte-bubble {
    position: relative;
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 10px 14px;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}
.byte-bubble::before {
    content: '';
    position: absolute;
    left: -10px; bottom: 24px;
    border-width: 8px 10px 8px 0;
    border-style: solid;
    border-color: transparent var(--border) transparent transparent;
}
.byte-bubble h3 { color: var(--accent-light); font-size: 16px; margin-bottom: 4px; }
.byte-bubble p { color: var(--text2); font-size: 14.5px; line-height: 1.4; }
.byte-bubble p b { color: #fff; }
.next-btn {
    margin-top: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 7px 16px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    animation: pulse 1.4s infinite;
}
.next-btn:hover { background: var(--accent-light); }

.controls-hint {
    position: fixed;
    right: 14px;
    bottom: 30px;
    background: var(--panel);
    border: 1px solid #5a3a4c;
    border-radius: 10px;
    padding: 7px 11px;
    font-size: 12.5px;
    color: var(--text2);
    line-height: 1.55;
    z-index: 10;
    max-width: 300px;
    pointer-events: none;
}
.controls-hint b { color: #fff; }

/* EVA-Karte */
.eva-card {
    position: fixed;
    top: 64px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 8px 12px;
    z-index: 10;
    animation: popIn 0.4s ease;
    pointer-events: none;
}
@keyframes popIn {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.eva-step { border-radius: 10px; padding: 5px 10px; text-align: center; min-width: 96px; }
.eva-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; }
.eva-dev { font-size: 15px; font-weight: 700; }
.eva-e { background: var(--e); }
.eva-v { background: var(--v); }
.eva-a { background: var(--a); }
.eva-s { background: var(--s); }
.eva-card.no-s .eva-s-part { display: none; }
.eva-arrow { font-size: 20px; color: var(--accent-light); }

/* Tooltip & Toast */
.tooltip {
    position: fixed;
    z-index: 20;
    background: rgba(20, 12, 24, 0.9);
    border: 1px solid var(--accent);
    color: #fff;
    font-size: 13px;
    padding: 4px 9px;
    border-radius: 8px;
    pointer-events: none;
    white-space: nowrap;
}
.toast {
    position: fixed;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--panel);
    border: 3px solid var(--accent);
    padding: 12px 22px;
    border-radius: 16px;
    font-size: 22px;
    font-weight: 700;
    z-index: 25;
    pointer-events: none;
    animation: toastIn 0.3s ease;
    text-align: center;
}
.toast.good { border-color: var(--e); }
.toast.bad { border-color: #e74c3c; }
@keyframes toastIn {
    from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Overlays */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 14, 30, 0.78);
    backdrop-filter: blur(6px);
    padding: 16px;
    overflow-y: auto;
}
.start-card, .end-card {
    background: linear-gradient(160deg, #2d1f35, #3e1e2e);
    border: 3px solid var(--border);
    border-radius: 22px;
    padding: 26px 30px;
    max-width: 640px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.start-card h1, .end-card h1 { font-size: 34px; color: var(--accent-light); margin-bottom: 4px; }
.subtitle { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.c-e { color: #6fdc98; } .c-v { color: #7fb0f5; } .c-a { color: #ffb066; } .c-s { color: #5fd6d6; }
.start-card p, .end-card p { color: var(--text2); line-height: 1.5; margin: 8px 0; }
.howto {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 16px 0;
    text-align: left;
    font-size: 14px;
    color: var(--text2);
}
.howto .key {
    display: inline-block;
    background: #1e1e2e;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 7px;
    margin-right: 4px;
    color: #fff;
    font-weight: 600;
}
.start-btn {
    background: linear-gradient(135deg, var(--accent), #b85c7c);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 14px 40px;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 6px 20px rgba(214,124,156,0.4);
    transition: transform 0.15s;
}
.start-btn:hover { transform: scale(1.05); }
.start-btn:disabled { opacity: 0.5; cursor: wait; }
.small { font-size: 12.5px; opacity: 0.8; }

.end-boxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.end-box { border-radius: 12px; padding: 10px; text-align: left; }
.end-box h3 { font-size: 16px; margin-bottom: 6px; text-align: center; }
.end-box ul { list-style: none; font-size: 14px; line-height: 1.6; }

.impressum {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    text-align: center;
    font-size: 11px;
    color: rgba(224,197,208,0.7);
    padding: 4px;
    z-index: 5;
    background: rgba(20,10,20,0.5);
}
.impressum a { color: var(--accent-light); text-decoration: none; margin: 0 4px; }

@media (max-width: 760px) {
    .howto { grid-template-columns: 1fr; }
    .end-boxes { grid-template-columns: 1fr 1fr; }
    .controls-hint { display: none; }
    .eva-step { min-width: 80px; padding: 4px 6px; }
    .eva-dev { font-size: 12px; }
    .hud-title { display: none; }
}

/* Die Fingerspitze der 3D-Hand ist der Zeiger */
canvas.hand-cursor { cursor: none; }
