@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap');

/* Tema değişkenleri: --btn-close, --btn-minimize, --btn-maximize titlebar butonları için */

:root,
[data-theme="dark"] {
    --bg: #0a0e14;
    --bg-secondary: #0d1117;
    --fg: #b3b1ad;
    --fg-bright: #e6e1cf;
    --prompt-user: #39c5bb;
    --prompt-host: #39c5bb;
    --prompt-path: #59c2ff;
    --prompt-symbol: #e6e1cf;
    --red: #f07178;
    --green: #aad94c;
    --yellow: #e6b450;
    --blue: #59c2ff;
    --magenta: #d2a6ff;
    --cyan: #95e6cb;
    --white: #e6e1cf;
    --gray: #626a73;
    --selection: rgba(57, 197, 187, 0.15);
    --scrollbar-bg: #0d1117;
    --scrollbar-thumb: #1c2433;
    --border: #1c2433;
    --glow: rgba(57, 197, 187, 0.08);
    --btn-close: #f07178;
    --btn-minimize: #e6b450;
    --btn-maximize: #aad94c;
    --font-mono: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Consolas', monospace;
    --font-size: 14px;
    --line-height: 1.7;
}

[data-theme="light"] {
    --bg: #f5f5f5;
    --bg-secondary: #eaeaea;
    --fg: #3c3c3c;
    --fg-bright: #1a1a1a;
    --prompt-user: #0e7c6b;
    --prompt-host: #0e7c6b;
    --prompt-path: #0060a8;
    --prompt-symbol: #1a1a1a;
    --red: #c0392b;
    --green: #27ae60;
    --yellow: #b8860b;
    --blue: #0060a8;
    --magenta: #8e44ad;
    --cyan: #0e7c6b;
    --white: #1a1a1a;
    --gray: #7f8c8d;
    --selection: rgba(14, 124, 107, 0.15);
    --scrollbar-bg: #eaeaea;
    --scrollbar-thumb: #c0c0c0;
    --border: #d0d0d0;
    --glow: rgba(14, 124, 107, 0.06);
    --btn-close: #e74c3c;
    --btn-minimize: #f39c12;
    --btn-maximize: #27ae60;
    --font-mono: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Consolas', monospace;
    --font-size: 14px;
    --line-height: 1.7;
}

/* Ocean — derin mavi / teal */
[data-theme="ocean"] {
    --bg: #0d1b2a;
    --bg-secondary: #1b263b;
    --fg: #e0e1dd;
    --fg-bright: #fff;
    --prompt-user: #48cae4;
    --prompt-host: #48cae4;
    --prompt-path: #90e0ef;
    --prompt-symbol: #e0e1dd;
    --red: #ef476f;
    --green: #06d6a0;
    --yellow: #ffd166;
    --blue: #118ab2;
    --magenta: #9d4edd;
    --cyan: #48cae4;
    --white: #e0e1dd;
    --gray: #778da9;
    --selection: rgba(72, 202, 228, 0.2);
    --scrollbar-bg: #1b263b;
    --scrollbar-thumb: #415a77;
    --border: #415a77;
    --glow: rgba(72, 202, 228, 0.1);
    --btn-close: #ef476f;
    --btn-minimize: #ffd166;
    --btn-maximize: #06d6a0;
}

/* Forest — yeşil tonları */
[data-theme="forest"] {
    --bg: #1a1f1c;
    --bg-secondary: #252b27;
    --fg: #d4d7d4;
    --fg-bright: #f0f2f0;
    --prompt-user: #7cb342;
    --prompt-host: #7cb342;
    --prompt-path: #9ccc65;
    --prompt-symbol: #d4d7d4;
    --red: #e57373;
    --green: #81c784;
    --yellow: #ffb74d;
    --blue: #64b5f6;
    --magenta: #ba68c8;
    --cyan: #4dd0e1;
    --white: #e0e0e0;
    --gray: #78909c;
    --selection: rgba(124, 179, 66, 0.2);
    --scrollbar-bg: #252b27;
    --scrollbar-thumb: #3d4a3e;
    --border: #3d4a3e;
    --glow: rgba(124, 179, 66, 0.1);
    --btn-close: #e57373;
    --btn-minimize: #ffb74d;
    --btn-maximize: #81c784;
}

