/* ══════════════════════════════════════════════════════════════════════════
   COMPY 386 — shared chrome for the DOS-in-a-browser wrapper
   Beige all-in-one - recessed CRT - molded plastic - clickable 3.5" floppies
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  /* molded beige plastic */
  --case-hi:    #ece3cd;
  --case:       #ddd2b6;
  --case-mid:   #d2c6a8;
  --case-lo:    #c2b690;
  --case-edge:  #a89c76;
  --case-deep:  #8d8261;

  /* dark screen surround */
  --bezel-hi:   #34302a;
  --bezel:      #211e19;
  --bezel-lo:   #141210;

  /* phosphor */
  --phos:       #d6f7c8;
  --phos-dim:   #8fcf86;

  --screen-w: 800px;
  --screen-h: 600px;
  --bezel-pad: 60px;
  --chin-h: 188px;

  --ink: #4b443a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(120% 90% at 50% 8%, #2a2c34 0%, #181a20 45%, #0c0d11 100%);
  font-family: "Michroma", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* faint room: a desk surface fading up into the dark */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(180deg, transparent 52%, rgba(60,46,32,0.28) 74%, rgba(38,28,18,0.55) 100%);
}

/* ── Stage: fixed design size, JS scales it to fit ───────────────────────── */
.stage {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  z-index: 1;
}

/* ══ THE COMPUTER ════════════════════════════════════════════════════════ */
.computer {
  position: relative;
  width: fit-content;
  padding: var(--bezel-pad) var(--bezel-pad) 0;
  border-radius: 34px 34px 30px 30px;
  background:
    linear-gradient(158deg, var(--case-hi) 0%, var(--case) 22%, var(--case-mid) 60%, var(--case-lo) 100%);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,0.55),
    inset 0 -5px 14px rgba(0,0,0,0.28),
    inset 5px 0 14px rgba(255,255,255,0.18),
    inset -6px 0 16px rgba(0,0,0,0.20),
    0 2px 1px rgba(255,255,255,0.30),
    0 60px 90px -30px rgba(0,0,0,0.75),
    0 30px 60px -20px rgba(0,0,0,0.55);
}
/* molded-plastic speckle */
.computer::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05; mix-blend-mode: multiply;
}

/* ── Screen surround (recessed dark bezel) ───────────────────────────────── */
.screen-frame {
  position: relative;
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--bezel-hi), var(--bezel) 45%, var(--bezel-lo));
  box-shadow:
    inset 0 5px 16px rgba(0,0,0,0.85),
    inset 0 -3px 6px rgba(255,255,255,0.05),
    0 1px 0 rgba(255,255,255,0.45),
    0 -1px 2px rgba(0,0,0,0.25);
}
/* engraved brand under the screen, on the bezel */
.screen-frame::after {
  content: "COMPY 386";
  position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 3px; color: #6f685a;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6), 0 -1px 0 rgba(255,255,255,0.06);
}

/* ── The CRT glass ───────────────────────────────────────────────────────── */
.crt {
  position: relative;
  width: var(--screen-w);
  height: var(--screen-h);
  border-radius: 30px / 22px;
  overflow: hidden;
  background: #07090a;
  box-shadow:
    inset 0 0 3px 2px rgba(0,0,0,0.9),
    inset 0 0 70px rgba(0,0,0,0.85);
}
.crt__content {
  position: absolute; inset: 0;
  filter: brightness(var(--bright, 1)) contrast(var(--contrast, 1));
}
.crt__content iframe,
.crt__content canvas,
.crt__content #dos,
.crt__content .dos { width: 100% !important; height: 100% !important; border: 0; }

