/* jungchi.boo - Skeuomorphic Control Panel */
/* Palette: #2e2a26, #b8875a, #ddd5c5, #f5efe6, #3a3631, #8fa88d, #fffcf5, #e8a44a, #d4917a */
/* Fonts: Recursive, DM Mono */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #2e2a26;
    font-family: 'DM Mono', monospace;
    color: #3a3631;
}

/* ============================
   HORIZONTAL SCROLL CONTAINER
   ============================ */

#scroll-container {
    width: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

#panel-rail {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: max-content;
}

/* ============================
   PANELS - BASE
   ============================ */

.panel {
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fffcf5 0%, #f5efe6 50%, #ddd5c5 100%);
    border-right: 2px solid #ddd5c5;
    overflow: hidden;
    transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg));
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.panel::before {
    content: '';
    position: absolute;
    inset: 2px;
    border: 1px solid #fffcf5;
    pointer-events: none;
    z-index: 1;
}

/* ============================
   SCREWS
   ============================ */

.screw {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ddd5c5, #fffcf5, #b8875a, #ddd5c5);
    box-shadow: 0 1px 2px rgba(46, 42, 38, 0.3);
    z-index: 10;
}

.screw::before,
.screw::after {
    content: '';
    position: absolute;
    background: #3a3631;
}

.screw::before {
    width: 6px;
    height: 1px;
    top: 3.5px;
    left: 1px;
}

.screw::after {
    width: 1px;
    height: 6px;
    top: 1px;
    left: 3.5px;
}

.screw-tl { top: 16px; left: 16px; }
.screw-tr { top: 16px; right: 16px; }
.screw-bl { bottom: 16px; left: 16px; }
.screw-br { bottom: 16px; right: 16px; }

/* ============================
   PANEL LABELS
   ============================ */

.panel-label {
    position: absolute;
    top: 30px;
    left: 40px;
    font-family: 'Recursive', sans-serif;
    font-weight: 800;
    font-variation-settings: 'CASL' 0, 'MONO' 0;
    font-size: 14px;
    letter-spacing: 0.12em;
    color: #3a3631;
    text-shadow: 0 1px 0 #fffcf5;
    text-transform: uppercase;
    z-index: 5;
}

/* ============================
   PANEL CONTENT AREAS
   ============================ */

.panel-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex: 1;
    padding: 60px 40px 20px;
    width: 100%;
    max-width: 900px;
}

/* ============================
   TOGGLE SWITCHES
   ============================ */

.toggle-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.toggle-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.toggle-switch {
    width: 40px;
    height: 24px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fffcf5 0%, #ddd5c5 100%);
    box-shadow: 2px 2px 6px rgba(46, 42, 38, 0.15),
                -1px -1px 3px rgba(255, 252, 245, 0.8),
                inset 0 1px 2px rgba(46, 42, 38, 0.1);
    cursor: pointer;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #ddd5c5;
    transition: background 0.3s, box-shadow 0.3s;
}

.toggle-switch.active {
    background: linear-gradient(0deg, #fffcf5 0%, #ddd5c5 100%);
}

.toggle-switch.active::after {
    background: #e8a44a;
    box-shadow: 0 0 6px #e8a44a;
}

.toggle-label {
    font-family: 'Recursive', sans-serif;
    font-weight: 400;
    font-variation-settings: 'CASL' 0.5;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #3a3631;
    text-shadow: 0 1px 0 #fffcf5;
}

/* ============================
   OSCILLOSCOPE (Panel 01)
   ============================ */

.oscilloscope-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.oscilloscope {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: #2e2a26;
    box-shadow: inset 0 4px 20px rgba(46, 42, 38, 0.6),
                2px 2px 8px rgba(46, 42, 38, 0.3),
                -1px -1px 4px rgba(255, 252, 245, 0.5);
    position: relative;
    overflow: hidden;
}

.oscilloscope-glass {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at center, #1a1816 0%, #2e2a26 100%);
    overflow: hidden;
}

.oscilloscope-sweep {
    position: absolute;
    inset: 0;
    background: conic-gradient(from 0deg, #8fa88d 0deg, transparent 60deg, transparent 360deg);
    opacity: 0.3;
    animation: sweep 4s linear infinite;
    border-radius: 50%;
}

.oscilloscope-wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.wave-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 0;
    animation: waveDash 3s linear infinite;
}

.wave-path-2 {
    animation-delay: -1.5s;
    animation-duration: 4s;
}

.oscilloscope-crosshair-h,
.oscilloscope-crosshair-v {
    position: absolute;
    background: rgba(143, 168, 141, 0.15);
}

.oscilloscope-crosshair-h {
    width: 100%;
    height: 1px;
    top: 50%;
}

.oscilloscope-crosshair-v {
    width: 1px;
    height: 100%;
    left: 50%;
}

.oscilloscope-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #eae4d8 0%, #ddd5c5 100%);
    box-shadow: inset 2px 2px 6px rgba(46, 42, 38, 0.2),
                inset -1px -1px 3px rgba(255, 252, 245, 0.5);
    padding: 8px 20px;
    border-radius: 4px;
}

