:root {
  --ink: #111814;
  --muted: #647067;
  --paper: #fffaf0;
  --warm: #f1e3c7;
  --line: rgba(17, 24, 20, 0.14);
  --green: #31543b;
  --green-2: #52775b;
  --gold: #d99835;
  --red: #b95c43;
  --shadow: 0 28px 80px rgba(36, 57, 42, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  background: linear-gradient(135deg, #f6edd9 0%, #eef3e8 52%, #fbf3e6 100%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hidden {
  display: none !important;
}

.app {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 44px;
}

.start-screen {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 80px);
  text-align: center;
}

.start-screen > * {
  max-width: 860px;
}

.start-guide {
  display: grid;
  width: min(1040px, 100%);
  margin-top: 8px;
  text-align: left;
}

.start-guide section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.78);
  padding: clamp(30px, 4vw, 48px);
  box-shadow: 0 16px 42px rgba(36, 57, 42, 0.08);
}

.start-guide h2 {
  margin-bottom: 22px;
  color: var(--green);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: clamp(2rem, 3.4vw, 3.1rem);
  font-weight: 900;
}

.start-guide ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink);
  font-size: clamp(1.16rem, 1.65vw, 1.38rem);
  line-height: 2.05;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.8rem, 7.5vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2vw, 2.2rem);
  letter-spacing: 0;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.9;
}

.start-button {
  width: min(420px, 92vw);
  min-height: 86px;
  margin: 28px 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff8e9;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 34px 90px rgba(36, 57, 42, 0.25);
}

.system-line,
.hint,
.answer-hint,
.saving-line,
.saved-path {
  color: var(--muted);
  line-height: 1.7;
}

.exam-header {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.progress-wrap {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.mini-progress {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(17, 24, 20, 0.12);
}

.mini-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 220ms ease;
}

.exam-grid {
  display: grid;
  grid-template-columns: minmax(0, 900px);
  gap: 18px;
  align-items: stretch;
  justify-content: center;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 24px;
}

.question-card {
  height: auto;
  min-height: min(760px, calc(100vh - 160px));
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.question-meta span,
.summary-score span,
.session-score {
  border-radius: 999px;
  background: rgba(49, 84, 59, 0.12);
  color: var(--green);
  padding: 7px 12px;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.problem-text {
  max-height: 46vh;
  overflow: auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  padding: 18px;
  line-height: 1.9;
}

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

.choice-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  padding: 14px 16px;
  text-align: left;
  line-height: 1.6;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.choice-button:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 84, 59, 0.34);
}

.choice-button.selected {
  border-color: var(--green);
  background: rgba(49, 84, 59, 0.12);
  font-weight: 900;
}

.answer-hint {
  margin: 14px 0 0;
}

.record-block {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.voice-instruction {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  padding: 18px;
}

.voice-instruction h2 {
  margin-bottom: 10px;
  font-size: clamp(1.2rem, 1.7vw, 1.7rem);
  line-height: 1.35;
  letter-spacing: 0;
}

.voice-instruction p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

.record-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 74px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff8e9;
  font-size: 1.16rem;
  font-weight: 900;
  box-shadow: 0 18px 48px rgba(49, 84, 59, 0.24);
}

.record-button.recording {
  background: var(--red);
}

.record-orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff1dd;
}

.record-button.recording .record-orb {
  animation: pulse 1s infinite;
}

.oral-chat {
  display: grid;
  gap: 12px;
  max-height: min(430px, 42vh);
  margin-bottom: 16px;
  border: 1px solid rgba(17, 24, 20, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.38);
  padding: 16px;
  overflow: auto;
}

.chat-message {
  display: grid;
  gap: 5px;
  max-width: 92%;
}

.chat-message.ai {
  justify-self: start;
}

.chat-message.student {
  justify-self: end;
}

.chat-role {
  color: var(--muted);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
}

.chat-message.student .chat-role {
  justify-self: end;
}