/* Nord — minimalist mavi-gri */
[data-theme="nord"] {
    --bg: #2e3440;
    --bg-secondary: #3b4252;
    --fg: #d8dee9;
    --fg-bright: #eceff4;
    --prompt-user: #88c0d0;
    --prompt-host: #88c0d0;
    --prompt-path: #81a1c1;
    --prompt-symbol: #eceff4;
    --red: #bf616a;
    --green: #a3be8c;
    --yellow: #ebcb8b;
    --blue: #81a1c1;
    --magenta: #b48ead;
    --cyan: #8fbcbb;
    --white: #eceff4;
    --gray: #4c566a;
    --selection: rgba(136, 192, 208, 0.2);
    --scrollbar-bg: #3b4252;
    --scrollbar-thumb: #4c566a;
    --border: #4c566a;
    --glow: rgba(136, 192, 208, 0.1);
    --btn-close: #bf616a;
    --btn-minimize: #ebcb8b;
    --btn-maximize: #a3be8c;
}

/* Monokai — klasik IDE paleti */
[data-theme="monokai"] {
    --bg: #272822;
    --bg-secondary: #3e3d32;
    --fg: #f8f8f2;
    --fg-bright: #fff;
    --prompt-user: #66d9ef;
    --prompt-host: #66d9ef;
    --prompt-path: #a6e22e;
    --prompt-symbol: #f8f8f2;
    --red: #f92672;
    --green: #a6e22e;
    --yellow: #e6db74;
    --blue: #66d9ef;
    --magenta: #ae81ff;
    --cyan: #66d9ef;
    --white: #f8f8f2;
    --gray: #75715e;
    --selection: rgba(102, 217, 239, 0.2);
    --scrollbar-bg: #3e3d32;
    --scrollbar-thumb: #49483e;
    --border: #49483e;
    --glow: rgba(102, 217, 239, 0.1);
    --btn-close: #f92672;
    --btn-minimize: #e6db74;
    --btn-maximize: #a6e22e;
}

/* Sunset — sıcak turuncu/ambar */
[data-theme="sunset"] {
    --bg: #1e1a17;
    --bg-secondary: #2a2420;
    --fg: #e8e0d9;
    --fg-bright: #fff8f0;
    --prompt-user: #f59e0b;
    --prompt-host: #f59e0b;
    --prompt-path: #fbbf24;
    --prompt-symbol: #e8e0d9;
    --red: #ef4444;
    --green: #34d399;
    --yellow: #fbbf24;
    --blue: #60a5fa;
    --magenta: #c084fc;
    --cyan: #22d3ee;
    --white: #fff8f0;
    --gray: #78716c;
    --selection: rgba(245, 158, 11, 0.2);
    --scrollbar-bg: #2a2420;
    --scrollbar-thumb: #44403c;
    --border: #44403c;
    --glow: rgba(245, 158, 11, 0.1);
    --btn-close: #ef4444;
    --btn-minimize: #fbbf24;
    --btn-maximize: #34d399;
}

[data-theme="dark"],
[data-theme="ocean"],
[data-theme="forest"],
[data-theme="nord"],
[data-theme="monokai"],
[data-theme="sunset"] { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

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

::selection {
    background: var(--selection);
    color: var(--fg-bright);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-mono);
    font-size: var(--font-size);
    line-height: var(--line-height);
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
}

/* ── Terminal Window ───────────────────────────── */

.terminal-window {
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
}

.terminal-titlebar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.titlebar-buttons {
    display: flex;
    gap: 8px;
    margin-right: 16px;
}

.titlebar-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: default;
}

.titlebar-btn.close { background: var(--btn-close); }
.titlebar-btn.minimize { background: var(--btn-minimize); }
.titlebar-btn.maximize { background: var(--btn-maximize); }