/* ============================
   KNOBS
   ============================ */

.knob-row,
.decoder-controls,
.coord-controls,
.output-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 16px 0 24px;
}

.knob-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.knob {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ddd5c5, #fffcf5, #f5efe6, #ddd5c5, #b8875a, #ddd5c5);
    box-shadow: 2px 2px 8px rgba(46, 42, 38, 0.2),
                -1px -1px 4px rgba(255, 252, 245, 0.6);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.knob-indicator {
    position: absolute;
    width: 2px;
    height: 16px;
    background: #3a3631;
    top: 6px;
    left: 50%;
    transform: translateX(-50%) rotate(var(--rotation, 0deg));
    transform-origin: bottom center;
    border-radius: 1px;
}

.knob-sm {
    width: 44px;
    height: 44px;
}

.knob-sm .knob-indicator {
    height: 12px;
    top: 4px;
}

.knob-label {
    font-family: 'Recursive', sans-serif;
    font-weight: 400;
    font-variation-settings: 'CASL' 0.5;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #3a3631;
    text-shadow: 0 1px 0 #fffcf5;
}

/* ============================
   LEDS
   ============================ */

.led-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ddd5c5;
    box-shadow: inset 0 1px 2px rgba(46, 42, 38, 0.2);
}

.led.active {
    background: #e8a44a;
    box-shadow: 0 0 4px #e8a44a;
    animation: pulse 2.5s ease-in-out infinite;
}

/* ============================
   READOUTS
   ============================ */

.readout-value {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #e8a44a;
}

.readout-label {
    font-family: 'Recursive', sans-serif;
    font-weight: 400;
    font-variation-settings: 'CASL' 0.5;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #3a3631;
    text-shadow: 0 1px 0 #fffcf5;
}

/* ============================
   PANEL 02 - TAPE REELS
   ============================ */

.panel-02-content {
    flex-direction: column;
    gap: 24px;
}

.tape-reel-section {
    display: flex;
    align-items: center;
    gap: 24px;
}

