/* 싱글링고 화면 모양. 색·크기·글자는 Figma "싱글링고 디자인" › 00 디자인 규칙 의 변수와 같은 값 (안드로이드 앱 ui/theme 과 같음).
   밝은 테마 하나만 쓴다. */

@font-face { font-family: 'Pretendard'; font-weight: 400; font-display: swap; src: url('fonts/pretendard-regular.woff2') format('woff2'); }
@font-face { font-family: 'Pretendard'; font-weight: 500; font-display: swap; src: url('fonts/pretendard-medium.woff2') format('woff2'); }
@font-face { font-family: 'Pretendard'; font-weight: 700; font-display: swap; src: url('fonts/pretendard-bold.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --primary-main: #7C8CF8;
  --primary-shade: #5B69D6;
  --primary-soft: #E9ECFF;
  --correct-main: #3CC99A;
  --correct-shade: #27A67C;
  --correct-soft: #DFF7EE;
  --wrong-main: #FF7B7B;
  --wrong-shade: #E05A5A;
  --wrong-soft: #FFE7E7;
  --almost-main: #FFB938;
  --almost-soft: #FFF3D6;
  --streak-main: #FF9658;
  --xp-main: #F7B500;
  --surface-page: #F6F7FC;
  --surface-card: #FFFFFF;
  --surface-border: #E3E6F2;
  --surface-disabled: #E9EBF3;
  --text-main: #2C2E43;
  --text-muted: #7D82A0;
  --text-on-color: #FFFFFF;
  --radius-12: 12px;
  --radius-16: 16px;
  --radius-24: 24px;
  --button-edge: 4px;
  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--surface-page);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--primary-main); outline-offset: 2px; }
a { color: inherit; text-decoration: none; }

/* 글자 스타일 (Figma 글자 스타일과 같은 이름·크기) */
.text-title-large { font-size: 26px; line-height: 34px; font-weight: 700; }
.text-title { font-size: 20px; line-height: 28px; font-weight: 700; }
.text-strong { font-size: 17px; line-height: 26px; font-weight: 500; }
.text-body { font-size: 16px; line-height: 24px; font-weight: 400; }
.text-small { font-size: 13px; line-height: 18px; font-weight: 400; }
.pre-line { white-space: pre-line; }

.muted { color: var(--text-muted); }
.primary { color: var(--primary-main); }
.primary-shade { color: var(--primary-shade); }
.correct { color: var(--correct-main); }
.wrong { color: var(--wrong-main); }
.almost { color: var(--almost-main); }
.streak { color: var(--streak-main); }

/* 배치 도우미 */
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }
.row-6, .row-8, .row-10 { display: flex; align-items: center; }
.row-6 { gap: 6px; }
.row-8 { gap: 8px; }
.row-10 { gap: 10px; }
.stack-4, .stack-10, .stack-12, .stack-16, .stack-20 { display: flex; flex-direction: column; }
.stack-4 { gap: 4px; }
.stack-10 { gap: 10px; }
.stack-12 { gap: 12px; }
.stack-16 { gap: 16px; }
.stack-20 { gap: 20px; }
.centered-column { align-items: center; text-align: center; }
.icon-holder { display: inline-flex; flex: none; line-height: 0; }

/* 화면 틀: 휴대폰 폭 하나만 쓰고, 넓은 화면에서는 가운데에 */
.app { max-width: 480px; margin: 0 auto; height: 100%; }
.screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  background: var(--surface-page);
}
.scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.list-body { padding: 24px; }
.list-head { display: flex; align-items: center; padding: 12px 24px; }
.close-button { align-self: flex-start; font-size: 20px; line-height: 28px; font-weight: 700; color: var(--text-muted); padding: 6px 12px; border-radius: var(--radius-12); }
.icon-button { display: inline-flex; padding: 2px; border-radius: var(--radius-12); }

.centered-screen { padding-left: 24px; padding-right: 24px; }
.centered-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 24px 0;
}
.screen-footer { padding: 8px 0 calc(24px + env(safe-area-inset-bottom)); }

/* 둥근 큰 버튼: 아래쪽 4px 진한 테두리, 누르면 그만큼 내려간다 */
.chunky {
  display: block;
  width: 100%;
  height: 56px;
  border-radius: var(--radius-16);
  background: var(--edge);
}
.chunky-face {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(56px - var(--button-edge));
  border-radius: var(--radius-16);
  background: var(--fill);
  color: var(--label);
  font-size: 16px;
  line-height: 20px;
  font-weight: 700;
  transition: transform 60ms ease-out;
}
.chunky:not(:disabled):active .chunky-face { transform: translateY(var(--button-edge)); }
.chunky-primary { --fill: var(--primary-main); --edge: var(--primary-shade); --label: var(--text-on-color); }
.chunky-correct { --fill: var(--correct-main); --edge: var(--correct-shade); --label: var(--text-on-color); }
.chunky-wrong { --fill: var(--wrong-main); --edge: var(--wrong-shade); --label: var(--text-on-color); }
.chunky-secondary { --fill: var(--surface-card); --edge: var(--surface-border); --label: var(--primary-main); }
.chunky-secondary .chunky-face { box-shadow: inset 0 0 0 2px var(--surface-border); }
.chunky:disabled { --fill: var(--surface-disabled); --edge: var(--surface-disabled); --label: var(--text-muted); }
.chunky:disabled .chunky-face { box-shadow: none; }

