/* THE FORGING CYCLE // TRILLY OS BRAND STYLESHEET */
:root {
    --void-black: #000000;
    --steel-gray: #0b0c10;
    --steel-highlight: #1f2833;
    
    /* FUI Colors */
    --fui-cyan: #00e5ff;
    --fui-cyan-dim: rgba(0, 229, 255, 0.2);
    --fui-cyan-glow: rgba(0, 229, 255, 0.6);
    
    --fui-gold: #c8961e;
    --fui-gold-dim: rgba(200, 150, 30, 0.2);
    --fui-gold-glow: rgba(200, 150, 30, 0.6);
    
    --fui-red: #ff3b30;
    --fui-red-dim: rgba(255, 59, 48, 0.15);
    
    --text-color: #f5f3ef;
    --text-dim: #8a8f98;
    
    /* Fonts */
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;
    --font-syne: 'Syne', sans-serif;
    --font-syne-mono: 'Syne Mono', monospace;

    /* Spacing / Sizes */
    --hud-border-width: 1px;
    --hud-border-style: solid;
    --hud-border-color: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body, html {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--void-black);
    color: var(--text-color);
    font-family: var(--font-mono);
    line-height: 1.5;
}

.font-mono {
    font-family: var(--font-mono) !important;
}

/* HELPER UTILITIES */
.highlight-cyan {
    color: var(--fui-cyan);
    text-shadow: 0 0 10px var(--fui-cyan-glow);
}
.highlight-gold {
    color: var(--fui-gold);
    text-shadow: 0 0 10px var(--fui-gold-glow);
}
.highlight-gold-bg {
    background-color: var(--fui-gold) !important;
    box-shadow: 0 0 10px var(--fui-gold-glow);
}
.text-dim {
    color: var(--text-dim);
}
.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* BACKGROUND GRID BACKDROP */
.fui-grid-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: 40px 40px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    z-index: 1;
    pointer-events: none;
}

/* CRT SCANLINE AND GLITCH OVERLAY */
.fui-scanline-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.06),
        rgba(0, 255, 0, 0.02),
        rgba(0, 0, 255, 0.06)
    );
    background-size: 100% 4px, 6px 100%;
    z-index: 999;
    pointer-events: none;
    opacity: 0.45;
}

/* INITIALIZATION SCREEN (Audio Handshake) */
.init-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--void-black);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.init-box {
    text-align: center;
    border: 1px solid var(--fui-gold-dim);
    background: rgba(11, 12, 16, 0.95);
    padding: 60px;
    max-width: 600px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(200, 150, 30, 0.05);
    position: relative;
    border-radius: 4px;
}

.init-box::before {
    content: '';
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border: 1px solid rgba(200, 150, 30, 0.1);
    pointer-events: none;
}

.init-glitch-title {
    font-family: var(--font-syne);
    font-weight: 800;
    font-size: 3rem;
    letter-spacing: 0.15em;
    color: #fff;
    position: relative;
    text-shadow: 0 0 15px var(--fui-gold-glow);
    margin-bottom: 10px;
}

.init-subtitle {
    font-size: 1rem;
    color: var(--fui-gold);
    letter-spacing: 0.3em;
    margin-bottom: 30px;
    text-transform: uppercase;
}

.init-details {
    font-size: 0.8rem;
    line-height: 1.8;
    color: var(--text-dim);
    margin-bottom: 40px;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 20px 0;
    letter-spacing: 0.05em;
}

.init-btn {
    background: transparent;
    border: 1px solid var(--fui-cyan);
    color: var(--fui-cyan);
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 0.15em;
    padding: 15px 35px;
    cursor: pointer;
    text-shadow: 0 0 10px var(--fui-cyan-glow);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
    transition: all 0.3s ease;
}

.init-btn:hover {
    background: var(--fui-cyan-dim);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
    transform: scale(1.02);
}

/* APP GRID LAYOUT */
.app-container {
    display: grid;
    grid-template-rows: 60px 1fr 80px;
    grid-template-columns: 280px 1fr 280px;
    width: 100vw;
    height: 100vh;
    position: relative;
    z-index: 5;
    transition: opacity 1.5s ease;
}

/* HUD PANELS */
.hud-top {
    grid-row: 1;
    grid-column: 1 / span 3;
    background: rgba(5, 5, 8, 0.95);
    border-bottom: var(--hud-border-width) var(--hud-border-style) var(--hud-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.left-align { width: 33%; justify-content: flex-start; }
.center-align { width: 34%; justify-content: center; }
.right-align { width: 33%; justify-content: flex-end; }

.fui-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.fui-value {
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.fui-divider {
    color: rgba(255,255,255,0.1);
}

.hud-main-title {
    font-family: var(--font-syne);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.25em;
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
    text-align: center;
}

/* SIDEBARS */
.hud-side {
    background: rgba(5, 5, 8, 0.92);
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    z-index: 10;
}

.left-side {
    grid-row: 2;
    grid-column: 1;
    border-right: var(--hud-border-width) var(--hud-border-style) var(--hud-border-color);
}

.right-side {
    grid-row: 2;
    grid-column: 3;
    border-left: var(--hud-border-width) var(--hud-border-style) var(--hud-border-color);
}

.hud-panel {
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(11, 12, 16, 0.5);
    display: flex;
    flex-direction: column;
    border-radius: 2px;
    padding: 12px;
}

.panel-header {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.panel-row-input {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    gap: 4px;
}

.panel-row-input input[type="range"] {
    width: 100%;
}

.console-logs {
    height: 120px;
    overflow-y: auto;
    font-size: 0.65rem;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--font-mono);
}

.console-logs::-webkit-scrollbar {
    width: 3px;
}
.console-logs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.log-line {
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 5px;
    word-break: break-all;
}
.log-line.cyan { color: var(--fui-cyan); }
.log-line.gold { color: var(--fui-gold); }
.log-line.red { color: var(--fui-red); }

/* SLIDERS & INPUTS STYLE */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: rgba(255,255,255,0.06);
    height: 4px;
    outline: none;
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--fui-cyan);
    box-shadow: 0 0 6px var(--fui-cyan-glow);
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]#slider-volume::-webkit-slider-thumb {
    background: var(--fui-gold);
    box-shadow: 0 0 6px var(--fui-gold-glow);
}

