/* ccbin.dev styles.
   Colours come from ComputerCraft's 16-colour palette (CC: Tweaked's
   Colour.java); the computer frames are drawn with CSS.
   The site CSP forbids inline styles: everything lives here. */

@font-face {
    font-family: "Silkscreen";
    src: url("../fonts/Silkscreen-Regular.ttf") format("truetype");
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/JetBrainsMono-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    color-scheme: dark;

    /* The ComputerCraft palette. */
    --cc-white: #f0f0f0;
    --cc-orange: #f2b233;
    --cc-magenta: #e57fd8;
    --cc-light-blue: #99b2f2;
    --cc-yellow: #dede6c;
    --cc-lime: #7fcc19;
    --cc-pink: #f2b2cc;
    --cc-gray: #4c4c4c;
    --cc-light-gray: #999999;
    --cc-cyan: #4c99b2;
    --cc-purple: #b266e5;
    --cc-blue: #3366cc;
    --cc-brown: #7f664c;
    --cc-green: #57a64e;
    --cc-red: #cc4c4c;
    --cc-black: #111111;

    /* Semantic tokens. */
    --cb-bg: #0c0c0c;
    --cb-surface: #161616;
    --cb-surface-2: #1f1f1f;
    --cb-border: #2c2c2c;
    --cb-text: var(--cc-white);
    --cb-muted: #a8a8a8;
    --cb-accent: var(--cc-yellow);
    --cb-link: var(--cc-light-blue);
    --cb-focus: var(--cc-yellow);

    --bezel-normal: #a3a3a3;
    --bezel-normal-light: #d4d4d4;
    --bezel-normal-dark: #5e5e5e;
    --bezel-advanced: #e0bd4f;
    --bezel-advanced-light: #f6e39a;
    --bezel-advanced-dark: #93762a;

    --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --font-pixel: "Silkscreen", var(--font-code);

    --radius: 4px;
    --gutter: 16px;
    --max-width: 1200px;
}

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

/* Components set display, which would otherwise beat the hidden attribute. */
[hidden] {
    display: none !important;
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cb-bg);
    color: var(--cb-text);
    font: 16px/1.55 var(--font-ui);
}

main {
    flex: 1;
}

a {
    color: var(--cb-link);
    text-underline-offset: 2px;
}

a:hover {
    color: var(--cc-white);
}

:focus-visible {
    outline: 3px solid var(--cb-focus);
    outline-offset: 2px;
}

code,
pre,
textarea.code-input {
    font-family: var(--font-code);
}

code {
    font-size: 0.92em;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    background: var(--cb-surface-2);
}

h1,
h2,
h3 {
    line-height: 1.2;
    margin: 0 0 0.5em;
}

h1 {
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: clamp(1.9rem, 4vw, 3rem);
    letter-spacing: 0.01em;
}

h2 {
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 1.25rem;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.skip-link {
    position: absolute;
    left: 8px;
    top: -48px;
    padding: 8px 12px;
    background: var(--cb-accent);
    color: var(--cc-black);
    z-index: 10;
}

.skip-link:focus {
    top: 8px;
}

.muted {
    color: var(--cb-muted);
}

.lede {
    font-size: 1.125rem;
    color: #d8d8d8;
    max-width: 62ch;
}

/* ---- Header & footer ---- */

.site-header {
    border-bottom: 1px solid var(--cb-border);
    background: var(--cb-surface);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    flex-wrap: wrap;
}

.logo {
    display: inline-flex;
    align-items: baseline;
    font-family: var(--font-pixel);
    font-size: 1.5rem;
    color: var(--cb-text);
    text-decoration: none;
}

.logo-prompt {
    color: var(--cb-accent);
    margin-right: 0.35em;
}

.logo-tld {
    color: var(--cb-accent);
}

.logo-cursor {
    display: inline-block;
    width: 0.55em;
    height: 0.15em;
    margin-left: 0.1em;
    background: var(--cb-text);
    animation: blink 1s steps(1) infinite;
}

.site-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 0.95rem;
}

.site-nav a {
    color: var(--cb-text);
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--cb-accent);
}

.nav-soon {
    color: var(--cb-muted);
    cursor: default;
}

.nav-soon small {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 5px;
    margin-left: 4px;
    border: 1px solid var(--cb-border);
    border-radius: 3px;
}

