:root {
    --bg: #050805;
    --bg-panel: #0a0f0a;
    --green: #33ff66;
    --green-dim: #1aaa44;
    --green-dark: #0d3d1c;
    --white: #e8efe8;
    --white-dim: #b7c4b7;
    --yellow: #ffe066;
    --yellow-bright: #ffff33;
    --yellow-dim: #c9a83a;
    --nc-cyan: #55ffff;
    --nc-blue: #0000aa;
    --nc-face: #00aaaa;
    --red: #ff5555;
    --line: #1a2e1a;
    --font-mono: "IBM Plex Mono", "Courier New", monospace;
    --font-crt: "VT323", "IBM Plex Mono", monospace;
    --max: 920px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.65;
    overflow-x: hidden;
}

a {
    color: var(--green);
    text-decoration: none;
}

a:hover {
    color: var(--yellow);
    text-decoration: underline;
}

/* CRT overlay */
.crt {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}

.crt-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0,
        rgba(0, 0, 0, 0) 2px,
        rgba(0, 0, 0, 0.18) 3px
    );
    opacity: 0.35;
}

.crt-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.crt::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(51, 255, 102, 0.015);
    animation: flicker 4.5s infinite;
}

/* Terminal shell */
.terminal {
    position: relative;
    z-index: 1;
    max-width: var(--max);
    margin: 1.25rem auto 2rem;
    background: var(--bg-panel);
    border: 1px solid var(--green-dark);
    box-shadow:
        0 0 0 1px #000,
        0 0 40px rgba(51, 255, 102, 0.08),
        inset 0 0 80px rgba(0, 0, 0, 0.45);
}

/* Sticky top: title bar + boot/menu stage */
.term-top {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #071107;
    border-bottom: 1px solid var(--green-dark);
}

.term-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--green-dark);
    background: #050a05;
}

