#level-eight-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9998;
    display: none;
    opacity: 0;
    background-color: #1b2a3b;
    background-image:
        linear-gradient(rgba(91,160,212,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91,160,212,0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #5ba0d4;
    font-family: "Monaco", "Courier New", monospace;
}
#level-eight-container .level-indicator {
    position: fixed;
    top: 20px; left: 20px;
    border: 3px solid #2e5c8a;
    padding: 0px 35px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    background: #152130;
    z-index: 9999;
    user-select: none;
    -webkit-user-select: none;
}
#level-eight-container .level-indicator::before,
#level-eight-container .level-indicator::after {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    border-color: #5ba0d4;
    border-style: solid;
}
#level-eight-container .level-indicator::before { top: -3px; left: -3px; border-width: 3px 0 0 3px; }
#level-eight-container .level-indicator::after  { bottom: -3px; right: -3px; border-width: 0 3px 3px 0; }
#level-eight-container .level-text {
    font-size: 2em; margin: 0; line-height: 1; font-weight: 800;
    letter-spacing: 3px; color: #5ba0d4;
    font-family: "Monaco", "Courier New", monospace;
    text-transform: uppercase;
}
#level-eight-container .slot-machine {
    display: flex;
    gap: 16px;
    background: transparent;
    padding: 24px;
    justify-content: center;
    margin-top: 50px;
}
#level-eight-container .reel {
    width: 150px;
    height: 500px;
    overflow: hidden;
    position: relative;
    border: 1px solid #2e5c8a;
    border-radius: 0;
    background-color: #152130;
    background-image:
        linear-gradient(rgba(91,160,212,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91,160,212,0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    cursor: grab;
    user-select: none;
}
#level-eight-container .reel:active { cursor: grabbing; border-color: #5ba0d4; }
#level-eight-container .reel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(21,33,48,0.92) 0%, rgba(21,33,48,0) 100%);
    z-index: 2;
    pointer-events: none;
}
#level-eight-container .reel::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(to top, rgba(21,33,48,0.92) 0%, rgba(21,33,48,0) 100%);
    z-index: 2;
    pointer-events: none;
}
#level-eight-container .reel-selector {
    position: absolute;
    top: 50%; left: 0; right: 0;
    height: 100px;
    transform: translateY(-50%);
    border-top: 1px solid #5ba0d4;
    border-bottom: 1px solid #5ba0d4;
    background: rgba(91,160,212,0.04);
    z-index: 3;
    pointer-events: none;
}
#level-eight-container .reel-selector::before,
#level-eight-container .reel-selector::after {
    content: '';
    position: absolute;
    width: 8px; height: 8px;
    border-color: #5ba0d4;
    border-style: solid;
}
#level-eight-container .reel-selector::before { top: 2px; left: 2px; border-width: 2px 0 0 2px; }
#level-eight-container .reel-selector::after  { bottom: 2px; right: 2px; border-width: 0 2px 2px 0; }
#level-eight-container .reel-content {
    position: absolute;
    width: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}
#level-eight-container .gate-image {
    width: 100%;
    height: 100px;
    object-fit: contain;
    padding: 14px;
    background: transparent;
    border-bottom: 1px solid #1e3a54;
    display: block;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
    transition: opacity 0.3s ease;
    filter: url(#l8-gate-filter);
    opacity: 0.35;
}
#level-eight-container .gate-image.selected {
    filter: url(#l8-gate-filter);
    opacity: 1;
    border-bottom: 1px solid #2e5c8a;
    z-index: 3;
}
#level-eight-container .validate-button {
    margin-top: 40px;
    padding: 12px 40px;
    width: 300px;
    font-family: "Monaco", "Courier New", monospace;
    font-size: 13px;
    background: rgba(160, 220, 185, 0.04);
    border: 1px solid #5ba0d4;
    border-radius: 0;
    color: #5ba0d4;
    cursor: pointer;
    position: relative;
    letter-spacing: 4px;
    text-transform: uppercase;
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
    transition: background 0.15s, color 0.15s;
}
#level-eight-container .validate-button::before {
    content: '';
    position: absolute;
    top: -22px;
    left: -1px;
    width: calc(100% + 2px);
    height: 20px;
    background: #152130;
    border: 1px solid #5ba0d4;
    border-bottom: none;
    box-sizing: border-box;
}
#level-eight-container .validate-button::after {
    content: '○ ○ ○';
    position: absolute;
    top: -20px;
    right: 8px;
    font-size: 11px;
    color: #5ba0d4;
    z-index: 1;
}
#level-eight-container .validate-button:hover {
    background: rgba(160, 220, 185, 0.09);
    color: #8fc4e3;
    border-color: #8fc4e3;
}
#level-eight-container .validate-button:active {
    background: rgba(160, 220, 185, 0.14);
}
#level-eight-container .hint-text {
    position: absolute;
    bottom: 50px;
    left: 54%;
    width: 44vw;
    text-align: left;
    color: #3d7aad;
    font-family: "Monaco", monospace;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.8;
    opacity: 0;
    white-space: pre-line;
    user-select: none;
    -webkit-user-select: none;
    border-left: 1px solid #2e5c8a;
    padding-left: 14px;
}
#level-eight-container .hint-text::before {
    content: '// ORACLE';
    display: block;
    color: #5ba0d4;
    font-size: 10px;
    letter-spacing: 3px;
    margin-bottom: 6px;
    font-weight: bold;
}
#level-eight-container .hint-text.error-state { color: #e05a5a; border-left-color: #e05a5a; }
#level-eight-container .highlighted {
    color: #8fc4e3;
    background: rgba(91,160,212,0.12);
    padding: 0 4px;
    border: 1px solid #2e5c8a;
}
#level-eight-container .gates-display { display: none; }
#level-eight-container .gate-info     { display: none; }
#level-eight-container .phase2-logic-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 40px;
    padding: 40px 50px;
    background: #152130;
    border: 1px solid #2e5c8a;
    border-radius: 0;
    min-width: 70%;
    justify-content: center;
}
#level-eight-container .phase2-logic-container::before,
#level-eight-container .phase2-logic-container::after {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    border-color: #5ba0d4;
    border-style: solid;
}
#level-eight-container .phase2-logic-container::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
#level-eight-container .phase2-logic-container::after  { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
#level-eight-container .logic-group {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 200px;
    position: relative;
}
#level-eight-container .numbers-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 40px;
    position: relative;
    z-index: 1;
}
#level-eight-container .logic-number {
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #2e5c8a;
    border-radius: 0;
    background: #1b2a3b;
    font-family: "Monaco", monospace;
    font-size: 20px;
    color: #5ba0d4;
    user-select: none;
    -webkit-user-select: none;
}
#level-eight-container .logic-wire {
    width: 20px; height: 1px;
    background: #2e5c8a;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