/* ACT BUTTONS */
.act-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    cursor: pointer;
    margin-bottom: 8px;
    text-align: left;
    transition: all 0.3s var(--e2);
    width: 100%;
}

.act-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-color);
}

.act-btn.active {
    background: var(--fui-cyan-dim);
    border-color: var(--fui-cyan);
    color: var(--fui-cyan);
    box-shadow: inset 0 0 10px rgba(0, 229, 255, 0.08);
}

.act-btn .act-num {
    font-size: 0.6rem;
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 2px;
    margin-bottom: 4px;
}

.act-btn.active .act-num {
    background: var(--fui-cyan);
    color: var(--void-black);
}

.act-btn .act-title {
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.act-btn .act-subtitle {
    font-size: 0.6rem;
    opacity: 0.6;
    letter-spacing: 0.02em;
}

/* FREQUENCY SPECTRAL ANALYZER */
.spectral-analyzer {
    display: flex;
    justify-content: space-between;
    height: 140px;
    align-items: flex-end;
    padding: 10px 0;
}

.freq-channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: calc(100% / 7 - 4px);
    height: 100%;
}

.freq-bar {
    width: 6px;
    height: calc(100% - 20px);
    background: rgba(255,255,255,0.03);
    position: relative;
    border-radius: 1px;
}

.freq-fill {
    width: 100%;
    background: var(--fui-cyan);
    box-shadow: 0 0 5px var(--fui-cyan-glow);
    position: absolute;
    bottom: 0;
    transition: height 0.08s ease;
}

.freq-hz {
    font-size: 0.55rem;
    margin-top: 4px;
    color: var(--text-dim);
}

.freq-channel.highlighted .freq-hz {
    color: var(--fui-gold);
}

/* INTERACTIVE BUTTONS */
.control-action-btn {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 8px 12px;
    cursor: pointer;
    flex: 1;
    text-align: center;
    transition: all 0.2s ease;
}
.control-action-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}
.control-action-btn:active {
    transform: scale(0.98);
}

/* VIEWPORT VIEW */
.viewport-container {
    grid-row: 2;
    grid-column: 2;
    background: #020204;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
}

.viewport-container:active {
    cursor: grabbing;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* MATH OVERLAYS AND TEXT GLITCH */
.math-overlay {
    position: absolute;
    top: 40px;
    left: 40px;
    pointer-events: none;
    z-index: 100;
    max-width: 500px;
}

.math-math {
    font-size: 1.4rem;
    color: var(--fui-gold);
    text-shadow: 0 0 10px var(--fui-gold-glow);
    margin-bottom: 8px;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

.math-subtext {
    font-size: 0.75rem;
    color: var(--fui-cyan);
    text-shadow: 0 0 6px var(--fui-cyan-glow);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.vector-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.cinematic-watermark {
    position: absolute;
    bottom: 25px;
    left: 40px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.25);
    display: flex;
    flex-direction: column;
    gap: 4px;
    letter-spacing: 0.1em;
}

/* BOTTOM TIMELINE HUD */
.hud-bottom {
    grid-row: 3;
    grid-column: 1 / span 3;
    background: rgba(5, 5, 8, 0.95);
    border-top: var(--hud-border-width) var(--hud-border-style) var(--hud-border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 20px;
    gap: 8px;
    z-index: 10;
}

.timeline-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.timeline-container input[type="range"] {
    flex: 1;
}

.bottom-footer-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
}

/* GOLD SEAL FLASHER */
.gold-seal-border {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 4px solid var(--fui-gold);
    box-shadow: inset 0 0 40px var(--fui-gold-glow), 0 0 40px var(--fui-gold-glow);
    pointer-events: none;
    opacity: 0;
    z-index: 1000;
}

.gold-seal-flash-anim {
    animation: gold-border-pulse 0.4s ease-out forwards;
}

@keyframes gold-border-pulse {
    0% { opacity: 0; border-width: 20px; }
    30% { opacity: 1; border-width: 12px; }
    100% { opacity: 0.9; border-width: 4px; }
}

.brutalist-seal-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-family: var(--font-syne);
    font-weight: 800;
    color: var(--fui-gold);
    text-shadow: 0 0 30px var(--fui-gold-glow);
    letter-spacing: 0.2em;
    text-align: center;
    pointer-events: none;
    z-index: 1001;
    opacity: 0;
    line-height: 1.5;
}

.brutalist-seal-text-anim {
    animation: seal-text-entry 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes seal-text-entry {
    0% { opacity: 0; transform: translate(-50%, -40%) scale(0.85); filter: blur(10px); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
}

/* RESPONSIVE RETUNING */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 240px 1fr 240px;
    }
}
