:root {
    --bg-canvas: #1C1B19;
    --bg-terminal: #0F0E0D;
    --text-cream: #F5F0E8;
    --text-stone: #A09A90;
    --accent-orange: #E8732A;
    --border-faint: rgba(160, 154, 144, 0.10);
    --border-soft: rgba(160, 154, 144, 0.18);
}

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

/* JS on (default site experience): clip SEO layer offscreen, leave it
   readable to crawlers + screen readers. */
html.js .seo-content {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    left: -9999px !important;
}

/* JS off: hide the dead emulator UI, render the SEO layer as a real page. */
html:not(.js) #room-canvas,
html:not(.js) #particles,
html:not(.js) .grain,
html:not(.js) main.shell {
    display: none !important;
}

html:not(.js) body { display: block; }

html:not(.js) .seo-content {
    display: block;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px 64px;
    color: var(--text-cream);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 14px;
    line-height: 1.65;
}

html:not(.js) .seo-content h1,
html:not(.js) .seo-content h2,
html:not(.js) .seo-content h3 {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    color: var(--text-cream);
    line-height: 1.2;
}

html:not(.js) .seo-content h1 { font-size: 32px; margin: 0 0 4px; }
html:not(.js) .seo-content h2 { font-size: 18px; margin: 32px 0 8px; color: var(--accent-orange); }
html:not(.js) .seo-content h3 { font-size: 14px; margin: 20px 0 6px; }
html:not(.js) .seo-content p { margin: 8px 0; }
html:not(.js) .seo-content ul,
html:not(.js) .seo-content ol { margin: 8px 0 16px 22px; }
html:not(.js) .seo-content li { margin-bottom: 10px; }
html:not(.js) .seo-content a {
    color: var(--accent-orange);
    text-decoration: none;
    border-bottom: 1px dotted rgba(232, 115, 42, 0.4);
}
html:not(.js) .seo-content a:hover { border-bottom-color: var(--accent-orange); }
html:not(.js) .seo-content header > p { color: var(--text-stone); font-size: 13px; }
html:not(.js) .seo-content code { color: var(--accent-orange); font-size: 13px; }
html:not(.js) .seo-content .seo-meta {
    color: var(--text-stone);
    font-size: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 0.5px solid var(--border-soft);
}

html, body {
    height: 100%;
    background: var(--bg-canvas);
    color: var(--text-cream);
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

#particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.06;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.shell {
    position: relative;
    z-index: 2;
    width: min(900px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 32px 0 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 4px 24px;
    gap: 24px;
}

.brand {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.01em;
    color: var(--text-cream);
}

.bar nav {
    display: flex;
    gap: 18px;
    font-size: 12px;
    color: var(--text-stone);
}

.bar nav a {
    color: var(--text-stone);
    text-decoration: none;
    transition: color 120ms ease;
}

.bar nav a:hover {
    color: var(--accent-orange);
}

.terminal-panel {
    position: relative;
    background: var(--bg-terminal);
    border: 0.5px solid var(--border-faint);
    border-radius: 4px;
    padding: 18px 20px;
    flex: 1;
    min-height: 0;
    /* Cap so the panel never eats the caption's room. 180px = shell padding
       (~56) + header bar (~46) + caption + margin (~40) + breathing room. */
    max-height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.02) inset,
        0 24px 60px rgba(0, 0, 0, 0.45);
}

.terminal-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 0.5px solid var(--border-faint);
}

.dots {
    display: flex;
    gap: 6px;
}

.dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(160, 154, 144, 0.22);
}

.terminal-label {
    font-size: 11px;
    color: var(--text-stone);
    letter-spacing: 0.04em;
}

#terminal {
    flex: 1;
    min-height: 200px;
    display: flex;
}

#terminal .xterm {
    width: 100%;
    height: 100%;
}

#terminal .xterm-viewport {
    background: transparent !important;
}

.boot-status {
    position: absolute;
    inset: auto 0 0 0;
    text-align: center;
    transform: translateY(-50%);
    top: 50%;
    color: var(--text-stone);
    font-size: 12px;
    letter-spacing: 0.04em;
    pointer-events: none;
    transition: opacity 240ms ease;
}

.boot-status.fade {
    opacity: 0;
}

.boot-dots::after {
    content: '';
    display: inline-block;
    width: 1.5em;
    text-align: left;
    animation: boot-dots 1.2s steps(4, end) infinite;
}

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

.caption {
    margin-top: 18px;
    text-align: center;
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-size: 14px;
    color: var(--text-stone);
    opacity: 0;
    transition: opacity 900ms linear;
    /* keep grayscale antialiasing throughout the fade so the browser doesn't
       flip to subpixel AA at opacity 1 (which reads as a "brightness pop") */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    will-change: opacity;
}

body.show-hint .caption {
    opacity: 1;
}

.caption code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-orange);
    font-style: normal;
    font-size: 12.5px;
    padding: 0 2px;
}

.mobile-warning {
    display: none;
    margin: 12px 4px 0;
    padding: 10px 12px;
    border: 0.5px solid var(--border-soft);
    border-radius: 4px;
    color: var(--text-stone);
    font-size: 12px;
    line-height: 1.5;
    background: rgba(232, 115, 42, 0.04);
}

.mobile-warning code {
    color: var(--accent-orange);
    font-size: 11.5px;
}

@media (max-width: 600px) {
    .shell { padding: 20px 0 16px; }
    .bar { padding: 0 4px 16px; flex-wrap: wrap; }
    .terminal-panel { padding: 14px 14px; }
    #terminal { min-height: 280px; }
    .mobile-warning { display: block; }
}
