/* ASCII Background */
#ascii-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    margin: 0;
    padding: 0;
    font-family: 'Unifont', 'Courier New', Courier, monospace;
    font-size: 10px;
    line-height: 10px;
    white-space: pre;
    overflow: hidden;
    color: #ffffff;
    /* White for high contrast */
    opacity: 0.2;
    /* Subtle */
    pointer-events: none;
    user-select: none;

    /* Reveal on hover logic */
    --cursor-x: 50%;
    --cursor-y: 50%;
    /* -webkit-mask-image: radial-gradient(circle 500px at var(--cursor-x) var(--cursor-y), black 0%, transparent 100%); */
    /* mask-image: radial-gradient(circle 500px at var(--cursor-x) var(--cursor-y), black 0%, transparent 100%); */
}

:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --accent-color: #ffffff;
    --dim-color: #888888;
    --border-color: #ffffff;
    --crt-green: #0f0;
    --font-main: 'Unifont', 'Courier New', Courier, monospace;
}

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

html {
    width: 100%;
    height: 100%;
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: never;
    image-rendering: pixelated;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.2);
}

body {
    width: 100%;
    height: 100dvh;
    background-color: transparent;
    /* Allow bg to show through */
    color: var(--text-color);
    overflow: hidden;
}

/* Wrapper for warping everything */
/* Wrapper for warping everything */
#screen-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: transparent;
    /* Changed from #000 to show transparent body/html bg if needed, or allow stacking */
    /* Transformation removed */
    transform: translateZ(0);
    z-index: 1;
}

/* WEGL CRT CANVAS REMOVED */

/* Main Container */
#terminal-container {
    height: 100%;
    width: 100%;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

/* Header */
header {
    border-bottom: 1px dashed var(--dim-color);
    padding-bottom: 2rem;
    margin-bottom: 3rem;
    text-align: center;
}

h1 {
    font-size: 4rem;
    text-transform: uppercase;
    letter-spacing: 0.5rem;
    margin-bottom: 1rem;
    font-weight: normal;
}

.subtitle-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 1.2rem;
    color: var(--text-color);
}

.separator {
    color: var(--text-color);
}

/* Sections */
section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px dashed var(--dim-color);
    padding-bottom: 0.5rem;
    display: inline-block;
    width: 100%;
}



p {
    line-height: 1.5;
    margin-bottom: 1rem;
    max-width: 800px;
}

/* Terminal Components */
.terminal-block {
    border-left: 2px solid var(--border-color);
    padding-left: 1.5rem;
    margin-left: 0.5rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.terminal-card {
    border: 1px solid #333;
    background: rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.terminal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 0%, rgba(255, 255, 255, 0.03) 100%);
    pointer-events: none;
}

.terminal-card:hover {
    border-color: var(--text-color);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.02);
}

.terminal-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    letter-spacing: 1px;
}

.terminal-card h3 a {
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.terminal-card h3 a:hover {
    border-bottom-color: var(--text-color);
}

.terminal-card p {
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 0;
    font-family: 'Inter', sans-serif;
    /* Cleaner font for reading */
}

.terminal-link {
    display: inline-block;
    margin-top: 1rem;
    color: inherit;
    text-decoration: none;
    font-weight: bold;
}

.terminal-link:hover {
    text-decoration: underline;
}

.terminal-list {
    list-style: none;
}

.terminal-list li {
    margin-bottom: 1rem;
}

.terminal-list a,
.discord-contact {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.2rem;
    display: inline-block;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
}

.terminal-list a:hover,
.discord-contact:hover {
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.1);
}

.directory-tree {
    list-style-type: none;
    padding-left: 1rem;
    font-family: monospace;
}

.directory-tree li::before {
    content: "├── ";
    color: var(--dim-color);
}

.directory-tree li:last-child::before {
    content: "└── ";
}

.directory-tree a {
    color: var(--text-color);
    text-decoration: none;
}

.directory-tree a:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px dashed var(--dim-color);
    padding-top: 2rem;
    text-align: center;
    padding-bottom: 2rem;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--dim-color);
    border: 1px solid var(--dim-color);
    padding: 0.5rem 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
        letter-spacing: 0.2rem;
    }

    .subtitle-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .separator {
        display: none;
    }

    #terminal-container {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    #music-player-container {
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        max-width: none;
    }

    .font-large .log-line {
        font-size: 20px;
    }

    .font-small .log-line {
        font-size: 12px;
    }

    #bootloader {
        padding: 10px;
    }
}

/* Bootloader & Splash Screen Styles */
#blackout {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#blackout.active {
    opacity: 1;
    pointer-events: all;
}

#splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
    background: #000;
}

#splash.active {
    opacity: 1;
    background: #000;
    /* Force opaque black */
    pointer-events: all;
}

.splash-logo {
    font-family: 'Unifont', monospace;
    font-size: 32px;
    color: white;
    margin-bottom: 40px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

#bootloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    color: #ccc;
    font-family: 'Unifont', monospace;
    font-size: 16px;
    padding: 20px;
    z-index: 9999;
    overflow-y: hidden;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    justify-content: flex-start;
}

#bootloader.active {
    display: flex;
}

.font-large .log-line {
    font-size: 32px;
    line-height: 1.25;
}

.font-small .log-line {
    font-size: 16px;
    line-height: 1.25;
    opacity: 0.9;
}

.log-line {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.log-status {
    font-weight: bold;
    margin-right: 10px;
}

.status-ok {
    color: #0f0;
}

.status-fail {
    color: #f00;
}

.status-warn {
    color: #ff0;
}

.log-msg {
    color: #eee;
}

/* Utility */
.hidden {
    display: none !important;
}

/* =========================================
   Cyber-Terminal Audio Deck Widget
   ========================================= */
#music-player-container {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: calc(100% - 40px);
    max-width: 320px;
    height: 50px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

#music-player-container.hidden {
    display: none;
}

#music-player-container:not(.hidden) {
    opacity: 1;
}

#music-player-container {
    pointer-events: all;
}

#player-ticket {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #000000;
    border: 1px solid #222;
    border-bottom: none;
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 12px;
    padding: 0;
    transform: translateY(calc(100% - 36px)); /* Show only the terminal header by default */
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Slide open on hover, playlist active, or manual expansion */
#music-player-container:hover #player-ticket,
#music-player-container.playlist-open #player-ticket,
#music-player-container.expanded #player-ticket {
    transform: translateY(0);
    border-color: var(--dim-color);
}

/* Terminal Header */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid #222;
    padding: 0.6rem 0.8rem;
}

#player-ticket:hover .player-header,
#music-player-container.playlist-open .player-header {
    border-color: var(--dim-color);
}

.player-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-color);
    box-shadow: 0 0 6px var(--text-color);
}

.blinking {
    animation: terminal-blink 1.5s infinite;
}

@keyframes terminal-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.player-title-text {
    font-weight: bold;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-color);
}

.player-header-btn {
    background: none;
    border: none;
    color: var(--dim-color);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    padding: 0;
    transition: color 0.2s;
}

.player-header-btn:hover {
    color: var(--text-color);
}

/* Player Body */
.player-body {
    padding: 1rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.track-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
}

