/* ============================================
   Font Declarations
   ============================================ */
@font-face {
    font-family: 'Play';
    src: url('assets/fonts/play-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Play';
    src: url('assets/fonts/play-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   Global Reset
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #000000;
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ============================================
   TV Container - Centered, Aspect-Locked
   ============================================ */
.tv-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;

    /* Allow scaling down when window is smaller than TV */
    max-width: 200vw;
    max-height: 200vh;
}

/* ============================================
   TV Screen Wrapper - Locks bezel and ASCII together
   ============================================ */
.tv-screen-wrapper {
    position: relative;
    display: inline-block;
    width: 100vw;      /* Fill the viewport width */
    max-width: 100vw;  /* Ensure it doesn't exceed viewport */
    height: auto;      /* Height scales proportionally with width */
}

/* ============================================
   CRT Effects Wrapper
   ============================================ */
.crt-effects {
    position: absolute;

    /* FIXED PIXEL COORDINATES - match exact screen position in 6000x4000px bezel image */
    left: 37%;      /* 35% of 6000px - adjust to match actual bezel screen position */
    top: 28%;        /* 21% of 4000px - adjust to match actual bezel screen position */
    width: 27%;     /* 30% of 6000px - adjust to match actual bezel screen size */
    height: 29%;    /* 40% of 4000px - adjust to match actual bezel screen size */

    /* Screen curvature using CSS transforms */
    transform-style: preserve-3d;
    perspective: 1000px;

    /* Rounded corners matching TV screen curvature */
    border-radius: 8px;
    overflow: hidden;

    /* Background color (shows when canvas not loaded) */
    background-color: #0a0a0a;

    /* Old TV screen glow */
    box-shadow:
        0 0 30px rgba(100, 255, 255, 0.4),
        0 0 60px rgba(100, 255, 255, 0.2),
        inset 0 0 30px rgba(0, 150, 150, 0.1);

    /* Subtle flicker animation */
    animation: crt-flicker 0.15s infinite;

    /* Ensure it's above the bezel image */
    z-index: 25;
}

@keyframes crt-flicker {
    0% { opacity: 0.98; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}

/* ============================================
   Canvas - Fits CRT Screen Area
   ============================================ */
#ascii-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1; /* Below scanlines and screen glow effects */

    /* Slightly increased brightness/contrast for CRT feel with random glitches */
    filter:
        brightness(1)
        contrast(1.5)
        saturate(1.15);

    /* Random signal interference glitch */
    animation: signal-glitch 12s infinite;
}

@keyframes signal-glitch {
    0%, 30%, 60%, 90%, 100% {
        filter: brightness(1) contrast(1.5) saturate(1.15);
    }
    31% {
        filter: brightness(1.3) contrast(1.8) saturate(0.8) hue-rotate(5deg);
    }
    32% {
        filter: brightness(0.8) contrast(2) saturate(1.5) hue-rotate(-5deg);
    }
    33% {
        filter: brightness(1) contrast(1.5) saturate(1.15);
    }
    61% {
        filter: brightness(1.15) contrast(1.7) saturate(1.3);
    }
    62% {
        filter: brightness(0.9) contrast(1.4) saturate(1);
    }
    91% {
        filter: brightness(1.2) contrast(2.5) saturate(0.7) hue-rotate(10deg);
    }
}

/* ============================================
   Scanline Effect - Enhanced Old TV Look
   ============================================ */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10; /* Above canvas (z-index: 1) */

    /* Strong horizontal scanlines with alternating dark lines */
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.5) 0px,
            rgba(0, 0, 0, 0.5) 1px,
            transparent 1px,
            transparent 3px
        );

    /* Continuous scanline drift animation */
    animation: scanline-drift 8s linear infinite;
}

@keyframes scanline-drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(8px); }
}

/* Tracking line - random horizontal interference */
.scanlines::before {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    opacity: 0;
    animation: tracking-line 20s infinite;
}

