@import url("https://fonts.googleapis.com/css2?family=VT323&family=Share+Tech+Mono&family=Orbitron:wght@400;700&display=swap");

:root {
    /* Mint Green / Violet / Grayscale Palette */
    --bg-darkest: #181818;
    --bg-dark: #1e1e1e;
    --bg-panel: #222222;
    --bg-cell: #1a1a1a;

    --border-dark: #333333;
    --border-med: #444444;
    --border-light: #555555;

    /* Primary - Mint Green */
    --primary: #B5FF84;
    --primary-dim: #6a9950;
    --primary-bright: #d4ffb3;

    /* Accent - Violet */
    --accent: #6544B9;
    --accent-dim: #4a3385;
    --accent-bright: #8866dd;

    /* Neutrals */
    --white: #ECECEC;
    --gray: #888888;
    --gray-dark: #555555;

    --text-bright: #ECECEC;
    --text-dim: #888888;
    --text-label: #666666;
}

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

html,
body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

body {
    background: var(--bg-darkest);
    color: var(--text-bright);
    font-family: "VT323", monospace;
    font-size: 13px;
    line-height: 1.1;
}

/* ========== LOADING ========== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-darkest);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s;
}

.preloader-canvas-container {
    width: 60px;
    height: 60px;
}

.preloader-canvas {
    width: 100%;
    height: 100%;
}

.loading-text {
    margin-top: 12px;
    font-family: "Orbitron", sans-serif;
    font-size: 11px;
    color: var(--primary);
    letter-spacing: 0.3em;
    text-align: center;
}

/* ========== NOTIFICATION ========== */
.notification {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-panel);
    border: 1px solid var(--accent);
    padding: 6px 14px;
    font-size: 11px;
    color: var(--accent-bright);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
    font-family: "Share Tech Mono", monospace;
}

/* ========== MAIN GRID ========== */
.interface-grid {
    display: grid;
    grid-template-rows: 36px 1fr 32px;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    max-width: 100%;
    padding: 4px;
    gap: 4px;
    background:
        linear-gradient(90deg, rgba(181, 255, 132, 0.04) 1px, transparent 1px),
        linear-gradient(rgba(181, 255, 132, 0.03) 1px, transparent 1px),
        var(--bg-darkest);
    background-size: 20px 20px;
}

/* ========== HEADER ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-dark);
    border-left: 3px solid var(--primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-jp {
    font-size: 16px;
    color: var(--accent);
    font-weight: bold;
}

.logo-text {
    font-family: "Orbitron", sans-serif;
    font-size: 13px;
    color: var(--text-bright);
    letter-spacing: 0.15em;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.signal-label {
    font-size: 10px;
    color: var(--text-label);
    letter-spacing: 0.1em;
}

.signal-status {
    font-family: "Share Tech Mono", monospace;
    font-size: 11px;
    color: var(--primary);
}

.signal-bars {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 12px;
}

.signal-bars .bar {
    width: 3px;
    background: var(--border-med);
    transition: all 0.2s;
}

.signal-bars .bar:nth-child(1) {
    height: 4px;
}

.signal-bars .bar:nth-child(2) {
    height: 6px;
}

.signal-bars .bar:nth-child(3) {
    height: 8px;
}

.signal-bars .bar:nth-child(4) {
    height: 10px;
}

.signal-bars .bar:nth-child(5) {
    height: 12px;
}

.signal-bars.active .bar {
    background: var(--primary);
}

.header-right {
    font-family: "Share Tech Mono", monospace;
    font-size: 12px;
    color: var(--primary);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    min-height: 0;
}

/* ========== VIEWER COLUMN ========== */
.viewer-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.viewer-box {
    flex: 1;
    position: relative;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    overflow: hidden;
}

.viewer-box canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.scanner-corners {
    position: absolute;
    inset: 10%;
    pointer-events: none;
    z-index: 10;
}

.scanner-corners .corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: var(--primary);
    border-style: solid;
    opacity: 0.6;
}

