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

  :root {
    --bg: #09090b;
    --surface: #111113;
    --border: #3f3f46;
    --border-subtle: #27272a;
    --text: #e4e4e7;
    --text-muted: #bdbdc3;
    --text-dim: #8b8b92;
    --green: #86efac;
    --yellow: #fde68a;
    --red: #fca5a5;
    --blue: #93c5fd;
    --purple: #c4b5fd;
    --orange: #fdba74;
    --prompt-color: #a1a1aa;
    --agent-color: #6ee7b7;
    --job-color: #fb923c;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: 0.35;
  }

  .terminal-wrapper {
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
  }

  .title-card {
    text-align: center;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeSlideDown 0.6s ease 0.2s forwards;
  }

  .title-card .name {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
  }

  .title-card h1 {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.18em;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-top: 5px;
  }

  .terminal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.03),
      0 32px 80px rgba(0,0,0,0.65),
      0 8px 24px rgba(0,0,0,0.4);
    opacity: 0;
    animation: fadeSlideDown 0.6s ease 0.4s forwards;
  }

  .terminal-header {
    background: #18181b;
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
  }

  .dots { display: flex; gap: 6px; }
  .dot  { width: 12px; height: 12px; border-radius: 50%; }
  .dot-red    { background: #ff5f57; }
  .dot-yellow { background: #febc2e; }
  .dot-green  { background: #28c840; }

  .terminal-title {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
  }

  .terminal-body {
    padding: 20px 20px 12px;
    min-height: 440px;
    max-height: 580px;
    overflow-y: auto;
    scroll-behavior: smooth;
  }

  .terminal-body::-webkit-scrollbar { width: 4px; }
  .terminal-body::-webkit-scrollbar-track { background: transparent; }
  .terminal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  .banner {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 20px;
    line-height: 1.8;
    white-space: pre-wrap;
  }

  .output-block {
    margin-bottom: 18px;
    animation: fadeIn 0.18s ease;
  }

  .prompt-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
  }

  .prompt-symbol {
    color: var(--prompt-color);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.3s;
  }
  .prompt-symbol.agent-mode { color: var(--agent-color); }
  .prompt-symbol.job-mode   { color: var(--job-color); }

  .command-text {
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    word-break: break-word;
  }

  /* THE KEY FIX: white-space pre-wrap renders \n as real line breaks */
  .output-text {
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.85;
    padding-left: 2px;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .output-text .key   { color: var(--yellow); font-weight: 600; }
  .output-text .good  { color: var(--green); }
  .output-text .bad   { color: var(--red); }
  .output-text .warn  { color: var(--orange); }
  .output-text .info  { color: var(--blue); }
  .output-text .muted { color: var(--text-muted); }
  .output-text .dim   { color: var(--text-dim); }
  .output-text .tag   { color: var(--purple); }
  .output-text .job   { color: var(--job-color); font-weight: 600; }

  /* Score bar */
  .score-section { padding: 0 2px; margin-top: -6px; }
  .score-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
  }
  .score-bar-bg {
    flex: 1;
    height: 7px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
  }
  .score-bar-fill {
    height: 100%;
    border-radius: 4px;
    width: 0%;
    transition: width 1.2s cubic-bezier(.22,.68,0,1.2);
  }
  .score-label {
    font-size: 14px;
    font-weight: 700;
    min-width: 42px;
    text-align: right;
  }

  /* JD paste area */
  .jd-input-area {
    background: #18181b;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 14px;
    margin-top: 10px;
    white-space: normal;
  }
  .jd-input-area textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.7;
    resize: vertical;
    min-height: 110px;
    max-height: 220px;
    caret-color: white;
    white-space: pre-wrap;
  }
  .jd-input-area textarea::placeholder { color: var(--text-dim); }
  .jd-btn {
    margin-top: 10px;
    background: #27272a;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    letter-spacing: 0.06em;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .jd-btn:hover { background: #3f3f46; border-color: var(--job-color); color: var(--job-color); }
  .jd-btn.cancel:hover { border-color: var(--red); color: var(--red); }

  /* Input row */
  .input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 18px;
    border-top: 1px solid var(--border-subtle);
  }

  #prompt-display {
    color: var(--prompt-color);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.3s;
    flex-shrink: 0;
  }
  #prompt-display.agent-mode { color: var(--agent-color); }
  #prompt-display.job-mode   { color: var(--job-color); }

  #cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    caret-color: #fff;
  }
  #cmd-input::placeholder { color: var(--text-dim); font-weight: 400; }
  #cmd-input:disabled { opacity: 0.35; }

  .typing-indicator { display: inline-flex; gap: 4px; align-items: center; }
  .typing-indicator span {
    width: 5px; height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.1s ease infinite;
  }
  .typing-indicator span:nth-child(2) { animation-delay: 0.18s; }
  .typing-indicator span:nth-child(3) { animation-delay: 0.36s; }

  .hint-bar {
    text-align: center;
    margin-top: 18px;
    font-size: 10.5px;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    opacity: 0;
    animation: fadeIn 0.6s ease 1.4s forwards;
  }
  .hint-bar kbd {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
  }

  .mode-flash {
    position: fixed; inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
  }
  .mode-flash.active { opacity: 1; }

  @keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
  }
  @keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-5px); }
  }