.chat-bubble {
  margin: 0;
  border: 1px solid rgba(17, 24, 20, 0.1);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  padding: 12px 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.chat-message.student .chat-bubble {
  border-color: rgba(49, 84, 59, 0.18);
  background: rgba(49, 84, 59, 0.12);
}

.field {
  display: block;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.followup-panel {
  display: block;
  margin: 0;
}

.followup-panel h2 {
  margin: -4px 0 0;
  color: var(--green);
  font-size: clamp(1.25rem, 1.8vw, 1.7rem);
}

.followup-question {
  margin: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  padding: 12px;
  line-height: 1.75;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  padding: 16px;
  line-height: 1.75;
  resize: vertical;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  padding: 12px 14px;
}

input:focus {
  border-color: rgba(49, 84, 59, 0.6);
  box-shadow: 0 0 0 5px rgba(49, 84, 59, 0.12);
}

textarea:focus {
  border-color: rgba(49, 84, 59, 0.6);
  box-shadow: 0 0 0 5px rgba(49, 84, 59, 0.12);
}

.primary,
.secondary,
.ghost {
  min-height: 54px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 900;
}

.primary {
  background: var(--ink);
  color: #fff8e9;
}

.secondary {
  background: var(--gold);
  color: #241707;
}

.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
}

.wide {
  width: 100%;
  margin-top: 16px;
}

.saving-line {
  min-height: 1.5em;
  margin: 12px 0 0;
}

@media (min-width: 921px) {
  .exam-screen {
    display: block;
    min-height: calc(100vh - 76px);
    height: auto;
    overflow: visible;
  }

  .exam-header {
    margin-bottom: 12px;
  }

  .exam-grid {
    align-items: start;
    min-height: auto;
  }

  .question-card {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: min(760px, calc(100vh - 160px));
    overflow: visible;
  }

  .question-meta {
    margin-bottom: 10px;
  }

  .problem-text {
    flex: 1 1 auto;
    max-height: 46vh;
    padding: 14px;
    line-height: 1.75;
  }

  .choices {
    flex: 0 0 auto;
    gap: 8px;
    margin-top: 10px;
  }

  .choice-button {
    padding: 10px 12px;
    line-height: 1.45;
  }

  .answer-hint {
    margin-top: 8px;
  }

  .record-block {
    gap: 8px;
    margin-bottom: 10px;
  }

  .voice-instruction {
    border-radius: 20px;
    padding: 14px;
  }

  .voice-instruction h2 {
    margin-bottom: 6px;
    font-size: clamp(1.05rem, 1.35vw, 1.35rem);
    line-height: 1.28;
  }

  .voice-instruction p,
  .hint {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .record-button {
    min-height: 60px;
  }

  .field {
    display: block;
  }

  textarea {
    min-height: 110px;
    padding: 14px;
    line-height: 1.6;
    resize: vertical;
  }

  .wide {
    margin-top: 10px;
  }

  .saving-line {
    min-height: 1.2em;
    margin-top: 8px;
  }
}

.report-hero {
  margin-bottom: 16px;
}

.report-hero h1 {
  margin-bottom: 8px;
  font-size: clamp(2.3rem, 4.2vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.report-hero .lead {
  max-width: 820px;
}

.report-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 4px 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 250, 240, 0.72);
  padding: 4px;
}

.report-tab {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 18px;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.94rem;
  font-weight: 900;
}

.report-tab.active {
  background: var(--ink);
  color: #fff8e9;
}

.report-panel {
  display: grid;
  gap: 16px;
}

.report-insights {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: 16px;
  align-items: start;
}

.report-main-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.32fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.summary-score {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-width: 230px;
  border: 1px solid rgba(49, 84, 59, 0.2);
  border-radius: 50%;
  background:
    conic-gradient(from 210deg, rgba(49, 84, 59, 0.9), rgba(217, 152, 53, 0.78), rgba(185, 92, 67, 0.82), rgba(49, 84, 59, 0.9));
  box-shadow: 0 24px 70px rgba(49, 84, 59, 0.18);
  text-align: center;
}

.summary-score span,
.summary-score small {
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-weight: 900;
}

.summary-score span {
  align-self: end;
  color: var(--green);
  font-size: 0.86rem;
}

.summary-score strong {
  font-size: clamp(3.8rem, 8vw, 7rem);
  line-height: 1;
  letter-spacing: 0;
}

.summary-score small {
  align-self: start;
  color: var(--muted);
}

.summary-copy {
  min-width: 0;
}

.summary-copy h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 3vw, 3rem);
}

.summary-copy > p:not(.eyebrow) {
  color: var(--ink);
  line-height: 1.85;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

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

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
}

.metric-card strong {
  color: var(--ink);
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.2;
}

.metric-card .risk-high,
.session-item.risk-high .session-risk small {
  color: #973d29;
}

.metric-card .risk-medium,
.session-item.risk-medium .session-risk small {
  color: #966018;
}

.metric-card .risk-low,
.session-item.risk-low .session-risk small {
  color: var(--green);
}