#level-eight-container .gate-image-phase2 {
    width: 120px; height: 120px;
    object-fit: contain;
    padding: 12px;
    background: transparent;
    border: 1px solid #5ba0d4;
    border-radius: 0;
    animation: gateImagePhase2Appear 0.5s ease-out forwards;
    filter: url(#l8-gate-filter);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
#level-eight-container .result-container {
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #2e5c8a;
    border-radius: 0;
    background: #1b2a3b;
    font-family: "Monaco", monospace;
    font-size: 20px;
    color: #2e5c8a;
    position: relative;
    z-index: 1;
}
#level-eight-container .password-section {
    position: fixed;
    left: 50%; bottom: 140px;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 8px 0;
    background: transparent;
    border: none;
    animation: fadeIn 0.5s ease-out;
    cursor: cell;
}
#level-eight-container .password-container {
    position: relative;
}
#level-eight-container .password-container::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 1px;
    bottom: -6px;
    background: #2e5c8a;
}
#level-eight-container .password-input {
    width: 52px; height: 52px;
    border: 1px solid #2e5c8a;
    border-radius: 0;
    font-family: "Monaco", monospace;
    font-size: 26px;
    text-align: center;
    background: #1b2a3b;
    color: #5ba0d4;
    cursor: cell;
    outline: none;
}
#level-eight-container .password-input:focus {
    border-color: #5ba0d4;
    background: rgba(91,160,212,0.06);
    box-shadow: inset 0 0 0 1px rgba(91,160,212,0.15);
}
#level-eight-container .password-input::placeholder       { color: #2e5c8a; opacity: 1; }
#level-eight-container .password-input:focus::placeholder { opacity: 0; }
#level-eight-container .binary-input { display: flex; gap: 15px; margin-top: 30px; }
#level-eight-container .binary-cell {
    width: 50px; height: 50px;
    border: 1px solid #2e5c8a;
    background: #1b2a3b;
    color: #5ba0d4;
    text-align: center;
    font-size: 24px;
    font-family: "Monaco", monospace;
    border-radius: 0;
    outline: none;
}
#level-eight-container .binary-display { font-family: "Monaco", monospace; font-size: 24px; color: #5ba0d4; }
@keyframes shuffleReel {
    0%   { transform: translateY(0); }
    20%  { transform: translateY(-200px); }
    40%  { transform: translateY(100px); }
    60%  { transform: translateY(-50px); }
    80%  { transform: translateY(25px); }
    100% { transform: translateY(0); }
}
#level-eight-container .reel-content.shuffle-animation { animation: shuffleReel 1s ease-in-out; }
@keyframes validateButton {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.05); background: rgba(160,220,185,0.15); color: #8fc4e3; }
    100% { transform: scale(0); opacity: 0; }
}
#level-eight-container .validate-button.success { animation: validateButton 1s ease-out forwards; }
@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; pointer-events: none; }
}
#level-eight-container .validate-button.fade-out,
#level-eight-container .hint-text.fade-out { animation: fadeOut 0.5s ease-out forwards; }
@keyframes gateImagePhase2Appear {
    0%   { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes passwordSectionError {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    20%, 60%  { transform: translateX(-50%) translateY(0) rotate(-1deg); }
    40%, 80%  { transform: translateX(-50%) translateY(0) rotate(1deg); }
}
#level-eight-container .password-section.error {
    animation: passwordSectionError 0.5s ease-in-out;
    border-color: #e05a5a;
}
@keyframes numberRegenerateEffect {
    0%   { transform: scale(1); opacity: 1; }
    50%  { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
#level-eight-container .logic-number.regenerate { animation: numberRegenerateEffect 0.5s ease-in-out; }
@keyframes lvl8PasswordValidate {
    0% {
        border-color: #2e5c8a;
        background: #1b2a3b;
        color: #5ba0d4;
    }
    50% {
        border-color: #5ba0d4;
        background: rgba(220, 245, 235, 0.18);
        color: #8fc4e3;
        transform: scale(1.08);
    }
    100% {
        border-color: #5ba0d4;
        background: rgba(230, 248, 242, 0.12);
        color: #5ba0d4;
    }
}
#level-eight-container .password-input.validate { animation: lvl8PasswordValidate 1s ease-in-out forwards; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%  { transform: translateX(-6px); }
    30%  { transform: translateX(6px); }
    45%  { transform: translateX(-4px); }
    60%  { transform: translateX(4px); }
    75%  { transform: translateX(-2px); }
    90%  { transform: translateX(2px); }
}
#level-eight-loading {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #1b2a3b;
    background-image:
        linear-gradient(rgba(91,160,212,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91,160,212,0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}
#level-eight-loading .slot-container {
    border: 1px solid #2e5c8a;
    padding: 24px 48px;
    background: #152130;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}
#level-eight-loading .slot-container::before,
#level-eight-loading .slot-container::after {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    border-color: #5ba0d4;
    border-style: solid;
}
#level-eight-loading .slot-container::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
#level-eight-loading .slot-container::after  { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
#level-eight-loading .slot-letter,
#level-eight-loading .slot-space {
    display: inline-block;
    font-family: "Monaco", monospace;
    font-size: 2em;
    font-weight: bold;
    margin: 0 2px;
    width: 1em;
    text-align: center;
    color: #5ba0d4;
    letter-spacing: 2px;
}
@media (max-width: 1400px) {
    #level-eight-container .phase2-logic-container { gap: 30px; padding: 32px 40px; }
    #level-eight-container .gate-image-phase2      { width: 100px; height: 100px; }
    #level-eight-container .logic-group            { min-width: 170px; }
    #level-eight-container .reel                   { width: 120px; }
    #level-eight-container .hint-text              { width: 52vw; font-size: 13px; bottom: 36px; }
    #level-eight-container .validate-button        { width: 240px; font-size: 12px; }
}
@media (max-width: 1200px) {
    #level-eight-container .reel                   { width: 100px; }
    #level-eight-container .hint-text              { width: 62vw; font-size: 13px; bottom: 28px; }
    #level-eight-container .validate-button        { width: 200px; }
    #level-eight-container .phase2-logic-container { gap: 22px; padding: 28px 32px; }
    #level-eight-container .logic-group            { min-width: 150px; }
    #level-eight-container .logic-number,
    #level-eight-container .result-container       { width: 32px; height: 32px; font-size: 18px; }
    #level-eight-container .numbers-container      { min-width: 32px; }
}
@media (max-width: 1000px) {
    #level-eight-container .phase2-logic-container {
        flex-direction: column; gap: 28px; min-width: auto; max-height: 90vh; overflow-y: auto;
    }
    #level-eight-container .logic-group            { justify-content: center; min-width: 140px; }
    #level-eight-container .reel                   { width: 80px; }
    #level-eight-container .hint-text              { width: 78vw; font-size: 12px; bottom: 18px; }
    #level-eight-container .validate-button        { width: 180px; font-size: 11px; }
}
@media (max-height: 800px) {
    #level-eight-container .reel                   { height: 500px; }
    #level-eight-container .hint-text              { bottom: 20px; }
    #level-eight-container .phase2-logic-container { gap: 30px; padding: 30px; }
    #level-eight-container .logic-group            { min-width: 160px; }
    #level-eight-container .numbers-container      { min-width: 30px; }
    #level-eight-container .logic-number,
    #level-eight-container .result-container       { width: 30px; height: 30px; font-size: 18px; }
}
@media (max-height: 600px) {
    #level-eight-container .reel                   { height: 500px; }
    #level-eight-container .hint-text              { bottom: 10px; }
    #level-eight-container .phase2-logic-container { gap: 20px; padding: 20px; }
    #level-eight-container .logic-group            { min-width: 140px; }
    #level-eight-container .numbers-container      { min-width: 25px; }
    #level-eight-container .logic-number,
    #level-eight-container .result-container       { width: 25px; height: 25px; font-size: 16px; }
}
#level-eight-container .audio-btn,
.audio-popup-backdrop.theme-8 .audio-popup {
    --ac-color: #5ba0d4;
    --ac-bg: #152130;
    --ac-border-w: 3px;
    --ac-border-style: solid;
    --ac-glow: 0 0 0 1px rgba(91, 160, 212, 0.2);
    --ac-font: 'Monaco', 'Courier New', monospace;
    --ac-symbols: '○ ○ ○';
}
.audio-popup-backdrop.theme-8 .audio-popup-title {
    font-size: 1.1em;
    letter-spacing: 4px;
}