.site-footer {
    margin-top: 64px;
    border-top: 1px solid var(--cb-border);
    background: var(--cb-surface);
    color: var(--cb-muted);
    font-size: 0.875rem;
}

.footer-inner {
    padding-top: 24px;
    padding-bottom: 32px;
}

.footer-inner p {
    margin: 0.35em 0;
}

.footer-brand {
    font-family: var(--font-pixel);
    color: var(--cb-text);
}

/* ---- Buttons, badges, notices ---- */

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 10px 18px;
    border: 0;
    border-radius: var(--radius);
    font: 600 1rem var(--font-ui);
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    background: var(--cb-accent);
    color: var(--cc-black);
    box-shadow: inset -3px -3px 0 rgb(0 0 0 / 25%), inset 3px 3px 0 rgb(255 255 255 / 30%);
}

.button-primary:hover {
    background: #ecec88;
    color: var(--cc-black);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border: 1px dashed var(--cb-border);
    border-radius: 999px;
    color: var(--cb-muted);
    font-size: 0.85rem;
}

.notice {
    padding: 12px 16px;
    border-left: 4px solid var(--cb-accent);
    background: var(--cb-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.notice-warn {
    border-left-color: var(--cc-orange);
}

/* ---- Computer frames ---- */

.bezel {
    padding: 14px;
    border-radius: 6px;
    background: var(--bezel-normal);
    box-shadow:
        inset 4px 4px 0 var(--bezel-normal-light),
        inset -4px -4px 0 var(--bezel-normal-dark),
        0 12px 32px rgb(0 0 0 / 45%);
}

.bezel-advanced {
    background: var(--bezel-advanced);
    box-shadow:
        inset 4px 4px 0 var(--bezel-advanced-light),
        inset -4px -4px 0 var(--bezel-advanced-dark),
        0 12px 32px rgb(0 0 0 / 45%);
}

.screen {
    padding: 14px 16px;
    min-height: 100%;
    background: var(--cc-black);
    color: var(--cc-white);
    font: 15px/1.5 var(--font-code);
    border-radius: 2px;
    overflow-x: auto;
}

.screen p {
    margin: 0;
    white-space: pre;
}

.screen-cursor {
    display: inline-block;
    width: 0.6em;
    height: 0.12em;
    margin-left: 0.15em;
    vertical-align: baseline;
    background: var(--cc-white);
    animation: blink 0.8s steps(1) infinite;
}

.t-yellow { color: var(--cc-yellow); }
.t-lime { color: var(--cc-lime); }
.t-cyan { color: var(--cc-cyan); }
.t-red { color: var(--cc-red); }

/* ---- Home ---- */

.hero {
    padding: 64px 0 40px;
    background:
        radial-gradient(circle at 85% 20%, rgb(222 222 108 / 8%), transparent 45%),
        linear-gradient(180deg, var(--cb-surface) 0%, var(--cb-bg) 100%);
}

.hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 48px;
    align-items: center;
}

.eyebrow {
    margin: 0 0 12px;
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    color: var(--cc-lime);
    letter-spacing: 0.04em;
}

.accent {
    color: var(--cb-accent);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-top: 28px;
}

.hero-terminal .screen {
    min-height: 220px;
}

.features {
    padding: 40px 0 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.card {
    padding: 20px;
    border: 1px solid var(--cb-border);
    border-top: 4px solid var(--card-accent, var(--cb-accent));
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.card p {
    margin: 0;
    color: #cfcfcf;
}

.card h2 {
    color: var(--card-accent, var(--cb-accent));
}

.card-yellow { --card-accent: var(--cc-yellow); }
.card-lime { --card-accent: var(--cc-lime); }
.card-cyan { --card-accent: #6fb6cf; }
.card-magenta { --card-accent: var(--cc-magenta); }

/* ---- Pages ---- */

.page {
    padding-top: 40px;
}

.page-narrow {
    max-width: 640px;
}

.page-head {
    margin-bottom: 24px;
}

/* ---- Playground ---- */

.playground {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 24px;
    align-items: start;
}

.editor-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-label {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--cb-muted);
}

textarea.code-input {
    width: 100%;
    min-height: 420px;
    padding: 14px;
    resize: vertical;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cc-black);
    color: var(--cc-white);
    font-size: 0.875rem;
    line-height: 1.5;
    tab-size: 2;
}

.run-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.field-inline {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--cb-muted);
}

/* Radio groups drawn as a segmented control. (WebKit reports a CSP
   style-src violation for native <select> elements under a strict policy,
   so prefer these.) */
.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.segmented legend {
    width: 100%;
    margin-bottom: 6px;
    padding: 0;
    color: var(--cb-muted);
    font-size: 0.85rem;
}

.segmented label {
    position: relative;
}

.segmented input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.segmented span {
    display: block;
    padding: 6px 12px;
    border: 1px solid var(--cb-border);
    margin-left: -1px;
    background: var(--cb-surface-2);
    color: var(--cb-muted);
    font: 0.875rem var(--font-code);
}

.segmented label:first-of-type span {
    border-radius: var(--radius) 0 0 var(--radius);
    margin-left: 0;
}

.segmented label:last-of-type span {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.segmented input:checked + span {
    position: relative;
    background: var(--cb-accent);
    border-color: var(--cb-accent);
    color: var(--cc-black);
    font-weight: 700;
}

.segmented input:focus-visible + span {
    outline: 3px solid var(--cb-focus);
    outline-offset: 2px;
}

.emulator-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.frame-slot {
    min-height: 320px;
    border: 1px dashed var(--cb-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.frame-slot:has(iframe) {
    border-style: solid;
    display: block;
}

.frame-placeholder {
    color: var(--cb-muted);
}

iframe.emu-frame {
    display: block;
    width: 100%;
    height: 480px;
    border: 0;
    background: #1b1b1b;
}

.netlog summary {
    cursor: pointer;
    font: 1rem var(--font-pixel);
}

.netlog p {
    margin: 8px 0;
    font-size: 0.875rem;
}

.netlog-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font: 0.8rem/1.6 var(--font-code);
}

.netlog-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
    padding: 6px 8px;
    border-bottom: 1px solid var(--cb-border);
    overflow-wrap: anywhere;
}

.netlog-url {
    flex: 1 1 260px;
    min-width: 0;
}

.netlog-status {
    color: var(--cb-muted);
}

.netlog-note {
    flex-basis: 100%;
    color: var(--cb-muted);
    font-size: 0.75rem;
}

.netlog-list .resolution {
    flex-shrink: 0;
    color: var(--cc-red);
}

.netlog-list .resolution-mock,
.netlog-list .resolution-resolver {
    color: var(--cc-lime);
}

.netlog-list .resolution-placeholder {
    color: var(--cc-light-blue);
}

/* Live requests left the browser for a third-party server. */
.netlog-list .resolution-live {
    color: var(--cc-orange);
}

/* ---- Navigation extras ---- */

.site-nav .nav-cta {
    padding: 4px 12px;
    border-radius: var(--radius);
    background: var(--cb-accent);
    color: var(--cc-black);
    font-weight: 600;
}

.site-nav .nav-cta:hover {
    background: #ecec88;
    color: var(--cc-black);
}

.inline-form {
    display: inline;
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--cb-muted);
    font: inherit;
    cursor: pointer;
}

.link-button:hover {
    color: var(--cb-text);
    text-decoration: underline;
}

.banner {
    margin: 0;
    padding: 10px var(--gutter);
    text-align: center;
    font-size: 0.95rem;
}

.banner-danger {
    background: #3a1616;
    color: #ffd6d6;
    border-bottom: 1px solid var(--cc-red);
}

/* ---- Forms ---- */

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 560px;
}