.tape-reel {
    width: 100px;
    height: 100px;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tape-reel-sm {
    width: 80px;
    height: 80px;
}

.reel-outer {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #fffcf5 0%, #ddd5c5 100%);
    box-shadow: 2px 2px 6px rgba(46, 42, 38, 0.15),
                -1px -1px 3px rgba(255, 252, 245, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: reelSpin 8s linear infinite;
}

.tape-reel-sm .reel-outer {
    animation-duration: 6s;
}

.reel-inner {
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ddd5c5, #f5efe6, #ddd5c5, #b8875a, #ddd5c5);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 1px 1px 4px rgba(46, 42, 38, 0.15);
}

.reel-hub {
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: #2e2a26;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.lcd-readout {
    background: #2e2a26;
    padding: 12px 24px;
    border-radius: 4px;
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.4),
                inset -1px -1px 3px rgba(255, 252, 245, 0.1);
    min-width: 280px;
    text-align: center;
}

.lcd-text {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: #e8a44a;
    text-shadow: 0 0 8px rgba(232, 164, 74, 0.4);
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.lcd-text.visible {
    opacity: 1;
}

/* ============================
   PANEL 03 - COORDINATE GRID
   ============================ */

.panel-03-content {
    padding: 60px 40px 0;
}

.coord-display {
    position: relative;
    width: 480px;
    height: 480px;
    background: #2e2a26;
    border-radius: 8px;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.4),
                2px 2px 8px rgba(46, 42, 38, 0.3);
    padding: 20px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.coord-grid {
    display: grid;
    grid-template-columns: repeat(32, 1fr);
    grid-template-rows: repeat(32, 1fr);
    gap: 1px;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.coord-cell {
    width: 100%;
    height: 100%;
    background: rgba(58, 54, 49, 0.3);
    border-radius: 1px;
    transition: background 0.4s ease;
}

.coord-cell.amber {
    background: #e8a44a;
    box-shadow: 0 0 3px rgba(232, 164, 74, 0.3);
}

.coord-cell.blush {
    background: #d4917a;
    box-shadow: 0 0 3px rgba(212, 145, 122, 0.3);
}

.coord-cell.sage {
    background: #8fa88d;
    box-shadow: 0 0 3px rgba(143, 168, 141, 0.3);
}

.coord-overlay {
    position: absolute;
    inset: 20px;
    pointer-events: none;
    z-index: 2;
}

.coord-axes-h {
    position: absolute;
    width: 100%;
    height: 1px;
    top: 50%;
    background: rgba(143, 168, 141, 0.3);
}

.coord-axes-v {
    position: absolute;
    width: 1px;
    height: 100%;
    left: 50%;
    background: rgba(143, 168, 141, 0.3);
}

.coord-readout-top,
.coord-readout-bottom {
    position: absolute;
    display: flex;
    gap: 24px;
    z-index: 3;
}

.coord-readout-top {
    top: 6px;
    right: 10px;
}

.coord-readout-bottom {
    bottom: 6px;
    left: 10px;
}

.coord-value {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #8fa88d;
    text-shadow: 0 0 6px rgba(143, 168, 141, 0.3);
}

/* ============================
   PANEL 04 - PATCH BAY
   ============================ */

.panel-04-content {
    padding: 60px 40px 0;
}

.patch-bay {
    position: relative;
    width: 600px;
    height: 400px;
    background: linear-gradient(135deg, #eae4d8 0%, #ddd5c5 100%);
    border-radius: 8px;
    box-shadow: inset 2px 2px 6px rgba(46, 42, 38, 0.2),
                inset -1px -1px 3px rgba(255, 252, 245, 0.5),
                2px 2px 8px rgba(46, 42, 38, 0.2);
    padding: 40px 30px 20px 50px;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.patch-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 16px;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.patch-jack {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2e2a26;
    box-shadow: inset 0 2px 6px rgba(46, 42, 38, 0.5);
    justify-self: center;
    align-self: center;
    position: relative;
}

.patch-jack.connected {
    box-shadow: inset 0 2px 6px rgba(46, 42, 38, 0.5),
                0 0 4px rgba(184, 135, 90, 0.4);
}

.patch-jack.connected::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #b8875a;
}

.patch-lines {
    position: absolute;
    inset: 40px 30px 20px 50px;
    width: calc(100% - 80px);
    height: calc(100% - 60px);
    z-index: 3;
    pointer-events: none;
}

.patch-line {
    fill: none;
    stroke: #b8875a;
    stroke-width: 2;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease-out;
}

.patch-line.visible {
    stroke-dashoffset: 0;
}

.patch-labels-top {
    position: absolute;
    top: 16px;
    left: 50px;
    right: 30px;
    display: flex;
    justify-content: space-around;
    z-index: 4;
}

.patch-labels-top span {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: #3a3631;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 0 #fffcf5;
}

.patch-labels-left {
    position: absolute;
    top: 40px;
    bottom: 20px;
    left: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    z-index: 4;
}

.patch-labels-left span {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: #3a3631;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 0 #fffcf5;
}

.patch-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 16px 0 24px;
}

.patch-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #eae4d8 0%, #ddd5c5 100%);
    box-shadow: inset 2px 2px 6px rgba(46, 42, 38, 0.2),
                inset -1px -1px 3px rgba(255, 252, 245, 0.5);
    padding: 8px 20px;
    border-radius: 4px;
}

/* ============================
   PANEL 05 - VU METER & OUTPUT
   ============================ */

.panel-05-content {
    flex-direction: column;
    gap: 24px;
}

.vu-meter-container {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.vu-meter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.vu-face {
    width: 300px;
    height: 150px;
    background: #fffcf5;
    border-radius: 150px 150px 0 0;
    box-shadow: inset 2px 2px 6px rgba(46, 42, 38, 0.15),
                inset -1px -1px 3px rgba(255, 252, 245, 0.5),
                2px 2px 8px rgba(46, 42, 38, 0.2);
    position: relative;
    overflow: hidden;
}

.vu-marking {
    position: absolute;
    width: 2px;
    height: 20px;
    background: #3a3631;
    bottom: 0;
    left: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(var(--angle));
    opacity: 0.6;
}

.vu-needle {
    position: absolute;
    width: 2px;
    height: 130px;
    background: linear-gradient(to top, #3a3631, #d4917a);
    bottom: 0;
    left: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-35deg);
    animation: needle 3s ease-in-out infinite;
    border-radius: 1px 1px 0 0;
}

.vu-label-row {
    display: flex;
    gap: 40px;
}

.vu-label-row span {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: #3a3631;
    letter-spacing: 0.04em;
}

.output-readouts {
    display: flex;
    gap: 24px;
}

.output-readout-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.readout-display {
    background: #2e2a26;
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.4),
                inset -1px -1px 3px rgba(255, 252, 245, 0.1);
}

.readout-display .readout-value {
    font-size: 16px;
    text-shadow: 0 0 8px rgba(232, 164, 74, 0.4);
}

.power-section {
    display: flex;
    justify-content: center;
    padding-top: 16px;
}

.power-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.power-led {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e8a44a;
    box-shadow: 0 0 12px #e8a44a, 0 0 24px rgba(232, 164, 74, 0.3);
    animation: powerPulse 2.5s ease-in-out infinite;
}

.power-label {
    font-family: 'Recursive', sans-serif;
    font-weight: 800;
    font-variation-settings: 'CASL' 0, 'MONO' 0;
    font-size: 12px;
    letter-spacing: 0.12em;
    color: #3a3631;
    text-shadow: 0 1px 0 #fffcf5;
}

/* ============================
   PROGRESS BAR
   ============================ */

#progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: #2e2a26;
    z-index: 100;
    display: flex;
    align-items: center;
}

#progress-fill {
    position: absolute;
    top: 9px;
    left: 0;
    height: 2px;
    background: #b8875a;
    width: 0%;
    transition: width 0.3s ease;
}

