
:root {
  --bg: #f2f1ed;
  --card: #ffffff;
  --ink: #171717;
  --muted: #747474;
  --line: #deddd8;
  --soft: #eceae4;
  --accent: #e0ff66;
  --accent-dark: #c8ea4e;
  --danger-soft: #fff0ed;
  --radius: 24px;
  --shadow: 0 12px 35px rgba(0,0,0,.07);
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
}
button { font: inherit; color: inherit; }
button:active { transform: scale(.985); }
.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--muted);
}
h1 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.icon-btn {
  width: 42px; height: 42px; border: 1px solid var(--line); background: var(--card);
  border-radius: 50%; display: grid; place-items: center; font-size: 24px; cursor: pointer;
}
.hero {
  background: var(--ink); color: white; border-radius: 28px; padding: 24px;
  display: flex; justify-content: space-between; gap: 18px; align-items: flex-end;
  box-shadow: var(--shadow);
}
.hero-kicker { margin: 0 0 8px; color: #bdbdbd; font-size: 12px; font-weight: 800; }
.hero h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.hero h2 span { color: var(--accent); }
.hero-sub { margin: 9px 0 0; color: #c9c9c9; font-size: 13px; line-height: 1.55; max-width: 280px; }
.streak-box {
  min-width: 76px; border-left: 1px solid #393939; padding-left: 18px; text-align: center;
}
.streak-box strong { display: block; font-size: 28px; }
.streak-box span { font-size: 11px; color: #bdbdbd; white-space: nowrap; }
.progress-wrap { padding: 17px 2px 14px; }
.progress-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.progress-track { height: 7px; background: #dddcd6; border-radius: 999px; overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: var(--ink); border-radius: 999px; transition: width .25s ease; }

.study-card, .quiz-card, .done-card {
  background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.025);
}
.card-meta, .quiz-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.pill {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border-radius: 999px;
  background: var(--soft); color: #4b4b4b; font-size: 11px; font-weight: 800;
}
.word-block { position: relative; padding: 31px 48px 15px 0; }
.type-label { margin: 0 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.word-block h3 { margin: 0; font-size: 35px; line-height: 1.12; letter-spacing: -.045em; overflow-wrap: anywhere; }
.speak-btn {
  position: absolute; right: 0; top: 39px; width: 40px; height: 40px; border: 0;
  background: var(--soft); border-radius: 50%; cursor: pointer;
}
.meaning { margin: 0 0 22px; font-size: 18px; font-weight: 750; line-height: 1.4; }
.example-box {
  background: #f7f7f4; border-radius: 17px; padding: 17px; margin-bottom: 12px;
}
.example-en { margin: 0; font-size: 16px; line-height: 1.55; font-weight: 650; }
.example-kr { margin: 9px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.text-btn {
  border: 0; background: none; padding: 10px 0 0; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer;
}
.usage-box { border: 1px solid var(--line); border-radius: 17px; padding: 14px 16px; margin-bottom: 18px; }
.usage-box span { font-size: 11px; font-weight: 800; color: var(--muted); }
.usage-box p { margin: 5px 0 0; font-size: 13px; line-height: 1.55; }
.rating-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.rate-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 5px;
  font-size: 12px; font-weight: 750; cursor: pointer;
}
.rate-btn:hover { background: #f8f8f6; }

.quiz-card h3 { margin: 28px 0 18px; font-size: 21px; line-height: 1.45; letter-spacing: -.02em; }
.quiz-options { display: grid; gap: 9px; }
.quiz-option {
  text-align: left; border: 1px solid var(--line); background: white; border-radius: 15px;
  padding: 14px 15px; cursor: pointer; line-height: 1.45;
}
.quiz-option.correct { background: #eef8d8; border-color: #b6cf70; }
.quiz-option.wrong { background: var(--danger-soft); border-color: #e4aaa0; }
.quiz-option:disabled { cursor: default; }
.quiz-feedback { min-height: 22px; margin: 13px 1px; font-size: 13px; font-weight: 700; }
.primary-btn {
  width: 100%; border: 0; border-radius: 15px; background: var(--ink); color: white; padding: 14px 16px;
  font-weight: 800; cursor: pointer;
}
.done-card { text-align: center; padding-top: 30px; }
.done-icon {
  width: 58px; height: 58px; margin: 0 auto 15px; border-radius: 50%; background: var(--accent);
  display: grid; place-items: center; font-size: 28px; font-weight: 900;
}
.done-card h2 { margin: 2px 0 8px; font-size: 28px; }
.done-card > p:not(.eyebrow) { color: var(--muted); font-size: 14px; line-height: 1.6; }
.done-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin: 20px 0; }
.done-stats div { background: #f7f7f4; border-radius: 16px; padding: 15px 10px; }
.done-stats strong { display: block; font-size: 20px; }
.done-stats span { font-size: 11px; color: var(--muted); }

.lower-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.mini-panel {
  border: 1px solid var(--line); background: transparent; border-radius: 18px; padding: 15px;
  display: flex; align-items: center; text-align: left; gap: 10px; cursor: pointer;
}
.mini-icon { width: 34px; height: 34px; display: grid; place-items: center; background: var(--card); border-radius: 50%; }
.mini-panel b { display: block; font-size: 13px; }
.mini-panel small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }

dialog {
  width: min(calc(100% - 30px), 470px); max-height: 80vh; border: 0; border-radius: 24px; padding: 20px;
  box-shadow: 0 25px 80px rgba(0,0,0,.22);
}
dialog::backdrop { background: rgba(0,0,0,.35); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-head h3 { margin: 0; }
.topic-list, .record-list { display: grid; gap: 8px; margin-top: 12px; }
.topic-row, .record-row {
  background: #f7f7f4; border-radius: 14px; padding: 12px 13px; display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px;
}
.topic-row small, .record-row small { color: var(--muted); }
.install-copy { font-size: 14px; line-height: 1.65; color: #4f4f4f; }
.hidden { display: none !important; }

@media (max-width: 390px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .hero { padding: 21px; }
  .hero h2 { font-size: 24px; }
  .word-block h3 { font-size: 31px; }
  .rating-row { gap: 6px; }
  .rate-btn { font-size: 11px; padding: 11px 2px; }
}