@keyframes tracking-line {
    0%, 50%, 100% {
        top: -10%;
        opacity: 0;
    }
    51% {
        top: 10%;
        opacity: 0.8;
    }
    55% {
        top: 90%;
        opacity: 0.8;
    }
    56% {
        top: 110%;
        opacity: 0;
    }
}

/* ============================================
   Screen Glow/Bloom Effect - Enhanced CRT Look
   ============================================ */
.screen-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15; /* Above scanlines (z-index: 10), below bezel (z-index: 20) */

    /* Strong vignette effect for old CRT tubes */
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, 0.4) 80%,
        rgba(0, 0, 0, 0.8) 100%
    );

    /* Enhanced uniform blue glow matching TV edges */
    box-shadow:
        inset 4px 0 8px rgba(100, 255, 255, 0.15),
        inset -4px 0 8px rgba(100, 255, 255, 0.15),
        inset 0 4px 8px rgba(100, 255, 255, 0.12),
        inset 0 -4px 8px rgba(100, 255, 255, 0.12),
        inset 0 0 40px rgba(0, 0, 0, 0.6);
}

/* ============================================
   Rolling Scan Bar Effect (Optional Additional Layer)
   ============================================ */
.screen-glow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 48%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 52%,
        transparent 100%
    );
    background-size: 100% 50%;
    animation: rolling-scan 10s linear infinite;
    pointer-events: none;
    mix-blend-mode: lighten;
}

@keyframes rolling-scan {
    0% { background-position: 0 -100%; }
    100% { background-position: 0 100%; }
}

/* ============================================
   TV Glitch Effects Layer
   ============================================ */
.crt-effects::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25; /* Above everything else inside crt-effects */
    opacity: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.1) 2px,
            rgba(255, 255, 255, 0.1) 4px
        );
    animation: tv-glitch 8s infinite;
}

@keyframes tv-glitch {
    0%, 80%, 100% {
        opacity: 0;
        transform: translateX(0);
    }
    81% {
        opacity: 0.7;
        transform: translateX(-3px);
    }
    82% {
        opacity: 0.4;
        transform: translateX(3px);
    }
    83% {
        opacity: 0.8;
        transform: translateX(-2px);
    }
    84% {
        opacity: 0;
        transform: translateX(0);
    }
}

/* ============================================
   TV Bezel Image
   ============================================ */
.tv-bezel {
    display: block;
    width: 100%;        /* Image sets the wrapper size */
    height: auto;       /* Maintain aspect ratio */
    pointer-events: none;
    z-index: 20;
}

/* ============================================
   Subtitle Box (TV Captions Style)
   ============================================ */
/* ============================================
   Subtitle Box - Above Input
   ============================================ */
.subtitle-box {
    position: fixed;
    bottom: 11%; /* Above input box (input is at bottom: 30px with ~48px height) */
    left: 50%;
    transform: translateX(-50%);

    width: 60%;
    max-width: 650px;
    height: 100px; /* Fixed height for 3-4 lines */

    background-color: transparent; /* Transparent edges */
    border: none;
    border-radius: 6px;

    padding: 0; /* No padding on outer box */

    z-index: 45; /* Below input (50) but above everything else */

    /* Clickable cursor */
    cursor: pointer;

    /* Smooth appearance */
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.subtitle-box.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.subtitle-content {
    color: #ffffff;
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    text-align: left;

    /* Text shadow for readability */
    text-shadow:
        1px 1px 2px rgba(0, 0, 0, 0.9),
        0 0 8px rgba(0, 0, 0, 0.5);

    /* Fixed height with scrolling enabled */
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;

    /* Transparent background, no visible border */
    background: transparent;
    padding: 0;

    /* Smooth text transitions */
    transition: transform 0.2s ease-out;
}

/* User message prefix styling */
.subtitle-content .user-prefix {
    color: #4a9eff; /* Blue for user */
    font-weight: bold;
}

/* Assistant message prefix styling */
.subtitle-content .assistant-prefix {
    color: #FF5656; /* Red for assistant */
    font-weight: bold;
}

/* Subtitle message spacing */
.subtitle-message {
    margin-bottom: 12px;
    line-height: 1.5;
}

.subtitle-message:last-child {
    margin-bottom: 0;
}

/* Custom scrollbar for subtitle box - only visible when scrolling */
.subtitle-content::-webkit-scrollbar {
    width: 8px;
}

.subtitle-content::-webkit-scrollbar-track {
    background: transparent;
}

.subtitle-content::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    transition: background 0.3s ease;
}