.titlebar-title {
    flex: 1;
    text-align: center;
    color: var(--gray);
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════════
   CLASSIC TEMPLATE - Input içerikle birlikte akar
   ══════════════════════════════════════════════════ */

.terminal-classic {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.terminal-classic .terminal-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.terminal-classic .input-line {
    display: flex;
    align-items: center;
    padding: 4px 0;
    margin-top: 4px;
    margin-left: 0;
}

/* ══════════════════════════════════════════════════
   FIXED TEMPLATE - Input altta sabit
   ══════════════════════════════════════════════════ */

.terminal-fixed {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.terminal-fixed .terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.terminal-fixed > .input-line {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

/* ── Scrollbar ─────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--prompt-user);
    opacity: 0.3;
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    opacity: 0.5;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--prompt-user) transparent;
}

/* ── Output ────────────────────────────────────── */

.output-line {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    min-height: 1em;
    max-width: 100%;
}

.output-block {
    margin-bottom: 8px;
}

.output-block .cmd-echo {
    margin-bottom: 4px;
}

.cmd-echo .prompt { color: var(--prompt-user); }
.cmd-echo .at { color: var(--gray); }
.cmd-echo .host { color: var(--prompt-host); }
.cmd-echo .colon { color: var(--gray); }
.cmd-echo .path { color: var(--prompt-path); }
.cmd-echo .symbol { color: var(--prompt-symbol); margin-left: 2px; }
.cmd-echo .cmd-text { color: var(--fg-bright); }

/* ── Color classes (ANSI-like) ─────────────────── */

.term-red { color: var(--red); }
.term-green { color: var(--green); }
.term-yellow { color: var(--yellow); }
.term-blue { color: var(--blue); }
.term-magenta { color: var(--magenta); }
.term-cyan { color: var(--cyan); }
.term-white { color: var(--white); }
.term-gray { color: var(--gray); }
.term-bold { font-weight: 700; }
.term-dim { opacity: 0.6; }
.term-underline { text-decoration: underline; }

/* ── Input ─────────────────────────────────────── */

.input-prompt {
    color: var(--prompt-user);
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}

.input-prompt .at { color: var(--gray); }
.input-prompt .host { color: var(--prompt-host); }
.input-prompt .colon { color: var(--gray); }
.input-prompt .path { color: var(--prompt-path); }
.input-prompt .symbol { color: var(--prompt-symbol); margin-left: 2px; margin-right: 6px; }

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg-bright);
    font-family: var(--font-mono);
    font-size: var(--font-size);
    line-height: var(--line-height);
    caret-color: var(--prompt-user);
}

#terminal-input::placeholder {
    color: var(--gray);
    opacity: 0.4;
}

/* ── Autocomplete Dropdown ─────────────────────── */

.autocomplete-list {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 0;
    z-index: 100;
    display: none;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.autocomplete-list.visible { display: block; }

.autocomplete-item {
    padding: 4px 12px;
    cursor: pointer;
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 13px;
    display: flex;
    gap: 12px;
    align-items: baseline;
}

.autocomplete-item.active,
.autocomplete-item:hover {
    background: var(--selection);
    color: var(--fg-bright);
}

.autocomplete-item .cmd-name { color: var(--green); }
.autocomplete-item .cmd-desc { color: var(--gray); }
.autocomplete-item .file-name { color: var(--fg-bright); }
.autocomplete-item .file-dir { color: var(--blue); font-weight: 700; }
.autocomplete-item .file-desc { color: var(--gray); font-size: 11px; }

/* ── ASCII Banner ──────────────────────────────── */

.ascii-banner {
    color: var(--prompt-user);
    font-size: 10px;
    line-height: 1.15;
    margin-bottom: 16px;
    opacity: 0.85;
    white-space: pre;
    overflow: hidden;
    font-variant-ligatures: none;
    letter-spacing: 0;
}

.welcome-msg {
    color: var(--gray);
    margin-bottom: 16px;
}

.welcome-msg a {
    color: var(--cyan);
    text-decoration: none;
}

.welcome-msg a:hover {
    text-decoration: underline;
}

/* Açılabilir dosya linkleri (PDF, HTML, vb.) */
.open-url-line {
    color: var(--cyan);
    margin-top: 2px;
}

.open-url-line a {
    color: var(--cyan);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.open-url-line a:hover {
    color: var(--fg-bright);
}

/* ── Loading Spinner ───────────────────────────── */

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}

/* ── Progress Bar ──────────────────────────────── */

.progress-text .filled { color: var(--green); }
.progress-text .empty { color: var(--gray); opacity: 0.3; }
.progress-text .label { color: var(--fg); }
.progress-text .percent { color: var(--yellow); }

/* ── Link Styles ───────────────────────────────── */

.term-link {
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px dotted var(--cyan);
    transition: opacity 0.15s;
}

.term-link:hover {
    opacity: 0.8;
}

/* ── AI Chat Popup ─────────────────────────────── */

.ai-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ai-popup-window {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-popup-titlebar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.ai-popup-title {
    font-size: 13px;
    color: var(--prompt-user);
    font-weight: 600;
}

.ai-popup-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--fg-bright);
    font-size: 22px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    padding: 0;
    line-height: 1;
    border-radius: 4px;
    transition: background 0.15s;
}

.ai-popup-close:hover {
    background: var(--selection);
}

.ai-popup-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
}

