:root {
  --bg:      #161b22;
  --term:    #1c2333;
  --polar1:  #2e3440;
  --polar3:  #434c5e;
  --polar4:  #4c566a;
  --frost1:  #8fbcbb;
  --frost2:  #88c0d0;
  --frost3:  #81a1c1;
  --frost4:  #5e81ac;
  --snow1:   #d8dee9;
  --snow2:   #e5e9f0;
  --snow3:   #eceff4;
  --green:   #a3be8c;
  --orange:  #d08770;
  --yellow:  #ebcb8b;
  --red:     #bf616a;
  --purple:  #b48ead;
  --border:  rgba(136,192,208,0.22);
  --accent:  #88c0d0;
  --dim:     #4c566a;
  --muted:   #434c5e;
  --white:   #d8dee9;
  --blue:    #81a1c1;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(22,27,34,.85) 100%);
}

/* Window */
.window {
  position: relative; z-index: 10;
  width: min(740px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--term);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(136,192,208,.05),
    0 4px 40px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(236,239,244,.04);
  animation: windowIn .5s cubic-bezier(.16,1,.3,1) both;
}
@keyframes windowIn {
  from { opacity: 0; transform: scale(.97) translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* Titlebar */
.titlebar {
  display: flex; align-items: center;
  padding: 0 12px;
  height: 36px;
  background: var(--polar1);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  flex-shrink: 0; user-select: none; gap: 8px;
  position: relative;
}

.menubar { display: flex; gap: 2px; flex: 1; }
.menu-item {
  font-size: 11px; color: var(--polar4);
  padding: 3px 8px; border-radius: 4px;
  cursor: default; transition: background .15s, color .15s;
  letter-spacing: .3px;
}
.menu-item:hover { background: rgba(136,192,208,.1); color: var(--frost2); }

.titlebar-tabs {
  display: flex; gap: 1px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.tab {
  font-size: 11px; padding: 4px 14px;
  border-radius: 5px 5px 0 0;
  color: var(--polar4); cursor: pointer;
  transition: all .2s;
  border: 1px solid transparent; border-bottom: none;
  letter-spacing: .3px;
}
.tab:hover { color: var(--frost2); background: rgba(136,192,208,.06); }
.tab.active {
  background: var(--term);
  color: var(--frost2);
  border-color: var(--border);
  border-bottom-color: var(--term);
}

.wm-controls { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.wm-btn {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 9px;
  transition: all .15s;
  color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.03);
}
.wm-btn:hover { color: rgba(255,255,255,.8); filter: brightness(1.5); }
.wm-btn.close { background: rgba(191,97,106,.12); border-color: rgba(191,97,106,.35); }
.wm-btn.min   { background: rgba(235,203,139,.08); border-color: rgba(235,203,139,.3); }
.wm-btn.max   { background: rgba(163,190,140,.08); border-color: rgba(163,190,140,.3); }
.wm-btn.close:hover { background: rgba(191,97,106,.5); }
.wm-btn.min:hover   { background: rgba(235,203,139,.4); }
.wm-btn.max:hover   { background: rgba(163,190,140,.35); }

/* Body */
.term-body {
  flex: 1; overflow-y: auto; padding: 20px 24px 24px;
  scrollbar-width: thin; scrollbar-color: var(--muted) transparent;
  scroll-behavior: smooth;
}
.term-body::-webkit-scrollbar { width: 3px; }
.term-body::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* Lines */
.line {
  display: flex; align-items: flex-start;
  font-size: 13px; line-height: 1.65;
  min-height: 21px;
  opacity: 0; transform: translateX(-5px);
  transition: opacity .14s, transform .14s;
}
.line.show { opacity: 1; transform: none; }
.gap { height: 12px; }

/* Prompt */
.pu { color: var(--frost2); font-weight: 700; }
.pa { color: var(--polar4); }
.ph { color: var(--frost3); font-weight: 500; }
.pp { color: var(--frost1); }
.ps { color: var(--polar4); margin: 0 7px 0 1px; }

/* Output */
.c-white  { color: var(--snow1); }
.c-accent { color: var(--frost2); }
.c-violet { color: var(--frost2); }
.c-dim    { color: var(--polar4); }
.c-blue   { color: var(--frost3); }
.c-green  { color: var(--green); }
.c-muted  { color: var(--muted); }
.c-red    { color: var(--red); }
.c-orange { color: var(--orange); }
.c-yellow { color: var(--yellow); }
.c-purple { color: var(--purple); }

/* ASCII */
.ascii-block {
  font-size: 10.5px; line-height: 1.22;
  color: var(--frost4);
  opacity: 0; transition: opacity .3s;
  display: block; white-space: pre;
}
.ascii-block.show { opacity: 1; }

/* Tags */
.tag-wrap { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0; opacity: 0; transition: opacity .2s; }
.tag-wrap.show { opacity: 1; }
.tag {
  font-size: 11px; padding: 3px 10px; border-radius: 4px;
  border: 1px solid rgba(136,192,208,.2);
  color: var(--snow1); background: rgba(136,192,208,.07);
  transition: all .2s; cursor: default;
}
.tag:hover {
  border-color: var(--frost2); background: rgba(136,192,208,.15);
  color: var(--snow3); transform: translateY(-1px);
}

/* Links */
.link-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; opacity: 0; transition: opacity .15s;
}
.link-row.show { opacity: 1; }
.link-row a { color: var(--frost3); text-decoration: none; transition: color .2s; }
.link-row a:hover { color: var(--snow2); }

/* Cursor */
.cursor {
  display: inline-block; width: 8px; height: 14px;
  background: var(--frost2);
  animation: blink 1s step-end infinite;
  vertical-align: middle; margin-left: 2px; flex-shrink: 0;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Interactive input */
.term-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--snow1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  flex: 1;
  caret-color: var(--frost2);
  min-width: 0;
  width: 100%;
}

/* Statusbar */
.statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 14px;
  background: var(--polar1);
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  flex-shrink: 0; user-select: none;
}
.sb { font-size: 10px; color: var(--polar4); display: flex; align-items: center; gap: 8px; letter-spacing: .3px; }
.sb-sep { color: var(--muted); }
.sb-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: blink 2.5s ease-in-out infinite; }
.sb-pill {
  background: rgba(94,129,172,.18); border: 1px solid rgba(94,129,172,.35);
  border-radius: 3px; padding: 1px 7px; color: var(--frost3); font-size: 10px;
}
.sb-exit {
  font-size: 10px; padding: 1px 7px; border-radius: 3px;
  background: rgba(163,190,140,.1); border: 1px solid rgba(163,190,140,.25);
  color: var(--green);
}

/* ── Mobile ── */
@media (max-width: 600px) {
  html, body { align-items: flex-start; }
  .window {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .titlebar { border-radius: 0; }
  .statusbar { border-radius: 0; }
  .menubar { display: none; }
  .titlebar-tabs { position: static; transform: none; flex: 1; justify-content: center; }
  .ascii-block { font-size: 6.5px; }
  .term-body { padding: 14px 14px 18px; }
  .line { font-size: 12px; }
}

@media (max-width: 380px) {
  .ascii-block { display: none; }
}