.stack-form label,
.stack-form legend {
    margin-top: 10px;
    font-weight: 600;
}

.stack-form input[type="text"],
.stack-form input:not([type]),
.stack-form input[type="url"],
.stack-form input[type="search"],
.stack-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface-2);
    color: var(--cb-text);
    font: inherit;
}

.stack-form textarea {
    resize: vertical;
}

.stack-form button {
    align-self: flex-start;
    margin-top: 16px;
}

.hint {
    margin: 0;
    color: var(--cb-muted);
    font-size: 0.85rem;
}

.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0;
    padding: 0;
    border: 0;
}

.checks legend {
    width: 100%;
}

.checks label {
    font-weight: 400;
    margin: 0;
}

.provider-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    margin: 24px 0;
}

.button-provider {
    justify-content: center;
    background: var(--cb-surface-2);
    border: 1px solid var(--cb-border);
    color: var(--cb-text);
}

.button-provider:hover {
    border-color: var(--cb-accent);
    color: var(--cb-text);
}

.button-dev {
    justify-content: center;
    background: transparent;
    border: 1px dashed var(--cc-orange);
    color: var(--cc-orange);
}

.fine-print {
    font-size: 0.85rem;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    border: 0;
}

.choice-list label {
    margin: 0;
    font-weight: 400;
}

