@font-face {
    font-family: "Space Mono";
    font-weight: 400;
    font-style: normal;
    src: url("../fonts/SpaceMono-Regular.woff2") format("woff2");
    font-display: swap;
  }
  @font-face {
    font-family: "Space Mono";
    font-weight: 700;
    font-style: normal;
    src: url("../fonts/SpaceMono-Bold.woff2") format("woff2");
    font-display: swap;
  }
  @font-face {
    font-family: "NFIcons";
    src: url("../fonts/nerd-icons-subset.woff2") format("woff2");
    font-display: swap;
  }

  :root {
    --panel: 20, 24, 21;
    --panel-alpha: 0.85;
    --panel-border: #7ea877;
    --text: #cfe6d2;
    --text-dim: #7f9384;
    --text-faint: #55635a;
    --accent: #a9d6a0;
    --accent-dim: #6f8f6c;
    --err: #d99a8a;
    --scrollbar: #3b453d;
    --chrome-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono-font: "Space Mono", "Courier New", monospace;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  body {
    font-family: var(--chrome-font);
    background-image: url("../img/dolmites.jpg");
    background-size: cover;
    background-position: center 60%;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: clamp(14px, 3.5vmin, 48px);
  }

  html[data-theme="windows"] body { background-image: url("../img/win11.jpg"); }
  html[data-theme="ubuntu"] body { background-image: url("../img/ubuntu.jpg"); }
  html[data-theme="kali"] body { background-image: url("../img/kali-linux.jpg"); }

  .stage {
    width: 100%;
    max-width: 1600px;
    display: flex;
    flex-direction: column;
  }

  .window {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    background: rgba(var(--panel), var(--panel-alpha));
    border: 2px solid var(--panel-border);
    border-radius: var(--win-radius, 0);
    overflow: hidden;
  }

  .titlebar {
    display: none;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    height: 34px;
    padding: 0 10px;
    font-family: var(--mono-font);
    font-size: 12.5px;
    user-select: none;
  }
  .tb-icon { display: none; margin-right: 8px; flex: 0 0 auto; font-size: 13px; }
  .tb-buttons { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
  .tb-btn { width: 12px; height: 12px; border-radius: 50%; display: inline-block; order: 2; }
  .tb-min { order: 1; }
  .tb-max { order: 2; }
  .tb-close { order: 3; }
  .tb-title {
    color: var(--tb-text, var(--text));
    flex: 1 1 auto;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menubar {
    display: none;
    flex: 0 0 auto;
    padding: 2px 10px;
    font-family: var(--chrome-font);
    font-size: 12px;
    letter-spacing: 0.3px;
    white-space: pre;
    user-select: none;
  }

  .prompt-top { display: none; white-space: pre; margin: 0 0 2px; font-family: var(--mono-font); }

  html[data-theme="windows"] {
    --panel: 1, 36, 86;
    --panel-alpha: 0.85;
    --panel-border: #2b2b2b;
    --text: #f2f2f2;
    --text-dim: #b7c6db;
    --text-faint: #7891ab;
    --accent: #62a6e0;
    --accent-dim: #3f7bab;
    --err: #ff5f5f;
    --scrollbar: #274266;
    --mono-font: "Lucida Console", "Cascadia Mono", Consolas, monospace;
    --win-radius: 0px;
    --tb-bg: #f3f3f3;
    --tb-text: #1a1a1a;
  }
  html[data-theme="windows"] .titlebar {
    display: flex;
    background: var(--tb-bg);
    padding: 0 0 0 10px;
  }
  html[data-theme="windows"] .tb-title { text-align: left; font-size: 12px; }
  html[data-theme="windows"] .tb-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url("../img/ps-icon.png") center / contain no-repeat;
    font-size: 0;
  }
  html[data-theme="windows"] .tb-buttons { gap: 0; align-self: stretch; }
  html[data-theme="windows"] .tb-btn {
    width: auto;
    height: auto;
    min-width: 34px;
    align-self: stretch;
    border-radius: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-family: var(--mono-font);
    font-size: 11px;
  }
  html[data-theme="windows"] .tb-btn:hover { background: #e2e2e2; }
  html[data-theme="windows"] .tb-close:hover { background: #c50f1f; color: #fff; }
  html[data-theme="windows"] .tb-min::before { content: "\2212"; }
  html[data-theme="windows"] .tb-max::before { content: "\25A1"; }
  html[data-theme="windows"] .tb-close::before { content: "\2715"; }

  html[data-theme="ubuntu"] {
    --panel: 30, 10, 24;
    --panel-alpha: 0.85;
    --panel-border: #b3492c;
    --text: #eeeeec;
    --text-dim: #b8a8ae;
    --text-faint: #8a7a80;
    --accent: #8ae234;
    --accent-dim: #5c9a1f;
    --err: #e04b3f;
    --scrollbar: #6b5760;
    --mono-font: "Ubuntu Sans Mono", "Ubuntu Mono", "DejaVu Sans Mono", monospace;
    --win-radius: 8px;
    --tb-text: #f2f2f2;
  }
  html[data-theme="ubuntu"] .titlebar {
    display: flex;
    background: linear-gradient(180deg, #5c5850 0%, #3a362f 100%);
    border-top-left-radius: var(--win-radius);
    border-top-right-radius: var(--win-radius);
  }
  html[data-theme="ubuntu"] .menubar { display: block; background: #2b2b2b; color: #d8d3ce; }
  html[data-theme="ubuntu"] .tb-btn { background: #a89e90; }
  html[data-theme="ubuntu"] .tb-close { background: #d9542a; }

  html[data-theme="kali"] {
    --panel: 15, 22, 34;
    --panel-alpha: 0.85;
    --panel-border: #3d4f66;
    --text: #d8dee8;
    --text-dim: #8592a6;
    --text-faint: #56637a;
    --accent: #3b8fd6;
    --accent-dim: #2a6ea6;
    --err: #e05561;
    --scrollbar: #2a3446;
    --mono-font: "Courier New", "DejaVu Sans Mono", monospace;
    --win-radius: 10px;
    --tb-bg: #0d1420;
    --tb-text: #c7cede;
  }
  html[data-theme="kali"] .titlebar {
    display: flex;
    background: var(--tb-bg);
    border-top-left-radius: var(--win-radius);
    border-top-right-radius: var(--win-radius);
  }
  html[data-theme="kali"] .tb-icon { display: inline-block; color: var(--accent); }
  html[data-theme="kali"] .tb-btn { background: #4a5568; }
  html[data-theme="kali"] .menubar { display: block; background: var(--tb-bg); color: #aab3c2; }
  html[data-theme="kali"] .prompt-top { display: block; }

  .matrix-overlay {
    position: absolute;
    inset: 0;
    display: none;
    background: rgb(6, 8, 6);
  }
  .matrix-overlay canvas { display: block; width: 100%; height: 100%; }

  .screen {
    flex: 1 1 auto;
    padding: 12px 16px;
    overflow-y: auto;
    font-family: var(--mono-font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    cursor: text;
  }

  .screen::-webkit-scrollbar { width: 10px; }
  .screen::-webkit-scrollbar-track { background: transparent; }
  .screen::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
  }

  .line { white-space: pre-wrap; word-break: break-word; margin: 0 0 2px; }
  .line.echo { color: var(--text); }
  .line.echo .prompt-prefix { color: var(--accent); }
  .line.out { color: var(--text); }
  .line.dim { color: var(--text-dim); }
  .line.err { color: var(--err); }
  .line.echo .err { color: var(--err); }
  .line.accent { color: var(--accent); }
  .line.heading { color: var(--accent); font-weight: 700; }

  a.inline-link { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-dim); }
  a.inline-link:hover { color: #c3e7bb; }

  .row { display: flex; align-items: center; }
  .prompt-live {
    flex: 0 0 auto;
    color: var(--accent);
    font-family: var(--mono-font);
    font-size: 14px;
    padding-right: 8px;
    white-space: pre;
  }

  .term-input {
    flex: 1 1 auto;
    min-width: 10px;
    background: transparent;
    border: 0;
    outline: 0;
    margin: 0;
    padding: 0;
    color: var(--text);
    font-family: var(--mono-font);
    font-size: 14px;
    caret-color: var(--accent);
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
  }

  .neofetch { display: flex; align-items: center; gap: 22px; margin: 6px 0; }
  .neofetch pre {
    margin: 0;
    color: #e4ece6;
    line-height: 1.05;
    font-size: 15px;
    letter-spacing: 1px;
  }
  .neofetch .rows { display: flex; flex-direction: column; gap: 3px; }
  .neofetch .r { display: flex; align-items: center; gap: 9px; }
  .neofetch .r .ic {
    font-family: "NFIcons", var(--mono-font);
    font-size: 13px;
    width: 1.2em;
    flex: 0 0 auto;
    text-align: center;
  }
  .neofetch .r .sep { color: var(--text-faint); }
  .neofetch .r .val { color: var(--text); }

  ::selection { background: rgba(169, 214, 160, 0.28); color: var(--text); }
