﻿:root {
  color-scheme: light;
  --bg: #f6efe2;
  --panel: rgba(255, 250, 242, 0.78);
  --panel-strong: rgba(255, 247, 232, 0.92);
  --border: rgba(106, 70, 34, 0.14);
  --shadow: 0 24px 60px rgba(89, 53, 22, 0.14);
  --text: #2a2018;
  --muted: #715f4a;
  --accent: #bb5a2a;
  --accent-soft: #f3c79f;
  --accent-deep: #8a3811;
  --success: #365f40;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Aptos", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 233, 193, 0.95), transparent 28%),
    radial-gradient(circle at top right, rgba(214, 130, 69, 0.24), transparent 24%),
    linear-gradient(145deg, #f9f2e6 0%, #f2e1c9 50%, #e8d4b3 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  filter: blur(22px);
  opacity: 0.3;
  pointer-events: none;
}

body::before {
  left: -7rem;
  bottom: -8rem;
  background: rgba(145, 82, 36, 0.22);
}

body::after {
  right: -6rem;
  top: 10rem;
  background: rgba(255, 210, 158, 0.55);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.5rem;
}

.sidebar,
.hero-card,
.chapter-summary-card,
.flashcard {
  backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 1.5rem;
  height: calc(100vh - 3rem);
  padding: 1.5rem;
  border-radius: 28px;
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 22%),
    linear-gradient(135deg, rgba(187, 90, 42, 0.04), transparent 40%);
  pointer-events: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

h2 {
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
}

h3 {
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.intro-copy,
.hero-copy,
.summary-copy,
.answer-copy {
  line-height: 1.6;
  color: var(--muted);
}

.intro-copy {
  margin: 0.9rem 0 1.4rem;
}

.search-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.search-input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(113, 95, 74, 0.16);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  color: var(--text);
}

.search-input:focus,
.chapter-button:focus-visible,
.flashcard:focus-visible,
.ghost-button:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid rgba(187, 90, 42, 0.28);
  outline-offset: 2px;
}

.sidebar-meta,
.summary-topline,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.sidebar-meta {
  margin: 1rem 0 1.25rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(113, 95, 74, 0.16);
  font-size: 0.82rem;
  color: var(--accent-deep);
}

.meta-pill.muted {
  color: var(--muted);
}

.chapter-list {
  display: grid;
  gap: 0.7rem;
  max-height: calc(100vh - 19rem);
  padding-right: 0.25rem;
  overflow: auto;
}

.chapter-button {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(106, 70, 34, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.chapter-button:hover {
  transform: translateY(-1px);
  border-color: rgba(187, 90, 42, 0.38);
}

.chapter-button.active {
  background: linear-gradient(135deg, rgba(187, 90, 42, 0.14), rgba(255, 255, 255, 0.78));
  border-color: rgba(187, 90, 42, 0.44);
}

.chapter-code {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.chapter-name {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.chapter-question-count {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.main-panel {
  display: grid;
  gap: 1rem;
}

.hero-card,
.chapter-summary-card {
  border-radius: 30px;
  padding: 1.4rem 1.5rem;
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  background:
    linear-gradient(135deg, rgba(255, 246, 232, 0.92), rgba(246, 229, 198, 0.84)),
    var(--panel-strong);
}

.hero-copy,
.summary-copy {
  max-width: 75ch;
  margin: 0.85rem 0 0;
}

.summary-copy p,
.answer-copy p {
  margin: 0 0 0.9rem;
}

.summary-copy p:last-child,
.answer-copy p:last-child {
  margin-bottom: 0;
}

.ghost-button,
.secondary-button {
  border-radius: 999px;
  padding: 0.85rem 1rem;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.secondary-button {
  border: 1px solid rgba(187, 90, 42, 0.34);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fffaf3;
  box-shadow: 0 12px 28px rgba(138, 56, 17, 0.22);
}

.ghost-button {
  border: 1px solid rgba(106, 70, 34, 0.12);
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
}

.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.secondary-button:disabled,
.ghost-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.flashcard {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 26px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.flashcard:hover {
  transform: translateY(-2px);
  border-color: rgba(187, 90, 42, 0.36);
}

.flashcard.is-open {
  background: linear-gradient(180deg, rgba(255, 251, 244, 0.96), rgba(248, 235, 213, 0.86));
  border-color: rgba(187, 90, 42, 0.34);
}

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

.flashcard-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.9rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.flashcard-state {
  font-size: 0.85rem;
  color: var(--muted);
}

.question-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.answer-panel {
  display: none;
  padding-top: 0.2rem;
  border-top: 1px solid rgba(106, 70, 34, 0.12);
}

.flashcard.is-open .answer-panel {
  display: grid;
  gap: 0.85rem;
}

.answer-heading {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--success);
}

.answer-copy {
  margin: 0;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  border-radius: 24px;
  border: 1px dashed rgba(106, 70, 34, 0.24);
  background: rgba(255, 255, 255, 0.36);
  text-align: center;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .chapter-list {
    max-height: 22rem;
  }

  .hero-card {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 1rem;
    gap: 1rem;
  }

  .sidebar,
  .hero-card,
  .chapter-summary-card,
  .flashcard {
    border-radius: 22px;
  }

  .sidebar,
  .hero-card,
  .chapter-summary-card {
    padding: 1.15rem;
  }

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

  .hero-actions {
    display: grid;
  }
}