.metric-card .risk-pending,
.session-item.risk-pending .session-risk small {
  color: var(--muted);
}

.score-guide,
.section-help {
  margin: 14px 0 0;
  border-radius: 8px;
  background: rgba(49, 84, 59, 0.09);
  color: var(--green);
  padding: 12px 14px;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.7;
}

.section-help {
  max-width: 520px;
  margin: 0;
  background: rgba(217, 152, 53, 0.13);
  color: #6e4813;
}

.report-section-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.report-section-header h2 {
  margin: 0;
}

.report-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.report-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  padding: 16px;
}

.report-section h3 {
  margin: 0 0 8px;
  color: var(--green);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 1rem;
  font-weight: 900;
}

.report-section p {
  margin-bottom: 0;
  color: var(--ink);
  line-height: 1.85;
}

.report-section ul {
  margin-top: 8px;
}

.report-side-card {
  min-height: 220px;
}

.report-side-card .pattern-card:first-child {
  border-color: rgba(185, 92, 67, 0.22);
  background: rgba(185, 92, 67, 0.08);
}

.patterns,
.session-list {
  display: grid;
  gap: 10px;
}

.history-card .session-list {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.pattern-card,
.session-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  padding: 14px;
}

.pattern-card div,
.session-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.session-item {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 118px;
  border-color: transparent;
  color: inherit;
  text-align: left;
  box-shadow: 0 14px 34px rgba(36, 57, 42, 0.08);
}

.session-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(36, 57, 42, 0.12);
}

.session-summary {
  position: relative;
  min-height: 88px;
  padding-left: 4px;
  list-style: none;
  cursor: pointer;
}

.session-summary::-webkit-details-marker {
  display: none;
}

.open-badge {
  position: absolute;
  right: 0;
  bottom: -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(17, 24, 20, 0.08);
  color: var(--muted);
  padding: 4px 9px;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  pointer-events: none;
}

.session-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--muted);
}

.session-item.is-correct {
  background: linear-gradient(135deg, rgba(49, 84, 59, 0.12), rgba(255, 255, 255, 0.64));
}

.session-item.is-correct::before {
  background: var(--green);
}

.session-item.is-wrong {
  background: linear-gradient(135deg, rgba(185, 92, 67, 0.15), rgba(255, 255, 255, 0.64));
}

.session-item.is-wrong::before {
  background: var(--red);
}

.session-summary > div {
  min-width: 0;
  padding-left: 4px;
}

.session-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.question-index,
.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.question-index {
  width: 28px;
  height: 28px;
  background: rgba(17, 24, 20, 0.09);
  color: var(--ink);
}

.result-badge {
  min-height: 28px;
  padding: 0 10px;
}

.is-correct .result-badge {
  background: rgba(49, 84, 59, 0.14);
  color: var(--green);
}

.is-wrong .result-badge {
  background: rgba(185, 92, 67, 0.15);
  color: var(--red);
}

.pattern-score {
  color: var(--red);
  font-weight: 900;
}

.pattern-description {
  margin: 8px 0 6px;
  color: var(--muted);
  line-height: 1.7;
}

.pattern-cues,
.session-item small {
  color: var(--muted);
}

.session-item strong {
  display: block;
}

.session-labels {
  display: block;
  margin-top: 5px;
  color: var(--ink) !important;
  font-weight: 800;
}

.session-assessment-line {
  display: block;
  margin-top: 5px;
  color: var(--green) !important;
  font-weight: 900;
}

.session-source-link,
.source-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(49, 84, 59, 0.22);
  border-radius: 8px;
  background: rgba(49, 84, 59, 0.08);
  color: var(--green);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-weight: 900;
  text-decoration: none;
}

.session-source-link {
  margin-top: 8px;
  padding: 5px 8px;
  font-size: 0.78rem;
}

.source-link {
  padding: 8px 10px;
  font-size: 0.9rem;
}

.session-source-link:hover,
.source-link:hover {
  border-color: rgba(49, 84, 59, 0.42);
  background: rgba(49, 84, 59, 0.13);
}

.session-risk {
  display: inline-grid;
  gap: 1px;
  min-width: 84px;
  justify-items: center;
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.78);
  padding: 10px 8px;
}

.session-item.risk-high .session-risk {
  background: rgba(185, 92, 67, 0.12);
}

.session-item.risk-medium .session-risk {
  background: rgba(217, 152, 53, 0.14);
}

.session-item.risk-low .session-risk {
  background: rgba(49, 84, 59, 0.11);
}

