:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-alt: #fffaf1;
  --card: rgba(255, 255, 255, 0.78);
  --card-strong: #ffffff;
  --ink: #14213d;
  --muted: #5f6b7a;
  --line: rgba(20, 33, 61, 0.1);
  --accent: #0f766e;
  --accent-2: #b45309;
  --accent-3: #7c3aed;
  --danger: #c2410c;
  --success: #166534;
  --shadow: 0 20px 45px rgba(20, 33, 61, 0.08);
  --radius: 22px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-alt: #111827;
  --card: rgba(15, 23, 42, 0.82);
  --card-strong: #111827;
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #2dd4bf;
  --accent-2: #f59e0b;
  --accent-3: #a78bfa;
  --danger: #fb7185;
  --success: #4ade80;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(180, 83, 9, 0.12), transparent 28%),
    linear-gradient(180deg, #fffdf8 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.12), transparent 25%),
    linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  background: linear-gradient(180deg, #1b2a4a 0%, #0f172a 100%);
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.15);
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary.active-filter {
  background: rgba(15, 23, 42, 0.08);
  border-color: rgba(15, 23, 42, 0.22);
}

html[data-theme="dark"] button.secondary.active-filter {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

button.ghost {
  background: transparent;
  color: var(--accent);
  padding: 0.4rem 0;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: rgba(15, 23, 42, 0.92);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.debug-shell {
  max-width: 1440px;
}

.debug-hero {
  background: linear-gradient(135deg, #0f172a 0%, #153b61 60%, #0f766e 100%);
  color: white;
}

.debug-hero .subtle {
  color: rgba(255, 255, 255, 0.78);
}

.debug-hero h1 {
  margin: 0.2rem 0 0.3rem;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.debug-hero-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

.debug-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.debug-meta {
  padding: 0.95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
}

.debug-meta strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.05rem;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.debug-list {
  display: grid;
  gap: 0.75rem;
}

.preview-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(320px, 1fr);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x mandatory;
}

.preview-card {
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--card-strong);
  box-shadow: var(--shadow);
}

.preview-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--line);
}

.preview-frame {
  width: 100%;
  height: 620px;
  border: 0;
  background: white;
}

.shell {
  display: grid;
  gap: 1rem;
}

.hero {
  background: linear-gradient(135deg, #0f172a 0%, #153b61 60%, #0f766e 100%);
  color: white;
  border-radius: 28px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -45% auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.profile-switch {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-switch button {
  background: rgba(255, 255, 255, 0.12);
}

.profile-switch button.active {
  background: white;
  color: var(--ink);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.metric {
  padding: 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

.metric strong {
  display: block;
  font-size: 1.3rem;
}

.hero-focus {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.hero-focus-card {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 0.95rem;
}

.hero-focus-card .label {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.3rem;
}

.hero-focus-card strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.3;
}

.hero-focus-card .meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.82);
}

.grid {
  display: grid;
  gap: 1rem;
}

.cards {
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.95), rgba(180, 83, 9, 0.9));
}

.card h2,
.card h3 {
  margin: 0 0 0.75rem;
}

.subtle {
  color: var(--muted);
  font-size: 0.95rem;
}

.nav {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: rgba(255, 250, 241, 0.88);
  padding: 0.75rem;
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  border-radius: 24px 24px 0 0;
  z-index: 10;
  box-shadow: 0 -10px 30px rgba(20, 33, 61, 0.08);
}

.nav button {
  padding: 0.7rem 0.5rem;
  background: transparent;
  color: var(--muted);
}

.nav button.active {
  background: var(--ink);
  color: white;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.hero-badges .pill {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.notice {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.95);
  display: grid;
  gap: 0.15rem;
}

.notice span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.week-grid,
.topic-grid,
.topic-summary {
  display: grid;
  gap: 0.85rem;
}

.week-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.day-card,
.topic-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.95rem;
  box-shadow: 0 14px 24px rgba(20, 33, 61, 0.05);
}

.day-card.today,
.topic-card:hover {
  border-color: rgba(15, 118, 110, 0.24);
  box-shadow: 0 18px 34px rgba(15, 118, 110, 0.09);
}

.day-card-top,
.topic-card-top,
.topic-group-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.day-bars,
.topic-meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.08);
  overflow: hidden;
  margin: 0.8rem 0;
}

.day-bars span,
.topic-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0f766e, #b45309);
}

.day-titles,
.topic-rows {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.topic-summary {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 1rem;
}

.topic-summary .item strong {
  font-size: 1.45rem;
}

.topic-groups {
  display: grid;
  gap: 1rem;
}

.topic-group {
  display: grid;
  gap: 0.75rem;
}

.session-panel {
  display: grid;
  gap: 0.9rem;
}

.training-shell {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.training-step .label {
  display: inline-block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.selected-option {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.08);
}

.solution-box {
  border-radius: 18px;
  border: 1px dashed rgba(20, 33, 61, 0.15);
  background: rgba(255, 250, 241, 0.9);
  padding: 0.9rem;
  min-height: 76px;
}

.solution-box.open {
  border-style: solid;
  border-color: rgba(15, 118, 110, 0.22);
}

.empty-state {
  padding: 1rem;
  border-radius: 18px;
  border: 1px dashed rgba(20, 33, 61, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.list {
  display: grid;
  gap: 0.75rem;
}

.item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.82);
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.pill-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  background: rgba(20, 33, 61, 0.08);
}

.pill.good {
  background: rgba(22, 101, 52, 0.12);
  color: var(--success);
}

.pill.warn {
  background: rgba(180, 83, 9, 0.12);
  color: var(--accent-2);
}

.pill.bad {
  background: rgba(194, 65, 12, 0.12);
  color: var(--danger);
}

.progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
}

.two-col {
  display: grid;
  gap: 1rem;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hidden {
  display: none !important;
}

.question-options {
  display: grid;
  gap: 0.5rem;
}

.option {
  display: flex;
  gap: 0.65rem;
  align-items: start;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.option input {
  width: auto;
  margin-top: 0.2rem;
}

html[data-theme="dark"] .nav {
  background: rgba(15, 23, 42, 0.9);
}

html[data-theme="dark"] .day-card,
html[data-theme="dark"] .topic-card,
html[data-theme="dark"] .option {
  background: rgba(15, 23, 42, 0.92);
}

html[data-theme="dark"] .preview-frame {
  background: #0b1220;
}

@media (min-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav {
    position: static;
    border-radius: 24px;
  }

  .debug-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .debug-hero-head,
  .hero-top {
    flex-direction: column;
  }

  .debug-meta-grid {
    grid-template-columns: 1fr;
  }

  .debug-grid {
    grid-template-columns: 1fr;
  }

  .preview-frame {
    height: 520px;
  }
}
