:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #66736c;
  --line: #d8ded9;
  --panel: #ffffff;
  --soft: #f5f7f2;
  --accent: #177e6b;
  --accent-dark: #0f5b4d;
  --gold: #f3b33d;
  --rose: #d95d6a;
  --shadow: 0 20px 60px rgba(23, 33, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 126, 107, 0.13), transparent 36%),
    linear-gradient(315deg, rgba(243, 179, 61, 0.18), transparent 34%),
    #eef3ee;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: center;
  padding: 32px 0;
}

.quiz-panel,
.lesson-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 222, 217, 0.9);
  box-shadow: var(--shadow);
}

.quiz-panel {
  border-radius: 8px;
  padding: 28px;
}

.brand-row,
.card-topline,
.actions,
.input-row {
  display: flex;
  align-items: center;
}

.brand-row {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.score-box {
  min-width: 88px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: var(--soft);
}

.score-box span {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
}

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

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.mode-tab {
  min-height: 44px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.mode-tab.active {
  color: #fff;
  background: var(--accent);
}

.question-card {
  min-height: 240px;
  border-radius: 8px;
  padding: 24px;
  background: #17211c;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.question-card::after {
  content: "ㄱ ㄴ ㄷ ㄹ ㅁ ㅂ ㅅ ㅇ ㅈ";
  position: absolute;
  right: -18px;
  bottom: -10px;
  width: 260px;
  color: rgba(255, 255, 255, 0.08);
  font-family: "Noto Sans KR", sans-serif;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1.05;
}

.card-topline {
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.prompt-label {
  margin: 34px 0 8px;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 700;
}

.prompt {
  margin-bottom: 14px;
  font-size: clamp(2.5rem, 8vw, 5.4rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hint {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 600;
}

.answer-form {
  margin-top: 20px;
}

.answer-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.input-row {
  gap: 10px;
}

input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  font-family: "Noto Sans KR", Inter, sans-serif;
  font-size: 1.15rem;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(23, 126, 107, 0.14);
}

.input-row button,
.secondary {
  min-height: 56px;
  border-radius: 8px;
  font-weight: 800;
}

.input-row button {
  min-width: 116px;
  color: #fff;
  background: var(--accent);
}

.input-row button:hover,
.mode-tab.active:hover {
  background: var(--accent-dark);
}

.feedback {
  min-height: 48px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 700;
}

.feedback.correct {
  color: #0f5b4d;
  background: rgba(23, 126, 107, 0.12);
}

.feedback.wrong {
  color: #a73b46;
  background: rgba(217, 93, 106, 0.13);
}

.actions {
  gap: 10px;
  margin-top: 14px;
}

.secondary {
  flex: 1;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.secondary:hover {
  background: var(--soft);
}

.lesson-panel {
  border-radius: 8px;
  padding: 24px;
}

.hangul-art {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.hangul-art span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-family: "Noto Sans KR", sans-serif;
  font-size: 3rem;
  font-weight: 900;
}

.hangul-art span:nth-child(2) {
  background: var(--rose);
}

.hangul-art span:nth-child(3) {
  background: var(--gold);
  color: var(--ink);
}

.hangul-art span:nth-child(4) {
  background: #2f4f9f;
}

.lesson-panel h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
}

.lesson-panel p {
  color: var(--muted);
  line-height: 1.6;
}

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

  .lesson-panel {
    order: -1;
  }

  .hangul-art {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 10px 0;
  }

  .quiz-panel,
  .lesson-panel {
    padding: 18px;
  }

  .brand-row,
  .input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .score-box {
    width: 100%;
  }

  .question-card {
    min-height: 220px;
    padding: 20px;
  }

  .mode-tabs {
    grid-template-columns: 1fr;
  }

  .input-row button {
    width: 100%;
  }
}

.topic-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.topic-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.topic-button:hover {
  background: var(--soft);
}

.topic-button.challenge {
  border-color: #d95d6a;
  color: #fff;
  background: #d95d6a;
}

.topic-button.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

@media (max-width: 680px) {
  .topic-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.topic-button.challenge.active {
  border-color: #d95d6a;
  background: #d95d6a;
}
