/* Coach Companion — v0 styles
   Design principle #1: glanceable over comprehensive.
   Live mode is deliberately sparser + bigger-target than Prep mode. */

:root {
  --bg: #0f1419;
  --surface: #1a2029;
  --surface-2: #222b36;
  --border: #2d3744;
  --text: #e6edf3;
  --text-dim: #9aa7b4;
  --accent: #4da3ff;
  --accent-dim: #1f4a73;
  --warn: #ffb454;
  --warn-bg: #3a2c12;
  --danger: #ff6b6b;
  --ok: #5fd38b;
  --radius: 10px;
  --maxw: 1100px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-left { flex: 0 0 auto; }
.topbar-center { flex: 1 1 auto; position: relative; max-width: 520px; }
.topbar-right { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; }

.brand {
  background: none; border: none; color: var(--text);
  font-size: 1.05rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
}
.brand-mark { color: var(--accent); font-size: 1.2rem; }

#search {
  width: 100%; padding: 9px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 0.95rem;
}
#search:focus { outline: none; border-color: var(--accent); }

.search-results {
  position: absolute; top: 110%; left: 0; right: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); max-height: 60vh; overflow-y: auto;
  z-index: 40; box-shadow: 0 12px 30px rgba(0,0,0,.4);
}
.search-results .sr-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.search-results .sr-item:hover { background: var(--accent-dim); }
.search-results .sr-kind { color: var(--text-dim); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

.xp-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--warn-bg); border: 1px solid var(--warn);
  color: var(--warn); padding: 7px 12px; border-radius: var(--radius);
  cursor: pointer; font-weight: 600; font-size: .9rem;
}
.xp-icon { font-size: 1rem; }

.ghost-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 12px; border-radius: var(--radius);
  cursor: pointer; font-size: .9rem;
}
.ghost-btn:hover { border-color: var(--accent); }

/* ---------- View container ---------- */
.view { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 80px; }

/* ---------- Entry page ---------- */
.hero { margin-bottom: 28px; }
.hero h1 { font-size: 1.8rem; margin: 0 0 6px; }
.hero p { color: var(--text-dim); margin: 0; max-width: 60ch; }

.picker-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 26px;
}
.picker-card label { display: block; font-weight: 600; margin-bottom: 8px; }
.picker-card select {
  width: 100%; padding: 12px; font-size: 1rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.picker-card select:focus { outline: none; border-color: var(--accent); }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.app-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer; text-align: left;
  color: var(--text); position: relative;
}
.app-tile:hover { border-color: var(--accent); }
.app-tile[data-status="wip"] { opacity: .6; cursor: not-allowed; }
.app-tile .app-name { font-weight: 600; font-size: 1.05rem; }
.app-tile .app-grades { color: var(--text-dim); font-size: .85rem; }
.pill {
  display: inline-block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 999px; margin-top: 8px;
}
.pill.ready { background: #143524; color: var(--ok); border: 1px solid #2f6b48; }
.pill.wip { background: #2e2a16; color: var(--warn); border: 1px solid #5c5223; }
.section-label { color: var(--text-dim); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 10px; }

/* ---------- App page ---------- */
.app-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-bottom: 18px;
}
.app-header h1 { font-size: 1.6rem; margin: 0; }
.tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 9px; border-radius: 999px; background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }
.tag.hole { background: #3a2c12; color: var(--warn); border-color: var(--warn); }
.app-band { color: var(--text-dim); font-size: .9rem; }

/* Verification banner */
.verify-banner {
  background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 18px; font-size: .88rem;
}
.unverified-flag {
  display: inline-block; font-size: .65rem; font-weight: 700; vertical-align: middle;
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn);
  padding: 1px 6px; border-radius: 4px; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em;
}