.hint-list {
    margin: 4px 0 0;
    padding-left: 20px;
    color: var(--cb-muted);
    font-size: 0.875rem;
}

.import-zip {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--cb-border);
}

.field-error {
    margin: 2px 0 0;
    color: #ff9a9a;
    font-size: 0.875rem;
}

/* ---- More buttons ---- */

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-secondary,
.button-like {
    background: var(--cb-surface-2);
    border: 1px solid var(--cb-border);
    color: var(--cb-text);
}

.button-secondary:hover,
.button-like:hover {
    border-color: var(--cb-accent);
    color: var(--cb-text);
}

.button-like [aria-hidden="true"] {
    color: var(--cb-muted);
}

.button-like.is-liked {
    border-color: var(--cc-pink);
}

.button-like.is-liked [aria-hidden="true"] {
    color: var(--cc-pink);
}

.like-form {
    display: inline;
    margin: 0;
}

.button-small {
    padding: 4px 10px;
    font-size: 0.85rem;
    background: var(--cb-surface-2);
    border: 1px solid var(--cb-border);
    color: var(--cb-text);
}

.button-small:hover {
    border-color: var(--cb-accent);
}

.button-quiet {
    background: transparent;
    border-color: transparent;
    color: var(--cb-muted);
}

.button-danger {
    background: #b33b3b;
    color: #ffffff;
}

.button-danger:hover {
    background: #c94545;
    color: #ffffff;
}

/* ---- Program page ---- */

.program-head {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
}

.program-title {
    min-width: 0;
    flex: 1 1 420px;
}

.program-title h1 {
    overflow-wrap: anywhere;
}

.program-title .lede {
    margin: 12px 0 0;
}

/* Case-sensitive codes can't use the pixel font, which has no lower case. */
.title-code {
    font-family: var(--font-code);
    font-weight: 700;
}

.byline {
    margin: 0;
    color: var(--cb-muted);
    font-size: 0.925rem;
}

.program-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.run-wrap {
    margin: 0 0 32px;
}

.run-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.run-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
}

.live-switch {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
}

.live-switch input {
    width: 18px;
    height: 18px;
    accent-color: var(--cc-orange);
}

.live-dialog {
    max-width: min(560px, calc(100vw - 32px));
    padding: 24px;
    border: 1px solid var(--cc-orange);
    border-radius: var(--radius);
    background: var(--cb-surface);
    color: var(--cb-text);
}

.live-dialog::backdrop {
    background: rgb(0 0 0 / 65%);
}

.live-dialog h2 {
    margin-top: 0;
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.run-notes {
    margin: 0;
    padding: 10px 16px 10px 32px;
    border-left: 4px solid var(--cc-orange);
    background: var(--cb-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.9rem;
}

.program-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 40px;
    align-items: start;
}

.install-box {
    margin-bottom: 24px;
    padding: 14px 16px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.install-box .field-label {
    margin: 0 0 8px;
}

.copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.copy-row + .copy-row {
    margin-top: 8px;
}

.copy-row code {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    overflow-x: auto;
    white-space: nowrap;
    background: var(--cc-black);
    font-size: 0.875rem;
}

/* The CraftOS shell prompt; not part of the copied text. */
.copy-row code::before {
    content: "> ";
    color: var(--cb-accent);
}

.file-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.file-tabs a {
    padding: 6px 12px;
    border: 1px solid var(--cb-border);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--cb-surface);
    color: var(--cb-muted);
    font: 0.85rem var(--font-code);
    text-decoration: none;
}

.file-tabs a:hover {
    color: var(--cb-text);
}

.file-tabs a[aria-current="page"] {
    background: var(--cb-surface-2);
    color: var(--cb-text);
}

.tag-entry {
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 3px;
    background: var(--cc-lime);
    color: var(--cc-black);
    font-size: 0.7rem;
    font-weight: 700;
}

.code-view {
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cc-black);
    overflow: hidden;
}

