/* niiku.xyz — terminal site */

:root {
  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --font-size: 15px;
}

/* Theme variables — set by JS on <body class="theme-xxx"> */
body.theme-gruvbox {
  --bg: #282828; --bg-elev: #32302f; --border: #3c3836;
  --fg: #ebdbb2; --fg-dim: #a89984; --fg-muted: #7c6f64;
  --red: #fb4934; --green: #b8bb26; --yellow: #fabd2f;
  --blue: #83a598; --purple: #d3869b; --cyan: #8ec07c; --orange: #fe8019;
}
body.theme-dracula {
  --bg: #282a36; --bg-elev: #343746; --border: #44475a;
  --fg: #f8f8f2; --fg-dim: #b8b9c4; --fg-muted: #6272a4;
  --red: #ff5555; --green: #50fa7b; --yellow: #f1fa8c;
  --blue: #8be9fd; --purple: #bd93f9; --cyan: #8be9fd; --orange: #ffb86c;
}
body.theme-nord {
  --bg: #2e3440; --bg-elev: #3b4252; --border: #434c5e;
  --fg: #eceff4; --fg-dim: #d8dee9; --fg-muted: #7b88a1;
  --red: #bf616a; --green: #a3be8c; --yellow: #ebcb8b;
  --blue: #81a1c1; --purple: #b48ead; --cyan: #88c0d0; --orange: #d08770;
}
body.theme-solarized {
  --bg: #002b36; --bg-elev: #073642; --border: #0e4a58;
  --fg: #eee8d5; --fg-dim: #93a1a1; --fg-muted: #586e75;
  --red: #dc322f; --green: #859900; --yellow: #b58900;
  --blue: #268bd2; --purple: #d33682; --cyan: #2aa198; --orange: #cb4b16;
}
body.theme-niiku {
  --bg: #0d0f12; --bg-elev: #14171c; --border: #23272e;
  --fg: #d6d8dc; --fg-dim: #8a8f98; --fg-muted: #5a6068;
  --red: #e06c75; --green: #98c379; --yellow: #e5c07b;
  --blue: #61afef; --purple: #c678dd; --cyan: #56b6c2; --orange: #d19a66;
}

html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(97,175,239,0.07), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(152,195,121,0.06), transparent 50%),
    #06080b;
  color: var(--fg, #d6d8dc);
  font-family: var(--mono);
  font-size: var(--font-size);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: color 0.3s;
}
body { overflow: hidden; }

/* subtle desktop noise */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

a { color: var(--blue); text-decoration: none; border-bottom: 1px dotted var(--blue); }
a:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

::selection { background: var(--green); color: var(--bg); }

/* scrollbar */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* desktop stage */
.desktop {
  height: 100vh; width: 100vw;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  box-sizing: border-box;
  position: relative; z-index: 1;
}

/* window frame */
.window {
  width: min(1120px, 100%);
  height: min(760px, 100%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 30px 80px rgba(0,0,0,0.55),
    0 10px 24px rgba(0,0,0,0.4);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}

.titlebar {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 14px;
  background: linear-gradient(to bottom, #1d2026, #14171c);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
}
.traffic { display: flex; gap: 7px; }
.traffic span {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.25);
}
.traffic .close  { background: #ff5f57; }
.traffic .min    { background: #febc2e; }
.traffic .max    { background: #28c840; }
.titlebar .title {
  flex: 1; text-align: center;
  color: var(--fg-muted); font-size: 12px;
  letter-spacing: 0.02em;
}
.titlebar .title b { color: var(--fg-dim); font-weight: 500; }

/* terminal container */
.term {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 22px 28px 16px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}
.term-scroll {
  flex: 1; overflow-y: auto;
  padding-bottom: 20px;
}
.term input {
  background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--mono); font-size: inherit;
  caret-color: var(--green);
  flex: 1; min-width: 100px; padding: 0;
}
.prompt-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0; }

/* blinking cursor for the input */
.term input { caret-shape: block; }

/* header strip */
.term-header {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--fg-muted); font-size: 12px; padding-bottom: 14px;
  margin-bottom: 14px; border-bottom: 1px dashed var(--border);
  flex-shrink: 0;
}

/* tweaks panel */
.tweaks {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 12px; z-index: 10;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.tweaks h4 { margin: 0 0 10px; color: var(--yellow); font-weight: 500; font-size: 12px; }
.tweaks label { display: block; color: var(--fg-dim); margin-bottom: 4px; font-size: 11px; }
.tweaks .row { margin-bottom: 10px; }
.tweaks select, .tweaks input[type=range] {
  width: 100%; background: var(--bg); color: var(--fg);
  border: 1px solid var(--border); padding: 4px 6px;
  font-family: var(--mono); font-size: 12px;
}
.tweaks button.close {
  position: absolute; top: 6px; right: 8px; background: transparent;
  border: none; color: var(--fg-muted); cursor: pointer; font-size: 14px;
  font-family: var(--mono);
}
.tweaks-toggle {
  position: fixed; bottom: 20px; right: 20px; z-index: 9;
  background: var(--bg-elev); color: var(--fg-dim);
  border: 1px solid var(--border);
  padding: 6px 10px; font-family: var(--mono); font-size: 11px;
  cursor: pointer;
}
.tweaks-toggle:hover { color: var(--green); border-color: var(--green); }

/* matrix rain canvas */
.matrix {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
}

/* responsive */
@media (max-width: 720px) {
  .desktop { padding: 0; }
  .window {
    height: 100dvh; width: 100vw;
    height: 100vh;
    border-radius: 0; border: none; box-shadow: none;
  }
  .term { padding: 12px 14px 0; }
  :root { --font-size: 13.5px; }
  .titlebar { height: 30px; padding: 0 10px; }
  .titlebar .title { font-size: 11px; }
  .term-scroll { padding-bottom: 14px; }

  .tweaks {
    left: 12px; right: 12px; bottom: 64px;
    width: auto;
  }
  .tweaks-toggle { display: none; } /* moved into touchbar */
}

/* touch key toolbar */
.touchbar {
  display: none;
  flex-shrink: 0;
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.touchbar button {
  flex-shrink: 0;
  min-width: 44px; height: 38px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--fg-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono); font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.touchbar button:active { background: var(--border); color: var(--green); }
@media (max-width: 720px) {
  .touchbar { display: flex; }
}

/* suggestion chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  background: transparent; border: 1px solid var(--border);
  color: var(--cyan); padding: 2px 8px;
  font-family: var(--mono); font-size: 11px; cursor: pointer;
}
.chip:hover { border-color: var(--cyan); background: var(--bg-elev); }
