#debugOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(4, 8, 28, 0.9);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
}
#debugOverlay.open { display: flex; }

#debugModal {
    background: linear-gradient(145deg, #080d22 0%, #0f1530 100%);
    border: 1.5px solid rgba(255, 200, 0, 0.4);
    border-radius: 16px;
    width: min(680px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 0 60px rgba(255,200,0,0.15), 0 20px 60px rgba(0,0,0,0.7);
    animation: dbIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,200,0,0.3) transparent;
}
@keyframes dbIn {
    from { opacity:0; transform:scale(0.88) translateY(20px); }
    to   { opacity:1; transform:scale(1) translateY(0); }
}
#debugModal::-webkit-scrollbar { width: 4px; }
#debugModal::-webkit-scrollbar-thumb { background: rgba(255,200,0,0.3); border-radius: 2px; }

.db-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255,200,0,0.2);
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(145deg, #080d22, #0f1530);
}
.db-header-icon { font-size: 2rem; }
#dbTitle {
    font-family: 'Jersey 15', sans-serif;
    font-size: 1.4rem;
    color: #ffd700;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(255,215,0,0.4);
    flex: 1;
}
.db-close {
    background: none;
    border: 1px solid rgba(255,200,0,0.25);
    color: rgba(255,200,0,0.5);
    font-size: 1rem;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.db-close:hover { color: #ffd700; border-color: #ffd700; background: rgba(255,200,0,0.08); }

.db-body { padding: 18px 22px; }

.db-intro {
    font-family: 'Oxanium', sans-serif;
    font-size: 0.9rem;
    color: rgba(200,240,255,0.8);
    line-height: 1.75;
    margin-bottom: 14px;
}

.db-label {
    font-family: 'Oxanium', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,200,0,0.6);
    margin-bottom: 7px;
    display: block;
}

.db-code-block {
    background: #06080f;
    border: 1px solid rgba(255,200,0,0.2);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'Oxanium', monospace;
    font-size: 0.88rem;
    color: #f0e68c;
    white-space: pre;
    line-height: 1.9;
    margin-bottom: 16px;
    overflow-x: auto;
}

.db-question {
    font-family: 'Oxanium', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.5;
    margin-bottom: 12px;
}

.db-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.db-opt {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,200,0,0.18);
    background: rgba(0,0,0,0.3);
    color: rgba(200,240,255,0.75);
    font-family: 'Oxanium', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    line-height: 1.55;
}
.db-opt:hover { border-color: #ffd700; color: #fff; background: rgba(255,200,0,0.06); }
.db-opt.correct { border-color: #00ff88; background: rgba(0,255,136,0.1); color: #00ff88; }
.db-opt.wrong   { border-color: #ff6050; background: rgba(255,96,80,0.08); color: #ff8070; }
.db-opt-letter {
    font-family: 'Jersey 15', monospace;
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
    color: #ffd700;
    flex-shrink: 0;
}

.db-editor-wrap {
    border: 1px solid rgba(255,200,0,0.22);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}
.db-editor-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: rgba(255,200,0,0.07);
    border-bottom: 1px solid rgba(255,200,0,0.12);
    font-family: 'Oxanium', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(255,200,0,0.4);
}
#dbCodeArea {
    width: 100%;
    min-height: 130px;
    background: #08080f;
    color: #ffd700;
    font-family: 'Oxanium', monospace;
    font-size: 13px;
    line-height: 1.75;
    padding: 12px 16px;
    border: none;
    outline: none;
    resize: vertical;
    tab-size: 4;
}
#dbCodeArea::placeholder { color: rgba(255,200,0,0.2); }

.db-hint-box {
    background: rgba(78,168,212,0.07);
    border: 1px solid rgba(78,168,212,0.28);
    border-radius: 7px;
    padding: 9px 14px;
    margin-bottom: 10px;
    font-family: 'Oxanium', monospace;
    font-size: 0.82rem;
    color: #4ea8d4;
    line-height: 1.75;
    white-space: pre-wrap;
}

.db-feedback {
    margin-top: 10px;
    padding: 11px 15px;
    border-radius: 8px;
    font-family: 'Oxanium', monospace;
    font-size: 0.83rem;
    line-height: 1.7;
    display: none;
}
.db-feedback.ok  { display: block; background: rgba(0,255,136,0.08); border: 1px solid rgba(0,255,136,0.3); color: #00ff88; }
.db-feedback.err { display: block; background: rgba(255,96,80,0.08); border: 1px solid rgba(255,96,80,0.3); color: #ff8070; }

.db-btn-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.db-btn {
    font-family: 'Oxanium', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.db-btn-run { background: #ffd700; color: #1a1000; box-shadow: 0 0 12px rgba(255,215,0,0.35); }
.db-btn-run:hover { background: #ffe44d; box-shadow: 0 0 22px rgba(255,215,0,0.6); transform: translateY(-1px); }
.db-btn-hint { background: transparent; color: rgba(78,168,212,0.6); border: 1px solid rgba(78,168,212,0.35); }
.db-btn-hint:hover { color: #4ea8d4; border-color: #4ea8d4; }
.db-btn-done { background: #00ff88; color: #040e12; box-shadow: 0 0 14px rgba(0,255,136,0.4); margin-top: 8px; }
.db-btn-done:hover { background: #33ffaa; box-shadow: 0 0 26px rgba(0,255,136,0.65); transform: translateY(-1px); }

#debugWaveBadge {
    position: fixed;
    top: 70px;
    right: 16px;
    z-index: 1500;
    background: rgba(4,8,28,0.92);
    border: 1.5px solid rgba(255,200,0,0.5);
    border-radius: 8px;
    padding: 7px 14px;
    font-family: 'Oxanium', monospace;
    font-size: 0.78rem;
    color: #ffd700;
    box-shadow: 0 0 18px rgba(255,200,0,0.25);
    display: none;
    animation: badgeIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
}
@keyframes badgeIn {
    from { opacity:0; transform: translateX(20px) scale(0.9); }
    to   { opacity:1; transform: translateX(0)    scale(1); }
}