@import url("https://fonts.googleapis.com/css2?family=Geist+Mono:wght@300;400;500&family=Geist:wght@300;400;600&display=swap");

:root {
    --bg: #050505;
    --fg: #fff;
    --fg-dim: #666;
    --fg-muted: #333;
    --accent: #4af;
    --border: rgba(255, 255, 255, 0.1);
    --surface: rgba(8, 8, 8, 0.97);
}

:root.light {
    --bg: #f2f0eb;
    --fg: #111;
    --fg-dim: #777;
    --fg-muted: #bbb;
    --accent: #1a6fcc;
    --border: rgba(0, 0, 0, 0.12);
    --surface: rgba(242, 240, 235, 0.98);
}

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

body {
    overflow: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: "Geist Mono", monospace;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    transition:
        background 0.4s,
        color 0.4s;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
}
#title-block {
    position: absolute;
    top: 15%;
    left: 15%;
    pointer-events: auto;
    user-select: none;
}
#title-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
#name-span {
    font-size: 22px;
    letter-spacing: 1px;
    font-weight: 500;
    color: var(--fg);
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition:
        text-shadow 0.2s,
        color 0.4s;
}
:root.light #name-span {
    text-shadow: 0 0 18px rgba(0, 0, 0, 0.08);
}
#name-span:hover {
    text-shadow: 0 0 28px rgba(255, 255, 255, 0.45);
}
:root.light #name-span:hover {
    text-shadow: 0 0 12px rgba(26, 111, 204, 0.3);
}
#bio-span {
    font-size: 10px;
    color: var(--fg-dim);
    letter-spacing: 2px;
    pointer-events: none;
    transition: color 0.4s;
}
#shader-sub {
    font-size: 9px;
    color: var(--fg-muted);
    margin-top: 2px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: color 0.15s;
}
#shader-sub:hover {
    color: var(--fg-dim);
}

.track-label {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 11px;
    pointer-events: none;
    white-space: nowrap;
    color: var(--fg-dim);
    transition:
        color 0.12s,
        text-shadow 0.12s,
        transform 0.12s,
        opacity 0.2s;
}
.track-label.hovered {
    color: var(--fg);
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.6),
        0 0 24px rgba(255, 255, 255, 0.25);
    transform: translate(var(--tx), var(--ty)) scale(1.12) !important;
}
:root.light .track-label.hovered {
    text-shadow: 0 0 8px rgba(26, 111, 204, 0.4);
}

#link-tooltip {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--bg);
    background: var(--fg);
    padding: 4px 14px;
    letter-spacing: 1px;
}

#labels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
#post-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
}
#mobile-hint {
    display: none;
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--fg-muted);
    letter-spacing: 1px;
    text-align: center;
    opacity: 1;
    transition: opacity 1.5s;
    white-space: nowrap;
    pointer-events: none;
}

#shader-ctx-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 0;
    font-size: 11px;
    font-family: "Geist Mono", monospace;
    color: var(--fg-dim);
    z-index: 100;
    display: none;
    min-width: 220px;
    max-height: 80vh;
    overflow-y: auto;
    transition:
        background 0.4s,
        border-color 0.4s;
}
#shader-ctx-menu
    > div:not(#shader-grid):not(.ctx-section-label):not(.ctx-divider) {
    padding: 6px 14px;
    cursor: pointer;
}
#shader-ctx-menu
    > div:not(#shader-grid):not(.ctx-section-label):not(.ctx-divider):hover {
    background: var(--border);
    color: var(--fg);
}
.ctx-section-label {
    font-size: 8px;
    color: var(--fg-muted);
    letter-spacing: 2px;
    padding: 7px 14px 2px !important;
    cursor: default !important;
    text-transform: uppercase;
}
.ctx-active-item {
    color: var(--accent) !important;
}
.ctx-divider {
    height: 1px;
    background: var(--border);
    margin: 3px 0;
}

#shader-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    padding: 5px 7px;
}
.shader-grid-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 3px 2px;
    transition:
        background 0.1s,
        border-color 0.1s;
    min-height: 44px;
    position: relative;
    overflow: hidden;
}
.shader-grid-cell:hover {
    border-color: rgba(255, 255, 255, 0.3);
}
:root.light .shader-grid-cell {
    background: rgba(0, 0, 0, 0.03);
}
:root.light .shader-grid-cell:hover {
    border-color: rgba(0, 0, 0, 0.2);
}
.shader-grid-cell.ctx-active-item {
    border-color: var(--accent);
}
.shader-grid-label {
    font-size: 7px;
    color: #ddd;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.2;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    transition: color 0.1s;
}
:root.light .shader-grid-label {
    color: #111;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
.shader-grid-cell.ctx-active-item .shader-grid-label {
    color: var(--accent);
}

#hold-ring {
    position: fixed;
    pointer-events: none;
    z-index: 50;
    display: none;
}
#hold-ring svg {
    transform: rotate(-90deg);
}
#hold-ring circle.track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 2;
}
#hold-ring circle.prog {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: 0 188;
    transition: stroke-dasharray 0.05s linear;
}