.scanner-corners .corner.tl {
    top: 0;
    left: 0;
    border-width: 2px 0 0 2px;
}

.scanner-corners .corner.tr {
    top: 0;
    right: 0;
    border-width: 2px 2px 0 0;
}

.scanner-corners .corner.bl {
    bottom: 0;
    left: 0;
    border-width: 0 0 2px 2px;
}

.scanner-corners .corner.br {
    bottom: 0;
    right: 0;
    border-width: 0 2px 2px 0;
}

.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.4;
    animation: scanMove 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes scanMove {

    0%,
    100% {
        top: 10%;
    }

    50% {
        top: 90%;
    }
}

.viewer-info {
    display: flex;
    background: var(--bg-panel);
    border: 1px solid var(--border-dark);
}

.info-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0;
    border-right: 1px solid var(--border-dark);
}

.info-item:last-child {
    border-right: none;
}

.info-label {
    font-size: 9px;
    color: var(--text-label);
    letter-spacing: 0.1em;
}

.info-value {
    font-family: "Share Tech Mono", monospace;
    font-size: 12px;
    color: var(--primary);
}

/* ========== DATA COLUMN ========== */
.data-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

.data-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    flex: 1;
}

.data-row-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    flex: 1;
}

/* ========== PANELS ========== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: var(--bg-cell);
    border-bottom: 1px solid var(--border-dark);
    min-height: 22px;
}

.panel-id {
    font-family: "Share Tech Mono", monospace;
    font-size: 10px;
    color: var(--text-label);
    background: var(--border-dark);
    padding: 1px 4px;
}

.panel-title {
    font-family: "Orbitron", sans-serif;
    font-size: 10px;
    color: var(--primary);
    letter-spacing: 0.15em;
    flex: 1;
}

.panel-status {
    font-family: "Share Tech Mono", monospace;
    font-size: 9px;
    color: var(--text-dim);
}

/* ========== SOURCE PANEL ========== */
.source-panel {
    border-left: 2px solid var(--accent);
}

.source-controls {
    display: flex;
    gap: 4px;
    padding: 6px;
}

.ctrl-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    background: var(--bg-cell);
    border: 1px solid var(--border-med);
    color: var(--text-bright);
    font-family: "VT323", monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.ctrl-btn:hover {
    background: var(--border-dark);
    border-color: var(--primary);
}

.ctrl-btn.active {
    background: var(--primary-dim);
    border-color: var(--primary);
}

.btn-icon {
    font-size: 10px;
    color: var(--primary);
}

.btn-text {
    font-size: 10px;
    letter-spacing: 0.05em;
}

.ctrl-btn.full-width {
    width: 100%;
    padding: 8px 12px;
    justify-content: center;
    gap: 8px;
}

.ctrl-btn.full-width .btn-icon {
    font-size: 12px;
}

.ctrl-btn.full-width .btn-text {
    font-size: 11px;
    letter-spacing: 0.1em;
}

.file-display {
    margin: 0 6px 6px;
    padding: 4px 6px;
    background: var(--bg-darkest);
    border: 1px solid var(--border-dark);
    font-size: 9px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-file-input {
    display: none;
}

/* ========== EYE SCANNER ========== */
.eye-scanner {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: var(--bg-cell);
    border-top: 1px solid var(--border-dark);
    flex: 1;
    min-height: 0;
}

.eye-container {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darkest);
    border: 1px solid var(--border-med);
    padding: 4px;
}

#eye-canvas {
    display: block;
    image-rendering: pixelated;
}