.session-risk strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1;
}

.session-risk small {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
}

.session-detail {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.session-assessment,
.session-detail-block {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  padding: 12px;
}

.session-assessment {
  border: 1px solid rgba(49, 84, 59, 0.14);
}

.session-assessment.assessment-good {
  background: rgba(49, 84, 59, 0.1);
}

.session-assessment.assessment-caution {
  background: rgba(217, 152, 53, 0.12);
}

.session-assessment.assessment-warning {
  background: rgba(185, 92, 67, 0.12);
}

.session-assessment.assessment-pending {
  background: rgba(17, 24, 20, 0.06);
}

.session-assessment strong,
.session-detail-block strong {
  margin-bottom: 6px;
  color: var(--green);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.session-assessment p,
.session-detail-block p {
  margin: 6px 0 0;
  color: var(--ink);
  line-height: 1.75;
}

.transcript-text {
  white-space: pre-wrap;
}

.session-detail-block ul {
  margin-top: 6px;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 20, 0.42);
  padding: 24px;
}

.attempt-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 100%);
  max-height: min(840px, calc(100vh - 48px));
  border: 1px solid rgba(255, 250, 240, 0.62);
  border-radius: 24px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 34px 120px rgba(17, 24, 20, 0.34);
  overflow: hidden;
}

.student-modal-card {
  grid-template-rows: auto auto;
  width: min(520px, 100%);
}

.oral-exam-modal {
  grid-template-rows: auto minmax(0, 1fr);
  width: min(860px, 100%);
}

.oral-exam-content {
  grid-template-columns: 1fr;
}

.oral-exam-content .modal-block {
  grid-column: 1 / -1;
}

.oral-exam-chat-block {
  border: 0;
  background: transparent;
  padding: 0;
}

.oral-exam-chat-block .oral-chat {
  max-height: min(360px, 34vh);
  margin-bottom: 0;
}

.oral-exam-answer-block {
  display: grid;
  gap: 14px;
}

.problem-feedback-modal {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(760px, 100%);
}

.problem-feedback-content {
  grid-template-columns: 1fr;
}

.problem-feedback-content .modal-block {
  grid-column: 1 / -1;
}

.problem-feedback-summary p {
  margin: 0;
  color: var(--ink);
  line-height: 1.85;
}

.problem-feedback-actions ul {
  color: var(--ink);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding: 16px 22px 20px;
}

.student-form {
  display: grid;
  gap: 16px;
  padding: 20px 22px 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 20px 22px 16px;
}

.modal-header h2 {
  margin-bottom: 6px;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.modal-header p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.modal-close {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
}

.modal-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  overflow: auto;
  padding: 18px 22px 22px;
}

.modal-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  padding: 14px;
}

.modal-block:first-child,
.modal-block:nth-child(2),
.modal-block:nth-child(4) {
  grid-column: 1 / -1;
}

.modal-block h3 {
  margin: 0 0 8px;
  color: var(--green);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.95rem;
  font-weight: 900;
}

.modal-problem-text,
.modal-explanation {
  max-height: 260px;
  overflow: auto;
  line-height: 1.8;
}

.modal-problem-text {
  white-space: pre-wrap;
}

.modal-explanation {
  display: grid;
  gap: 10px;
}

.modal-explanation-point {
  margin: 0;
  color: var(--ink);
}

.modal-explanation strong {
  display: block;
  color: var(--green);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.modal-explanation ul {
  margin-top: -4px;
}

ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  line-height: 1.8;
}

.saved-path {
  margin: 16px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  word-break: break-all;
  font-size: 0.86rem;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: 420px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff8e9;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 241, 221, 0.75);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 0 10px rgba(255, 241, 221, 0);
  }
}

@media (max-width: 920px) {
  .exam-header,
  .exam-grid,
  .report-insights {
    grid-template-columns: 1fr;
  }

  .report-body {
    grid-template-columns: 1fr;
  }

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

  .report-section-header {
    display: grid;
    align-items: start;
  }

  .summary-score {
    max-width: 190px;
  }

  .question-card {
    height: auto;
    min-height: auto;
  }

  .problem-text {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .app {
    width: min(100% - 18px, 620px);
    padding-top: 18px;
  }

  .card {
    border-radius: 8px;
    padding: 18px;
  }

  .report-metrics,
  .history-card .session-list {
    grid-template-columns: 1fr;
  }

  .report-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .session-item {
    align-items: stretch;
  }
}