#vhs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 400;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}
#vhs-canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}
#vhs-overlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 1;
}
#vhs-overlay::after {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%/8px;
    box-shadow:
        inset 0 0 0 6px rgba(0, 0, 0, 0.85),
        inset 0 6px 18px rgba(0, 0, 0, 0.7),
        inset 0 -6px 18px rgba(0, 0, 0, 0.7),
        inset 6px 0 18px rgba(0, 0, 0, 0.5),
        inset -6px 0 18px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 2;
}

#iyrs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    font-family: "Geist", sans-serif;
    background: #fafdee;
    display: flex;
    flex-direction: column;
}
#iyrs-overlay.active {
    opacity: 1;
    pointer-events: all;
}

#iy-header {
    background: #fff;
    border-bottom: 2px solid #1a3a6e;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 48px;
    position: relative;
    flex-shrink: 0;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 12px 100%);
}
#iy-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #4af, transparent);
    animation: scanH 3s linear infinite;
}
@keyframes scanH {
    from {
        background-position: -200% 0;
    }
    to {
        background-position: 200% 0;
    }
}
#iy-logo-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}
#iy-logo-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #4af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #4af;
    letter-spacing: 0;
    font-weight: 700;
    flex-shrink: 0;
}
#iy-logo-text {
    font-size: 18px;
    font-weight: 600;
    color: #c8deff;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-family: "Geist Mono", monospace;
}
#iy-nav {
    display: flex;
    gap: 0;
    margin-left: 20px;
}
#iy-nav a {
    color: #7aaad4;
    font-size: 12px;
    letter-spacing: 1px;
    text-decoration: none;
    padding: 0 16px;
    height: 48px;
    display: flex;
    align-items: center;
    border-left: 1px solid rgba(74, 170, 255, 0.1);
    transition:
        color 0.15s,
        background 0.15s;
    font-weight: 500;
    text-transform: uppercase;
}
#iy-nav a:hover {
    color: #fff;
    background: rgba(74, 170, 255, 0.06);
}
#iy-close {
    color: #4af;
    font-size: 18px;
    cursor: pointer;
    padding: 0 8px;
    opacity: 0.5;
    transition: opacity 0.15s;
    user-select: none;
    font-weight: 300;
}
#iy-close:hover {
    opacity: 1;
}

#iy-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
#iy-sidebar {
    width: 190px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #1a3a6e;
    display: flex;
    flex-direction: column;
    padding: 14px 0;
    position: relative;
    overflow: hidden;
}
#iy-sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(74, 170, 255, 0.018) 0px,
        rgba(74, 170, 255, 0.018) 1px,
        transparent 1px,
        transparent 4px
    );
    pointer-events: none;
}
.sb-label {
    font-size: 8px;
    color: #2a5a8e;
    letter-spacing: 2px;
    padding: 0 16px 5px;
    text-transform: uppercase;
    font-family: "Geist Mono", monospace;
}
.sb-stat {
    padding: 3px 16px;
    font-size: 10px;
    color: #4a7aaa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: "Geist Mono", monospace;
}
.sb-stat span {
    color: #4af;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.sb-divider {
    height: 1px;
    background: #1a3a6e;
    margin: 8px 16px;
}
.sb-node {
    margin: 2px 8px;
    padding: 4px 10px;
    font-size: 9px;
    color: #2a5a8e;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 1px;
    font-family: "Geist Mono", monospace;
}
.sb-node:hover {
    color: #4af;
    border-color: #1a3a6e;
    background: rgba(74, 170, 255, 0.04);
}
.sb-node.active {
    color: #4af;
    border-color: #1a4a8e;
    background: rgba(74, 170, 255, 0.07);
}

#iy-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-width: 0;
}
#iy-main::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(
            ellipse 40% 40% at 0% 0%,
            rgba(44, 130, 255, 0.2) 0%,
            transparent 100%
        ),
        radial-gradient(
            ellipse 15% 15% at 0% 0%,
            rgba(74, 170, 255, 0.15) 0%,
            transparent 100%
        );
    pointer-events: none;
    z-index: 0;
}
#iy-greeting {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s;
}
#iy-greeting.hidden {
    opacity: 0;
}
#iy-greeting-text {
    font-size: 20px;
    font-weight: 600;
    color: #1a4a8e;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: greetPulse 4s ease-in-out infinite;
    font-family: "Geist Mono", monospace;
}
@keyframes greetPulse {
    0%,
    100% {
        color: #1a4a8e;
    }
    50% {
        color: #2a7aee;
        text-shadow: 0 0 20px rgba(74, 170, 255, 0.25);
    }
}
#iy-greeting-sub {
    font-size: 9px;
    color: #0e2a4e;
    letter-spacing: 2px;
    margin-top: 5px;
    font-family: "Geist Mono", monospace;
}
#iy-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: #1a3a6e transparent;
}
#iy-messages::-webkit-scrollbar {
    width: 3px;
}
#iy-messages::-webkit-scrollbar-thumb {
    background: #1a3a6e;
    border-radius: 2px;
}

