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

body {
    background: #000;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    font-family: 'Courier New', monospace;
}

#wrap {
    position: fixed;
    inset: 0;
}

#gl, #spectrum {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: block;
}

#spectrum { pointer-events: none; }

#flash-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    mix-blend-mode: screen;
}

#flash-layer.visible { opacity: 1; }

#flash-img {
    width: min(520px, 72vw);
    height: auto;
    filter: sepia(1) saturate(6) hue-rotate(345deg) brightness(0.4);
    opacity: 0.55;
}

/* ── Title ─────────────────────────────────────────────────────────────────── */

#title {
    position: fixed;
    top: 28px;
    width: 100%;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    transition: opacity 2.5s ease;
}

#title.dissolved { opacity: 0; }

.title-main {
    font-size: 1.6rem;
    letter-spacing: 0.55em;
    color: #b87333;
    text-shadow: 0 0 24px rgba(184, 115, 51, 0.5), 0 0 60px rgba(184, 115, 51, 0.2);
}

.title-sub {
    font-size: 0.52rem;
    letter-spacing: 0.4em;
    color: #3d2208;
    margin-top: 6px;
}

/* ── Control area + tabs ───────────────────────────────────────────────────── */

#ctrl-area {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

#tab-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid #150800;
    padding: 10px 0 16px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-right: 1px solid #150800;
    color: #2a1200;
    font-family: 'Courier New', monospace;
    font-size: 0.38rem;
    letter-spacing: 0.32em;
    padding: 6px 24px;
    cursor: pointer;
    outline: none;
    transition: color 0.2s;
}

.tab-btn:last-child { border-right: none; }

.tab-btn.active {
    color: #b87333;
    text-shadow: 0 0 10px rgba(184, 115, 51, 0.4);
}

.tab-btn:hover:not(.active) { color: #5a2a0a; }

.tab-panel {
    display: none;
    justify-content: center;
    flex-wrap: wrap;
    gap: 40px 52px;
    padding: 16px 20px 10px;
}

.tab-panel.active { display: flex; }

/* ── Individual controls ───────────────────────────────────────────────────── */

.ctrl {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ctrl label {
    font-size: 0.48rem;
    letter-spacing: 0.32em;
    color: #8a4a1a;
}

.gauge {
    position: relative;
    background: #050200;
    border: 1px solid #1a0d00;
    padding: 4px 10px;
    min-width: 90px;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    color: #b87333;
    text-shadow: 0 0 8px rgba(184,115,51,0.8), 0 0 20px rgba(184,115,51,0.3);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.8), 0 0 10px rgba(184,115,51,0.1);
}

.gauge-unit {
    font-size: 0.45rem;
    letter-spacing: 0.15em;
    color: #7a3a10;
    margin-left: 4px;
    vertical-align: middle;
}

.beat-label {
    font-size: 0.38rem;
    letter-spacing: 0.3em;
    color: #5a2a0a;
    text-align: center;
    margin-top: -4px;
}

.ticks {
    display: flex;
    justify-content: space-between;
    width: 110px;
    padding: 0 2px;
    margin-top: 4px;
}

.ticks span {
    width: 1px;
    height: 5px;
    background: #2a1200;
}

.ticks span:nth-child(3) {
    height: 7px;
    background: #3d2208;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 110px;
    height: 1px;
    background: #1a0d00;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #b87333;
    box-shadow: 0 0 10px rgba(184, 115, 51, 0.7), 0 0 24px rgba(184, 115, 51, 0.3);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #b87333;
    border: none;
    box-shadow: 0 0 10px rgba(184, 115, 51, 0.7);
    cursor: pointer;
}

/* ── Gate ──────────────────────────────────────────────────────────────────── */

#gate {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 100;
    transition: opacity 1.8s ease;
}

#gate.fade-out {
    opacity: 0;
    pointer-events: none;
}

.gate-title {
    font-size: clamp(3rem, 10vw, 6rem);
    letter-spacing: 0.6em;
    color: #b87333;
    text-shadow:
        0 0 40px rgba(184, 115, 51, 0.4),
        0 0 100px rgba(184, 115, 51, 0.15);
    margin-bottom: 10px;
}

.gate-sub {
    font-size: 0.65rem;
    letter-spacing: 0.42em;
    color: #2a1504;
    margin-bottom: 40px;
}

#gate-cover {
    width: min(480px, 80vw);
    height: auto;
    display: block;
    margin-bottom: 48px;
    filter: drop-shadow(0 0 40px rgba(184, 115, 51, 0.35)) drop-shadow(0 0 100px rgba(184, 115, 51, 0.12));
    cursor: pointer;
    transition: filter 0.3s;
}

#gate-cover:hover {
    filter: drop-shadow(0 0 60px rgba(184, 115, 51, 0.6)) drop-shadow(0 0 120px rgba(184, 115, 51, 0.25));
}

#enter-btn {
    background: transparent;
    border: 1px solid #3d2208;
    color: #b87333;
    padding: 16px 52px;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.35em;
    cursor: pointer;
    transition: border-color 0.4s, box-shadow 0.4s, color 0.4s;
    outline: none;
}

#enter-btn:hover {
    border-color: #b87333;
    color: #d4924a;
    box-shadow: 0 0 24px rgba(184, 115, 51, 0.25), inset 0 0 12px rgba(184, 115, 51, 0.05);
}

/* ── Off button ────────────────────────────────────────────────────────────── */

#off-btn {
    position: fixed;
    top: 24px;
    right: 28px;
    z-index: 110;
    background: transparent;
    border: 1px solid #2a1200;
    color: #8a4a1a;
    font-size: 0.42rem;
    letter-spacing: 0.3em;
    padding: 8px 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
    font-family: 'Courier New', monospace;
}

#off-btn.visible { display: flex; }

#visions-btn {
    position: fixed;
    top: 24px;
    left: 28px;
    z-index: 110;
    background: transparent;
    border: 1px solid #2a1200;
    color: #8a4a1a;
    font-size: 0.42rem;
    letter-spacing: 0.3em;
    padding: 8px 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
    font-family: 'Courier New', monospace;
}

#visions-btn.visible { display: flex; }

#visions-btn.off {
    color: #2a1200;
    border-color: #150800;
}

#visions-btn:hover {
    border-color: #b87333;
    color: #b87333;
    box-shadow: 0 0 16px rgba(184,115,51,0.3);
}

#off-btn:hover {
    border-color: #b87333;
    color: #b87333;
    box-shadow: 0 0 16px rgba(184,115,51,0.3);
}

/* ── Vignette ──────────────────────────────────────────────────────────────── */

#wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
}