/* 보기 카드 (고르기·빈칸·짝 맞추기·목표) */
.choice {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border-radius: var(--radius-16);
  background: var(--fill);
  border: 2px solid var(--edge);
  border-bottom-width: 6px;
  color: var(--label);
  font-size: 17px;
  line-height: 26px;
  font-weight: 500;
  text-align: center;
  word-break: keep-all;
}
.choice-default { --fill: var(--surface-card); --edge: var(--surface-border); --label: var(--text-main); }
.choice-selected { --fill: var(--primary-soft); --edge: var(--primary-main); --label: var(--primary-shade); }
.choice-correct { --fill: var(--correct-soft); --edge: var(--correct-main); --label: var(--correct-shade); }
.choice-wrong { --fill: var(--wrong-soft); --edge: var(--wrong-main); --label: var(--wrong-shade); }
.choice-matched { --fill: var(--correct-soft); --edge: var(--correct-main); --label: var(--correct-shade); opacity: 0.45; }

/* 아래 탭 */
.tab-bar {
  display: flex;
  justify-content: space-evenly;
  background: var(--surface-card);
  border-top: 2px solid var(--surface-border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 16px; color: var(--text-muted); }
.tab-label { font-size: 13px; line-height: 18px; }
.tab-selected { color: var(--primary-main); }

/* 확인 창 */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(44, 46, 67, 0.45);
}
.dialog {
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 28px;
  background: var(--surface-card);
  overflow-y: auto;
}
.dialog-body { white-space: pre-line; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.text-button { padding: 10px 12px; border-radius: 20px; font-size: 16px; line-height: 20px; font-weight: 700; }
.text-button-primary { color: var(--primary-main); }
.text-button-muted { color: var(--text-muted); }
.text-button-danger { color: var(--wrong-main); }
.license { max-height: 420px; overflow-y: auto; }

/* 둥근 가로 막대 */
.bar { position: relative; width: 100%; border-radius: 999px; background: var(--surface-disabled); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 300ms ease-out, background-color 300ms; }

.mascot { display: block; flex: none; }

/* ── 홈 ── */
.home-head { display: flex; flex-direction: column; gap: 16px; padding: 24px 24px 16px; }
.top-bar { display: flex; align-items: center; gap: 12px; }
.course-chip { background: var(--surface-card); border-radius: 999px; padding: 6px 12px; }
.stat { display: inline-flex; align-items: center; gap: 4px; }
.stat-streak { color: var(--streak-main); }
.stat-muted { color: var(--text-muted); }
.stat-xp { color: var(--xp-main); }
.section-bar {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  border-radius: var(--radius-16);
  background: var(--surface-card);
  border: 2px solid var(--surface-border);
}
.section-bar-text { display: flex; flex-direction: column; flex: 1 1 auto; }
.text-button-label { font-size: 16px; line-height: 20px; font-weight: 700; }

.path-scroll { position: relative; overflow-x: hidden; }
.path { display: flex; flex-direction: column; gap: 20px; padding: 4px 24px 24px; }
.unit-header {
  display: flex;
  align-items: center;
  padding: 16px 12px 16px 20px;
  border-radius: var(--radius-24);
  background: var(--primary-main);
  color: var(--text-on-color);
}
.unit-header-text { flex: 1 1 auto; display: flex; flex-direction: column; align-items: flex-start; }
.unit-skip {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-12);
  background: var(--surface-card);
  color: var(--primary-main);
  font-size: 16px;
  line-height: 20px;
  font-weight: 700;
}
.tip-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  border: 2px solid var(--text-on-color);
  border-radius: var(--radius-12);
  color: var(--text-on-color);
}
.node-row { display: flex; align-items: center; justify-content: center; }
.bubble-space { width: 96px; flex: none; }
.bubble-right { padding-left: 10px; }
.level-node {
  width: 76px;
  height: 72px;
  border-radius: 50%;
  background: var(--edge);
  flex: none;
}
.level-face {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 66px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--tint);
  transition: transform 60ms ease-out;
}
.level-node:not(:disabled):active .level-face { transform: translateY(6px); }
.level-locked { --fill: var(--surface-disabled); --edge: var(--surface-border); --tint: var(--text-muted); }
.level-active { --fill: var(--primary-main); --edge: var(--primary-shade); --tint: var(--text-on-color); }
.level-passed { --fill: var(--xp-main); --edge: var(--streak-main); --tint: var(--text-on-color); }
.start-bubble {
  display: inline-block;
  padding: 6px 10px;
  border-radius: var(--radius-12);
  background: var(--surface-card);
  border: 2px solid var(--surface-border);
  color: var(--primary-main);
}
.path-end { display: flex; justify-content: center; }