.ai-popup-loading {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

.ai-popup-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--prompt-user);
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-popup-loading-text {
    color: var(--gray);
    font-size: 13px;
}

.ai-popup-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.ai-popup-messages .ai-msg-user {
    margin-bottom: 12px;
}

.ai-popup-messages .ai-msg-user .ai-msg-label {
    color: var(--prompt-user);
    font-weight: 600;
    margin-bottom: 4px;
}

.ai-popup-messages .ai-msg-user .ai-msg-body {
    color: var(--fg-bright);
}

.ai-popup-messages .ai-msg-assistant {
    margin-bottom: 16px;
}

.ai-popup-messages .ai-msg-assistant .ai-msg-label {
    color: var(--cyan);
    font-weight: 600;
    margin-bottom: 4px;
}

.ai-popup-messages .ai-msg-assistant .ai-msg-body {
    color: var(--fg);
}

.ai-popup-messages .ai-msg-assistant .ai-msg-body pre {
    margin: 8px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
}

.ai-popup-messages .ai-msg-assistant .ai-msg-body pre code {
    background: none;
    padding: 0;
}

.ai-popup-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.ai-popup-prompt {
    color: var(--cyan);
    font-weight: 600;
    flex-shrink: 0;
}

.ai-popup-input-wrap input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg-bright);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 4px;
    outline: none;
}

.ai-popup-input-wrap input:focus {
    border-color: var(--prompt-user);
}

.ai-popup-reset {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--gray);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 16px;
    transition: color 0.15s, border-color 0.15s;
}

.ai-popup-reset:hover {
    color: var(--prompt-user);
    border-color: var(--prompt-user);
}

.ai-msg-typing {
    margin-bottom: 12px;
}

.ai-msg-typing .ai-msg-label {
    color: var(--cyan);
    font-weight: 600;
    margin-bottom: 4px;
}

.ai-typing-dots {
    color: var(--gray);
    font-style: italic;
    animation: ai-typing-pulse 1.2s ease-in-out infinite;
}

@keyframes ai-typing-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ── Image Viewer Modal ────────────────────────── */

.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 900px;
    padding: 12px 16px;
    color: var(--fg);
    font-size: 13px;
}

.image-viewer-close-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--fg-bright);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.15s;
}

.image-viewer-close-btn:hover {
    background: var(--selection);
}

.image-viewer-content {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 95vw;
}

.image-viewer-body {
    max-width: 85vw;
    max-height: 80vh;
    overflow: auto;
    flex: 1;
    display: flex;
    justify-content: center;
}

.image-viewer-body img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.gallery-nav {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: var(--fg-bright);
    font-size: 36px;
    width: 48px;
    height: 80px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ── SEO Content (help, about vb. uzun içerik sayfaları) ── */
/* Sayfa kaydırılabilir olmalı; fixed height + overflow: hidden kaldırılır */
.terminal-seo.terminal-fixed {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

.seo-content {
    padding: 40px 20px;
    max-width: 800px;
    margin: 0 auto;
    font-family: var(--font-mono);
}

.seo-content h1 {
    color: var(--cyan);
    font-weight: 700;
    margin-bottom: 12px;
}

.seo-content h2, .seo-content h3 {
    color: var(--fg-bright);
    margin-bottom: 12px;
}

.seo-content p, .seo-content li {
    color: var(--fg);
    margin-bottom: 8px;
}

/* Terminal tarzı liste: ▸ işareti, bullet yok */
.seo-content ul {
    list-style: none;
    padding-left: 0;
}

.seo-content ul li {
    position: relative;
    padding-left: 0;
}

.seo-content ul li::before {
    content: '\25B8 ';
    color: var(--yellow);
    margin-right: 8px;
}

/* Terminal tarzı linkler */
.seo-content a {
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px dotted var(--cyan);
}

.seo-content a:hover {
    opacity: 0.85;
}

.seo-content .subtitle {
    color: var(--gray);
}

.seo-content .term-hint {
    color: var(--gray);
}

.seo-content nav {
    margin-bottom: 20px;
}

.seo-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--cyan);
}