.file-tabs + .code-view {
    border-top-left-radius: 0;
}

.code-head {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--cb-border);
    background: var(--cb-surface-2);
    font: 0.85rem var(--font-code);
}

.code-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.code-tools {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: auto;
}

.code-body {
    padding: 10px 0;
    overflow-x: auto;
}

/* Highlighted code, coloured like CraftOS's own edit program: keywords
   yellow, comments green, strings red. */
.code-table {
    border-collapse: collapse;
    font: 0.875rem/1.6 var(--font-code);
    tab-size: 2;
}

.code-table td {
    padding: 0;
    vertical-align: top;
}

.code-table .ln {
    min-width: 3.5em;
    padding: 0 14px 0 12px;
    text-align: right;
    user-select: none;
}

.code-table .ln a {
    color: #7d7d7d;
    text-decoration: none;
}

.code-table .ln a:hover {
    color: var(--cb-text);
}

.code-table .lc {
    padding-right: 24px;
    white-space: pre;
    color: var(--cc-white);
}

.code-table tr:target {
    background: rgb(222 222 108 / 12%);
}

.code-table tr:target .ln a {
    color: var(--cb-accent);
}

.code-table .k { color: var(--cc-yellow); }
.code-table .c { color: var(--cc-green); }
.code-table .s { color: #e36d6d; }
.code-table .n { color: var(--cc-magenta); }
.code-table .b { color: #6fb6cf; }
.code-table .l { color: var(--cc-light-blue); }
.code-table .o { color: var(--cc-light-gray); }

.code-table a.api {
    color: inherit;
    text-decoration: underline dotted rgb(153 178 242 / 70%);
    text-underline-offset: 3px;
}

.code-table a.api:hover {
    color: var(--cc-light-blue);
    text-decoration-style: solid;
}

.prose {
    max-width: 72ch;
    margin-top: 32px;
}

.prose h1,
.prose h2,
.prose h3 {
    margin-top: 1.4em;
}

.prose h1 {
    font-size: 1.6rem;
}

.prose pre {
    padding: 12px 14px;
    overflow-x: auto;
    border-radius: var(--radius);
    background: var(--cc-black);
}

.prose pre code {
    padding: 0;
    background: none;
}

.prose blockquote {
    margin: 1em 0;
    padding-left: 14px;
    border-left: 3px solid var(--cb-border);
    color: var(--cb-muted);
}

.prose table {
    border-collapse: collapse;
}

.prose th,
.prose td {
    padding: 4px 10px;
    border: 1px solid var(--cb-border);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 8px;
}

.stats div {
    padding: 10px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.stats dt {
    color: var(--cb-muted);
    font-size: 0.75rem;
    line-height: 1.3;
}

.stats dd {
    margin: 4px 0 0;
    font: 1.15rem var(--font-pixel);
}

.side-heading {
    margin: 22px 0 8px;
    color: var(--cb-muted);
    font: 0.75rem var(--font-code);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-text {
    margin: 0;
    font-size: 0.925rem;
    overflow-wrap: anywhere;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.badge-hw,
.badge-cap,
.badge-tag {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--cb-border);
    border-radius: 999px;
    background: var(--cb-surface-2);
    font: 0.8rem var(--font-code);
}

.badge-hw {
    border-color: var(--cc-cyan);
    color: #8fd0e6;
}

/* Capabilities worth a second look before running a program for real. */
.badge-http,
.badge-deletes-files {
    border-color: var(--cc-orange);
    color: var(--cc-orange);
}

.badge-tag {
    color: var(--cb-link);
    text-decoration: none;
}

.badge-tag:hover {
    border-color: var(--cb-link);
}

.revisions {
    max-height: 320px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    font-size: 0.9rem;
}

.revisions li {
    padding: 6px 0;
    border-bottom: 1px solid var(--cb-border);
}

.revisions a[aria-current="page"] {
    color: var(--cb-accent);
    font-weight: 700;
}

.rev-message {
    color: #cfcfcf;
    overflow-wrap: anywhere;
}

.side-links {
    margin: 24px 0 0;
    font-size: 0.9rem;
}

.danger-zone {
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid #5a2626;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.danger-zone summary {
    color: #ff9a9a;
    cursor: pointer;
}

.danger-zone p {
    margin: 8px 0 12px;
}

/* ---- Program form ---- */

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
}

.form-main,
.form-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.form-side .field-label {
    margin-top: 12px;
}

.form-side button[type="submit"] {
    align-self: flex-start;
    margin-top: 20px;
}

.text-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface-2);
    color: var(--cb-text);
    font: inherit;
}

textarea.text-input {
    resize: vertical;
}

.text-input-small {
    max-width: 200px;
    padding: 5px 8px;
    font-size: 0.9rem;
}

.files-head {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}

.files {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.file-block {
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cc-black);
    overflow: hidden;
}

.file-block-extra {
    border-style: dashed;
}

.file-head {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid var(--cb-border);
    background: var(--cb-surface);
}

.file-path {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--cb-border);
    border-radius: 3px;
    background: var(--cb-surface-2);
    color: var(--cb-text);
    font: 0.9rem var(--font-code);
}

