:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-soft: #edf6f4;
  --text: #17212f;
  --muted: #5d6b7d;
  --line: #dce4ee;
  --primary: #1f7a8c;
  --primary-dark: #155d70;
  --accent: #f4b63f;
  --danger: #c44949;
  --success: #287a4b;
  --shadow: 0 16px 40px rgba(23, 33, 47, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

a {
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  background: var(--panel-soft);
  color: var(--primary-dark);
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-main,
.panel,
.flashcard,
.term-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-main {
  padding: clamp(24px, 4vw, 42px);
}

.eyebrow {
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  max-width: 760px;
  margin-top: 8px;
  font-size: clamp(2.15rem, 5vw, 4.1rem);
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  line-height: 1.58;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
}

.actions,
.card-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button,
button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 15px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button.secondary,
button.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.button.warning,
button.warning {
  background: var(--accent);
  color: #342200;
}

.button.danger,
button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.stats-grid,
.option-grid,
.term-grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 24px 0;
}

.stat,
.panel {
  padding: 20px;
}

.stat {
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.stat strong {
  display: block;
  font-size: 1.9rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.92rem;
}

.setup-form {
  display: grid;
  gap: 20px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label,
.checkbox-group legend {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
}

.checkbox-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.session-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
}

.flashcard {
  min-height: 420px;
  padding: clamp(20px, 5vw, 44px);
  display: grid;
  gap: 18px;
  align-content: center;
  text-align: center;
}

.lemma {
  font-family: "SBL BibLit", "SBL Greek", "SBL Hebrew", Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 10vw, 6.4rem);
  line-height: 1;
}

.hebrew {
  direction: rtl;
}

.term-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  color: var(--muted);
}

.tag {
  border-radius: 999px;
  background: var(--panel-soft);
  padding: 5px 9px;
  font-size: 0.82rem;
  font-weight: 800;
}

.answer {
  margin: 0 auto;
  max-width: 640px;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 800;
}

.hint {
  margin: 0;
  color: var(--muted);
}

.progress-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.progress-row,
.term-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 110px 110px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

.empty-state,
.loading-panel {
  padding: 42px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: white;
  text-align: center;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff7df;
  color: #6e4a00;
}

.test-results {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

.pass {
  color: var(--success);
}

.fail {
  color: var(--danger);
}

@media (max-width: 860px) {
  .app-header,
  .hero,
  .session-layout {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: flex-start;
  }

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

  .progress-row,
  .term-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .stats-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    justify-content: flex-start;
  }
}
