:root {
  color-scheme: light;
  --bg: #edf4f3;
  --ink: #202124;
  --muted: #666a73;
  --line: #cfd9d7;
  --paper: #ffffff;
  --paper-2: #ffffff;
  --green: #24745a;
  --blue: #315f8c;
  --red: #b8463c;
  --yellow: #f2c14e;
  --shadow: 0 18px 42px rgba(27, 59, 57, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0)),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic",
    "Segoe UI", sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.session-strip,
.workspace,
.summary {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.eyebrow,
.question-type {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: 0;
}

.streak-box {
  display: grid;
  place-items: center;
  width: 82px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.streak-box span {
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
}

.streak-box small {
  color: var(--muted);
  font-weight: 700;
}

.session-strip {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9f5ef;
}

.bridge-text {
  max-width: 680px;
  margin: 8px 0 0;
  color: #46625b;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.55;
}

.interest-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.history-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.interest-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.interest-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.interest-head p {
  margin: 3px 0 0;
  color: #46625b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.file-button {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #c8d9e8;
  border-radius: 8px;
  background: #edf3f8;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.interest-panel textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  resize: vertical;
  line-height: 1.6;
}

.interest-result {
  display: grid;
  gap: 12px;
}

.history-result {
  display: grid;
  gap: 12px;
}

.history-meta,
.empty-result {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.interest-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.interest-grid article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.interest-grid b {
  color: var(--green);
  font-size: 13px;
}

.interest-grid span {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.interest-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sample-titles {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.sample-titles summary {
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.sample-titles ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.55;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.session-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.small-button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  background: var(--paper);
  color: var(--ink);
  font-size: 22px;
  border: 1px solid var(--line);
}

.small-button {
  padding: 0 14px;
  background: #edf3f8;
  color: var(--blue);
  border: 1px solid #c8d9e8;
}

.primary-button,
.secondary-button {
  padding: 0 18px;
}

.primary-button {
  background: var(--green);
  color: white;
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #a7b5af;
}

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

.workspace {
  grid-template-columns: minmax(320px, 0.86fr) minmax(420px, 1.14fr);
  align-items: start;
  margin-top: 18px;
}

.passage-card,
.quiz-panel,
.summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.passage-card {
  position: sticky;
  top: 16px;
  padding: 22px;
}

.passage-head,
.reason-head,
.progress-row,
.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.passage-head {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.passage-text {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 2.05;
  letter-spacing: 0;
}

.passage-text mark {
  padding: 2px 4px;
  border-radius: 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: var(--ink);
}

.passage-text mark.evidence {
  background: #ffe88d;
}

.passage-text mark.focus {
  padding: 0 2px 2px;
  border-radius: 0;
  background: transparent;
  color: #1f5f96;
  font-weight: 900;
  text-decoration-line: underline;
  text-decoration-color: #1f5f96;
  text-decoration-thickness: 4px;
  text-underline-offset: 5px;
}

.passage-visual {
  margin-top: 18px;
}

.passage-visual table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.55;
}

.passage-visual th,
.passage-visual td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.passage-visual th {
  background: #e9f5ef;
  color: var(--green);
  font-weight: 850;
}

.passage-visual tr:last-child td {
  border-bottom: 0;
}

.flow-diagram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6fbfa;
}

.flow-diagram span {
  padding: 8px 10px;
  border-radius: 8px;
  background: white;
  border: 1px solid #c8d9e8;
  color: var(--blue);
  font-weight: 850;
}

.flow-diagram i {
  color: var(--muted);
  font-style: normal;
  font-weight: 850;
}

.passage-note {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #c8d9e8;
  background: #edf6fb;
  color: #234964;
  line-height: 1.65;
}

.passage-note strong {
  color: var(--blue);
  font-size: 13px;
}

.choice-explain {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(36, 116, 90, 0.22);
}

.choice-explain b {
  color: var(--green);
  font-size: 13px;
}

.choice-explain span {
  color: #18543e;
}

.choice-explain.wrong-choice {
  border-top-color: rgba(184, 70, 60, 0.24);
}

.choice-explain.wrong-choice b {
  color: var(--red);
}

.choice-explain.wrong-choice span {
  color: #8b2f27;
}

.reading-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 0 2px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
}

.reading-flow span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(49, 95, 140, 0.11);
}

.reading-flow i {
  color: var(--muted);
  font-style: normal;
}

.passage-note.good {
  border-color: #badbca;
  background: #e7f5ee;
  color: #18543e;
}

.passage-note.bad {
  border-color: #efc8c2;
  background: #fae8e5;
  color: #8b2f27;
}

.quiz-panel {
  padding: 20px;
}

.progress-row {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.progress-track {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9e5e2;
}

#progressBar {
  width: 20%;
  height: 100%;
  background: var(--yellow);
  transition: width 180ms ease;
}

.question-card,
.reason-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
}

.choices {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.choice {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.choice:hover {
  border-color: #9fb5aa;
}

.choice.selected {
  border-color: var(--green);
  background: #eef7f2;
}

.choice.correct {
  border-color: var(--green);
  background: #e7f5ee;
}

.choice.wrong {
  border-color: var(--red);
  background: #faecea;
}

.choice-key {
  display: grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #eef3f1;
  font-weight: 850;
}

.choice-text {
  line-height: 1.55;
}

.reason-card {
  margin-top: 12px;
  background: #f6fbfa;
}

.reason-card textarea {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  line-height: 1.65;
}

.feedback {
  min-height: 58px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #e8eeee;
  color: var(--muted);
  line-height: 1.65;
}

.feedback.good {
  background: #e4f3ec;
  color: #18543e;
}

.feedback.bad {
  background: #fae8e5;
  color: #8b2f27;
}

.bottom-actions {
  margin-top: 14px;
  justify-content: flex-end;
}

.summary {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-top: 18px;
  padding: 22px;
}

@media (max-width: 820px) {
  .app {
    width: min(100vw - 20px, 640px);
    padding-top: 14px;
  }

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

  .streak-box {
    width: 100%;
    aspect-ratio: auto;
    grid-auto-flow: column;
    justify-content: center;
    gap: 8px;
    min-height: 56px;
  }

  .session-strip,
  .workspace,
  .summary {
    grid-template-columns: 1fr;
  }

  .interest-head {
    display: grid;
  }

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

  .passage-card {
    position: static;
  }

  .passage-text {
    font-size: 18px;
    line-height: 1.9;
  }
}