.eye-data {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.eye-label {
    font-family: "Orbitron", sans-serif;
    font-size: 9px;
    color: var(--text-label);
    letter-spacing: 0.15em;
}

.eye-status {
    font-family: "Share Tech Mono", monospace;
    font-size: 11px;
    color: var(--primary);
    animation: eyeStatusBlink 2s infinite;
}

@keyframes eyeStatusBlink {

    0%,
    70% {
        opacity: 1;
    }

    71%,
    100% {
        opacity: 0.4;
    }
}

.eye-id {
    font-family: "Share Tech Mono", monospace;
    font-size: 10px;
    color: var(--text-dim);
}

/* ========== SPECTRUM PANEL ========== */
.spectrum-panel {
    border-left: 2px solid var(--primary-dim);
    border-right: 2px solid var(--accent-dim);
}

.spectrum-container {
    flex: 1;
    padding: 4px;
    min-height: 0;
}

.spectrum-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ========== WAVEFORM PANEL ========== */
.waveform-panel {
    flex: 0.6;
    border-left: 2px solid var(--primary-dim);
    border-right: 2px solid var(--primary-dim);
}

.dna-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.dna-label {
    font-size: 9px;
    color: var(--primary);
}

.dna-bars {
    display: flex;
    gap: 1px;
}

.dna-bar {
    width: 3px;
    height: 8px;
    background: var(--border-dark);
}

.dna-bar.active {
    background: var(--primary);
}

.waveform-container {
    flex: 1;
    padding: 4px;
    min-height: 0;
}

.waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ========== METRICS PANEL ========== */
.metrics-panel {
    border-left: 2px solid var(--accent);
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 4px;
    flex: 1;
}

.metric-cell {
    background: var(--bg-cell);
    padding: 4px 6px;
    border: 1px solid var(--border-dark);
}

.metric-label {
    display: block;
    font-size: 8px;
    color: var(--text-label);
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.metric-value {
    font-family: "Share Tech Mono", monospace;
    font-size: 13px;
    color: var(--text-bright);
}

.metric-bar {
    height: 3px;
    background: var(--border-dark);
    margin-top: 3px;
}

.metric-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

/* ========== CONTROLS PANEL ========== */
.controls-panel {
    border-left: 2px solid var(--gray);
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 4px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    background: var(--bg-cell);
    border: 1px solid var(--border-dark);
}

.ctrl-label {
    font-size: 9px;
    color: var(--text-label);
    width: 24px;
}

.slider {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-dark);
    border: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 8px;
    height: 8px;
    background: var(--primary);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border: none;
    cursor: pointer;
}

.ctrl-value {
    font-family: "Share Tech Mono", monospace;
    font-size: 10px;
    color: var(--primary);
    width: 24px;
    text-align: right;
}

.action-btns {
    display: flex;
    gap: 4px;
    padding: 4px;
}

.action-btn {
    flex: 1;
    padding: 5px 8px;
    background: var(--bg-cell);
    border: 1px solid var(--border-med);
    color: var(--text-bright);
    font-family: "Orbitron", sans-serif;
    font-size: 9px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.15s;
}

.action-btn:hover {
    border-color: var(--primary);
}

.action-btn.primary {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary-bright);
}

.action-btn.primary:hover {
    background: var(--primary);
    color: var(--bg-darkest);
}

/* ========== MAIN PLAY BUTTON ========== */
.play-btn-main {
    position: relative;
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    overflow: hidden;
    margin-top: 4px;
}

.play-btn-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-dim) 0%, var(--primary) 50%, var(--primary-dim) 100%);
    background-size: 200% 200%;
    border: 2px solid var(--primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.play-btn-main:hover .play-btn-inner {
    background-position: 100% 100%;
    background: var(--primary);
    box-shadow:
        0 0 20px rgba(181, 255, 132, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.play-btn-main:active .play-btn-inner {
    transform: scale(0.98);
}

.play-icon {
    font-size: 18px;
    color: var(--bg-darkest);
    transition: transform 0.3s ease;
}

.play-btn-main:hover .play-icon {
    transform: scale(1.2);
}

.play-text {
    font-family: "Orbitron", sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.4em;
    color: var(--bg-darkest);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.play-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg,
            var(--primary) 0%,
            transparent 40%,
            transparent 60%,
            var(--primary) 100%);
    opacity: 0;
    z-index: 0;
    filter: blur(8px);
    transition: opacity 0.3s ease;
}

.play-btn-main:hover .play-glow {
    opacity: 0.6;
    animation: glowPulse 1.5s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.7;
    }
}

/* Active/Playing state */
.play-btn-main.active .play-btn-inner {
    background: var(--accent);
    border-color: var(--accent-bright);
}

.play-btn-main.active .play-icon,
.play-btn-main.active .play-text {
    color: var(--white);
}

.play-btn-main.active .play-glow {
    background: linear-gradient(45deg,
            var(--accent) 0%,
            transparent 40%,
            transparent 60%,
            var(--accent) 100%);
}

/* ========== FOOTER ========== */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-dark);
    border-top: 2px solid var(--border-med);
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-label {
    font-size: 9px;
    color: var(--text-label);
}

