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

:root {
  --bg:         #141414;
  --border:     #2a2a2a;
  --orange:     #ff8c00;
  --orange-dim: rgba(255, 140, 0, 0.45);
  --cyan:       #00d4ff;
  --white:      #e8e8e8;
  --gray:       #555;
  --red:        #ff4444;
  --font:       'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --glow-o:     0 0 8px rgba(255, 140, 0, 0.55);
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}

/* ── App shell ───────────────────────────────────────────────────────────────── */
#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 130px;
  min-height: 100vh;
}

/* ── Welcome panel ───────────────────────────────────────────────────────────── */
#welcome-panel {
  border: 1px dashed var(--orange);
  position: relative;
  margin-bottom: 32px;
  animation: fadein 0.5s ease;
}

#panel-title {
  position: absolute;
  top: -0.65em;
  left: 16px;
  background: var(--bg);
  padding: 0 8px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 700;
  text-shadow: var(--glow-o);
}

#panel-body {
  display: flex;
  min-height: 230px;
}

#panel-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  gap: 6px;
  border-right: 1px solid var(--border);
}

#panel-right {
  width: 260px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.panel-greeting {
  color: var(--gray);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

#name-logo {
  font-size: 52px;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 8px;
  line-height: 1;
  text-shadow: 0 0 24px rgba(255, 140, 0, 0.35);
  margin: 10px 0 18px;
}

#panel-stats {
  width: 100%;
  max-width: 230px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.stat-row:last-child { border-bottom: none; }

.stat-label { color: var(--gray); }

.stat-value {
  color: var(--white);
  text-align: right;
}

#stat-visitors {
  color: var(--orange);
  text-shadow: var(--glow-o);
}

.panel-section-title {
  color: var(--orange);
  font-weight: 700;
  font-size: 12px;
  text-shadow: var(--glow-o);
  margin-top: 10px;
}

.panel-section-title:first-child { margin-top: 0; }

.panel-tip {
  color: var(--gray);
  font-size: 12px;
  line-height: 1.5;
}

.panel-tip .hl { color: var(--white); }

.panel-rule {
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

/* ── Output ──────────────────────────────────────────────────────────────────── */
#output { margin-bottom: 12px; }

.output-block {
  margin-bottom: 14px;
  animation: fadein 0.15s ease;
}

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

/* ── Text lines ──────────────────────────────────────────────────────────────── */
.line        { display: block; white-space: pre-wrap; word-break: break-word; }
.line.dim    { color: var(--gray); }
.line.orange { color: var(--orange); }
.line.cyan   { color: var(--cyan); }
.line.red    { color: var(--red); }
.line.bold   { font-weight: 700; color: var(--white); }
.line.gap    { margin-top: 8px; }

/* ── Section header ──────────────────────────────────────────────────────────── */
.section-header {
  color: var(--orange);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 8px;
  text-shadow: var(--glow-o);
}

/* ── Echoed command ──────────────────────────────────────────────────────────── */
.cmd-echo {
  color: var(--orange);
  margin-bottom: 4px;
}

.cmd-echo .echo-prompt {
  color: var(--orange-dim);
}

/* ── Typewriter cursor ───────────────────────────────────────────────────────── */
.typewriter-cursor {
  display: inline-block;
  width: 0.55ch;
  height: 1.1em;
  background: var(--cyan);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 0.7s step-end infinite;
  box-shadow: 0 0 6px var(--cyan);
}

@keyframes blink { 50% { opacity: 0; } }

/* ── Thinking dots ───────────────────────────────────────────────────────────── */
.thinking {
  color: var(--gray);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.thinking-label { margin-right: 4px; }

.thinking .dot {
  display: inline-block;
  opacity: 0;
  animation: dot-rise 1.4s ease-in-out infinite;
}

.thinking .dot:nth-child(2) { animation-delay: 0s;    }
.thinking .dot:nth-child(3) { animation-delay: 0.2s;  }
.thinking .dot:nth-child(4) { animation-delay: 0.4s;  }

@keyframes dot-rise {
  0%, 60%, 100% { opacity: 0; transform: translateY(0);    }
  30%           { opacity: 1; transform: translateY(-3px); }
}

/* ── Input bar ───────────────────────────────────────────────────────────────── */
#input-line {
  display: flex;
  align-items: center;
  position: fixed;
  bottom: 36px;
  left: 0;
  right: 0;
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  transition: border-top-color 0.2s, box-shadow 0.2s;
}

#input-line:focus-within {
  border-top-color: var(--orange);
  box-shadow: 0 -3px 16px rgba(255, 140, 0, 0.12);
}