.term-bar-left {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.term-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse-dot 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

.term-title {
    font-family: var(--font-crt);
    font-size: 1.55rem;
    color: var(--green);
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 8ch;
    text-shadow: 0 0 10px rgba(51, 255, 102, 0.35);
}

.term-title.is-scrambling {
    color: var(--yellow-bright);
    text-shadow: 0 0 12px rgba(255, 255, 51, 0.45);
}

.lang-switch {
    display: flex;
    gap: 0.25rem;
}

.lang-btn {
    color: var(--green-dim);
    border: 1px solid var(--green-dark);
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.lang-btn:hover,
.lang-btn.is-active {
    color: #031006;
    background: var(--green);
    border-color: var(--green);
    text-decoration: none;
}

.term-stage {
    position: relative;
    min-height: 3.4rem;
}

.term-boot {
    padding: 0.65rem 1rem;
    color: var(--green-dim);
    font-size: 0.82rem;
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.term-boot.is-hiding {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

.term-boot.is-gone {
    display: none;
}

.boot-line {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.boot-line.is-shown {
    opacity: 1;
}

/* Norton Commander layout, terminal palette */
.term-nav {
    display: none;
    padding: 0.55rem 0.75rem 0.7rem;
    background: var(--bg-panel);
    border-top: 1px solid var(--green-dark);
    border-bottom: 1px solid var(--green-dark);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.term-nav.is-ready {
    display: block;
}

.term-nav.is-shown {
    opacity: 1;
    transform: translateY(0);
}

.nc-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.nc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 7.5rem;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    font-family: var(--font-crt);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--green);
    background: var(--bg);
    border: 1px solid #e8efe8;
    box-shadow:
        inset -1px -1px 0 rgba(232, 239, 232, 0.2),
        inset 1px 1px 0 rgba(51, 255, 102, 0.12),
        2px 2px 0 #000;
    text-decoration: none !important;
    text-shadow: 0 0 8px rgba(51, 255, 102, 0.25);
    cursor: pointer;
    user-select: none;
}

.nc-btn .nc-key {
    color: var(--green);
    font-weight: 400;
}

.nc-btn:hover {
    color: var(--green);
    background: #081208;
    border-color: #ffffff;
    text-decoration: none !important;
    text-shadow: 0 0 12px rgba(51, 255, 102, 0.45);
}

.nc-btn.is-active {
    color: var(--green);
    background: #0a150a;
    border-color: #ffffff;
    box-shadow:
        inset 0 0 0 1px rgba(51, 255, 102, 0.35),
        0 0 10px rgba(51, 255, 102, 0.15),
        2px 2px 0 #000;
}

.nc-btn.is-active .nc-key {
    color: var(--green);
}

.nc-btn:active {
    transform: translate(1px, 1px);
    box-shadow:
        inset 1px 1px 0 #000,
        1px 1px 0 #000;
}

.nav-toggle {
    display: none;
    background: var(--bg);
    border: 1px solid #e8efe8;
    color: var(--green);
    font-family: var(--font-crt);
    font-size: 1.2rem;
    font-weight: 400;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    margin-bottom: 0.45rem;
    box-shadow: 2px 2px 0 #000;
}

.term-body {
    padding: 1.25rem 1rem 1.5rem;
    min-height: 55vh;
}

.term-section + .term-section {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--green-dark);
}

.cmd {
    color: var(--white-dim);
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.prompt {
    color: var(--yellow);
    margin-right: 0.35rem;
}

/* Headings = large green */
.term-h1 {
    font-family: var(--font-crt);
    font-size: clamp(2.4rem, 8vw, 3.8rem);
    line-height: 1.05;
    color: var(--green);
    text-shadow: 0 0 12px rgba(51, 255, 102, 0.25);
    margin-bottom: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.term-h2 {
    font-family: var(--font-crt);
    font-size: clamp(1.7rem, 5vw, 2.3rem);
    line-height: 1.1;
    color: var(--green);
    text-shadow: 0 0 8px rgba(51, 255, 102, 0.2);
    margin: 1.25rem 0 0.55rem;
    font-weight: 400;
}

.term-lead {
    color: var(--white);
    font-size: 1.05rem;
    margin-bottom: 0.85rem;
    max-width: 42rem;
}

.term-text {
    color: var(--white);
    margin-bottom: 1rem;
    max-width: 44rem;
}

.term-block + .term-block {
    margin-top: 0.5rem;
}

/* Yellow enumeration items */
.term-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.term-item {
    color: var(--yellow);
    line-height: 1.55;
}

.term-item .item-mark {
    color: var(--yellow);
    font-weight: 700;
    margin-right: 0.35rem;
}

.term-item .item-title {
    color: var(--yellow);
    font-weight: 600;
}

.term-item .item-desc {
    color: var(--white);
    font-weight: 400;
}

.term-item a {
    color: var(--yellow);
}

.term-item a:hover {
    color: var(--green);
}

/* Services nested bullets */
.services-list {
    gap: 1.75rem;
}

.service-block .service-head {
    margin-bottom: 0.55rem;
}

.service-block .item-mark,
.service-block .item-title {
    color: var(--yellow-bright);
    font-size: 1.35em;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 255, 51, 0.25);
}

.service-bullets {
    list-style: none;
    margin: 0;
    padding: 0 0 0 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.service-bullets li {
    color: var(--white);
    font-size: 0.98rem;
    padding-left: 1.1rem;
    position: relative;
}

.service-bullets li::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--yellow);
}

/* Examples: intro erase → Windows-style menubar + simulator */
.examples-intro {
    transition: opacity 0.35s ease, transform 0.35s ease;
    overflow: hidden;
}

.examples-intro.is-erasing .term-h1,
.examples-intro.is-erasing .term-text,
.examples-intro.is-erasing .cmd {
    animation: intro-wipe 0.95s steps(20, end) forwards;
}

.examples-intro.is-gone {
    display: none;
}

@keyframes intro-wipe {
    from { opacity: 1; filter: none; }
    to { opacity: 0; filter: blur(1px); letter-spacing: 0.1em; }
}

.examples-workbench {
    display: none;
}

.examples-workbench.is-ready {
    display: block;
    animation: workbench-in 0.45s ease both;
}

.examples-workbench[hidden] {
    display: none !important;
}

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

.examples-cmd {
    margin-bottom: 0.75rem;
}

.win-menubar-wrap {
    margin-bottom: 1rem;
}

.win-menubar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
    border: 1px solid #e8efe8;
    background: #0a120a;
    padding: 0;
    position: relative;
    z-index: 20;
}

.win-menu-item {
    position: relative;
    list-style: none;
}

.win-menu-label {
    display: block;
    background: transparent;
    border: 0;
    border-right: 1px solid rgba(232, 239, 232, 0.2);
    color: var(--yellow-bright);
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.55rem 0.85rem;
    cursor: default;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(255, 255, 51, 0.25);
}

.win-menu-item:hover > .win-menu-label,
.win-menu-item:focus-within > .win-menu-label,
.win-menu-item.is-open > .win-menu-label {
    background: rgba(255, 255, 51, 0.12);
    color: #ffff66;
}

.win-submenu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 17rem;
    margin: 0;
    padding: 0.2rem 0;
    list-style: none;
    background: var(--bg);
    border: 1px solid var(--green-dark);
    box-shadow: 4px 6px 0 rgba(0, 0, 0, 0.55);
    z-index: 30;
}

.win-menu-item:hover > .win-submenu,
.win-menu-item:focus-within > .win-submenu,
.win-menu-item.is-open > .win-submenu {
    display: block;
}

.win-submenu-btn {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: #55cfff;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
}

.win-submenu-btn:hover,
.win-submenu-btn.is-active {
    background: rgba(85, 207, 255, 0.12);
    color: #7adbff;
}

.examples-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--green-dark);
    background: #050805;
}