.footer-value {
    font-family: "Share Tech Mono", monospace;
    font-size: 10px;
    color: var(--text-dim);
}

.rec-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    color: var(--accent-bright);
}

.rec-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: recBlink 1s infinite;
}

@keyframes recBlink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0.3;
    }
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 600px) {
    .interface-grid {
        grid-template-rows: 32px 1fr 32px;
        padding: 2px;
        gap: 2px;
    }

    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 40% 60%;
    }

    .viewer-column {
        min-height: 0;
    }

    .data-column {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 2px;
    }

    .data-row-top,
    .data-row-bottom {
        display: contents;
    }

    .waveform-panel {
        grid-column: 1 / -1;
        flex: none;
        min-height: 50px;
    }

    .panel-header {
        padding: 2px 4px;
        min-height: 18px;
    }

    .panel-id {
        display: none;
    }

    .panel-title {
        font-size: 9px;
    }

    .source-controls {
        padding: 3px;
        gap: 2px;
    }

    .ctrl-btn {
        padding: 4px 2px;
    }

    .btn-text {
        font-size: 9px;
    }

    .file-display {
        margin: 0 3px 3px;
        padding: 2px 4px;
        font-size: 8px;
    }

    .metrics-grid,
    .controls-grid {
        padding: 2px;
        gap: 1px;
    }

    .metric-cell,
    .control-item {
        padding: 2px 4px;
    }

    .metric-label,
    .ctrl-label {
        font-size: 7px;
    }

    .metric-value {
        font-size: 11px;
    }

    .action-btns {
        padding: 2px;
        gap: 2px;
    }

    .action-btn {
        padding: 3px 4px;
        font-size: 8px;
    }

    .header {
        padding: 0 4px;
    }

    .logo-jp {
        font-size: 12px;
    }

    .logo-text {
        font-size: 10px;
    }

    .signal-label,
    .signal-status {
        font-size: 8px;
    }

    .signal-bars {
        display: none;
    }

    .header-right {
        font-size: 10px;
    }

    .footer {
        padding: 0 4px;
    }

    .footer-label {
        font-size: 8px;
    }

    .footer-value {
        font-size: 9px;
    }

    .rec-indicator {
        font-size: 8px;
    }

    .info-item {
        padding: 2px 0;
    }

    .info-label {
        font-size: 8px;
    }

    .info-value {
        font-size: 10px;
    }

    /* Mobile play button */
    .play-btn-main {
        margin-top: 2px;
        grid-column: 1 / -1;
    }

    .play-btn-inner {
        padding: 10px 16px;
        gap: 8px;
    }

    .play-icon {
        font-size: 14px;
    }

    .play-text {
        font-size: 12px;
        letter-spacing: 0.3em;
    }

    .ctrl-btn.full-width {
        padding: 6px 8px;
    }

    .ctrl-btn.full-width .btn-text {
        font-size: 9px;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darkest);
}

::-webkit-scrollbar-thumb {
    background: var(--border-med);
}

/* ========== SELECTION ========== */
::selection {
    background: var(--primary);
    color: var(--bg-darkest);
}

/* ========== CRT EFFECT (subtle) ========== */
.interface-grid::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.1) 2px,
            rgba(0, 0, 0, 0.1) 4px);
    pointer-events: none;
    z-index: 9999;
}