:root {
  --bg: #f3f1ec;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: rgba(17, 17, 17, 0.08);
  --accent: #111111;
  --accent-deep: #111111;
  --accent-soft: #efefef;
  --olive: #65704f;
  --shadow: 0 10px 30px rgba(17, 17, 17, 0.06);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f6f4ef 0%, #f0eee8 100%);
}

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

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.card,
.panel {
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0 0 8px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  line-height: 1;
}

h1 {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  max-width: 14ch;
}

h2 {
  font-size: 2.25rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

.topbar-actions,
.session-actions,
.difficulty-actions,
.hint-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.primary,
.secondary,
.ghost,
.difficulty {
  padding: 12px 18px;
  font-weight: 700;
}

.primary {
  background: var(--accent);
  color: #fff8f2;
}

.secondary,
.difficulty {
  background: #f8ede4;
  color: var(--ink);
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.panel {
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 24px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
}

.column,
.subgrid {
  display: grid;
  gap: 24px;
}

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

.card {
  border-radius: var(--radius);
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head.compact p {
  margin: 6px 0 0;
  color: var(--muted);
}

.stack-form,
.builder-form {
  display: grid;
  gap: 12px;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 12px 14px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--muted);
}

.builder-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: start;
}

.list,
.deck-library,
.stats-panel,
.graph,
.choices {
  display: grid;
  gap: 12px;
}

.list-item,
.deck-card,
.metric,
.choice {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  padding: 14px;
}

.list-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.deck-card header,
.deck-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.deck-card footer {
  margin-top: 16px;
}

.deck-card p {
  color: var(--muted);
}

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

.mini-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
}

.mini-card p {
  margin: 6px 0;
}

.mini-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.inline-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.inline-editor textarea {
  min-height: 88px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hidden {
  display: none !important;
}

.empty-state,
.fine-print {
  color: var(--muted);
  line-height: 1.6;
}

.session-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.session-media img,
.thumb {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 18px;
}

.session-media audio {
  width: 100%;
  margin-top: 10px;
}

.choice {
  text-align: left;
  width: 100%;
}

.choice.correct {
  background: rgba(101, 112, 79, 0.15);
  border-color: rgba(101, 112, 79, 0.4);
}

.choice.incorrect {
  background: rgba(184, 76, 42, 0.14);
  border-color: rgba(184, 76, 42, 0.38);
}

.answer-review {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.5;
}

.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.metric strong {
  font-size: 1.4rem;
  font-family: "DM Serif Display", serif;
}

.graph-bar {
  display: grid;
  gap: 6px;
}

.graph-bar span {
  color: var(--muted);
  font-size: 0.88rem;
}

.graph-track {
  height: 12px;
  background: rgba(29, 29, 27, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.graph-fill {
  height: 100%;
  background: linear-gradient(90deg, #111111, #555555);
  border-radius: inherit;
}

.compact-card {
  align-self: start;
}

@media (max-width: 1100px) {
  .topbar,
  .workspace-grid,
  .subgrid,
  .builder-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1400px);
    padding-top: 10px;
  }

  .panel,
  .card {
    padding: 16px;
    border-radius: 18px;
  }

  h1 {
    font-size: 1.8rem;
  }
}
