/* Guide — prototype UI
   Aesthetic: calm, trustworthy "tool that sits beside your work" — deep ink
   surface, warm amber highlight (the pointer color), Space Grotesk + JetBrains
   Mono. Supports light + dark. Semantic tokens only. */

:root {
  --bg: #0f1117;
  --surface: #171a22;
  --surface-2: #1e222c;
  --border: #2a2f3a;
  --text: #eef1f6;
  --text-dim: #9aa3b2;
  --primary: #2dd4bf;      /* teal — actions */
  --primary-ink: #05130f;
  --accent: #f5a524;       /* amber — the pointer/highlight */
  --accent-soft: rgba(245, 165, 36, 0.18);
  --danger: #f0603a;
  --ok: #34d399;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Space Grotesk", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dde1e8;
    --text: #14171d;
    --text-dim: #5b6472;
    --primary: #0e9f8e;
    --primary-ink: #ffffff;
    --shadow: 0 10px 30px rgba(20, 23, 29, 0.12);
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.brand-text h1 {
  font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em;
}
.brand-text p {
  margin: 0; font-size: 12px; color: var(--text-dim);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.pill {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.pill-idle { }
.pill-live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill-thinking { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--primary); }
.icon-btn:focus-visible { outline: 3px solid var(--accent-soft); }
#report-btn:hover { color: var(--danger); border-color: var(--danger); }
.icon-btn.mic.recording { color: var(--danger); border-color: var(--danger); animation: pulse 1.2s infinite; }

/* ── Workspace ──────────────────────────────────────────── */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 18px;
  padding: 18px;
  min-height: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}

.panel-screen { display: flex; }
.canvas-wrap {
  position: relative;
  flex: 1;
  background:
    repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 24px 24px;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
}
#mirror {
  max-width: 100%; max-height: 100%;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.share-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}
.share-overlay.hidden { display: none; }
.share-card {
  text-align: center; max-width: 360px; padding: 30px;
}
.share-card h2 { margin: 0 0 10px; font-size: 20px; }
.share-card p { color: var(--text-dim); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.share-card .fineprint { font-size: 12px; margin-top: 14px; }

/* ── Guide panel ────────────────────────────────────────── */
.panel-guide {
  display: flex; flex-direction: column;
  padding: 20px;
  gap: 18px;
}

.avatar-stage {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 8px 0 4px;
}
.avatar-orb {
  position: relative;
  width: 120px; height: 120px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
}
.avatar-orb.speaking .avatar-ring { animation: ring 1.4s ease-in-out infinite; opacity: 1; }
.avatar-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--primary); opacity: 0.35;
}
.avatar-face {
  font-size: 42px; font-weight: 700;
  color: var(--primary);
}
.avatar-meta { text-align: center; }
.avatar-name { display: block; font-weight: 600; font-size: 15px; }
.avatar-latency { display: block; font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

.guidance {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  overflow-y: auto;
  min-height: 120px;
}
.guidance-empty { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin: 0; }
.guidance .step-label {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent); margin: 0 0 8px;
}
.guidance .step-text { font-size: 15px; line-height: 1.6; margin: 0 0 12px; }
.guidance .step-meta { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.guidance .done-badge {
  display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok);
  font-size: 12px; font-weight: 600;
}

/* ── Ask ────────────────────────────────────────────────── */
.ask { display: flex; flex-direction: column; gap: 10px; }
.ask-row { display: flex; gap: 8px; }
#question {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}
#question:focus-visible { outline: none; border-color: var(--primary); }

.btn {
  font-family: var(--font); font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  padding: 12px 18px; cursor: pointer;
  transition: transform .1s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--accent-soft); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-block { width: 100%; }

/* ── Modal ──────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; width: min(440px, 92vw);
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 6px; font-size: 18px; }
.modal-sub { margin: 0 0 14px; color: var(--text-dim); font-size: 13px; }
#report-text {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; font-family: var(--font); font-size: 14px; resize: vertical;
}
#report-text:focus-visible { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.report-status { margin: 12px 0 0; font-size: 13px; color: var(--ok); }

/* ── Animations ─────────────────────────────────────────── */
@keyframes ring {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.06); opacity: 0.8; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 40%, transparent); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .panel-screen { min-height: 340px; }
}