#progress-labels {
    display: flex;
    justify-content: space-around;
    width: 100%;
    position: relative;
    z-index: 1;
}

.progress-label {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    color: #ddd5c5;
    letter-spacing: 0.04em;
    text-shadow: 0 -1px 0 rgba(46, 42, 38, 0.5);
    transition: color 0.3s;
}

.progress-label.active {
    color: #e8a44a;
}

/* ============================
   ANIMATIONS
   ============================ */

@keyframes sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes waveDash {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -800; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; box-shadow: 0 0 4px #e8a44a; }
    50% { opacity: 1; box-shadow: 0 0 12px #e8a44a; }
}

@keyframes powerPulse {
    0%, 100% { opacity: 0.7; box-shadow: 0 0 8px #e8a44a, 0 0 16px rgba(232, 164, 74, 0.2); }
    50% { opacity: 1; box-shadow: 0 0 16px #e8a44a, 0 0 32px rgba(232, 164, 74, 0.4); }
}

@keyframes needle {
    0% { transform: translateX(-50%) rotate(-35deg); }
    50% { transform: translateX(-50%) rotate(25deg); }
    100% { transform: translateX(-50%) rotate(-35deg); }
}

@keyframes reelSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================
   MOBILE / VERTICAL LAYOUT
   ============================ */

@media (max-width: 768px) {
    #scroll-container {
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
    }

    #panel-rail {
        flex-direction: column;
        width: 100vw;
        height: auto;
    }

    .panel {
        width: 100vw;
        min-height: 100vh;
        height: auto;
        scroll-snap-align: start;
        border-right: none;
        border-bottom: 2px solid #ddd5c5;
    }

    .panel-content {
        flex-direction: column;
        gap: 20px;
        padding: 60px 20px 20px;
    }

    .panel-01-content {
        flex-direction: column;
    }

    .toggle-column {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .oscilloscope {
        width: 200px;
        height: 200px;
    }

    .coord-display {
        width: 320px;
        height: 320px;
    }

    .patch-bay {
        width: 100%;
        max-width: 360px;
        height: 280px;
        padding: 30px 20px 16px 36px;
    }

    .patch-lines {
        inset: 30px 20px 16px 36px;
        width: calc(100% - 56px);
        height: calc(100% - 46px);
    }

    .vu-face {
        width: 220px;
        height: 110px;
    }

    .vu-needle {
        height: 95px;
    }

    .output-readouts {
        flex-direction: column;
        gap: 16px;
    }

    .tape-reel-section {
        flex-wrap: wrap;
        justify-content: center;
    }

    .lcd-readout {
        min-width: 200px;
    }
}