/* Show scrollbar on hover or during scroll */
.subtitle-content:hover::-webkit-scrollbar-thumb,
.subtitle-content:active::-webkit-scrollbar-thumb {
    background: rgba(102, 102, 102, 0.7);
}

.subtitle-content:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(85, 85, 85, 0.9);
}

/* ============================================
   History Toggle Button - REMOVED (Click subtitle box instead)
   ============================================ */

/* ============================================
   Conversation History Panel
   ============================================ */
.history-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;

    background: rgba(0, 0, 0, 0.95);

    z-index: 2000;

    display: none;
    align-items: center;
    justify-content: center;

    animation: fadeIn 0.3s ease;
}

.history-panel.visible {
    display: flex;
}

.history-panel.hidden {
    display: none;
}

.history-content-wrapper {
    width: 90%;
    max-width: 1000px;
    height: 90vh;

    background: transparent;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 40px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);

    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #ffffff;
    line-height: 1.6;
}

.history-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.history-close {
    position: absolute;
    top: 20px;
    right: 20px;

    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #fff;
    color: #fff;

    font-size: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.3s ease;
    z-index: 2001;
}

.history-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
}

.history-messages {
    padding: 0;
}

.history-message {
    margin-bottom: 20px;
    animation: message-appear 0.3s ease;
}

@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-label {
    font-size: 16px;
    font-weight: bold;
    display: inline;
    margin-right: 8px;
}

.message-label.user {
    color: #6A7EFC;
}

.message-label.assistant {
    color: #FF5656;
}

.message-content {
    color: #ffffff;
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    display: inline;
}

/* Custom retro scrollbar for history */
.history-content-wrapper::-webkit-scrollbar {
    width: 14px;
}

.history-content-wrapper::-webkit-scrollbar-track {
    background: #d0d0c0;
    border-right: 1px solid #999;
}

.history-content-wrapper::-webkit-scrollbar-thumb {
    background: #666;
    border: 1px solid #444;
}

.history-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   Input Container - Below TV
   ============================================ */
#input-container {
    position: fixed;
    bottom: 4%;
    left: 50%;
    transform: translateX(-50%);

    width: 60%;
    max-width: 650px;

    z-index: 50;
}

#user-input {
    width: 100%;
    padding: 14px 24px;

    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #acacac;
    border-radius: 6px;

    color: #ffffff;
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;

    outline: none;
    transition: all 0.3s ease;

    /* box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2); */
}

#user-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#user-input:focus {
    background: rgba(0, 0, 0, 0.6);
    border-color: #ffffff;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.loading-text {
    color: #ffffff;
    font-size: 20px;
    margin-bottom: 20px;
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #ffffff, #cccccc);
    width: 0%;
    transition: width 0.1s ease;
}

.loading-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin-top: 15px;
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
/* ============================================
   TV Document Viewer (Inside TV Screen)
   ============================================ */
.tv-document-viewer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: #ffffff;

    overflow-y: auto;
    overflow-x: hidden;

    z-index: 5; /* Above canvas, below scanlines */

    display: none;
    padding: 20px;

    /* Clean, modern aesthetic */
    font-family: 'Play', sans-serif;
    color: #000;
    line-height: 1.6;
}

.tv-document-viewer.active {
    display: block;
}

/* Content wrapper inside TV viewer */
.tv-document-content {
    width: 100%;
}

/* ============================================
   TV Fullscreen Button - Retro Computer Style
   ============================================ */
