/* ═══════════════════════════════════════════════════════
   ClearCoach — Brand / Light Theme
   Used by: landing, login, register, dashboard, player,
            session, comparison, library pages.
   ═══════════════════════════════════════════════════════ */

/* ── Variables (see tokens.css) ────────────────────── */

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
img { max-width: 100%; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Layout helpers ────────────────────────────────────── */
.container   { max-width: 1100px; width: 100%; margin: 0 auto; padding: 0 20px; }
.container-sm{ max-width: 480px;  width: 100%; margin: 0 auto; padding: 0 20px; }

/* ── Navbar ────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg-panel) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
}
.navbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.navbar-brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-brand-icon { font-size: 20px; vertical-align: middle; margin-right: 2px; }
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.nav-link {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active {
  background: var(--bg-3);
  color: var(--text);
  text-decoration: none;
}
.navbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* User avatar menu */
.user-menu-wrap { position: relative; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
  color: var(--text);
  transition: border-color .15s;
}
.user-menu-btn:hover { border-color: var(--brand); }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-lg {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  min-width: 160px;
  overflow: hidden;
  display: none;
  z-index: 300;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: block;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13px;
  transition: background .12s;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-2); text-decoration: none; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Main content ──────────────────────────────────────── */
.page-body { padding-top: var(--nav-h); min-height: 100vh; }

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  margin-top: 20px;
  border: 1px solid var(--accent-border);
  border-radius: var(--r);
  background: var(--brand-dim);
}
.demo-banner strong { font-size: 14px; }
.demo-banner p { color: var(--text-2); font-size: 13px; }
.demo-banner-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.demo-qa-section { padding-bottom: 32px; }
.demo-qa-section h2 { font-size: 18px; margin-bottom: 12px; }
.demo-qa-list { display: flex; flex-direction: column; gap: 8px; }
.demo-qa-item { border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); overflow: hidden; }
.demo-qa-question { width: 100%; padding: 12px 14px; border: 0; background: var(--bg); color: var(--text); font-size: 13px; font-weight: 600; text-align: left; }
.demo-qa-question:hover { background: var(--bg-2); }
.demo-qa-answer { padding: 0 14px 14px; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.demo-chat-disabled { position: static; margin-top: 14px; border: 1px solid var(--border); border-radius: var(--r); }
.guest-banner { position: sticky; top: calc(var(--nav-h) + 8px); z-index: 120; }
.guest-coach-prompt { padding-top: 24px; padding-bottom: 32px; }
.guest-coach-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.guest-coach-card strong { display: block; margin-bottom: 4px; }
.guest-coach-card p { color: var(--text-2); font-size: 13px; }

@media (max-width: 600px) {
  .demo-banner { align-items: flex-start; flex-direction: column; }
  .guest-coach-card { align-items: flex-start; flex-direction: column; }
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: var(--r-sm);
  padding: 8px 16px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { opacity: .85; text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary   { background: var(--brand);   color: #fff; }
.btn-secondary { background: var(--bg-3);    color: var(--text); border: 1px solid var(--border); }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-ghost     { background: transparent;    color: var(--text-3); border: none; }
.btn-ghost:hover { color: var(--text); background: var(--bg-3); }
.btn-sm        { padding: 5px 12px; font-size: 13px; }
.btn-lg        { padding: 12px 28px; font-size: 15px; }

/* ── Form elements ─────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: var(--text-3); }
select.form-control option { background: var(--bg); }
textarea.form-control { resize: vertical; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-body  { padding: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-subtitle { font-size: 13px; color: var(--text-3); }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-critical   { background: rgba(239,68,68,.15);  color: var(--badge-critical); }
.badge-important  { background: rgba(245,158,11,.15); color: var(--badge-important); }
.badge-minor      { background: rgba(107,114,128,.12);color: var(--badge-minor); }
.badge-negligible { background: rgba(16,185,129,.15); color: var(--badge-negligible); }
.badge-blue       { background: rgba(37,99,235,.12);  color: var(--brand); }

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 60px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-3);
  font-size: 13px;
}

/* ── Auth pages ────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg-2);
}
.auth-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  font-size: 20px;
  font-weight: 600;
  color: var(--brand);
  text-align: center;
  margin-bottom: 8px;
}
.auth-logo-icon { font-size: 20px; vertical-align: middle; margin-right: 4px; }
.auth-subtitle {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  margin-bottom: 16px;
}
.auth-lang {
  text-align: center;
  margin-bottom: 20px;
}
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-footer-text {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  margin-top: 20px;
}
.alert {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3); color: var(--danger); }
.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: var(--success); }

/* ── Landing page ──────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 72px 0 56px;
}
.hero-icon {
  font-size: 56px;
  margin-bottom: 20px;
  display: block;
  animation: shuttle-float 3s ease-in-out infinite;
}
@keyframes shuttle-float {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%       { transform: translateY(-10px) rotate(5deg); }
}
.hero-title {
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--text);
}
.hero-title span { color: var(--brand); }
.hero-subtitle {
  font-size: 18px;
  color: var(--text-3);
  max-width: 540px;
  margin: 0 auto 36px;
  line-height: 1.6;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn { min-width: 160px; }

.section { padding: 60px 0; }
.section-title {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
}
.section-subtitle {
  text-align: center;
  color: var(--text-3);
  margin-bottom: 36px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.step-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  text-align: center;
}
.step-num-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-dim);
  color: var(--brand);
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.step-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.step-card p  { font-size: 14px; color: var(--text-3); }

/* ── Dashboard ─────────────────────────────────────────── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 24px 0;
  align-items: start;
}
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-action-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 14px; font-weight: 500;
  color: var(--text);
  cursor: pointer; font-family: inherit;
  transition: border-color .15s, background .15s;
  text-decoration: none;
  width: 100%;
  text-align: left;
}
.quick-action-btn:hover { border-color: var(--brand); background: var(--brand-dim); text-decoration: none; }
.quick-action-icon { font-size: 16px; width: 20px; text-align: center; }

.player-list { display: flex; flex-direction: column; gap: 8px; }
.player-list-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color .15s;
  text-decoration: none;
  color: var(--text);
}
.player-list-item:hover { border-color: var(--brand); text-decoration: none; }
.player-list-item.active { border-color: var(--brand); background: var(--brand-dim); }
.player-list-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.player-list-name { font-weight: 600; font-size: 14px; }

.main-panel { display: flex; flex-direction: column; gap: 20px; }
.activity-feed { display: flex; flex-direction: column; gap: 12px; }
.activity-date-group {}
.activity-date-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.activity-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-decoration: none;
  color: var(--text);
}
.activity-item:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); text-decoration: none; }
.activity-thumb {
  width: 64px; height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  flex-shrink: 0;
}
.activity-info { flex: 1; min-width: 0; }
.activity-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.activity-sub   { font-size: 12px; color: var(--text-3); }
.activity-meta  { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  text-align: center;
}
.stat-value { font-size: 24px; font-weight: 600; color: var(--brand); }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Player profile ────────────────────────────────────── */
.player-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 0 16px;
}
.player-header-info { flex: 1; }
.player-header-name  { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.player-header-meta  { font-size: 14px; color: var(--text-3); display: flex; gap: 16px; flex-wrap: wrap; }
.player-header-meta span { display: flex; align-items: center; gap: 4px; }

.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  gap: 0;
}
.tab-btn {
  padding: 8px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--text-3);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-btn:hover:not(.active) { color: var(--text); }

.stroke-filter {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px; font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s;
}
.filter-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.filter-chip:hover:not(.active) { border-color: var(--brand); color: var(--brand); }

.session-timeline { display: flex; flex-direction: column; gap: 16px; }
.session-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.session-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.session-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
}
.session-card-date { font-size: 12px; color: var(--text-3); font-weight: 600; }
.session-card-title { font-size: 14px; font-weight: 600; flex: 1; }
.session-thumb-strip {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}
.session-card-body { padding: 12px 18px; }
.session-key-finding {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 12px;
  line-height: 1.5;
}
.session-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Session detail ────────────────────────────────────── */
.session-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 24px 0;
}
.video-panel-wrapper {
  display: flex; flex-direction: column; gap: 14px;
}
.video-player-wrap {
  background: #000;
  border-radius: var(--r);
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
}
video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.video-controls {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-3);
  border-radius: var(--r-sm);
  flex-wrap: wrap;
}
.speed-btns { display: flex; gap: 4px; }
.speed-btn {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px; font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-3);
  cursor: pointer;
}
.speed-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.video-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.filmstrip-wrap { overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--border); }
.filmstrip-img  { height: 80px; width: auto; display: block; }