.examples-compact[hidden] {
    display: none !important;
}

.examples-compact-path {
    color: var(--yellow-bright);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.examples-layout {
    display: block;
    margin-top: 0.25rem;
}

.examples-layout--sim-only .simulator-panel {
    width: 100%;
}

.simulator-panel {
    display: none;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.75rem;
    border: 1px dashed var(--green-dark);
    background: #020402;
    min-height: 22rem;
}

.simulator-panel.is-open,
.simulator-panel:not([hidden]) {
    display: flex;
}

.simulator-panel[hidden] {
    display: none !important;
}

/* Mock GUI Window (contrasts with CRT terminal) */
.mock-gui-window {
    background-color: #e2e8f0;
    border-radius: 6px;
    border: 1px solid #94a3b8;
    color: #0f172a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.mock-gui-header {
    background-color: #cbd5e1;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #94a3b8;
    gap: 0.5rem;
}

.window-controls {
    display: flex;
    gap: 6px;
    margin-right: 8px;
    flex-shrink: 0;
}

.window-controls .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot-close { background: #ff5f56; }
.dot-min { background: #ffbd2e; }
.dot-max { background: #27c93f; }

.mock-gui-title {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #475569;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mock-gui-x {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #94a3b8;
    border-radius: 3px;
    padding: 2px 6px;
    cursor: pointer;
}

.mock-gui-x:hover {
    background: #fff;
    color: #0f172a;
}

.mock-gui-body {
    padding: 16px 18px;
    min-height: 130px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    background: #f8fafc;
}

.mock-gui-toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #e2e8f0;
    border-top: 1px solid #cbd5e1;
}

.gui-btn {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border: 1px solid #64748b;
    border-radius: 4px;
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
}

.gui-btn:hover {
    background: #2563eb;
}

.gui-btn-secondary {
    background: #f1f5f9;
    color: #0f172a;
}

.gui-btn-secondary:hover {
    background: #e2e8f0;
}

.gui-progress-track {
    background: #cbd5e1;
    height: 16px;
    width: 100%;
    border-radius: 8px;
    margin-top: 10px;
    overflow: hidden;
}

.gui-progress-bar {
    background: #3b82f6;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.gui-table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
    font-size: 12px;
}

.gui-table th,
.gui-table td {
    text-align: left;
    padding: 6px 4px;
    border-bottom: 1px solid #cbd5e1;
}

.gui-table th {
    color: #475569;
}

.gui-stat-box {
    margin-top: 15px;
    padding: 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #334155;
    font-size: 13px;
    line-height: 1.55;
}

.gui-status-init { color: #ea580c; }
.gui-status-run { color: #16a34a; }
.gui-status-done { color: #15803d; font-weight: 700; }
.gui-ok { color: #16a34a; font-weight: 700; }

/* Mock Terminal under the GUI */
.mock-terminal-window {
    border: 1px solid var(--green);
    padding: 10px;
    background: #050805;
    height: 220px;
    display: flex;
    flex-direction: column;
}

.term-header {
    font-size: 12px;
    color: var(--green);
    border-bottom: 1px dashed var(--green);
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-family: var(--font-mono);
}

.log-container {
    flex-grow: 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.45;
    min-height: 0;
    padding: 0;
}

.log-line {
    margin: 0 0 0.2rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-info { color: var(--white); }
.log-debug { color: var(--green-dim); }
.log-success { color: var(--green); }
.log-warn { color: var(--yellow); }
.log-error { color: var(--red); }

.sim-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.15rem 0 0;
}

.btn-download {
    border-color: var(--yellow);
    color: var(--yellow);
}

.btn-download:hover {
    background: var(--yellow);
    color: #1a1400;
}

.term-hint {
    color: var(--green-dim);
    font-size: 0.92rem;
}

/* Examples page: eye-catching titles */
.examples-list {
    gap: 1.6rem;
}

.examples-list .example-item .item-mark,
.examples-list .example-item .item-title {
    color: var(--yellow-bright);
    font-size: 2em;
    font-weight: 700;
    line-height: 1.25;
    text-shadow: 0 0 10px rgba(255, 255, 51, 0.35);
}

.examples-list .example-item .item-desc {
    display: inline;
    font-size: 1em;
    color: var(--white);
    font-weight: 400;
    text-shadow: none;
}

.term-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 1.25rem 0 0.5rem;
    opacity: 0;
    pointer-events: none;
}

[data-type-group] {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.term-actions.is-shown,
[data-type-group].is-shown {
    opacity: 1;
    pointer-events: auto;
}

.btn {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--green);
    color: var(--green);
    background: transparent;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
    background: var(--green);
    color: #031006;
    text-decoration: none;
    text-shadow: none;
}

.btn-ghost {
    border-color: var(--green-dim);
    color: var(--green-dim);
}

.btn-ghost:hover {
    border-color: var(--yellow);
    background: var(--yellow);
    color: #1a1400;
}

/* Typing state */
[data-type] {
    visibility: hidden;
}

[data-type].is-typing,
[data-type].is-done {
    visibility: visible;
}

.typing-caret {
    display: inline-block;
    width: 0.55ch;
    margin-left: 1px;
    background: var(--green);
    color: transparent;
    animation: caret-blink 0.7s step-end infinite;
    vertical-align: baseline;
}

.term-cursor-line {
    margin-top: 2rem;
    color: var(--white-dim);
    font-size: 0.95rem;
}

.blink-cursor {
    color: var(--green);
    animation: caret-blink 0.9s step-end infinite;
}

/* Form */
.contact-form-wrap {
    margin-top: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 34rem;
}

.contact-form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.field-label {
    color: var(--yellow);
    font-size: 0.88rem;
}

.contact-form input,
.contact-form textarea {
    font: inherit;
    color: var(--white);
    background: #030603;
    border: 1px solid var(--green-dark);
    padding: 0.55rem 0.65rem;
    outline: none;
    caret-color: var(--green);
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 1px rgba(51, 255, 102, 0.25);
}

.contact-form .btn {
    align-self: flex-start;
    margin-top: 0.25rem;
}

.form-note {
    color: var(--green-dim);
    font-size: 0.8rem;
}

.form-success {
    color: var(--green);
    margin-bottom: 0.85rem;
    border-left: 2px solid var(--green);
    padding-left: 0.65rem;
}

.term-footer {
    border-top: 1px solid var(--green-dark);
    padding: 0.75rem 1rem;
    color: var(--green-dim);
    font-size: 0.78rem;
}

@keyframes caret-blink {
    50% { opacity: 0; }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.85; }
    94% { opacity: 1; }
    96% { opacity: 0.9; }
    97% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .crt::after,
    .blink-cursor,
    .typing-caret,
    .term-dot {
        animation: none;
    }

    [data-type] {
        visibility: visible;
    }

    .term-actions,
    .contact-form-wrap,
    [data-type-group] {
        opacity: 1;
        pointer-events: auto;
    }

    .boot-line {
        opacity: 1;
    }

    .term-boot {
        display: none;
    }

    .term-nav {
        display: block;
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 720px) {
    .terminal {
        margin: 0;
        border-left: 0;
        border-right: 0;
        min-height: 100vh;
    }

    .nav-toggle {
        display: inline-block;
    }

    .nc-menu {
        display: none;
        flex-direction: column;
        gap: 0.45rem;
    }

    body.nav-open .nc-menu {
        display: flex;
    }

    .nc-btn {
        width: 100%;
        justify-content: flex-start;
    }

    .term-h1 {
        font-size: 2.3rem;
    }

    .examples-list .example-item .item-mark,
    .examples-list .example-item .item-title {
        font-size: 1.55em;
    }

    .win-menubar {
        flex-direction: column;
    }

    .win-menu-label {
        border-right: 0;
        border-bottom: 1px solid rgba(232, 239, 232, 0.15);
        font-size: 1.05rem;
        white-space: normal;
    }

    .win-submenu {
        position: static;
        box-shadow: none;
        border-left: 0;
        border-right: 0;
    }

    .win-menu-item:hover > .win-submenu,
    .win-menu-item:focus-within > .win-submenu,
    .win-menu-item.is-open > .win-submenu {
        display: none;
    }

    .win-menu-item.is-open > .win-submenu {
        display: block;
    }

    .service-block .item-mark,
    .service-block .item-title {
        font-size: 1.2em;
    }
}
