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

:root {
  --bg0: #08090b;
  --bg1: #0d0f12;
  --bg2: #12151a;
  --bg3: #181c22;
  --bg4: #1e232b;
  --line: rgba(255,255,255,0.06);
  --line2: rgba(255,255,255,0.10);
  --line3: rgba(255,255,255,0.16);
  --t0: #f4f3f0;
  --t1: #a8a9ad;
  --t2: #606268;
  --t3: #3a3c42;
  --blue: #3B82F6;
  --blue-dim: rgba(59,130,246,0.10);
  --blue-dim2: rgba(59,130,246,0.18);
  --red: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
  --f-display: 'Barlow Condensed', sans-serif;
  --f-body: 'Barlow', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;
}

html { background: var(--bg0); color: var(--t0); font-family: var(--f-body); }
body { min-height: 100vh; }
button { font-family: var(--f-body); cursor: pointer; border: none; }
input { font-family: var(--f-body); }

/* AUTH */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-logo { height: 32px; margin-bottom: 28px; display: block; }
.auth-tagline { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--t2); margin-bottom: 14px; }
.auth-title { font-family: var(--f-display); font-size: 42px; font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; margin-bottom: 14px; }
.auth-sub { font-size: 14px; font-weight: 300; color: var(--t1); line-height: 1.6; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.auth-input { background: var(--bg3); border: 1px solid var(--line2); border-radius: 10px; padding: 14px 16px; font-size: 15px; color: var(--t0); outline: none; transition: border-color 0.2s; }
.auth-input:focus { border-color: var(--blue); }
.auth-input::placeholder { color: var(--t3); }
.auth-btn { background: var(--blue); color: #fff; border-radius: 10px; padding: 14px; font-family: var(--f-display); font-size: 16px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; transition: all 0.2s; }
.auth-btn:hover { opacity: 0.9; }
.auth-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.auth-msg { font-size: 13px; font-family: var(--f-mono); }
.auth-msg.success { color: var(--green); }
.auth-msg.error { color: var(--red); }

/* TOPBAR */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: 58px; border-bottom: 1px solid var(--line); background: var(--bg0); position: sticky; top: 0; z-index: 90; }
.logo-img { height: 26px; display: block; }
.credits-badge { display: flex; align-items: center; gap: 8px; background: var(--bg3); border: 1px solid var(--line2); border-radius: 100px; padding: 6px 14px 6px 10px; font-family: var(--f-mono); font-size: 12px; color: var(--t1); }
.credits-badge strong { color: var(--blue); }
.credit-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: blink 2.4s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* BUTTONS */
.btn-primary { width: 100%; padding: 15px; background: var(--blue); color: #fff; border-radius: 10px; font-family: var(--f-display); font-size: 16px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; transition: all 0.2s; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn-ghost { width: 100%; padding: 13px; background: transparent; color: var(--t1); border-radius: 10px; border: 1px solid var(--line2); font-family: var(--f-display); font-size: 15px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; transition: all 0.2s; }
.btn-ghost:hover { border-color: var(--line3); color: var(--t0); }

/* HOME */
.home-hero { padding: 48px 24px 36px; border-bottom: 1px solid var(--line); }
.home-eyebrow { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--t2); margin-bottom: 16px; }
.home-h1 { font-family: var(--f-display); font-size: clamp(32px, 8vw, 52px); font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; margin-bottom: 14px; }
.home-h1 .accent { color: var(--blue); }
.home-sub { font-size: 14px; font-weight: 300; color: var(--t1); line-height: 1.6; max-width: 380px; }
.stats-row { display: flex; border-bottom: 1px solid var(--line); }
.stat-cell { flex: 1; padding: 18px 24px; border-right: 1px solid var(--line); }
.stat-cell:last-child { border-right: none; }
.stat-num { font-family: var(--f-display); font-size: 24px; font-weight: 700; color: var(--blue); margin-bottom: 2px; }
.stat-lbl { font-family: var(--f-mono); font-size: 10px; color: var(--t2); letter-spacing: 0.1em; text-transform: uppercase; }
.section-head { padding: 24px 24px 14px; }
.section-title { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--t2); }
.scenario-list { padding: 0 24px 40px; display: flex; flex-direction: column; gap: 10px; }
.scenario-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 20px; cursor: pointer; transition: all 0.2s; }
.scenario-card:hover { border-color: var(--line3); background: var(--bg3); }
.sc-tag { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); background: var(--blue-dim); padding: 3px 8px; border-radius: 4px; display: inline-block; margin-bottom: 8px; }
.sc-title { font-family: var(--f-display); font-size: 19px; font-weight: 600; margin-bottom: 6px; }
.sc-desc { font-size: 13px; font-weight: 300; color: var(--t1); line-height: 1.5; margin-bottom: 14px; }
.sc-footer { display: flex; align-items: center; justify-content: space-between; }
.sc-cost { font-family: var(--f-mono); font-size: 11px; color: var(--t2); }
.sc-cta { font-family: var(--f-mono); font-size: 11px; color: var(--blue); letter-spacing: 0.08em; text-transform: uppercase; }