.player-cover {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.track-text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.track-meta-row {
    display: flex;
    gap: 0.5rem;
}

.meta-label {
    color: var(--dim-color);
    font-weight: bold;
}

.track-title {
    font-weight: bold;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.track-artist {
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Progress Block */
.progress-block {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.bracket-char {
    color: var(--dim-color);
    font-weight: bold;
}

.progress-bar-bg {
    flex: 1;
    height: 6px;
    background: #1a1a1a;
    cursor: pointer;
    position: relative;
    border: 1px solid #333;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--text-color);
}

.time-display {
    font-size: 0.75rem;
    color: var(--dim-color);
    margin-left: 0.5rem;
    white-space: nowrap;
}

/* Player Footer */
.player-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed #222;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.2);
}

.controls {
    display: flex;
    gap: 0.5rem;
}

.ctrl-btn {
    background: #000000;
    border: 1px solid #333;
    color: var(--dim-color);
    font-family: inherit;
    cursor: pointer;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    transition: all 0.1s ease;
}

.ctrl-btn:hover {
    border-color: var(--border-color);
    color: var(--bg-color);
    background: var(--text-color);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.vol-label {
    font-size: 0.75rem;
    color: var(--dim-color);
}

.volume-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 3px;
    background: #222;
    outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 8px;
    background: var(--text-color);
    cursor: pointer;
    border-radius: 0;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 8px;
    height: 8px;
    background: var(--text-color);
    cursor: pointer;
    border-radius: 0;
    border: none;
}

/* Playlist Overlay */
.playlist-overlay {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 100%;
    max-height: 250px;
    background: #000000;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 12px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    margin-bottom: -1px;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #222;
    background: rgba(255, 255, 255, 0.03);
}

.pl-title {
    font-weight: bold;
    color: var(--text-color);
}

.pl-close-btn {
    background: none;
    border: none;
    color: var(--dim-color);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
}

.pl-close-btn:hover {
    color: var(--text-color);
}

.directory-playlist {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    overflow-y: auto;
    flex: 1;
}

.directory-playlist::-webkit-scrollbar {
    width: 4px;
}

.directory-playlist::-webkit-scrollbar-thumb {
    background: #333;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: monospace;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.playlist-item.active {
    color: var(--text-color);
    font-weight: bold;
}

.branch-connector {
    color: #444;
    margin-right: 0.25rem;
    white-space: pre;
}

.playlist-item.active .branch-connector {
    color: var(--text-color);
}

.song-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.song-separator {
    color: #444;
    margin: 0 0.5rem;
}

.song-artist {
    color: var(--dim-color);
    font-size: 0.75rem;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

/* =========================================
   Squirclified Tech Stack
   ========================================= */
.tech-icons-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.tech-icons-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
    max-width: 800px;
    padding: 1rem;
}

.tech-card {
    width: 64px;
    height: 64px;
    background: #000000;
    border: 1px solid #222;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    transition: all 0.15s ease;
    color: var(--text-color);
    z-index: 2;
}

.tech-card i {
    font-size: 32px;
}

.tech-card:hover {
    border-color: var(--border-color);
    background: var(--text-color);
    color: var(--bg-color);
}

.tech-card .custom-code-tag {
    font-family: monospace;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    letter-spacing: -1px;
}

.tech-card:hover .custom-code-tag {
    color: var(--bg-color);
}

.tech-card .custom-code-tag .slash {
    color: var(--dim-color);
}

.tech-card:hover .custom-code-tag .slash {
    color: var(--bg-color);
}

/* Tooltips (Aligned Above Card) */
.tech-card::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: #000;
    color: #fff;
    border: 1px solid #333;
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 4px;
    font-family: var(--font-main);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 30;
}

.tech-card:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    top: -34px;
}

/* =========================================
   Reworked Project Showcase
   ========================================= */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.project-card {
    border: 1px solid #222;
    background: #000000;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.project-card:hover {
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.01);
    border-bottom: 1px solid #222;
    padding: 0.75rem 1.25rem;
}

.project-title-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-card-title {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-color);
    letter-spacing: 1px;
}

.project-lang-badge {
    font-size: 0.75rem;
    color: var(--dim-color);
    border: 1px solid #333;
    padding: 1px 6px;
    border-radius: 0;
    font-family: monospace;
}

.project-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}

.project-desc {
    font-size: 0.9rem;
    color: #8a8d9a;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
    margin: 0;
}

.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    border-top: 1px dashed #222;
    padding-top: 0.75rem;
}

.project-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--dim-color);
}

.project-stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.project-action-btn {
    font-size: 0.85rem;
    color: var(--text-color);
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #333;
    padding: 4px 10px;
    border-radius: 0;
    transition: all 0.2s ease;
}

.project-action-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

/* =========================================
   Synced Background Lyrics / Subtitles
   ========================================= */
.lyrics-bg-column {
    position: fixed;
    top: 5%;
    width: 200px;
    height: 90%;
    z-index: 0;
    pointer-events: none;
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    opacity: 0.45;
    overflow: visible;
    transition: opacity 0.5s ease;
}

.lyrics-bg-column.left {
    left: 40px;
    text-align: left;
}

.lyrics-bg-column.right {
    right: 40px;
    text-align: right;
}

.lyric-line {
    opacity: 0.2;
    transition: opacity 0.3s ease, color 0.3s ease;
    letter-spacing: 0.5px;
}

.lyric-line.active {
    opacity: 1;
    color: var(--text-color);
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Hide on mobile/narrower screens to avoid overlap */
@media (max-width: 1400px) {
    .lyrics-bg-column {
        display: none !important;
    }
}

/* Autoplay Authorization Overlay */
#autoplay-auth {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    z-index: 100002;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-main);
    color: var(--text-color);
}

#autoplay-auth.hidden {
    display: none !important;
}

.auth-box {
    border: 1px solid var(--border-color);
    background: #000000;
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.auth-title {
    font-size: 1.2rem;
    font-weight: bold;
    border-bottom: 1px dashed var(--dim-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.auth-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-text {
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-color);
    font-family: var(--font-main);
    margin-bottom: 0.5rem;
}

.auth-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.auth-btn {
    flex: 1;
    background: #000000;
    border: 1px solid #333;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease;
}

.auth-btn:hover {
    border-color: var(--border-color);
    color: var(--bg-color);
    background: var(--text-color);
}

@media (max-width: 480px) {
    .auth-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
}