:root {
  --lg-red: #a50034;
  --lg-red-dark: #7f0028;
  --lg-pink: #f6d6df;
  --rose: #ffd8df;
  --peach: #f8c8a8;
  --ink: #241a20;
  --muted: #756a70;
  --line: #e8dce1;
  --surface: #fff8fa;
  --white: #ffffff;
  --success: #178a53;
  --warning: #c74436;
  --shadow: 0 24px 60px rgba(93, 16, 43, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 14%, rgba(248, 200, 168, 0.5), transparent 28rem),
    linear-gradient(135deg, #fff7f9 0%, #f4edf0 48%, #ffffff 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.75fr);
  gap: 28px;
  align-items: center;
}

.quiz-panel,
.study-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(165, 0, 52, 0.12);
  box-shadow: var(--shadow);
}

.quiz-panel {
  min-height: 690px;
  padding: 22px;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: var(--lg-red);
  background: var(--surface);
  font-size: 1.35rem;
  font-weight: 900;
  cursor: pointer;
}

.progress-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadde2;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lg-red), #d83365);
  transition: width 220ms ease;
}

.score-pill {
  min-width: 72px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--lg-red);
  background: #fff0f4;
  text-align: center;
  font-weight: 900;
}

.brand-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.mark {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--lg-red);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12);
}

.mark span {
  font-weight: 950;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--lg-red);
  font-size: 0.9rem;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4.5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.question-card {
  flex: 1;
  padding: 28px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #fff8fa);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 800;
}

.question-card h2 {
  margin-bottom: 24px;
  font-size: clamp(1.45rem, 3vw, 2.5rem);
  line-height: 1.22;
  letter-spacing: 0;
}

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

.option-button {
  width: 100%;
  min-height: 68px;
  padding: 16px 18px;
  border: 2px solid #eadde2;
  border-radius: 16px;
  color: var(--ink);
  background: var(--white);
  text-align: left;
  font-weight: 900;
  line-height: 1.35;
  cursor: pointer;
  box-shadow: 0 5px 0 #e7d7dd;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.option-button:hover {
  transform: translateY(-1px);
  border-color: #d8a5b6;
}

.option-button.selected {
  border-color: var(--lg-red);
  background: #fff0f4;
  box-shadow: 0 5px 0 #d59bad;
}

.option-button.correct {
  border-color: var(--success);
  background: #edfff5;
  box-shadow: 0 5px 0 #b8e6cc;
}

.option-button.wrong {
  border-color: var(--warning);
  background: #fff0ee;
  box-shadow: 0 5px 0 #e9b8b1;
}

.feedback {
  min-height: 94px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: #fff7fa;
}

.feedback strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.feedback p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.feedback.is-correct {
  border-color: #a8dbbf;
  background: #f1fff7;
}

.feedback.is-wrong {
  border-color: #efb8b0;
  background: #fff4f2;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  font-weight: 950;
  cursor: pointer;
}

.primary-button {
  color: var(--white);
  background: var(--lg-red);
  box-shadow: 0 6px 0 var(--lg-red-dark);
}

.primary-button:disabled {
  color: #b5aab0;
  background: #eee5e9;
  box-shadow: 0 6px 0 #d9cdd3;
  cursor: not-allowed;
}

.secondary-button {
  color: var(--lg-red);
  background: #fff0f4;
  box-shadow: 0 6px 0 #ead0d9;
}

.study-panel {
  padding: 26px;
  border-radius: 26px;
}

.study-copy h2 {
  margin-bottom: 12px;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 1.15;
}

.study-copy p:last-child {
  color: var(--muted);
  line-height: 1.65;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0;
}

.stat-grid div {
  min-height: 92px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--rose), var(--peach));
}

.stat-grid span,
.stat-grid strong {
  display: block;
}

.stat-grid span {
  color: var(--lg-red);
  font-size: 1.45rem;
  font-weight: 950;
}

.stat-grid strong {
  margin-top: 8px;
  font-size: 0.92rem;
}

.reference {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.reference summary {
  color: var(--lg-red);
  font-weight: 950;
  cursor: pointer;
}

.reference img {
  display: block;
  width: 100%;
  margin-top: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.result-card {
  flex: 1;
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 28px;
  text-align: center;
}

.result-badge {
  width: 104px;
  height: 104px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--lg-red);
  font-size: 2.6rem;
  font-weight: 950;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.12);
}