/* DIFFICULTY */
.inner { padding: 28px 24px; flex: 1; }
.back-btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--t2); background: none; border: none; cursor: pointer; margin-bottom: 24px; transition: color 0.2s; }
.back-btn:hover { color: var(--t0); }
.block-label { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--t2); margin-bottom: 12px; }
.selected-pill { display: inline-flex; align-items: center; gap: 10px; background: var(--bg3); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 16px; margin-bottom: 24px; }
.selected-pill-tag { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--blue); }
.selected-pill-title { font-size: 14px; font-weight: 500; }
.diff-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.diff-row { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 15px 18px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 14px; }
.diff-row:hover { border-color: var(--line2); }
.diff-row.selected { border-color: var(--blue); background: var(--blue-dim); }
.diff-row-body h3 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.diff-row-body p { font-size: 12px; font-weight: 300; color: var(--t1); }
.diff-radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line3); margin-left: auto; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.diff-row.selected .diff-radio { border-color: var(--blue); background: var(--blue); }
.diff-radio-dot { width: 5px; height: 5px; border-radius: 50%; background: #fff; display: none; }
.diff-row.selected .diff-radio-dot { display: block; }
.persona-panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 24px; }
.persona-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.persona-initials { width: 44px; height: 44px; border-radius: 10px; background: var(--bg4); border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center; font-family: var(--f-display); font-size: 15px; font-weight: 700; color: var(--blue); flex-shrink: 0; }
.persona-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.persona-role { font-family: var(--f-mono); font-size: 11px; color: var(--t2); }
.persona-divider { height: 1px; background: var(--line); margin-bottom: 10px; }
.persona-bio { font-size: 13px; font-weight: 300; color: var(--t1); line-height: 1.5; margin-bottom: 8px; }
.persona-traits { display: flex; gap: 6px; flex-wrap: wrap; }
.trait-tag { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; color: var(--t1); background: var(--bg4); border: 1px solid var(--line); }
.credit-notice { background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.credit-notice-line { width: 3px; height: 30px; border-radius: 2px; background: var(--blue); flex-shrink: 0; }
.credit-notice p { font-size: 13px; font-weight: 300; color: var(--t1); line-height: 1.5; }
.credit-notice strong { color: var(--t0); font-weight: 500; }

/* SESSION */
.session-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: 58px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.session-live { display: flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
.session-clock { font-family: var(--f-mono); font-size: 20px; color: var(--t0); letter-spacing: 0.1em; }
.end-btn { font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--t2); background: var(--bg3); border: 1px solid var(--line2); border-radius: 6px; padding: 7px 14px; cursor: pointer; transition: all 0.2s; }
.end-btn:hover { border-color: var(--red); color: var(--red); }
.opponent-banner { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.opp-avatar { width: 48px; height: 48px; border-radius: 10px; background: var(--bg3); border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center; font-family: var(--f-display); font-size: 16px; font-weight: 700; color: var(--blue); flex-shrink: 0; position: relative; }
.opp-ring { position: absolute; inset: -5px; border-radius: 14px; border: 2px solid var(--blue); opacity: 0; transition: opacity 0.3s; }
.opp-avatar.speaking .opp-ring { opacity: 1; animation: ringPulse 1.4s infinite; }
@keyframes ringPulse { 0%,100%{transform:scale(1);opacity:0.8} 50%{transform:scale(1.06);opacity:0.2} }
.opp-info h3 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.opp-info p { font-family: var(--f-mono); font-size: 11px; color: var(--t2); }
.opp-status { margin-left: auto; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 10px; border-radius: 4px; background: var(--blue-dim); color: var(--blue); flex-shrink: 0; }
.chat-area { flex: 1; overflow-y: auto; padding: 18px 24px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg.ai { align-self: flex-start; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg-sender { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--t3); margin-bottom: 4px; }
.msg-bubble { padding: 11px 15px; border-radius: 10px; font-size: 14px; font-weight: 300; line-height: 1.6; color: var(--t0); }
.msg.ai .msg-bubble { background: var(--bg3); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg.user .msg-bubble { background: var(--blue-dim2); border: 1px solid rgba(59,130,246,0.2); border-bottom-right-radius: 3px; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t3); display: inline-block; animation: typingBounce 1.2s infinite; margin: 2px 2px; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
.mic-panel { padding: 18px 24px 28px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 12px; flex-shrink: 0; }
.waveform { display: flex; align-items: center; gap: 3px; height: 26px; opacity: 0; transition: opacity 0.3s; }
.waveform.live { opacity: 1; }
.wbar { width: 3px; border-radius: 2px; background: var(--blue); animation: wave 0.9s ease-in-out infinite; }
.wbar:nth-child(1){animation-delay:0.0s;height:4px} .wbar:nth-child(2){animation-delay:0.15s;height:4px} .wbar:nth-child(3){animation-delay:0.3s;height:4px} .wbar:nth-child(4){animation-delay:0.45s;height:4px} .wbar:nth-child(5){animation-delay:0.3s;height:4px} .wbar:nth-child(6){animation-delay:0.15s;height:4px} .wbar:nth-child(7){animation-delay:0.0s;height:4px}
@keyframes wave { 0%,100%{height:4px} 50%{height:20px} }
.mic-button { width: 64px; height: 64px; border-radius: 50%; background: var(--bg3); border: 1.5px solid var(--line2); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.25s; position: relative; }
.mic-button:hover { border-color: var(--blue); }
.mic-button.recording { background: rgba(239,68,68,0.1); border-color: var(--red); }
.mic-button.recording::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid var(--red); animation: ringPulse 1s infinite; }
.mic-hint { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--t3); }

/* DEBRIEF */
.debrief-header { padding: 32px 24px 24px; border-bottom: 1px solid var(--line); text-align: center; }
.debrief-outcome { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 12px; }
.debrief-score { font-family: var(--f-display); font-size: 76px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin-bottom: 6px; }
.debrief-label { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--t2); }
.debrief-scenario { font-size: 13px; font-weight: 300; color: var(--t1); margin-top: 5px; }
.scores-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.score-tile { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; }
.score-tile-label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--t2); margin-bottom: 7px; }
.score-tile-val { font-family: var(--f-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 7px; }
.score-track { height: 2px; background: var(--bg4); border-radius: 1px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 1px; transition: width 1.2s cubic-bezier(.22,.68,0,1.2); }
.debrief-section { padding: 20px 24px 4px; border-top: 1px solid var(--line); }
.debrief-section-title { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--t2); margin-bottom: 14px; }
.mistake-card { background: var(--bg2); border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 10px; padding: 13px 15px; margin-bottom: 9px; }
.mistake-ts { font-family: var(--f-mono); font-size: 10px; color: var(--t3); margin-bottom: 4px; }
.mistake-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.mistake-body { font-size: 13px; font-weight: 300; color: var(--t1); line-height: 1.5; }
.phrase-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 9px; }
.phrase-row { padding: 11px 15px; display: flex; gap: 10px; align-items: flex-start; }
.phrase-row.was { border-bottom: 1px solid var(--line); }
.phrase-row.better { background: rgba(34,197,94,0.04); }
.phrase-col-label { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--t3); margin-bottom: 3px; }
.phrase-col-label.good { color: var(--green); }
.phrase-text { font-size: 13px; font-weight: 300; color: var(--t1); line-height: 1.5; font-style: italic; }
.phrase-text.better { color: var(--t0); font-style: normal; }
.debrief-actions { padding: 18px 24px 40px; display: flex; flex-direction: column; gap: 10px; }

/* LOADER */
.loader { display: none; position: fixed; inset: 0; background: rgba(8,9,11,0.88); z-index: 200; align-items: center; justify-content: center; flex-direction: column; gap: 16px; }
.loader.active { display: flex; }
.loader-ring { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--bg4); border-top-color: var(--blue); animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-family: var(--f-mono); font-size: 12px; color: var(--t2); letter-spacing: 0.08em; }