:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0e0e0e;
  --muted: #6b6b6b;
  --border: #e5e5e5;
  --border-hover: #b8b8b8;
  --danger: #b3453d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --fg: #fafafa;
    --muted: #9a9a9a;
    --border: #2e2e2e;
    --border-hover: #4a4a4a;
    --danger: #e08079;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}

nav.app-nav {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

nav.app-nav a {
  color: var(--muted);
  text-decoration: none;
}

nav.app-nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
}

h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.1rem; }
.subtitle { color: var(--muted); margin-top: 0; margin-bottom: 2rem; font-size: 0.95rem; }

.micro-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.concept-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  transition: border-color 0.15s ease;
}
.concept-card:hover { border-color: var(--border-hover); }

.concept-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.concept-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

.tip-list { padding-left: 1.1rem; }
.tip-list li { margin-bottom: 0.5rem; }

.source { color: var(--muted); font-size: 0.8rem; }

.difficulty-dots { display: inline-flex; gap: 0.25rem; vertical-align: middle; }
.difficulty-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  display: inline-block;
}
.difficulty-dots .dot.filled { background: var(--fg); }

.funnel-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

button {
  font: inherit;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--fg); border-color: var(--border); }
button.secondary:hover { border-color: var(--border-hover); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }

.qa-option, .scenario-choice { margin-bottom: 0.5rem; text-align: left; width: 100%; max-width: 480px; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
.field input, .field textarea, .field select {
  width: 100%;
  max-width: 360px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font: inherit;
}
.field textarea { min-height: 4.5rem; resize: vertical; }

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (max-width: 480px) {
  .video-grid { grid-template-columns: 1fr; }
}
.video-grid video {
  width: 100%;
  border-radius: 10px;
  background: #000;
  aspect-ratio: 4 / 3;
}

.drill-banner {
  border: 1px solid var(--border);
  border-left: 3px solid var(--fg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.call-actions { display: flex; gap: 0.75rem; margin-bottom: 1rem; }

.rating-modal {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.rating-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.rating-row .stars { display: flex; gap: 0.25rem; }
.rating-row button.star {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  padding: 0.1rem;
  cursor: pointer;
}
.rating-row button.star.selected { color: var(--fg); }

.empty-state { color: var(--muted); text-align: center; padding: 2rem 0; }
.status-line { color: var(--muted); font-size: 0.9rem; margin-bottom: 1rem; }

nav.tab-bar { display: none; }

@media (max-width: 640px) {
  nav.tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border);
    background: var(--bg);
    z-index: 50;
  }
  nav.tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.5rem 0;
    min-height: 52px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 500;
  }
  nav.tab-bar a[aria-current="page"] { color: var(--fg); }
}