/* 섹션 목록 */
.section-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: var(--radius-24);
  background: var(--surface-card);
  border: 2px solid var(--surface-border);
}
.section-card-shown { border-color: var(--primary-main); }

/* ── 레슨 ── */
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 16px 24px 0 20px; }
.lesson-top .close-button { align-self: center; padding: 4px; }
.lesson-body { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.instruction { display: flex; flex-direction: column; gap: 6px; }
.speech { display: flex; align-items: flex-end; gap: 8px; }
.bubble {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-16);
  background: var(--surface-card);
  border: 2px solid var(--surface-border);
}
button.bubble { cursor: pointer; }
.word-bank { display: flex; flex-direction: column; gap: 24px; }
.answer-line {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px 8px;
  min-height: 112px;
  padding: 12px 0;
  border-top: 2px solid var(--surface-border);
  border-bottom: 2px solid var(--surface-border);
}
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 8px; }
.block {
  padding: 10px 14px 7px;
  border-radius: var(--radius-12);
  background: var(--surface-card);
  border: 2px solid var(--surface-border);
  border-bottom-width: 5px;
  font-size: 16px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-main);
}
.block-used { background: var(--surface-disabled); border-color: var(--surface-disabled); color: transparent; user-select: none; }
.speaker-buttons { display: flex; justify-content: center; align-items: center; gap: 16px; }
.speaker-big { width: 120px; height: 96px; border-radius: var(--radius-24); background: var(--primary-shade); }
.speaker-face {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 91px;
  border-radius: var(--radius-24);
  background: var(--primary-main);
  color: var(--text-on-color);
  transition: transform 60ms ease-out;
}
.speaker-big:active .speaker-face { transform: translateY(5px); }
.speaker-slow { width: 72px; height: 72px; border-radius: var(--radius-24); background: var(--primary-soft); color: var(--primary-shade); }
.cloze { display: flex; flex-wrap: wrap; gap: 8px; font-size: 20px; line-height: 28px; font-weight: 700; }
.cloze-blank { min-width: 88px; padding: 0 4px; border-bottom: 3px solid var(--primary-main); color: var(--primary-shade); }
.match { display: flex; gap: 12px; }
.match-column { flex: 1 1 0; min-width: 0; }
.match .choice { word-break: break-word; }
.lesson-footer { padding: 8px 24px calc(24px + env(safe-area-inset-bottom)); }
.feedback {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
  background: var(--feedback-background);
  color: var(--feedback-accent);
  animation: slide-up 160ms ease-out;
}
.feedback-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--feedback-accent); flex: none; }
.feedback-correct { --feedback-background: var(--correct-soft); --feedback-accent: var(--correct-main); }
.feedback-wrong { --feedback-background: var(--wrong-soft); --feedback-accent: var(--wrong-main); }
.feedback-almost { --feedback-background: var(--almost-soft); --feedback-accent: var(--almost-main); }
@keyframes slide-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.stats { display: flex; gap: 12px; width: 100%; }
.stat-card {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 0;
  border-radius: var(--radius-16);
  background: var(--surface-card);
  border: 2px solid;
}
.today-card { width: 100%; padding: 16px; border-radius: var(--radius-16); background: var(--surface-card); text-align: left; }

/* ── 팁 ── */
.tip-card { padding: 20px; border-radius: var(--radius-24); background: var(--surface-card); border: 2px solid var(--surface-border); }
.tip-example {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-12);
  background: var(--primary-soft);
}
.tip-example-text { display: flex; flex-direction: column; }

/* ── 연속 학습 ── */
.week { display: flex; justify-content: space-evenly; width: 100%; padding: 16px 8px; border-radius: var(--radius-16); background: var(--surface-card); }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.day-dot { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; }
.day-studied { background: var(--streak-main); color: var(--text-on-color); }
.day-rest { background: var(--primary-soft); color: var(--primary-main); }
.day-today { background: var(--surface-card); border: 2px solid var(--streak-main); }
.day-other { background: var(--surface-disabled); }
.rest-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; border-radius: var(--radius-16); background: var(--primary-soft); text-align: left; }

/* ── 설정 ── */
.setting-row { display: flex; align-items: center; width: 100%; padding: 16px; border-radius: var(--radius-16); background: var(--surface-card); text-align: left; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* 가운데 정렬 화면에서도 보기 묶음·카드는 폭을 다 쓴다 */
.centered-body > .stack-12, .centered-body > .stats, .centered-body > .today-card { align-self: stretch; }
.row-10 > .text-small, .lesson-top .text-small { white-space: nowrap; }
