:root {
    --matrix: #00ff41;
    --matrix-dim: #003b00;
    --matrix-bright: #39ff14;
    --matrix-glow: rgba(0, 255, 65, 0.3);
    --dark-0: #000000;
    --dark-1: #0a0a0a;
    --dark-2: #111;
    --white: #e0e0e0;
    --gray: #555;
    --red: #ff2020;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { touch-action: manipulation; }

body {
    background: var(--dark-0);
    color: var(--matrix);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ---- Help Button & Modal ---- */
.help-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 200;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0,255,65,0.2);
    background: rgba(0,0,0,0.6);
    color: var(--matrix);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.help-btn:hover, .help-btn:active {
    opacity: 0.8;
}

.help-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.help-modal.open {
    display: flex;
}

.help-content {
    background: #0a0a0a;
    border: 1px solid rgba(0,255,65,0.2);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 340px;
    width: 100%;
    position: relative;
}

.help-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: var(--gray);
    font-size: 24px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.help-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.3rem;
    color: var(--matrix);
    letter-spacing: 3px;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px var(--matrix-glow);
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.help-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.help-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,255,65,0.1);
    border: 1px solid rgba(0,255,65,0.3);
    color: var(--matrix);
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.help-step strong {
    color: var(--white);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.2rem;
}

.help-step p {
    color: var(--gray);
    font-size: 0.8rem;
    line-height: 1.4;
}

.help-icon {
    font-size: 0.9rem;
}

.help-step em {
    color: var(--matrix);
    font-style: normal;
}

.help-note {
    color: var(--gray);
    font-size: 0.7rem;
    text-align: center;
    letter-spacing: 0.5px;
}

/* ---- PIN Screen ---- */
.pin-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--dark-0);
    gap: 1rem;
}

.pin-logo { margin-bottom: 0.5rem; }

.pin-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.4rem;
    letter-spacing: 6px;
    color: var(--matrix);
    line-height: 1;
    text-shadow: 0 0 20px var(--matrix-glow);
}

.pin-title-accent {
    color: var(--matrix-bright);
}

/* Terminal display box */
.terminal-box {
    background: rgba(0, 255, 65, 0.03);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    margin-top: 0.5rem;
    min-width: 260px;
    text-align: center;
}

.terminal-prompt {
    font-family: monospace;
    font-size: 0.65rem;
    color: var(--matrix);
    opacity: 0.4;
    letter-spacing: 3px;
    margin-bottom: 0.5rem;
}

.terminal-cursor {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.terminal-digits {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
}

.term-digit {
    width: 32px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--matrix);
    text-shadow: 0 0 12px var(--matrix-glow);
    border-bottom: 2px solid var(--matrix-dim);
    transition: all 0.15s ease;
}

.term-digit.filled {
    border-bottom-color: var(--matrix);
    text-shadow: 0 0 20px var(--matrix-glow), 0 0 40px rgba(0,255,65,0.15);
}

.term-digit.just-typed {
    transform: scale(1.15);
    text-shadow: 0 0 25px var(--matrix-glow), 0 0 50px rgba(0,255,65,0.3);
}

/* Numpad */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
    width: 260px;
}

.num-key {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 65, 0.04);
    border: 1px solid rgba(0, 255, 65, 0.12);
    border-radius: 8px;
    color: var(--matrix);
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.num-key:active {
    background: rgba(0, 255, 65, 0.15);
    border-color: var(--matrix);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
    transform: scale(0.95);
}

.num-key-empty {
    visibility: hidden;
}

.num-key-del {
    color: var(--gray);
    font-size: 1rem;
}

.num-key-del:active {
    color: var(--red);
    border-color: var(--red);
    background: rgba(255, 32, 32, 0.1);
    box-shadow: 0 0 15px rgba(255, 32, 32, 0.15);
}

.pin-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    font-size: 16px;
    pointer-events: none;
}

.pin-error {
    font-size: 0.8rem;
    color: var(--red);
    min-height: 1.2em;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
    text-shadow: 0 0 10px rgba(255, 32, 32, 0.3);
}

.pin-screen.shake .terminal-box {
    animation: shake 0.5s ease;
}

.pin-screen.shake .term-digit {
    border-bottom-color: var(--red);
    color: var(--red);
    text-shadow: 0 0 12px rgba(255, 32, 32, 0.4);
}

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

.pin-screen.success .term-digit.filled {
    color: var(--matrix-bright);
    border-bottom-color: var(--matrix-bright);
    text-shadow: 0 0 20px var(--matrix-glow), 0 0 40px rgba(0,255,65,0.3);
}

/* ---- Main Screen ---- */
.main-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.status-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
    text-align: center;
    padding: 2rem;
}

.status-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    letter-spacing: 6px;
    color: var(--matrix);
    text-shadow: 0 0 30px var(--matrix-glow), 0 0 60px rgba(0,255,65,0.2);
    transition: all 0.5s ease;
}

.status-sub {
    font-size: 1rem;
    color: var(--matrix);
    opacity: 0.85;
    letter-spacing: 2px;
    text-transform: uppercase;
    min-height: 1.4em;
    text-shadow: 0 0 10px var(--matrix-glow);
}

.status-info {
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
    color: var(--matrix);
    opacity: 0.7;
    letter-spacing: 1px;
    margin-top: 0.5rem;
    min-height: 1.4em;
}

/* Countdown timer */
.countdown {
    font-family: 'Orbitron', monospace;
    font-size: 5rem;
    font-weight: 700;
    color: var(--matrix);
    text-shadow: 0 0 50px var(--matrix-glow), 0 0 100px rgba(0,255,65,0.25);
    line-height: 1;
    margin: 0.75rem 0;
}

/* Funny message */
.funny-message {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--matrix);
    opacity: 0.75;
    letter-spacing: 1px;
    min-height: 1.5em;
    transition: opacity 0.4s;
    max-width: 340px;
    line-height: 1.4;
}

.funny-message.fade {
    opacity: 0;
}

/* Wake button tap area */
.wake-tap-area {
    position: absolute;
    z-index: 10;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    cursor: pointer;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

/* Retry button */
.retry-btn {
    position: relative;
    z-index: 10;
    margin-top: 1.5rem;
    padding: 0.6rem 2rem;
    background: transparent;
    border: 1px solid var(--matrix);
    color: var(--matrix);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    letter-spacing: 3px;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s;
    text-shadow: 0 0 10px var(--matrix-glow);
    box-shadow: 0 0 15px rgba(0,255,65,0.1);
}

.retry-btn:hover {
    background: rgba(0,255,65,0.1);
    box-shadow: 0 0 25px rgba(0,255,65,0.2);
}

/* Stream badge */
.stream-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(0,255,65,0.1);
    border: 1px solid rgba(0,255,65,0.25);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--matrix);
    letter-spacing: 1px;
}

.stream-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--matrix);
    animation: pulse-dot 2s ease infinite;
    box-shadow: 0 0 6px var(--matrix-glow);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.idle-timer {
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    color: var(--matrix);
    opacity: 0.6;
    letter-spacing: 1.5px;
}

/* Retry button size bump */
.retry-btn {
    font-size: 1.2rem;
    padding: 0.7rem 2.5rem;
    letter-spacing: 4px;
}
