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

/* ── Theme variables ─────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --bg:         #0f0f0f;
  --surface:    #161616;
  --border:     #2a2a2a;
  --border-top: #1f1f1f;
  --muted:      #555;
  --dim:        #888;
  --text:       #d4d4d4;
  --bright:     #f0f0f0;
  --accent:     #7ee787;
  --accent-dim: #3d7a44;
  --prompt:     #58a6ff;
  --yellow:     #e3b341;
  --scanline:   rgba(0,0,0,0.03);
  --glow:       rgba(126,231,135,0.04);
  --dot-red:    #ff5f57;
  --dot-yellow: #febc2e;
  --dot-green:  #28c840;
  --toggle-ico: "☀️";
}

:root[data-theme="light"] {
  --bg:         #f5f5f0;
  --surface:    #ffffff;
  --border:     #d0d0c8;
  --border-top: #e8e8e0;
  --muted:      #999;
  --dim:        #666;
  --text:       #333;
  --bright:     #111;
  --accent:     #2d6a35;
  --accent-dim: #7ab884;
  --prompt:     #0969da;
  --yellow:     #b08000;
  --scanline:   rgba(0,0,0,0.01);
  --glow:       rgba(45,106,53,0.03);
  --dot-red:    #ff5f57;
  --dot-yellow: #febc2e;
  --dot-green:  #28c840;
  --toggle-ico: "🌙";
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    var(--scanline) 2px, var(--scanline) 4px
  );
  pointer-events: none;
  z-index: 100;
}

body::before {
  content: '';
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 800px; height: 500px;
  background: radial-gradient(ellipse, var(--glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Theme toggle ────────────────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--dim);
}
.theme-toggle .ico { font-size: 0.85rem; }

/* ── Terminal window ─────────────────────────────────────────────────────── */
.terminal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  animation: fadein 0.5s ease both;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.window-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.dots { display: flex; gap: 7px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red    { background: var(--dot-red); }
.dot.yellow { background: var(--dot-yellow); }
.dot.green  { background: var(--dot-green); }

.window-title {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-right: 44px;
}

.window-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 1px solid var(--border-top);
  border-radius: 0 0 10px 10px;
  padding: 28px 32px 36px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* ── Prompt lines ────────────────────────────────────────────────────────── */
.prompt-line {
  font-size: 0.78rem;
  color: var(--dim);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.prompt-line.show { opacity: 1; }

.prompt-user { color: var(--accent); }
.prompt-sep  { color: var(--muted); }
.prompt-dir  { color: var(--prompt); }
.prompt-sym  { color: var(--muted); }
.prompt-cmd  { color: var(--text); }

/* ── Loading sequence ────────────────────────────────────────────────────── */
.loading-lines {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.loading-lines.show { opacity: 1; }

.loading-line {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.loading-line .spinner {
  display: inline-block;
  animation: spin-chars 0.8s steps(4) infinite;
  color: var(--accent);
}
@keyframes spin-chars {
  0%   { content: "⠋"; }
  25%  { content: "⠙"; }
  50%  { content: "⠹"; }
  75%  { content: "⠸"; }
}
.loading-line.done .spinner { color: var(--accent); }
.loading-line.done .spinner::before { content: "✓"; animation: none; }
.loading-line:not(.done) .spinner::before { content: "⠋"; }

/* ── Output block ────────────────────────────────────────────────────────── */
.output {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.output.show { opacity: 1; }

.output-label {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
  transition: border-color 0.3s ease;
}

.reason-line {
  font-size: 0.72rem;
  color: var(--dim);
  margin-bottom: 4px;
}
.reason-line .reason-text { color: var(--yellow); }

.quote-block {
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--accent-dim);
  margin: 18px 0 22px;
  transition: border-color 0.3s ease;
}

.quote-text {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 300;
  font-size: clamp(0.92rem, 2vw, 1.1rem);
  line-height: 1.85;
  color: var(--bright);
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
}
.quote-text::before { content: '"'; color: var(--accent-dim); font-weight: 500; }
.quote-text::after  { content: '"'; color: var(--accent-dim); font-weight: 500; }

.quote-author {
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 14px;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}
.quote-author::before { content: '→ '; color: var(--accent-dim); }

/* ── Meta row ────────────────────────────────────────────────────────────── */
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.meta-item {
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.meta-item .key { color: var(--dim); }
.meta-item .val { color: var(--yellow); }

/* ── Action buttons ──────────────────────────────────────────────────────── */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}
.btn:hover {
  color: var(--text);
  border-color: var(--dim);
}
.btn.copied {
  color: var(--accent);
  border-color: var(--accent-dim);
}

/* ── Footer prompt ───────────────────────────────────────────────────────── */
.footer-prompt {
  margin-top: 28px;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.footer-prompt.show { opacity: 1; }
.footer-prompt .comment { color: var(--accent-dim); }

.cursor {
  display: inline-block;
  width: 8px; height: 1em;
  background: var(--accent);
  vertical-align: text-bottom;
  margin-left: 3px;
  animation: blink 1.1s step-end infinite;
  transition: background 0.3s ease;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Usage bar ───────────────────────────────────────────────────────────── */
.usage-bar {
  width: 100%;
  max-width: 680px;
  margin-top: 10px;
  font-size: 0.67rem;
  color: var(--muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.usage-bar.show { opacity: 1; }
.usage-bar .key { color: var(--dim); }
.usage-bar .val { color: var(--yellow); }

/* ── Greeting line ───────────────────────────────────────────────────────── */
.greeting-line {
  font-size: 0.75rem;
  color: var(--dim);
  margin-bottom: 16px;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.greeting-line.show { opacity: 1; }
.greeting-line .name { color: var(--accent); }