.result-card h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.result-card p {
  margin: 0 auto;
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.6;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-stats div {
  padding: 18px;
  border-radius: 16px;
  background: #fff0f4;
}

.result-stats span,
.result-stats strong {
  display: block;
}

.result-stats span {
  color: var(--lg-red);
  font-size: 2rem;
  font-weight: 950;
}

.result-stats strong {
  margin-top: 4px;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .quiz-panel {
    min-height: calc(100vh - 28px);
    border-radius: 22px;
  }

  .study-panel {
    border-radius: 22px;
  }
}

@media (max-width: 560px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    min-height: 100dvh;
  }

  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
    padding: 8px;
    overflow: hidden;
  }

  .quiz-panel {
    height: calc(100dvh - 16px);
    min-height: 0;
    padding: 12px;
    gap: 10px;
    border-radius: 18px;
  }

  .study-panel {
    display: none;
  }

  .topbar {
    grid-template-columns: 36px 1fr 56px;
    gap: 8px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .progress-track {
    height: 12px;
  }

  .score-pill {
    min-width: 56px;
    padding: 8px 10px;
    font-size: 0.88rem;
  }

  .brand-row {
    gap: 10px;
  }

  .mark {
    width: 44px;
    height: 44px;
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12);
  }

  .eyebrow {
    margin-bottom: 3px;
    font-size: 0.78rem;
  }

  h1 {
    font-size: 1.75rem;
    line-height: 1;
  }

  .question-card {
    min-height: 0;
    padding: 12px;
    border-radius: 16px;
    overflow: hidden;
  }

  .question-meta {
    margin-bottom: 8px;
    font-size: 0.76rem;
  }

  .question-card h2 {
    margin-bottom: 10px;
    font-size: 1.12rem;
    line-height: 1.24;
  }

  .options {
    gap: 7px;
  }

  .option-button {
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 12px;
    border-width: 1.5px;
    font-size: 0.93rem;
    line-height: 1.18;
    box-shadow: 0 3px 0 #e7d7dd;
  }

  .option-button.selected {
    box-shadow: 0 3px 0 #d59bad;
  }

  .option-button.correct {
    box-shadow: 0 3px 0 #b8e6cc;
  }

  .option-button.wrong {
    box-shadow: 0 3px 0 #e9b8b1;
  }

  .feedback {
    min-height: 62px;
    padding: 10px 12px;
    border-radius: 14px;
    border-width: 1.5px;
  }

  .feedback strong {
    margin-bottom: 3px;
    font-size: 0.9rem;
  }

  .feedback p {
    font-size: 0.78rem;
    line-height: 1.32;
  }

  .actions {
    grid-template-columns: 0.9fr 1.25fr;
    gap: 8px;
  }

  .primary-button,
  .secondary-button {
    min-height: 44px;
    border-radius: 13px;
    box-shadow: 0 4px 0 var(--lg-red-dark);
  }

  .primary-button:disabled {
    box-shadow: 0 4px 0 #d9cdd3;
  }

  .secondary-button {
    box-shadow: 0 4px 0 #ead0d9;
  }

  .result-card {
    padding: 12px;
    gap: 14px;
  }

  .result-badge {
    width: 76px;
    height: 76px;
    font-size: 2rem;
    box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.12);
  }

  .result-card h2 {
    font-size: 1.85rem;
  }

  .result-card p {
    font-size: 0.92rem;
  }

  .result-stats {
    gap: 8px;
  }

  .result-stats div {
    padding: 12px;
  }

  .result-stats span {
    font-size: 1.55rem;
  }

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

@media (max-width: 380px), (max-height: 720px) {
  .quiz-panel {
    padding: 9px;
    gap: 8px;
  }

  .brand-row {
    gap: 8px;
  }

  .mark {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  .eyebrow {
    font-size: 0.7rem;
  }

  h1 {
    font-size: 1.42rem;
  }

  .question-card {
    padding: 10px;
  }

  .question-card h2 {
    margin-bottom: 8px;
    font-size: 1rem;
  }

  .options {
    gap: 5px;
  }

  .option-button {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.84rem;
  }

  .feedback {
    min-height: 52px;
    padding: 8px 10px;
  }

  .feedback p {
    font-size: 0.72rem;
  }

  .primary-button,
  .secondary-button {
    min-height: 40px;
  }
}