.session-meta-panel { display: flex; flex-direction: column; gap: 14px; }
.meta-row { display: flex; gap: 6px; align-items: baseline; }
.meta-key { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; flex-shrink: 0; }
.meta-val { font-size: 13px; color: var(--text); }

.phase-sidebar { display: flex; flex-direction: column; gap: 0; }
.phase-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s, border-color .12s;
}
.phase-sidebar-item:hover    { background: var(--bg-2); }
.phase-sidebar-item.active   { border-left-color: var(--brand); background: var(--brand-dim); }
.phase-sidebar-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-3); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.phase-sidebar-item.active .phase-sidebar-num { background: var(--brand); border-color: var(--brand); color: #fff; }
.phase-sidebar-name { font-size: 13px; font-weight: 600; text-transform: capitalize; flex: 1; }

.phase-detail { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.keyframe-large {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-3);
  display: block;
}
.field-list { display: flex; flex-direction: column; gap: 10px; }
.field-key { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.field-val { font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* ── Clear diagnosis ───────────────────────────────────── */
.diagnosis-section { margin-bottom: 24px; }
.diagnosis-heading { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.diagnosis-root-card {
  padding: 20px;
  border: 2px solid var(--brand);
  border-radius: var(--r);
  background: var(--brand-dim);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.diagnosis-root-eyebrow,
.diagnosis-prescription-label {
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.diagnosis-root-title { font-size: 20px; font-weight: 700; margin: 4px 0 8px; }
.diagnosis-root-reason { color: var(--text-2); font-size: 14px; line-height: 1.55; margin-bottom: 14px; }
.diagnosis-prescription { color: var(--text); font-size: 14px; line-height: 1.55; margin-top: 3px; }
.diagnosis-errors { display: flex; flex-direction: column; gap: 10px; }
.diagnosis-error-card { padding: 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.diagnosis-error-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.diagnosis-error-name { flex: 1; font-size: 14px; font-weight: 600; }
.diagnosis-confidence { padding: 2px 7px; border-radius: var(--radius-full); font-size: 10px; font-weight: 600; text-transform: uppercase; }
.confidence-high { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.confidence-medium { color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); }
.confidence-low { color: var(--text-3); background: var(--bg-3); }
.diagnosis-observation, .diagnosis-impact { color: var(--text-2); font-size: 13px; line-height: 1.5; }
.diagnosis-impact { margin-top: 5px; }
.diagnosis-evidence-list { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; }
.diagnosis-evidence { min-width: 128px; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-3); color: var(--text-2); cursor: pointer; text-align: left; }
.diagnosis-evidence:hover { border-color: var(--brand); }
.diagnosis-evidence img { width: 100%; height: 72px; object-fit: cover; display: block; }
.diagnosis-evidence span { display: block; padding: 6px 8px; font-size: 11px; text-transform: capitalize; }
.diagnosis-secondary { color: var(--text-3); font-size: 12px; line-height: 1.5; margin-top: 10px; }
.diagnosis-self-checks { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-2); }
.diagnosis-self-checks summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.diagnosis-self-check-note { color: var(--text-3); font-size: 12px; margin: 10px 0; }
.diagnosis-self-check-item { border-top: 1px solid var(--border); padding: 10px 0; }
.diagnosis-self-check-title { font-size: 12px; font-weight: 600; }
.diagnosis-self-check-reason, .diagnosis-self-check-instruction { color: var(--text-2); font-size: 12px; line-height: 1.5; margin-top: 3px; }

/* ── Comparison view ───────────────────────────────────── */
.comparison-header { padding: 24px 0 16px; }
.comparison-title  { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.comparison-sub    { font-size: 14px; color: var(--text-3); }

.dual-video {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.dual-video-player { display: flex; flex-direction: column; gap: 8px; }
.video-label { font-size: 13px; font-weight: 500; text-align: center; color: var(--text-3); }

.sync-controls {
  display: flex; gap: 10px; justify-content: center;
  margin-bottom: 24px;
}

.comparison-phases { display: flex; flex-direction: column; gap: 16px; }
.comparison-phase-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.comparison-phase-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.comparison-phase-header:hover { background: var(--bg-2); }
.comparison-phase-name  { font-weight: 600; font-size: 14px; flex: 1; text-transform: capitalize; }
.comparison-phase-body  { padding: 16px; }
.comparison-phase-body.hidden { display: none; }

.frame-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.frame-pair-item { text-align: center; }
.frame-pair-thumb {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-3);
  display: block;
  margin-bottom: 4px;
}
.frame-pair-label { font-size: 11px; font-weight: 600; color: var(--text-3); }

.delta-list { display: flex; flex-direction: column; gap: 8px; }
.delta-row  {}
.delta-key  { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.delta-val  { font-size: 13px; line-height: 1.5; }

/* ── Chat panel ────────────────────────────────────────── */
.chat-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
  z-index: 400;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.chat-panel.open { transform: translateX(0); }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.chat-header h3  { font-size: 14px; font-weight: 600; }
.chat-close-btn  { background: none; border: none; color: var(--text-3); font-size: 18px; line-height: 1; }
.chat-messages   { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-starters   { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.starter-chip {
  padding: 8px 12px;
  background: var(--brand-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-sm);
  font-size: 13px; color: var(--brand);
  cursor: pointer; text-align: left;
  transition: background .12s;
}
.starter-chip:hover { background: var(--brand-dim); }
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: 13px;
  line-height: 1.55;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-bubble-time { font-size: 10px; opacity: .6; margin-top: 4px; }
.chat-input-area {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--bg-2);
  flex-shrink: 0;
}
.chat-textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 8px 12px;
  resize: none;
  font-size: 13px;
  outline: none;
  max-height: 100px;
  line-height: 1.5;
}
.chat-textarea:focus { border-color: var(--brand); }
.chat-send-btn {
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; }
.chat-typing { font-size: 12px; color: var(--text-3); font-style: italic; }

/* Chat overlay (dim background) */
.chat-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25);
  z-index: 399;
  display: none;
}
.chat-overlay.open { display: block; }

/* ── Library page ──────────────────────────────────────── */
.library-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.lib-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, transform .1s;
}
.lib-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.lib-thumb {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover; display: block;
  background: var(--bg-3);
}
.lib-info  { padding: 10px 12px; }
.lib-name  { font-weight: 600; font-size: 14px; }
.lib-stroke{ font-size: 12px; color: var(--brand); }
.lib-source{ font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── Page header ───────────────────────────────────────── */
.page-header {
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.page-header-inner {
  display: flex; align-items: center; gap: 16px;
}
.back-link {
  color: var(--text-3);
  font-size: 13px;
  display: flex; align-items: center; gap: 4px;
  text-decoration: none;
}
.back-link:hover { color: var(--text); text-decoration: none; }
.page-title { font-size: 20px; font-weight: 600; flex: 1; }
.breadcrumb {
  font-size: 13px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.breadcrumb a { color: var(--text-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-icon  { font-size: 48px; margin-bottom: 16px; opacity: .4; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-sub   { font-size: 14px; color: var(--text-3); margin-bottom: 24px; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .session-layout   { grid-template-columns: 1fr; }
  .dual-video       { grid-template-columns: 1fr; }
  .stats-grid       { grid-template-columns: 1fr 1fr; }
  .chat-panel       { width: 100%; }
  .frame-pair       { grid-template-columns: 1fr; }
  .navbar-nav       { gap: 2px; }
  .library-grid     { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 480px) {
  .hero-title  { font-size: 24px; }
  .stats-grid  { grid-template-columns: 1fr; }
  .auth-card   { padding: 24px 16px; }
  .hero        { padding: 48px 0 36px; }
  .section     { padding: 40px 0; }
}
