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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

body {
    position: relative;
    font-family: "Times New Roman", serif;
}

canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* MAIN TITLE
   The visible title is drawn on the canvas by landing.js.
   (Its look is set in the TITLE SETTINGS at the top of that file.)
   This hidden copy stays in the page so search engines and
   screen readers still know what the page is called. */

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

/* CAUGHT PLANET LINK
   An invisible circle sitting exactly over the planet (drawn on the
   canvas), plus the page name floating above it. landing.js sets its
   position, size and colours (--ink, --glow). */

.catch {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 4;                 /* above the vignette */
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;       /* only clickable while the planet is out */
    text-decoration: none;
    outline: none;
    will-change: transform, opacity;
}

.catch.is-live {
    pointer-events: auto;
    cursor: pointer;
}

/* THE PLANET'S NAME
   A ring of letters circling the planet, flat to the screen. It always
   turns clockwise, on its own, separate from the planet's spin. landing.js
   places each letter around the ring. */

.catch-name {
    --ring-font: 13px;          /* size of the letters */
    --ring-spin: 18s;           /* time for one full turn around the planet */

    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;

    font-family: "Times New Roman", serif;
    font-size: var(--ring-font);
    white-space: nowrap;

    color: var(--ink, #fff);
    text-shadow:
        0 0 4px var(--glow, #fff),
        0 0 12px var(--glow, #fff);

    transition: color 0.2s, text-shadow 0.2s;
    animation:
        catch-ring var(--ring-spin) linear infinite,
        catch-flicker 3.2s infinite steps(1);
}

/* one slot per letter, turned to that letter's spot on the ring */
.catch-name .slot {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
}

/* the letter itself, standing on the ring at normal proportions */
.catch-name .ring-ch {
    position: absolute;
    left: 0;
    line-height: 1;
    transform: translateX(-50%);
}

@keyframes catch-ring {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.catch:hover .catch-name,
.catch:focus-visible .catch-name {
    color: #fff;
    text-shadow:
        0 0 6px var(--glow, #fff),
        0 0 18px var(--glow, #fff),
        0 0 32px var(--glow, #fff);
}

.catch:focus-visible {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.4);
}

/* A faint, irregular flicker on the page name */
@keyframes catch-flicker {
    0%, 100% { opacity: 1; }
    41%      { opacity: 0.55; }
    42%      { opacity: 1; }
    77%      { opacity: 0.7; }
    78%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .catch-name { animation: none; }
}

/* SCREEN VIGNETTE */

body::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;

    background: radial-gradient(
        ellipse at center,
        transparent 25%,
        rgba(0,0,0,0.12) 65%,
        rgba(0,0,0,0.55) 100%
    );

    transition: opacity 0.5s;
}

/* The vignette fades away while diving into a planet,
   so the screen ends up the same solid colour as the next page */
body.is-diving::after {
    opacity: 0;
}

/* =====================================================================
   THE CONSOLE (landing/console.js)
   A dim blinking block under the title. When you start typing it opens
   into a command line 40% wider than the title, and the text slides
   over to the left. Nothing is drawn around it: no field, no box. The
   text carries its own faint violet glow instead.
   ===================================================================== */

#apparatus {
    --ap-font: 12px;
    --ap-lead: 1.32;                                  /* line height (tight, like cmd) */
    --ap-prompt: rgba(196, 198, 214, 0.78);           /* X:\Echalalius\operator>  */
    --ap-typed: rgba(255, 255, 255, 0.96);            /* what you type             */
    --ap-log: rgba(222, 224, 236, 0.86);              /* the log                   */
    --ap-dim: rgba(196, 198, 214, 0.38);              /* autofill hints            */
    --ap-glow: 0 0 6px rgba(132, 104, 255, 0.55),     /* the faint indigo/violet glow */
               0 0 1px rgba(170, 150, 255, 0.5);
    --ap-lines: 12;                                   /* log lines before it scrolls */

    position: absolute;
    z-index: 5;
    transform: translateX(-50%);
    width: 1.2ch;                     /* just the cursor, until you type */
    font-family: Consolas, "Lucida Console", "Courier New", monospace;
    font-size: var(--ap-font);
    line-height: var(--ap-lead);
    color: var(--ap-log);
    text-shadow: var(--ap-glow);
    transition: width 0.38s cubic-bezier(0.2, 0.7, 0.2, 1);
    cursor: text;
}

#apparatus.open {
    width: var(--ap-width, 520px);
}

/* the whole console: the log, then the typing line under it. Grows
   until full, then scrolls, with the typing line at the bottom. */
.ap-screen {
    position: relative;
    max-height: calc((var(--ap-lines) + 1) * var(--ap-lead) * 1em);
    overflow-y: auto;
    overflow-x: hidden;
    contain: content;                 /* keeps its glow from being redrawn needlessly */
    scrollbar-width: thin;
    scrollbar-color: rgba(208, 212, 224, 0.25) transparent;
}

.ap-screen::-webkit-scrollbar {
    width: 5px;
}

.ap-screen::-webkit-scrollbar-thumb {
    background: rgba(208, 212, 224, 0.25);
}

.ap-field {
    height: calc(var(--ap-lead) * 1em);
    white-space: pre;
    overflow: hidden;
}

.ap-prompt {
    display: none;
    color: var(--ap-prompt);
}

#apparatus.open .ap-prompt {
    display: inline;
}

.ap-typed {
    color: var(--ap-typed);
}

.ap-cursor {
    color: var(--ap-dim);
    animation: ap-blink 1.1s steps(1) infinite;
}

#apparatus.open .ap-cursor {
    color: var(--ap-typed);
}

@keyframes ap-blink {
    0%, 55%  { opacity: 1; }
    56%, 100% { opacity: 0; }
}

/* the log: just glowing text */
.ap-log {
    white-space: pre-wrap;
    word-break: break-word;
    cursor: auto;
}

/* the blank line after each command: there, but shorter than a full line */
.ap-gap {
    height: 0.55em;
    overflow: hidden;
}

.ap-tx-head {
    color: rgba(160, 255, 200, 0.85);   /* RADIO's green */
    text-shadow: 0 0 6px rgba(90, 255, 150, 0.35);
}

.ap-tx-body {
    padding-left: 2ch;
}

/* the autofill list: glowing words, no box */
.ap-suggest {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    min-width: 10ch;
    padding: 1px 0;
    background: rgba(2, 2, 8, 0.88);
    box-shadow: 0 0 12px 4px rgba(2, 2, 8, 0.88);   /* soft edges instead of a hard box */
}

.ap-option {
    padding: 0;
    color: var(--ap-dim);
    cursor: pointer;
}

.ap-option.on {
    color: var(--ap-typed);
}

/* the real text box, invisible (it's what makes phones show a keyboard) */
.ap-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    font-size: 16px;            /* stops iPhones zooming in */
    pointer-events: none;
}

#apparatus [hidden] {
    display: none;
}

/* passing through a gate: the screen fades to black, then the page loads */
#gate-fade {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

#gate-fade.on {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    #apparatus { transition: none; }
    .ap-cursor { animation: none; }
}

/* PHONES: the invisible text box covers the whole console, so a tap lands
   on it directly and the keyboard opens. The log stays on top so it can
   still be scrolled. */
@media (pointer: coarse) {
    #apparatus .ap-input {
        left: 0; top: 0; width: 100%; height: 100%;
        min-height: 44px;
        pointer-events: auto;
        z-index: 1;
        color: transparent; background: transparent; caret-color: transparent;
    }
    #apparatus .ap-log { position: relative; z-index: 2; }
}