.tv-fullscreen-btn {
    position: sticky; /* Sticky so it stays visible when scrolling */
    top: 0px;
    left: calc(100% - 20px); /* Position from the left edge (100% - 48px button - 20px margin) */
    margin-bottom: -0px; /* Negative margin so it doesn't push content down */
    z-index: 10; /* Above the document content but within the white area */

    width: 30px;
    height: 30px;

    /* Retro 3D button effect with beveled edges */
    background: linear-gradient(135deg, #e0e0e0 0%, #b0b0b0 100%);
    border: none;
    box-shadow:
        /* Outer raised border (light on top-left, dark on bottom-right) */
        inset 2px 2px 0 0 #ffffff,
        inset -2px -2px 0 0 #606060,
        /* Middle border */
        inset 4px 4px 0 0 #d0d0d0,
        inset -4px -4px 0 0 #808080,
        /* Outer shadow for depth */
        2px 2px 4px rgba(0, 0, 0, 0.5);

    color: #000;

    display: none;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    font-family: 'Play', sans-serif;
    font-size: 16px;

    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;

    /* Pixelated/retro rendering */
    image-rendering: pixelated;
}

/* Show button when TV viewer is active */
.tv-document-viewer.active .tv-fullscreen-btn {
    display: flex;
}

.tv-fullscreen-btn.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.tv-fullscreen-btn svg {
    filter: drop-shadow(1px 1px 0 rgba(255, 255, 255, 0.5));
    stroke: #000;
    stroke-width: 2;
}

.tv-fullscreen-btn:hover {
    /* Slightly brighter on hover */
    background: linear-gradient(135deg, #f0f0f0 0%, #c0c0c0 100%);
    box-shadow:
        inset 2px 2px 0 0 #ffffff,
        inset -2px -2px 0 0 #707070,
        inset 4px 4px 0 0 #e0e0e0,
        inset -4px -4px 0 0 #909090,
        2px 2px 6px rgba(0, 0, 0, 0.6);
}

.tv-fullscreen-btn:active {
    /* Pressed/inverted bevel effect */
    background: linear-gradient(135deg, #a0a0a0 0%, #d0d0d0 100%);
    box-shadow:
        inset -2px -2px 0 0 #ffffff,
        inset 2px 2px 0 0 #606060,
        inset -4px -4px 0 0 #d0d0d0,
        inset 4px 4px 0 0 #808080,
        1px 1px 2px rgba(0, 0, 0, 0.4);
    transform: translateY(1px);
}

/* Custom Windows 95 scrollbar
.tv-document-viewer::-webkit-scrollbar {
    width: 16px;
}

.tv-document-viewer::-webkit-scrollbar-track {
    background: #c0c0c0;
    border-left: 1px solid #dfdfdf;
    border-top: 1px solid #dfdfdf;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
}

.tv-document-viewer::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #000000;
    border-right: 2px solid #000000;
    box-shadow:
        inset 1px 1px 0 #dfdfdf,
        inset -1px -1px 0 #808080;
    min-height: 20px;
}

.tv-document-viewer::-webkit-scrollbar-thumb:hover {
    background: #c0c0c0;
}

.tv-document-viewer::-webkit-scrollbar-thumb:active {
    background: #a0a0a0;
    border-top: 1px solid #000000;
    border-left: 1px solid #000000;
    border-bottom: 1px solid #ffffff;
    border-right: 1px solid #ffffff;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
}

Arrow buttons
.tv-document-viewer::-webkit-scrollbar-button {
    height: 16px;
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #000000;
    border-right: 2px solid #000000;
    box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080;
    background-repeat: no-repeat;
    background-position: center;
}

.tv-document-viewer::-webkit-scrollbar-button:vertical:decrement {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M 8 5 L 4 11 L 12 11 Z" fill="%23000"/></svg>');
}

.tv-document-viewer::-webkit-scrollbar-button:vertical:increment {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M 8 11 L 4 5 L 12 5 Z" fill="%23000"/></svg>');
}

.tv-document-viewer::-webkit-scrollbar-button:hover {
    background-color: #c0c0c0;
}

.tv-document-viewer::-webkit-scrollbar-button:active {
    background-color: #a0a0a0;
    border-top: 1px solid #000000;
    border-left: 1px solid #000000;
    border-bottom: 1px solid #ffffff;
    border-right: 1px solid #ffffff;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
} */

.tv-document-viewer {
    scrollbar-width: auto;
    scrollbar-color: #c0c0c0 #808080;
}

/* ============================================
   Fullscreen Document Viewer
   ============================================ */
.fullscreen-document-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;

    background: rgba(0, 0, 0, 0.95);

    z-index: 2000;

    display: none;
    align-items: center;
    justify-content: center;

    animation: fadeIn 0.3s ease;
}

.fullscreen-document-viewer.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;

    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #fff;
    color: #fff;

    font-size: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.3s ease;
    z-index: 2001;
}

.fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
}