.prompt {
  color: var(--white);
  margin-right: 10px;
  flex-shrink: 0;
  font-weight: 700;
}

#cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  caret-color: var(--orange);
}

#cmd-input::placeholder { color: var(--gray); }

/* ── Status bar ──────────────────────────────────────────────────────────────── */
#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 900px;
  margin: 0 auto;
  height: 36px;
  padding: 0 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

#status-left, #status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 3px;
}

.pill-orange {
  background: var(--orange);
  color: #000;
}

.pill-dark {
  background: #252525;
  color: var(--gray);
  font-weight: 400;
}

.status-text {
  color: var(--gray);
  font-size: 12px;
}

/* ── Batman overlay ──────────────────────────────────────────────────────────── */
.batman-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: bat-bg-in 1s ease forwards;
  pointer-events: none;
}

.batman-overlay.bat-out {
  animation: bat-bg-out 1.2s ease forwards;
}

@keyframes bat-bg-in {
  to { background: rgba(0, 0, 0, 0.96); }
}

@keyframes bat-bg-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.bat-logo {
  width: min(420px, 80vw);
  opacity: 0;
  animation:
    bat-appear  0.8s ease 0.4s forwards,
    bat-flash   1.2s ease-in-out 1.2s infinite;
  filter:
    drop-shadow(0 0 18px rgba(255, 215, 0, 0.9))
    drop-shadow(0 0 60px rgba(255, 215, 0, 0.5));
}

@keyframes bat-flash {
  0%, 100% {
    filter:
      drop-shadow(0 0 18px rgba(255, 215, 0, 0.9))
      drop-shadow(0 0 60px rgba(255, 215, 0, 0.5));
    transform: scale(1);
  }
  50% {
    filter:
      drop-shadow(0 0 40px rgba(255, 215, 0, 1))
      drop-shadow(0 0 120px rgba(255, 215, 0, 0.9))
      drop-shadow(0 0 200px rgba(255, 215, 0, 0.5));
    transform: scale(1.06);
  }
}

.bat-quote {
  margin-top: 36px;
  color: #ffd700;
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0;
  animation: bat-appear 0.8s ease 1.6s forwards;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
}

@keyframes bat-appear {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Links ───────────────────────────────────────────────────────────────────── */
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Mobile ──────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* Base */
  html, body { font-size: 13px; }

  #app {
    padding: 12px 12px 130px;
  }

  /* Welcome panel — single column */
  #panel-body    { flex-direction: column; }
  #panel-right   { display: none; }

  #panel-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 24px 16px;
    gap: 8px;
  }

  /* Shrink the logo so it fits */
  #name-logo {
    font-size: 36px;
    letter-spacing: 5px;
  }

  /* Stats full width */
  #panel-stats {
    max-width: 100%;
    width: 100%;
  }

  /* Input — 16px prevents iOS auto-zoom on focus */
  #cmd-input { font-size: 16px; }

  #input-line {
    padding: 10px 12px;
    left: 0;
    right: 0;
    max-width: 100%;
  }


  /* Status bar — hide text label, keep pills compact */
  #status-bar {
    padding: 0 8px;
    left: 0;
    right: 0;
    max-width: 100%;
  }

  .status-text  { display: none; }

  .pill {
    font-size: 11px;
    padding: 2px 8px;
  }

  /* Panel title smaller */
  #panel-title { font-size: 11px; }

  /* Output text comfortable on small screen */
  .output-block { margin-bottom: 12px; }
}
