  :root {
    --bg:        #1e1e2e;
    --bg-alt:    #181825;
    --surface:   #313244;
    --overlay:   #6c7086;
    --text:      #cdd6f4;
    --subtext:   #a6adc8;
    --cyan:      #89dceb;
    --purple:    #cba6f7;
    --green:     #a6e3a1;
    --yellow:    #f9e2af;
    --red:       #f38ba8;
    --blue:      #89b4fa;
    --peach:     #fab387;
    --font:      'JetBrains Mono', 'Fira Code', 'Ubuntu Mono', monospace;
  }

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

  html, body {
    width: 100%; height: 100%;
    background: url('https://dwfcctyh2o6me.ok.kimi.link/wallpaper-default.jpg') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  /* ─── CRT MONITOR SHELL ──────────────────────────────────────────────── */
  .monitor {
    width: min(98vw, 1100px);
    height: min(96vh, 720px);
    background: var(--bg-alt);
    border-radius: 14px;
    box-shadow:
      0 0 0 2px #2a2a3e,
      0 0 0 6px #141420,
      0 0 60px #000a,
      0 0 120px #000c,
      inset 0 0 80px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* subtle barrel distortion via perspective */
    perspective: 1200px;
  }

  /* CRT glass shine */
  .monitor::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(
      ellipse 90% 70% at 50% 30%,
      rgba(255,255,255,0.025) 0%,
      transparent 70%
    );
    pointer-events: none;
    z-index: 10;
    border-radius: 14px;
  }

  /* Scanlines */
  .monitor::after {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0) 0px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0.15) 2px,
      rgba(0,0,0,0.15) 3px
    );
    pointer-events: none;
    z-index: 9;
    border-radius: 14px;
  }

  /* ─── TITLE BAR ──────────────────────────────────────────────────────── */
  .titlebar {
    background: #21222c;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2a3e;
    flex-shrink: 0;
    z-index: 5;
  }
  .title-left {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
  }
  .terminal-icon {
    color: #c6d0f5;
    stroke: currentColor;
  }
  .dots { display: flex; gap: 8px; }
  .dot {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #c6d0f5;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
  }
  .dot:hover { background: rgba(255,255,255,0.1); }
  .dot.close:hover { background: #f38ba8; color: #1e1e2e; }
  .tab-title {
    font-family: var(--font);
    font-size: 12px;
    color: #c6d0f5;
    letter-spacing: 0.5px;
    display: flex;           /* Enables flexbox */
    justify-content: center; /* Centers content horizontally */
    align-items: center;     /* Centers content vertically */
    width: 100%;             /* Ensures it spans the full width of the bar */
    text-align: center;      /* Fallback for older browsers */
    flex-grow: 1;
  }
  .tab-title span { color: #a6adc8; }

  /* ─── TERMINAL BODY ──────────────────────────────────────────────────── */
  #terminal {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 22px 8px;
    font-family: var(--font);
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    scroll-behavior: smooth;
    position: relative;
    z-index: 2;
  }
  #terminal::-webkit-scrollbar { width: 6px; }
  #terminal::-webkit-scrollbar-track { background: transparent; }
  #terminal::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 3px; }

  /* Boot output */
  .boot-line {
    display: block;
    white-space: pre-wrap;
    animation: fadeIn 0.1s ease;
  }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .ok     { color: var(--green); }
  .info   { color: var(--subtext); }

  /* Terminal output entries */
  .entry { margin-bottom: 2px; }
  .prompt-line { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }

  .p-user   { color: var(--cyan);   font-weight: 500; }
  .p-at     { color: var(--subtext); }
  .p-host   { color: var(--cyan);   font-weight: 500; }
  .p-colon  { color: var(--subtext); }
  .p-dir    { color: var(--purple); font-weight: 500; }
  .p-sym    { color: var(--purple); }
  .p-cmd    { color: var(--text); }

  .output {
    padding: 4px 0 10px 0;
    white-space: pre-wrap;
    color: var(--text);
  }
  .output .key   { color: var(--cyan);   font-weight: 500; }
  .output .val   { color: var(--text); }
  .output .head  { color: var(--purple); font-weight: 700; }
  .output .ok    { color: var(--green); }
  .output .warn  { color: var(--yellow); }
  .output .err   { color: var(--red); }
  .output .num   { color: var(--peach); font-weight: 700; }
  .output .dim   { color: var(--subtext); }
  .output .arrow { color: var(--blue); }
  .output .tag   { color: var(--peach); }
  .output .bold  { font-weight: 700; }

  /* ─── INPUT ROW ──────────────────────────────────────────────────────── */
  #input-row {
    display: flex;
    align-items: center;
    padding: 10px 22px 14px;
    background: var(--bg);
    border-top: 1px solid #2a2a3e;
    gap: 0;
    flex-shrink: 0;
    z-index: 5;
    position: relative;
  }
  #input-prompt {
    font-family: var(--font);
    font-size: 13.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  #cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--text);
    caret-color: var(--purple);
    padding: 0 6px;
  }

  /* ─── CURSOR BLINK ───────────────────────────────────────────────────── */
  .cursor {
    display: inline-block;
    width: 8px; height: 1.1em;
    background: var(--purple);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 1px;
  }
  @keyframes blink { 50% { opacity: 0; } }

  /* ─── BOOT SCREEN ────────────────────────────────────────────────────── */
  #boot-screen {
    position: absolute; inset: 0;
    background: var(--bg);
    z-index: 20;
    padding: 22px;
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.7;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  #boot-output { flex: 1; overflow: hidden; }

  .boot-ok   { color: var(--green); }
  .boot-info { color: var(--subtext); }
  .boot-dim  { color: #3783a9; }

  /* ─── WELCOME BANNER ─────────────────────────────────────────────────── */
  .banner {
    color: var(--purple);
    font-size: 11px;
    line-height: 1.3;
    margin-bottom: 14px;
    display: block;
  }
  .banner-sub {
    color: var(--subtext);
    font-size: 12px;
    margin-bottom: 4px;
    display: block;
  }

  /* ─── MISC ───────────────────────────────────────────────────────────── */
  ::selection { background: #cba6f730; }

  .input-hidden-focus { position: absolute; opacity: 0; pointer-events: none; }

  /* ─── SHUTDOWN OVERLAY ───────────────────────────────────────────────── */
  #shutdown-overlay {
    position: absolute; inset: 0;
    background: #000;
    opacity: 0;
    z-index: 50;
    transition: opacity 2.4s ease;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    font-family: var(--font);
    border-radius: 14px;
  }
  #halted-msg {
    opacity: 0;
    transition: opacity 1.2s ease;
    text-align: center;
    font-size: 12px;
    line-height: 2;
    color: var(--overlay);
    letter-spacing: 0.5px;
  }
  #halted-msg .power-icon { font-size: 28px; display: block; margin-bottom: 8px; opacity: 0.5; }