.document-content {
    width: 90%;
    max-width: 1000px;
    height: 90vh;

    background: transparent;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 40px;
    /* border-radius: 8px; */
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);

    /* Old computer/PDF aesthetic */
    font-family: "Play", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #ffffff;
    line-height: 1.6;

    /* Paper texture */
    /* background-image:
        linear-gradient(90deg, transparent 79px, #abced4 79px, #abced4 81px, transparent 81px),
        linear-gradient(#eee .1em, transparent .1em);
    background-size: 100% 1.2em; */
}

/* Custom retro scrollbar */
.document-content::-webkit-scrollbar {
    width: 14px;
}

.document-content::-webkit-scrollbar-track {
    background: #d0d0c0;
    border-right: 1px solid #999;
}

.document-content::-webkit-scrollbar-thumb {
    background: #666;
    border: 1px solid #444;
}

.document-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
.document-content {
    scrollbar-width: thin;
    scrollbar-color: #666 #d0d0c0;
}

/* ============================================
   Document Styling (Common to both viewers)
   ============================================ */
.document-section h1 {
    font-size: 24px;
    font-weight: bold;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.document-section h2 {
    font-size: 18px;
    font-weight: bold;
    margin: 15px 0 8px 0;
}

.document-section h3 {
    font-size: 16px;
    font-weight: bold;
    margin: 12px 0 6px 0;
}

.document-section p {
    margin-bottom: 12px;
}

.document-section ul,
.document-section ol {
    margin-left: 30px;
    margin-bottom: 12px;
}

.document-section li {
    margin-bottom: 6px;
}

.document-item {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #999;
}

.document-item:last-child {
    border-bottom: none;
}

.item-header {
    margin-bottom: 12px;
}

.item-meta {
    font-size: 14px;
    color: #444;
    margin-top: 4px;
}

.item-meta .institution,
.item-meta .company {
    font-weight: bold;
}

.item-meta .dates {
    margin-left: 12px;
    font-style: italic;
}

.item-technologies {
    margin-top: 12px;
    font-size: 14px;
    color: #555;
}

.item-links {
    margin-top: 12px;
}

.item-links a {
    color: #0066cc;
    text-decoration: underline;
    margin-right: 15px;
}

.item-links a:hover {
    color: #004499;
}

.document-link a {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 16px;
    background: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
}

.document-link a:hover {
    background: #555;
}

.document-error {
    padding: 20px;
    text-align: center;
}

.document-error h2 {
    color: #c00;
}

.skills-category {
    margin-bottom: 25px;
}

.skills-category h2 {
    margin-bottom: 10px;
}

.skills-category ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.skills-category li {
    list-style: none;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid #666;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .tv-container {
        width: 90vw;
        max-height: 70vh;
    }

    .history-panel {
        width: 45%;
    }

    #input-container {
        width: 70%;
    }
}

@media (max-width: 768px) {
    .tv-container {
        width: 95vw;
        max-height: 65vh;
    }

    /* Disable screen curvature on mobile for readability */
    .crt-effects {
        perspective: none;
    }

    .scanlines {
        /* Lighter scanlines on mobile */
        background: repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(0, 0, 0, 0.08) 3px,
            rgba(0, 0, 0, 0.08) 6px
        );
    }

    .history-panel {
        width: 80%;
        max-width: none;
    }

    #input-container {
        width: 85%;
    }

    .subtitle-box {
        font-size: 14px;
        padding: 10px 15px;
    }
}
