:root {
  --bg-top: #efe5d2;
  --bg-bottom: #d8e0dc;
  --panel: rgba(252, 248, 241, 0.9);
  --panel-strong: rgba(247, 240, 229, 0.96);
  --sidebar: rgba(45, 40, 33, 0.9);
  --sidebar-ink: #f3ead9;
  --ink: #1f1b15;
  --muted: #6b655d;
  --line: rgba(31, 27, 21, 0.12);
  --shadow: 0 24px 80px rgba(63, 52, 39, 0.17);
  --shadow-soft: 0 14px 30px rgba(52, 45, 35, 0.08);
  --appropriate: #2f7d42;
  --appropriate-soft: rgba(47, 125, 66, 0.12);
  --generally-appropriate: #9b6a00;
  --generally-appropriate-soft: rgba(155, 106, 0, 0.12);
  --generally-inappropriate: #b74f2a;
  --generally-inappropriate-soft: rgba(183, 79, 42, 0.12);
  --orange: #cf6d26;
  --purple: #6f62a6;
  --blue: #2a82cc;
  --yellow: #b89110;
  --green: #4d8e3d;
  --grey: #6d7076;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Iowan Old Style", "Baskerville", "Noto Serif CJK SC", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 28%),
    linear-gradient(165deg, var(--bg-top), var(--bg-bottom));
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(290px, 340px) 1fr;
}

.sidebar {
  padding: 28px 24px;
  color: var(--sidebar-ink);
  background:
    linear-gradient(180deg, rgba(64, 56, 46, 0.96), rgba(38, 33, 27, 0.96)),
    var(--sidebar);
  border-right: 1px solid rgba(243, 234, 217, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-block {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.brand-block h1 {
  margin: 0;
  font-size: clamp(2rem, 2.5vw, 2.5rem);
  line-height: 1.02;
}

.sidebar-copy,
.note-block p,
.section-heading p {
  margin: 10px 0 0;
  color: rgba(243, 234, 217, 0.72);
  line-height: 1.45;
}

.workspace {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  animation: rise-in 0.45s ease both;
}

.workspace-header,
.control-bar,
.prompt-panel,
.answer-panel {
  backdrop-filter: blur(10px);
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px;
}

.workspace-header h2 {
  margin: 6px 0 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.02;
  text-wrap: balance;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  min-width: min(420px, 100%);
}

.stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.stat-label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 1.18rem;
}

.ghost-button,
.nav-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ghost-button:hover,
.nav-button:hover,
.paper-button:hover,
.question-pill:hover,
.option-button:hover {
  transform: translateY(-1px);
}

.ghost-button {
  padding: 10px 16px;
}

.control-bar {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 12px;
}

.nav-button {
  padding: 12px 16px;
}

.nav-button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.question-pills {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.question-pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 10px 14px;
  min-width: 84px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.question-pill.is-active {
  border-color: rgba(31, 27, 21, 0.35);
  box-shadow: inset 0 0 0 1px rgba(31, 27, 21, 0.08);
}

.question-pill.is-answered::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--appropriate);
}

.question-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
}

.prompt-panel,
.answer-panel {
  padding: 24px;
}

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

.theme-badge.orange,
.theme-chip.orange {
  color: var(--orange);
}

.theme-badge.purple,
.theme-chip.purple {
  color: var(--purple);
}

.theme-badge.blue,
.theme-chip.blue {
  color: var(--blue);
}

.theme-badge.yellow,
.theme-chip.yellow {
  color: var(--yellow);
}

.theme-badge.green,
.theme-chip.green {
  color: var(--green);
}

.theme-badge.grey,
.theme-chip.grey {
  color: var(--grey);
}

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

.prompt-copy {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  line-height: 1.56;
}

.answer-heading {
  margin-bottom: 18px;
}

.answer-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.options-list {
  display: grid;
  gap: 12px;
}

.option-button {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  border-radius: 20px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.option-button.is-selected {
  box-shadow: 0 0 0 2px rgba(31, 27, 21, 0.08);
}

.option-button.bucket-appropriate {
  background: var(--appropriate-soft);
  border-color: rgba(47, 125, 66, 0.28);
}

.option-button.bucket-generally-appropriate {
  background: var(--generally-appropriate-soft);
  border-color: rgba(155, 106, 0, 0.28);
}

.option-button.bucket-generally-inappropriate {
  background: var(--generally-inappropriate-soft);
  border-color: rgba(183, 79, 42, 0.28);
}

.option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.option-name {
  font-size: 1.16rem;
}

.option-rating {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  border: 1px solid rgba(31, 27, 21, 0.08);
}

.option-rating.appropriate {
  background: rgba(47, 125, 66, 0.14);
  color: var(--appropriate);
}

.option-rating.generally-appropriate {
  background: rgba(155, 106, 0, 0.14);
  color: var(--generally-appropriate);
}

.option-rating.generally-inappropriate {
  background: rgba(183, 79, 42, 0.14);
  color: var(--generally-inappropriate);
}

.feedback-box {
  margin-top: 18px;
  padding: 18px;
  min-height: 208px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
}

.feedback-box.is-refreshing,
.prompt-panel.is-refreshing {
  animation: pulse-in 0.28s ease both;
}

.feedback-placeholder,
.feedback-main,
.feedback-grid {
  display: grid;
  gap: 14px;
}

.feedback-main h3 {
  margin: 0;
  font-size: 1.35rem;
}

.feedback-main p {
  margin: 0;
  line-height: 1.55;
}

.feedback-main.appropriate h3 {
  color: var(--appropriate);
}

.feedback-main.generally-appropriate h3 {
  color: var(--generally-appropriate);
}

.feedback-main.generally-inappropriate h3 {
  color: var(--generally-inappropriate);
}

.feedback-chip-list {
  display: grid;
  gap: 10px;
}

.feedback-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.feedback-chip strong {
  font-size: 0.96rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.sidebar .eyebrow {
  color: rgba(243, 234, 217, 0.68);
}

.theme-legend {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.theme-chip {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.paper-groups {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.filter-stack {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.filter-label {
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(243, 234, 217, 0.68);
}

.filter-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(243, 234, 217, 0.82);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(243, 234, 217, 0.24);
}

.filter-chip.is-active {
  background: rgba(243, 234, 217, 0.16);
  border-color: rgba(243, 234, 217, 0.34);
  color: var(--sidebar-ink);
}

.paper-group {
  display: grid;
  gap: 8px;
}

.paper-group h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(243, 234, 217, 0.62);
}

.paper-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sidebar-ink);
  border-radius: 18px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.paper-button.is-active {
  border-color: rgba(243, 234, 217, 0.28);
  background: rgba(255, 255, 255, 0.09);
}

.paper-button strong,
.paper-button span {
  display: block;
}

.paper-button strong {
  font-size: 1rem;
}

.paper-button span {
  margin-top: 6px;
  color: rgba(243, 234, 217, 0.68);
  font-size: 0.88rem;
}

.paper-progress {
  margin-top: 8px;
  font-size: 0.82rem;
  color: rgba(243, 234, 217, 0.8);
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(243, 234, 217, 0.08);
  }

  .workspace-header {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    align-items: stretch;
  }

  .question-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .sidebar {
    padding: 18px;
  }

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

  .control-bar {
    grid-template-columns: 1fr;
  }

  .question-pills {
    justify-content: flex-start;
  }

  .option-top,
  .feedback-chip {
    align-items: flex-start;
    flex-direction: column;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-in {
  from {
    opacity: 0.3;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
