/* STEPHEN, sitting inside the terminal.
 *
 * HOW THE SCREEN IS FITTED
 *
 * The shell is a PNG with the screen punched out of it. Measured off the alpha
 * channel, the hole sits at 22.997% / 10.313% and runs 51.381% x 51.105% of the
 * image. Those numbers are in .glass below and they are not guesses.
 *
 * The chat sits UNDER the PNG, not inside a clipped box. That matters because
 * the hole is a real tube barrel, not a rounded rectangle - it is inset 319px
 * at the very top edge and does not straighten out until 240px down. No
 * border-radius reproduces that. Laying the opaque bezel over the top masks the
 * overflow to the exact shape of the glass for free. The image takes
 * pointer-events:none so clicks still reach the input underneath.
 *
 * Below 1000x700 there is not enough glass left to read, so the shell is
 * dropped and the terminal goes full bleed. Full bleed is the base style here
 * and the cabinet is the enhancement, which is why the media query adds rather
 * than undoes.
 */
:root{
  --bg:#05070a; --deep:#020305;
  --fg:#c8f7e2; --dim:#5c8a7b; --faint:#2c4a41;
  --hot:#4dffc3; --pink:#ff4d9d; --amber:#ffc857;
  --rule:#12312a;
  --mono:ui-monospace,"SF Mono",Menlo,Consolas,"DejaVu Sans Mono",monospace;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--deep); color:var(--fg);
  font:13px/1.55 var(--mono); overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  -webkit-font-smoothing:antialiased;
}

.rig{position:relative; width:100%; height:100%}
.shell{display:none}

/* ── the glass ───────────────────────────────────────── */
.glass{
  position:absolute; inset:0; display:flex; flex-direction:column;
  background:radial-gradient(120% 100% at 50% 45%, #0a1014 0%, var(--bg) 58%, var(--deep) 100%);
  padding:clamp(10px,2.4vh,26px) clamp(12px,3.4vw,44px);
  overflow:hidden;
}
/* scanlines and vignette, both inert */
.glass::after{
  content:""; position:absolute; inset:0; pointer-events:none; z-index:5;
  background:
    repeating-linear-gradient(180deg, rgba(0,0,0,.34) 0 1px, transparent 1px 3px),
    radial-gradient(140% 120% at 50% 50%, transparent 50%, rgba(0,0,0,.66) 100%);
  mix-blend-mode:multiply;
}
/* one slow bright band travelling down the tube */
.glass::before{
  content:""; position:absolute; left:0; right:0; height:40%; z-index:4;
  pointer-events:none; opacity:.06;
  background:linear-gradient(180deg,transparent,var(--hot) 55%,transparent);
  animation:sweep 7.5s linear infinite;
}
@keyframes sweep{from{top:-42%}to{top:102%}}
@media (prefers-reduced-motion:reduce){.glass::before{display:none}}

/* ── status strip ────────────────────────────────────── */
.strip{
  flex:0 0 auto; display:flex; gap:1.6em; align-items:baseline; flex-wrap:wrap;
  border-bottom:1px solid var(--rule); padding-bottom:.5em; font-size:.82em;
  letter-spacing:.14em; text-transform:uppercase; color:var(--faint);
}
.strip .mark{color:var(--hot); letter-spacing:.34em; font-weight:700;
  text-shadow:0 0 12px rgba(77,255,195,.5)}
.strip b{font-weight:400; color:var(--amber)}
.strip .on b{color:var(--pink)}
.strip .sp{flex:1}
.strip .live b{display:inline-block;width:5px;height:5px;border-radius:50%;
  background:var(--pink);box-shadow:0 0 7px var(--pink);animation:pulse 1.9s ease-in-out infinite}
@keyframes pulse{50%{opacity:.2}}

/* ── transcript ──────────────────────────────────────── */
.feed{
  flex:1; overflow-y:auto; min-height:0; padding:.9em .2em 0 0;
  scrollbar-width:thin; scrollbar-color:var(--faint) transparent;
}
.feed::-webkit-scrollbar{width:5px}
.feed::-webkit-scrollbar-thumb{background:var(--faint)}
.line{margin:0 0 .8em; max-width:70ch; word-wrap:break-word}
.line .who{display:inline-block; min-width:8.5ch; color:var(--faint);
  letter-spacing:.1em; user-select:none}
.line.me  .txt{color:#eafff7}
.line.him .txt{color:var(--hot); text-shadow:0 0 11px rgba(77,255,195,.3)}
.line.sys{color:var(--dim); font-size:.92em; letter-spacing:.05em}

/* ── prompt ──────────────────────────────────────────── */
.prompt{flex:0 0 auto; display:flex; align-items:center; gap:.8em;
  border-top:1px solid var(--rule); padding-top:.6em}
.prompt .sig{color:var(--pink); text-shadow:0 0 9px rgba(255,77,157,.5)}
.prompt input{flex:1; background:none; border:0; outline:0; color:#eafff7;
  font:inherit; caret-color:var(--hot); padding:1px 0; min-width:0}
.prompt input::placeholder{color:var(--faint)}
.prompt .hint{font-size:.8em; color:var(--faint); letter-spacing:.1em; flex:0 0 auto}

/* ── the cabinet, when there is room for it ──────────── */
@media (min-width:1000px) and (min-height:720px){
  body{padding:clamp(8px,2vh,28px)}
  .rig{
    width:min(100%, 133.333vh);   /* 1448/1086 keeps the shell undistorted */
    aspect-ratio:1448/1086; height:auto;
  }
  .shell{
    display:block; position:absolute; inset:0; z-index:2;
    width:100%; height:100%; pointer-events:none; /* clicks reach the input */
  }
  .glass{
    /* measured off the alpha channel of shell.png */
    inset:10.313% 25.622% 38.582% 22.997%;
    z-index:1; border-radius:6% / 8%;
    /* the barrel curves hardest at the corners, so hold the text off them */
    padding:7% 5.5%;
    /* cqw is 1% of the RIG, not of the glass. 13px in a 744px screen on a
       1448px rig is 13/1448 = 0.9cqw. Sizing it against the glass instead
       gave 1.72cqw, which is nearly double. */
    font-size:clamp(9px, 0.9cqw, 14px);
    background:radial-gradient(120% 100% at 50% 45%, #0a1216 0%, #04080b 60%, #010305 100%);
  }
  .glass::after{background:
    repeating-linear-gradient(180deg, rgba(0,0,0,.3) 0 1px, transparent 1px 3px),
    radial-gradient(130% 115% at 50% 50%, transparent 46%, rgba(0,0,0,.6) 100%)}
  .rig{container-type:inline-size}
}