.entry-choice {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    color: var(--cb-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.file-block textarea.code-input {
    min-height: 140px;
    border: 0;
    border-radius: 0;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    margin: 12px 0 0;
    padding: 0;
    border: 0;
}

.choice-grid legend {
    margin-bottom: 6px;
    padding: 0;
    color: var(--cb-muted);
    font: 0.85rem var(--font-code);
}

.choice-grid label {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.9rem;
}

/* ---- Program cards ---- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.program-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.program-card:hover,
.program-card:focus-within {
    border-color: var(--cb-accent);
}

.program-card-title {
    margin: 0;
    font: 700 1.05rem/1.3 var(--font-ui);
    overflow-wrap: anywhere;
}

.program-card-title a {
    color: var(--cb-text);
    text-decoration: none;
}

/* The title link covers the whole card; the card's other links sit above it. */
.program-card-title a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.program-card-meta a {
    position: relative;
    z-index: 1;
}

.program-card-meta {
    margin: 0;
    color: var(--cb-muted);
    font-size: 0.85rem;
}

.program-card-summary {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: #d0d0d0;
    font-size: 0.925rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.program-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: auto;
    padding-top: 6px;
    font-size: 0.8rem;
}

.program-card-stats {
    margin-left: auto;
    color: var(--cb-muted);
    white-space: nowrap;
}

.pill {
    padding: 1px 8px;
    border: 1px solid var(--cb-border);
    border-radius: 999px;
    color: var(--cb-muted);
    font: 0.75rem var(--font-code);
}

.pill-hw {
    border-color: var(--cc-cyan);
    color: #8fd0e6;
}

.pill-warn {
    border-color: var(--cc-orange);
    color: var(--cc-orange);
}

.empty {
    padding: 32px;
    border: 1px dashed var(--cb-border);
    border-radius: var(--radius);
    color: var(--cb-muted);
    text-align: center;
}

.pager {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
}

/* ---- Browse, search, profiles, home ---- */

.browse-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.browse-filters .side-heading:first-child {
    margin-top: 0;
}

.filter-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-list a {
    padding: 4px 8px;
    border-radius: 3px;
    color: var(--cb-text);
    font-size: 0.925rem;
    text-decoration: none;
}

.filter-list a:hover {
    background: var(--cb-surface-2);
}

.filter-list a[aria-current="page"] {
    background: var(--cb-surface-2);
    color: var(--cb-accent);
    font-weight: 700;
}

.search-form {
    display: flex;
    gap: 8px;
    max-width: 640px;
    margin: 12px 0 8px;
}

.search-form .text-input {
    flex: 1;
    min-width: 0;
}

.hero-search {
    margin-top: 28px;
}

.site-nav .nav-search-link {
    display: none;
}

.nav-search input {
    width: 160px;
    padding: 5px 10px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface-2);
    color: var(--cb-text);
    font: inherit;
    font-size: 0.9rem;
}

.profile-name {
    font-family: var(--font-ui);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.profile-bio {
    max-width: 62ch;
    white-space: pre-line;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.home-section {
    padding-top: 48px;
}

.section-head {
    display: flex;
    gap: 16px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-head h2 {
    margin: 0;
}

/* ---- Admin ---- */

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 16px;
    border-bottom: 1px solid var(--cb-border);
}

.admin-nav a {
    padding: 8px 14px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--cb-muted);
    text-decoration: none;
}

.admin-nav a[aria-current="page"] {
    border-color: var(--cb-border);
    background: var(--cb-surface);
    color: var(--cb-text);
}

.count {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--cc-orange);
    color: var(--cc-black);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}

.admin-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.admin-stat {
    min-width: 220px;
    padding: 16px 20px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
    color: var(--cb-muted);
    text-decoration: none;
}

.admin-stat-value {
    display: block;
    color: var(--cb-text);
    font: 2rem var(--font-pixel);
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-item {
    padding: 14px 16px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.admin-item-head {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: center;
}

.admin-item-text {
    margin: 6px 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.report-list {
    margin: 10px 0;
    padding-left: 20px;
}

.report-list li + li {
    margin-top: 8px;
}

.moderate-form,
.ban-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
}

.moderate-form .text-input-small,
.ban-form .text-input-small {
    flex: 1 1 160px;
    max-width: 320px;
}

.button-approve {
    border-color: var(--cc-lime);
    color: var(--cc-lime);
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--cb-border);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--cb-muted);
    font: 0.75rem var(--font-code);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.role-forms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.role-forms form {
    margin: 0;
}

.role-forms .pill {
    background: none;
    cursor: pointer;
}

.pill-on {
    border-color: var(--cb-accent);
    color: var(--cb-accent);
}

.pill-off {
    border-style: dashed;
}

/* ---- Utilities & motion ---- */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

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

@media (prefers-reduced-motion: reduce) {
    .logo-cursor,
    .screen-cursor {
        animation: none;
    }
}

@media (max-width: 900px) {
    .hero-inner,
    .playground,
    .program-layout,
    .form-grid,
    .browse-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .nav-search {
        display: none;
    }

    .site-nav .nav-search-link {
        display: inline;
    }

    .filter-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .filter-list a {
        padding: 3px 10px;
        border: 1px solid var(--cb-border);
        border-radius: 999px;
        font-size: 0.85rem;
    }

    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero {
        padding-top: 40px;
    }
}

@media (max-width: 560px) {
    .feature-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .site-nav {
        gap: 12px;
        font-size: 0.875rem;
    }

    .screen {
        font-size: 12px;
    }
}

/* ---- Scene editor ---- */

.scene-editor {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.scene-editor summary {
    cursor: pointer;
    font-weight: 600;
}

.scene-editor .hint {
    margin: 10px 0;
}

.scene-example {
    max-height: 260px;
    margin: 0 0 12px;
    padding: 10px 12px;
    overflow: auto;
    border-radius: var(--radius);
    background: var(--cc-black);
    font: 0.8rem/1.5 var(--font-code);
}

textarea.scene-input {
    min-height: 200px;
}

/* ---- Audio files ---- */

.assets-block {
    margin: 16px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.assets-block legend {
    padding: 0 4px;
    font-weight: 600;
}

.asset-list {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.asset-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--cb-border);
}

.asset-upload {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 12px;
    align-items: center;
}

.asset-files {
    margin-top: 24px;
}

/* ---- Previews ---- */

.preview {
    margin: 0 0 24px;
}

.preview img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 4px solid var(--bezel-advanced);
    border-radius: var(--radius);
    background: var(--cc-black);
    image-rendering: pixelated;
}

.preview figcaption {
    margin-top: 6px;
}

.program-card-preview {
    display: block;
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: 2px;
    background: var(--cc-black);
    image-rendering: pixelated;
}

.side-links .link-button {
    color: var(--cb-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.side-links .link-button:hover {
    color: var(--cc-white);
}

/* ---- Dependencies: files the code downloads ---- */

.deps {
    margin-bottom: 24px;
    padding: 14px 16px;
    border: 1px dashed var(--cb-border);
    border-radius: var(--radius);
    background: var(--cb-surface);
}

.deps h2 {
    font-size: 1rem;
}

.deps-list {
    margin: 10px 0 14px;
    padding: 0;
    list-style: none;
}

.deps-list li {
    padding: 4px 0;
    overflow-wrap: anywhere;
}

.deps-list label {
    cursor: pointer;
}

.deps-list .pill {
    display: inline-block;
}

.asset-remove {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-basis: 100%;
}