/* curvature vignette */
.crt__vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  border-radius: inherit;
  background: radial-gradient(118% 118% at 50% 50%, transparent 62%, rgba(0,0,0,0.45) 88%, rgba(0,0,0,0.8) 100%);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.7);
}
/* scanlines + phosphor mask */
.crt__scan {
  position: absolute; inset: 0; pointer-events: none; z-index: 6; opacity: 0.5;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
/* glass glare */
.crt__glare {
  position: absolute; inset: 0; pointer-events: none; z-index: 7;
  background:
    linear-gradient(127deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.04) 14%, transparent 34%),
    radial-gradient(60% 40% at 78% 90%, rgba(255,255,255,0.05), transparent 70%);
}
/* power-on flash / warm-up */
.crt__flash {
  position: absolute; inset: 0; pointer-events: none; z-index: 9;
  background: #eafff0; opacity: 0;
}
.crt.is-booting .crt__flash { animation: powerOn 0.85s ease-out forwards; }
@keyframes powerOn {
  0%   { opacity: 0; transform: scaleY(0.004) scaleX(1); }
  6%   { opacity: 0.95; transform: scaleY(0.01) scaleX(1.2); }
  16%  { opacity: 0.85; transform: scaleY(1) scaleX(1); }
  40%  { opacity: 0.18; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .crt.is-booting .crt__flash { animation: none; }
}

/* ══ CHIN: controls below the screen ═════════════════════════════════════ */
.chin {
  position: relative;
  width: calc(var(--screen-w) + 44px);   /* = screen-frame width; keeps the case from growing past the glass */
  height: var(--chin-h);
  display: flex; align-items: center; gap: 26px;
  padding: 22px 14px 26px;
}
.chin__group { display: flex; align-items: center; gap: 22px; min-width: 0; }
.chin__center { min-width: 0; }   /* let the drive shrink so the right controls never overflow */
.chin__left   { flex: 0 0 auto; }
.chin__center { flex: 1 1 auto; justify-content: center; }
.chin__right  { flex: 0 0 auto; }

/* brand nameplate */
.nameplate {
  display: flex; flex-direction: column; gap: 5px; line-height: 1;
  padding-right: 4px;
}
.nameplate__logo {
  font-size: 27px; letter-spacing: 1px; color: #59513f;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6), 0 -1px 1px rgba(0,0,0,0.35);
}
.nameplate__logo b { color: #7a3b1f; }
.nameplate__model {
  font-size: 10px; letter-spacing: 4px; color: #8a8068;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
/* little retro accent stripes */
.stripes { display: flex; gap: 3px; margin-top: 7px; }
.stripes i { width: 16px; height: 5px; border-radius: 1px; display: block; opacity: 0.85; }
.stripes i:nth-child(1){background:#c64b3a} .stripes i:nth-child(2){background:#d98a2b}
.stripes i:nth-child(3){background:#caa52e} .stripes i:nth-child(4){background:#3f8a55}
.stripes i:nth-child(5){background:#2f6ea8}

/* power LED + label */
.led-cluster { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.led {
  width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #d6ffdc, #43e766 45%, #1c9a3c 100%);
  box-shadow: 0 0 7px 1px rgba(70,235,110,0.85), 0 0 16px 3px rgba(70,235,110,0.35),
              inset 0 -1px 2px rgba(0,0,0,0.4);
  animation: ledFlicker 5.5s infinite;
}
.led--amber { background: radial-gradient(circle at 38% 32%, #ffe9c0, #f3a83a 45%, #a85f12 100%);
  box-shadow: 0 0 6px 1px rgba(243,168,58,0.8), 0 0 14px 3px rgba(243,168,58,0.3); animation: none; }
.led--off { background: radial-gradient(circle at 38% 32%, #6b6b66, #3a3a36 60%, #242420);
  box-shadow: inset 0 -1px 2px rgba(0,0,0,0.5); animation: none; }
@keyframes ledFlicker {
  0%,93%,100% { opacity: 1; }
  94% { opacity: 0.55; } 95% { opacity: 1; } 96.5% { opacity: 0.6; } 97.5% { opacity: 1; }
}
.led-label { font-size: 8px; letter-spacing: 2px; color: #7d7359; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }

/* ── Floppy drive slot ───────────────────────────────────────────────────── */
.drive {
  position: relative;
  width: 100%; max-width: 300px; min-width: 200px;
  border-radius: 7px;
  padding: 12px 12px;
  background: linear-gradient(180deg, #cabf9f, #b6ab8b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 -2px 4px rgba(0,0,0,0.25),
              0 1px 1px rgba(255,255,255,0.3);
}
.drive__slot {
  position: relative;
  height: 16px; border-radius: 3px;
  background: linear-gradient(180deg, #1a1814 0%, #2a2620 48%, #100e0b 52%, #050403 100%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.9), inset 0 -1px 0 rgba(255,255,255,0.12),
              0 1px 0 rgba(255,255,255,0.35);
  overflow: hidden;
}
/* the disk peeking once "inserted" */
.drive__slot .inserted-strip {
  position: absolute; left: 8px; right: 44px; top: 3px; bottom: 3px;
  border-radius: 2px; background: linear-gradient(180deg, #3a3a3e, #222226);
  transform: translateY(-120%); transition: transform 0.45s cubic-bezier(.2,.8,.2,1);
}
.drive__slot.is-loaded .inserted-strip { transform: translateY(0); }
.drive__row { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.drive__led {
  width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffd9d2, #d8412c 55%, #7e1e12);
  box-shadow: 0 0 5px rgba(216,65,44,0.7);
}
.drive__led.is-idle { background: radial-gradient(circle at 40% 35%, #6b6b66, #3a3a36 60%, #242420); box-shadow: none; }
.drive__label { font-size: 8px; letter-spacing: 2px; color: #7d7359; }
.eject {
  margin-left: auto;
  width: 40px; height: 17px; border: 0; cursor: pointer;
  border-radius: 3px;
  background: linear-gradient(180deg, #e7ddc6, #c9bd9c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -2px 3px rgba(0,0,0,0.25),
              0 2px 3px rgba(0,0,0,0.3);
  position: relative;
}
.eject::after {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-58%);
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 6px solid #6a6149;
}
.eject::before {
  content: ""; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  width: 11px; height: 2px; background: #6a6149;
}
.eject:active { box-shadow: inset 0 2px 4px rgba(0,0,0,0.4); transform: translateY(1px); }

/* ── Rotary knobs (brightness / contrast) ────────────────────────────────── */
.knob-bank { display: flex; gap: 22px; }
.knob-wrap { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.knob {
  position: relative; width: 50px; height: 50px; border-radius: 50%;
  cursor: ns-resize; touch-action: none;
  background:
    radial-gradient(circle at 50% 38%, #3a3733 0%, #2a2723 55%, #1b1916 100%);
  box-shadow:
    0 3px 5px rgba(0,0,0,0.45), inset 0 2px 3px rgba(255,255,255,0.18),
    inset 0 -3px 5px rgba(0,0,0,0.6),
    0 0 0 4px rgba(0,0,0,0.10), 0 0 0 5px rgba(255,255,255,0.22);
}
/* knurled grip ring */
.knob::before {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #322f2b 0 6deg, #26231f 6deg 12deg);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.7);
}
.knob__pointer { position: absolute; inset: 0; z-index: 2; }
.knob__pointer::after {
  content: ""; position: absolute; left: 50%; top: 7px; transform: translateX(-50%);
  width: 3px; height: 13px; border-radius: 2px;
  background: linear-gradient(#f3ead2, #c9bd9c);
  box-shadow: 0 0 4px rgba(255,250,230,0.5);
}
.knob-label { font-size: 8px; letter-spacing: 2px; color: #7d7359; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }

/* ── Vents ───────────────────────────────────────────────────────────────── */
.vents {
  flex: 0 0 auto;
  width: 60px; height: 70px; border-radius: 5px;
  background:
    repeating-linear-gradient(180deg,
      rgba(255,255,255,0.32) 0 1px,
      rgba(0,0,0,0.30) 1px 2px,
      transparent 2px 7px);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.25);
}

/* ── Phillips screws ─────────────────────────────────────────────────────── */
.screw {
  position: absolute; width: 17px; height: 17px; border-radius: 50%; z-index: 8;
  background: radial-gradient(circle at 36% 30%, #d3c8a8, #a89c78 65%, #837858);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.6), inset 0 -1px 2px rgba(0,0,0,0.45),
              0 1px 1px rgba(0,0,0,0.3);
}
.screw::before, .screw::after {
  content: ""; position: absolute; left: 50%; top: 50%; background: rgba(60,52,38,0.75);
  border-radius: 1px;
}
.screw::before { width: 10px; height: 2px; transform: translate(-50%,-50%) rotate(35deg); }
.screw::after  { width: 10px; height: 2px; transform: translate(-50%,-50%) rotate(125deg); }
.screw--tl { top: 20px; left: 20px; }
.screw--tr { top: 20px; right: 20px; }
.screw--bl { bottom: 20px; left: 20px; }
.screw--br { bottom: 20px; right: 20px; }

/* ══ ON-SCREEN: boot menu / DOS text ═════════════════════════════════════ */
.boot {
  position: absolute; inset: 0;
  font-family: "VT323", monospace;
  color: var(--phos);
  text-shadow: 0 0 6px rgba(150,255,170,0.45);
  padding: 34px 40px;
  font-size: 27px; line-height: 1.28;
  background: radial-gradient(130% 120% at 50% 30%, #0c1410 0%, #060a07 70%, #030503 100%);
}
.boot__head { color: #eafff0; }
.boot__dim { color: var(--phos-dim); }
.boot__rule { color: var(--phos-dim); letter-spacing: -1px; opacity: 0.7; white-space: nowrap; overflow: hidden; }
.boot__menu { margin: 18px 0; }
.boot__item {
  display: flex; align-items: baseline; gap: 14px; padding: 2px 10px; cursor: pointer;
  white-space: nowrap;
}
.boot__item .num { color: var(--phos-dim); }
.boot__item .yr { margin-left: auto; color: var(--phos-dim); }
.boot__item .na { color: #e6b35a; font-size: 20px; margin-left: 10px; }
.boot__item.is-sel { background: var(--phos); color: #06140a; text-shadow: none; }
.boot__item.is-sel .num, .boot__item.is-sel .yr { color: #1c5a2c; }
.boot__item.is-sel .na { color: #8a4a0a; }
.boot__blurb { min-height: 1.3em; color: var(--phos-dim); margin-top: 6px; }
.boot__foot { position: absolute; left: 40px; right: 40px; bottom: 28px; color: var(--phos-dim); font-size: 22px;
  display: flex; justify-content: space-between; }
.cursor::after { content: "_"; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ══ 3.5" FLOPPY DISK ════════════════════════════════════════════════════ */
.disk {
  --body: #2b2b2f; --stripe: #6a6a72;
  position: relative;
  width: 156px; height: 166px;
  border-radius: 8px 8px 9px 9px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--body) 88%, #fff 12%), var(--body) 45%, color-mix(in srgb, var(--body) 78%, #000 22%));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -2px 4px rgba(0,0,0,0.4),
    0 10px 18px -6px rgba(0,0,0,0.6), 0 2px 4px rgba(0,0,0,0.4);
  /* bevelled top-right corner */
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  user-select: none;
}
.disk__shutter {
  position: absolute; top: 9px; left: 16px; right: 30px; height: 40px;
  border-radius: 3px;
  background: linear-gradient(180deg, #e8eaee 0%, #b9bcc4 40%, #8f939c 60%, #c4c7cd 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), inset 0 -2px 3px rgba(0,0,0,0.35),
              0 1px 2px rgba(0,0,0,0.4);
}
/* shutter window + slider */
.disk__shutter::before {
  content: ""; position: absolute; top: 6px; bottom: 6px; left: 10px; width: 30px;
  border-radius: 2px; background: linear-gradient(180deg, #4a4d54, #2c2e33);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.7);
}
.disk__shutter::after {
  content: ""; position: absolute; top: 5px; bottom: 5px; right: 6px; width: 7px;
  border-radius: 2px; background: linear-gradient(180deg, #d6d9df, #9a9da4);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.7);
}
/* write-protect tab notch hint, bottom-left */
.disk__wp {
  position: absolute; bottom: 8px; left: 9px; width: 12px; height: 12px;
  background: color-mix(in srgb, var(--body) 60%, #000 40%);
  border-radius: 2px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.7);
}
.disk__label {
  position: absolute; left: 12px; right: 12px; top: 58px; bottom: 12px;
  background: linear-gradient(180deg, #fbf7ec, #efe9d6);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(0,0,0,0.05);
  padding: 8px 9px 7px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.disk__label::before {
  content: ""; display: block; height: 6px; margin: -2px -3px 7px;
  background: var(--stripe); border-radius: 2px; opacity: 0.9;
}
.disk__title {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 15px; line-height: 1.05; color: #2b2620; letter-spacing: -0.2px;
}
.disk__meta {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 10px; color: #6a6253; margin-top: auto; display: flex; justify-content: space-between;
}
/* colour variants */
.disk--black { --body: #2a2a2e; --stripe: #5b5b63; }
.disk--blue  { --body: #2b4f86; --stripe: #2b4f86; }
.disk--red   { --body: #9e3a31; --stripe: #9e3a31; }
.disk--green { --body: #2f6b46; --stripe: #2f6b46; }
.disk--amber { --body: #c89a3a; --stripe: #b07d1f; }

.disk:hover { transform: translateY(-10px) rotate(-1.5deg); box-shadow: 0 22px 30px -10px rgba(0,0,0,0.65); z-index: 3; }
.disk:hover { animation: wiggle 0.5s ease; }
@keyframes wiggle {
  0%,100% { rotate: -1.5deg; } 25% { rotate: 1.5deg; } 50% { rotate: -2.2deg; } 75% { rotate: 0.8deg; }
}
.disk.is-grabbed { transition: transform 0.5s cubic-bezier(.4,0,.2,1), opacity 0.4s; }
@media (prefers-reduced-motion: reduce) { .disk:hover { animation: none; } }