.msg {
    max-width: 70%;
    padding: 9px 13px;
    font-size: 12px;
    line-height: 1.55;
    position: relative;
    border-radius: 6px;
    font-family: "Geist", sans-serif;
}
.msg.user {
    align-self: flex-end;
    background: #0e1e3a;
    border: 1px solid #1a3a6e;
    color: #c8deff;
    border-bottom-right-radius: 2px;
}

.msg.room {
    align-self: flex-start;
    background: #070a11;
    border: 1px solid #0e2a4e;
    color: #7aaad4;
    border-bottom-left-radius: 2px;
    background-image: radial-gradient(
        ellipse at center,
        rgba(74, 170, 255, 0.04) 0%,
        rgba(7, 10, 17, 0) 70%
    );
}

.msg.ai {
    align-self: flex-start;
    background: #070a11;
    border: 1px solid #0e2a4e;
    color: #7aaad4;
    border-bottom-left-radius: 2px;
    background-image: radial-gradient(
        ellipse at center,
        rgba(74, 170, 255, 0.06) 0%,
        rgba(7, 10, 17, 0) 70%
    );
}
.msg-user {
    color: #4af;
    font-size: 10px;
    font-family: "Geist Mono", monospace;
    display: block;
    margin-bottom: 2px;
    letter-spacing: 1px;
}

#iy-input-zone {
    border-top: 1px solid #1a3a6e;
    padding: 12px 18px;
    display: flex;
    gap: 9px;
    align-items: center;
    background: #ccccff;
    flex-shrink: 0;
}
#iy-attach {
    background: #ddddff;
    border: 1px solid #1a4a8e;
    color: #4af;
    font-size: 15px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
}
#iy-attach:hover {
    background: #1a3a6e;
}
#iy-input {
    flex: 1;
    background: #eeeeff;
    border: 1px solid #1a3a6e;
    color: #c8deff;
    font-family: "Geist", serif;
    font-size: 12px;
    padding: 9px 13px;
    outline: none;
    border-radius: 4px;
    transition: border-color 0.15s;
}
#iy-input:focus {
    border-color: #4af;
}
#iy-input::placeholder {
    color: #3a3a66;
}
#iy-send {
    background: #ddddff;
    border: 1px solid #1a4a8e;
    color: #4af;
    font-family: "Geist Mono", monospace;
    font-size: 10px;
    padding: 9px 14px;
    cursor: pointer;
    letter-spacing: 2px;
    border-radius: 4px;
    transition: all 0.15s;
    text-transform: uppercase;
}
#iy-send:hover {
    background: #1a3a6e;
    color: #fff;
}
#iy-statusbar {
    background: #aaaaff;
    border-top: 1px solid #0e2040;
    padding: 3px 22px;
    font-size: 8px;
    color: #1a3a6e;
    display: flex;
    gap: 22px;
    letter-spacing: 1px;
    flex-shrink: 0;
    font-family: "Geist Mono", monospace;
}
#iy-statusbar span {
    color: #0a2050;
}
.sb-live {
    color: #4af !important;
    animation: blink 2s step-end infinite;
}
@keyframes blink {
    50% {
        opacity: 0;
    }
}

#iy-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.035) 0px,
        rgba(0, 0, 0, 0.035) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1;
}

#iyrs-overlay.intro #iy-logo-zone {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    flex-direction: column;
    gap: 8px;
}
#iyrs-overlay.intro #iy-logo-circle {
    width: 60px;
    height: 60px;
    font-size: 0;
}
#iyrs-overlay.intro #iy-logo-text {
    font-size: 36px;
    letter-spacing: 8px;
}
#iyrs-overlay.intro #iy-nav,
#iyrs-overlay.intro #iy-close {
    display: none;
}
#iyrs-overlay.settled #iy-logo-zone {
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 600px) {
    #title-block {
        top: 8%;
        left: 8%;
    }
    #name-span {
        font-size: 17px;
    }
    #bio-span {
        font-size: 9px;
    }
    .track-label {
        font-size: 10px;
    }
    #link-tooltip {
        bottom: 12px;
        font-size: 11px;
        max-width: 80vw;
        text-align: center;
    }
    #iy-sidebar {
        display: none;
    }
    #iy-nav a {
        padding: 0 9px;
        font-size: 10px;
    }
    #iy-greeting-text {
        font-size: 15px;
    }
    .msg {
        max-width: 90%;
        font-size: 11px;
    }
    #iy-input {
        font-size: 16px;
    }
    #shader-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 400px) {
    #name-span {
        font-size: 14px;
    }
    #iy-logo-text {
        font-size: 14px;
        letter-spacing: 2px;
    }
}