/* Mode toggle */
.mode-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; margin-left: auto; }
.mode-toggle button {
  border: none; background: none; color: var(--text-dim);
  padding: 7px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem;
}
.mode-toggle button.active { background: var(--accent); color: #06121f; }

/* Layout: main + right rail (Prep) */
.app-body { display: grid; grid-template-columns: 1fr; gap: 20px; }
.app-body.with-rail { grid-template-columns: 1fr 300px; }
@media (max-width: 820px) { .app-body.with-rail { grid-template-columns: 1fr; } }

.module {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
}
.module h2 { font-size: 1.1rem; margin: 0 0 4px; }
.module .module-intro { color: var(--text-dim); font-size: .88rem; margin: 0 0 14px; }

/* Right rail facts */
.rail .module { position: sticky; top: 70px; }
.fact { padding: 8px 0; border-bottom: 1px solid var(--border); }
.fact:last-child { border-bottom: none; }
.fact .fk { color: var(--text-dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.fact .fv { font-size: .92rem; }

/* Screenshots */
.shot {
  border: 1px dashed var(--border); border-radius: 8px; padding: 0; margin: 12px 0;
  background: var(--surface-2); overflow: hidden;
}
.shot .shot-ph {
  background: repeating-linear-gradient(45deg, #1c2530, #1c2530 12px, #202a36 12px, #202a36 24px);
  min-height: 130px; display: none; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: .82rem; text-align: center; padding: 16px;
}
.shot.noimg .shot-ph { display: flex; }
.shot .shot-imglink { display: block; line-height: 0; background: #000; }
.shot.noimg .shot-imglink { display: none; }
.shot .shot-img-real { width: 100%; height: auto; display: block; }
.shot .shot-meta { padding: 10px 12px; }
.shot .shot-id { font-size: .7rem; color: var(--accent); font-weight: 700; letter-spacing: .05em; }
.shot .shot-cap { font-weight: 600; font-size: .92rem; }
.shot .shot-must { color: var(--text-dim); font-size: .8rem; margin-top: 4px; }
.shot .strand-chip { font-size: .65rem; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-dim); margin-left: 6px; }

.tour-section { margin-bottom: 18px; }
.tour-section h3 { font-size: .98rem; margin: 0 0 2px; }
.tour-section .tour-note { color: var(--text-dim); font-size: .84rem; margin: 0 0 8px; }

/* Tables */
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.grid th, table.grid td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid th { color: var(--text-dim); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
table.grid tr:last-child td { border-bottom: none; }

.critical {
  background: #3a1414; border: 1px solid var(--danger); color: #ffd6d6;
  border-radius: 8px; padding: 12px 14px; margin: 12px 0; font-size: .9rem;
}

/* Workflows */
.workflow { margin-bottom: 14px; }
.workflow h4 { margin: 0 0 6px; font-size: .95rem; }
.workflow ol { margin: 0; padding-left: 20px; }
.workflow li { margin-bottom: 4px; font-size: .9rem; }

/* Collapsible */
details.collapsible { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; background: var(--surface-2); }
details.collapsible summary { cursor: pointer; padding: 12px 14px; font-weight: 600; }
details.collapsible .collapsible-body { padding: 0 14px 14px; }

/* ---------- Live mode ---------- */
.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .live-grid { grid-template-columns: 1fr; } }

.live-xp {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--warn-bg); border: 1px solid var(--warn);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px;
}
.live-xp .lx-big { font-size: 1.5rem; font-weight: 700; color: var(--warn); }
.live-xp .lx-strand { font-size: .92rem; color: var(--text); margin-top: 2px; }
.live-xp .lx-warn { color: var(--warn); font-weight: 600; max-width: 320px; text-align: right; }

/* Key coaching points — prominent callout in both modes */
.coach-highlight {
  background: var(--accent-dim); border: 1px solid var(--accent); border-left: 5px solid var(--accent);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px;
}
.coach-highlight .ch-title { color: var(--accent); font-weight: 700; margin-bottom: 6px; letter-spacing: .02em; }
.coach-highlight ul { margin: 0; padding-left: 20px; }
.coach-highlight li { margin-bottom: 6px; font-size: .95rem; }
.coach-highlight li:last-child { margin-bottom: 0; }

/* Video walkthrough — prominent training element */
.video-module h2 { color: var(--accent); }
video.walkthrough {
  width: 100%; border-radius: 8px; background: #000; margin-top: 6px;
  max-height: 460px; display: block;
}

.prereq-line {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; font-size: .95rem;
}

/* Leading-question picker (Layer 4 quick-switch surface) */
.lq { }
.lq .lq-strand-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.lq .lq-strand-tabs button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.lq .lq-strand-tabs button.active { background: var(--accent); color: #06121f; }
.lq-split { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; }
@media (max-width: 640px) { .lq-split { grid-template-columns: 1fr; } }
.lq-types { display: flex; flex-direction: column; gap: 8px; }
.lq-types button {
  text-align: left; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 11px 14px; border-radius: 8px; cursor: pointer; font-size: .92rem;
}
.lq-types button:hover { border-color: var(--accent); }
.lq-types button.active { border-color: var(--accent); background: var(--accent-dim); }
.lq-out { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.lq-out .lq-empty { color: var(--text-dim); }
.lq-out ul { margin: 0; padding-left: 18px; }
.lq-out li { margin-bottom: 10px; font-size: 1.05rem; }
.lq-ai-row { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.lq-ai-btn {
  background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: .88rem; font-weight: 600;
}
.lq-ai-note { color: var(--text-dim); font-size: .78rem; margin-top: 8px; }

/* Question bank */
.qs-list { display: flex; flex-direction: column; gap: 16px; }
.qs { display: grid; grid-template-columns: 220px 1fr; gap: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface-2); }
@media (max-width: 700px) { .qs { grid-template-columns: 1fr; } }
.qs-imglink { display: block; line-height: 0; }
.qs-img { width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--border); background: #000; }
.qs-tags { margin-bottom: 6px; }
.qs-prompt { font-weight: 600; font-size: .98rem; margin-bottom: 6px; }
.qs-meta { font-size: .85rem; color: var(--text-dim); margin-bottom: 4px; }
.qs-meta strong { color: var(--text); }
.qs-meta mark { background: #143524; color: var(--ok); padding: 0 4px; border-radius: 3px; }
.qs-guiding { margin-top: 8px; font-size: .88rem; }
.qs-guiding ul { margin: 4px 0 0; padding-left: 18px; }
.qs-guiding li { margin-bottom: 4px; }

/* Coach notes */
.coach-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.note-flash { font-size: .8rem; font-style: italic; margin: 0 0 10px; }
.coach-note .cn-meta { color: var(--text-dim); font-size: .78rem; margin-top: 6px; }
.note-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.note-form textarea, .note-form input, .note-form select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px; font-family: inherit; font-size: .9rem;
}
.btn-primary {
  background: var(--accent); color: #06121f; border: none; padding: 10px 16px;
  border-radius: 8px; font-weight: 600; cursor: pointer; align-self: flex-start;
}

/* WIP panel */
.wip-panel { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.wip-panel .wip-icon { font-size: 3rem; }
.wip-panel h1 { color: var(--text); }

/* ---------- Drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw);
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 60; display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.5);
}
/* `hidden` must win over the display:flex above */
.drawer[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 1.1rem; }
.drawer-body { padding: 16px 18px; overflow-y: auto; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; }

.glossary-search { width: 100%; margin-bottom: 12px; padding: 9px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.gloss-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.gloss-item .gt { font-weight: 600; }
.gloss-item .gm { color: var(--text-dim); font-size: .88rem; }

a.link { color: var(--accent); }
.muted { color: var(--text-dim); }