.seo-content pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border);
    color: var(--fg);
    white-space: pre-wrap;
}

.seo-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.seo-content th, .seo-content td {
    text-align: left;
    padding: 8px 12px;
    border: 1px solid var(--border);
    color: var(--fg);
}

.seo-content th {
    background: var(--bg-secondary);
    color: var(--fg-bright);
}

.seo-content figure {
    margin: 16px 0;
}

.seo-content figure img {
    cursor: pointer;
    transition: opacity 0.2s;
}
.seo-content figure img:hover {
    opacity: 0.9;
}

.seo-content figcaption {
    color: var(--gray);
    font-size: 12px;
    margin-top: 8px;
}

.seo-content .back-to-terminal {
    display: inline-block;
    margin-top: 24px;
    color: var(--prompt-user);
    text-decoration: none;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.2s;
}

.seo-content .back-to-terminal:hover {
    background: var(--selection);
}

/* ── Responsive ────────────────────────────────── */

@media (max-width: 768px) {
    :root {
        --font-size: 13px;
    }

    html {
        font-size: 14px;
    }

    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    .terminal-classic {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .terminal-fixed {
        height: 100vh;
        height: 100dvh;
    }

    .terminal-body {
        padding: 12px;
    }

    .terminal-fixed > .input-line {
        padding: 8px 12px 12px;
    }

    .terminal-classic .input-line {
        padding: 4px 0;
    }

    .ascii-banner {
        font-size: 5.5px;
        line-height: 1.1;
        overflow-x: hidden;
    }

    .output-line {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    #terminal-input {
        font-size: 16px;
        min-height: 44px;
    }

    .input-prompt {
        font-size: var(--font-size);
    }

    .autocomplete-list {
        left: 0 !important;
        right: 0;
        max-width: 100vw;
        max-height: 200px;
        border-radius: 0;
    }

    .autocomplete-item {
        padding: 8px 12px;
        min-height: 40px;
        font-size: var(--font-size);
    }

    .image-viewer-content {
        max-width: 100vw;
        gap: 4px;
    }

    .image-viewer-body {
        max-width: 80vw;
    }

    .image-viewer-body img {
        max-width: 100%;
        max-height: 70vh;
    }

    .gallery-nav {
        width: 36px;
        height: 60px;
        font-size: 28px;
    }

    .image-viewer-header {
        padding: 8px 12px;
    }

    .image-viewer-close-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size: 12px;
    }

    .terminal-titlebar {
        padding: 8px 12px;
    }

    .titlebar-buttons {
        gap: 6px;
    }

    .titlebar-btn {
        width: 10px;
        height: 10px;
    }

    .terminal-body {
        padding: 10px;
    }

    .terminal-fixed > .input-line {
        padding: 6px 10px 10px;
    }

    .ascii-banner {
        font-size: 4px;
        line-height: 1.05;
    }

    .input-prompt .symbol {
        margin-right: 4px;
    }
}

@media (max-width: 360px) {
    :root {
        --font-size: 11px;
    }

    .ascii-banner {
        display: none;
    }

    .terminal-body {
        padding: 8px;
    }

    .terminal-fixed > .input-line {
        padding: 6px 8px 8px;
    }
}

/* ── Touch Devices ─────────────────────────────── */

@media (hover: none) and (pointer: coarse) {
    #terminal-input {
        font-size: 16px;
    }

    .autocomplete-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ── Print ─────────────────────────────────────── */

@media print {
    body { background: white; color: black; }
    .terminal-titlebar { display: none; }
    .input-line { display: none; }
    .autocomplete-list { display: none; }
    .image-viewer-overlay { display: none !important; }
}

/* ── 404 Page ──────────────────────────────────── */

.page-404 .terminal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 40px 24px;
}

.page-404-output {
    text-align: center;
    width: 100%;
    max-width: 420px;
}

.page-404-output .ascii-404 {
    display: block;
    font-size: 72px;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--red);
    margin-bottom: 20px;
}

.page-404-output .output-line {
    margin: 4px 0;
}

.page-404-output .back-to-terminal {
    display: inline-block;
    margin-top: 24px;
    color: var(--cyan);
    text-decoration: none;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.2s;
}

.page-404-output .back-to-terminal:hover {
    background: var(--selection);
}
