/* ───────── 나를 위한 스온스 찾기 · 유치원 스타일 ───────── */
:root {
  /* 기본 */
  --bg: #FFF8E8;
  --paper: #FFFFFF;
  --ink: #2B2A4C;
  --muted: #6E6A86;
  --main: #FFD43B;
  --main-t: #FFF1B8;

  /* 스터디 색 (진한 / 연한) — 글씨는 모두 --ink */
  --basic: #4D8DFF;   --basic-t: #E3EEFF;
  --elem: #3CC47C;    --elem-t: #DFF7E9;
  --inter: #FFA62B;   --inter-t: #FFEFD6;
  --adv: #FF5D7A;     --adv-t: #FFE3E9;
  --frase: #3EC5E8;   --frase-t: #DDF6FC;
  --ensayo: #9B7BFF;  --ensayo-t: #EEE8FF;
  --cancion: #FF7A4D; --cancion-t: #FFE6DC;
  --palabra: #FFE14D; --palabra-t: #FFF8CC;

  --border: 2px solid var(--ink);
  --pop: 3px 3px 0 var(--ink);
  --font: 'Inter', 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: #F3EBD8;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--basic); outline-offset: 2px; }

/* 앱 틀: 휴대폰에서는 꽉 차게, 넓은 화면에서는 가운데 카드 */
.app {
  background: var(--bg);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 520px) {
  body { padding: 28px 16px; }
  .app {
    min-height: calc(100vh - 56px);
    border: 3px solid var(--ink);
    border-radius: 36px;
    box-shadow: 6px 6px 0 var(--ink);
    overflow: hidden;
  }
}

/* ───── 공통 컴포넌트 ───── */
.btn {
  display: block; width: 100%; text-align: center;
  background: var(--main); color: var(--ink);
  font-weight: 700; font-size: 15px;
  padding: 13px 18px; border-radius: 999px;
  border: var(--border); box-shadow: var(--pop);
  transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.white { background: var(--paper); }
.btn.ghost { background: var(--paper); }
.btn.small { font-size: 13px; padding: 9px 14px; }
.btn:disabled { background: #EDE7D6; color: var(--muted); box-shadow: none; cursor: not-allowed; border-color: #BDB6A3; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--paper); border: var(--border);
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}

.chip {
  display: inline-block; font-size: 13px; font-weight: 700;
  padding: 5px 13px; border-radius: 999px;
  background: var(--paper); border: var(--border);
}
.chip.on { background: var(--main); }

/* ───── 상단 바 · 메뉴 ───── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 20px 0; position: relative;
}
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.logo { font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 6px; }
.logo::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--adv); border: var(--border); }
.q-count { font-size: 13px; font-weight: 700; background: var(--paper); border: var(--border); border-radius: 999px; padding: 2px 10px; }

.menu {
  position: absolute; right: 20px; top: 62px; z-index: 20;
  background: var(--paper); border: var(--border); border-radius: 20px; box-shadow: var(--pop);
  display: flex; flex-direction: column; padding: 6px; min-width: 200px;
}
.menu button, .menu a { text-align: left; padding: 10px 14px; border-radius: 14px; font-weight: 700; font-size: 14px; }
.menu button:hover, .menu a:hover { background: var(--main-t); }

/* ───── 화면 ───── */
main { flex: 1; display: flex; flex-direction: column; }
.screen { padding: 16px 20px 26px; display: flex; flex-direction: column; gap: 16px; flex: 1; }

/* ① 메인 */
.hero {
  background: var(--main); border: var(--border); box-shadow: var(--pop); border-radius: 28px;
  padding: 26px 22px 20px; display: flex; flex-direction: column; gap: 12px;
  position: relative; overflow: hidden;
}
.hero > * { position: relative; }
.hero .deco { position: absolute; border-radius: 50%; border: var(--border); }
.hero .d1 { width: 90px; height: 90px; right: -24px; top: -24px; background: var(--adv); }
.hero .d2 { width: 40px; height: 40px; right: 46px; top: 30px; background: var(--frase); }
.hero .d3 { width: 26px; height: 26px; right: 18px; top: 84px; background: var(--elem); }
.eyebrow { align-self: flex-start; font-size: 12px; font-weight: 700; background: var(--paper); border: var(--border); border-radius: 999px; padding: 2px 10px; }
.hero h1 { font-weight: 800; font-size: 34px; line-height: 1.2; }
.hero p { font-weight: 500; }
.hero .meta { text-align: center; font-size: 12px; font-weight: 500; }

.term {
  border-radius: 22px; padding: 16px 18px; background: var(--paper); border: var(--border);
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; align-items: center;
}
.term .t-title { grid-column: 1 / -1; font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.term b { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; border: var(--border); text-align: center; }
.t-sky { background: var(--frase-t); } .t-pink { background: var(--adv-t); } .t-green { background: var(--elem-t); }

.sec-title { font-weight: 700; font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sec-title small { font-weight: 500; font-size: 12px; color: var(--muted); }
.cards {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 2px 4px 8px 2px; scrollbar-width: none;
}
.cards::-webkit-scrollbar { display: none; }
.scard {
  width: 140px; flex-shrink: 0; scroll-snap-align: start; text-align: left;
  border-radius: 20px; overflow: hidden; background: var(--paper); border: var(--border); box-shadow: var(--pop);
}
.scard .art { height: 92px; display: flex; align-items: flex-end; padding: 10px 12px; font-weight: 800; font-size: 19px; border-bottom: var(--border); }
.scard .body { padding: 8px 12px 12px; font-size: 12px; }
.scard .body b { display: block; font-size: 14px; font-weight: 700; }
.scard .body span { color: var(--muted); font-weight: 500; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 14px; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--paper); border: 1.5px solid var(--ink); transition: width .2s; }
.dots i.on { background: var(--ink); width: 20px; }

/* ② 질문 */
.progress { height: 14px; border-radius: 999px; background: var(--paper); border: var(--border); overflow: hidden; }
.progress i { display: block; height: 100%; width: 10%; background: var(--elem); border-right: var(--border); transition: width .25s; }
.q-part { align-self: flex-start; font-size: 12px; font-weight: 700; border: var(--border); border-radius: 999px; padding: 2px 10px; background: var(--basic-t); }
.q-title { font-size: 22px; font-weight: 800; line-height: 1.35; }
.example { background: var(--paper); border: var(--border); border-radius: 22px; padding: 18px; text-align: center; font-weight: 600; font-size: 19px; box-shadow: var(--pop); }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  background: var(--paper); border: var(--border); border-radius: 18px;
  padding: 13px 16px; display: flex; gap: 12px; align-items: center; text-align: left; font-weight: 500;
  transition: background .1s;
}
.choice:hover { background: #FFFCF0; }
.choice .dot { width: 20px; height: 20px; border-radius: 50%; border: var(--border); flex-shrink: 0; background: var(--paper); }
.choice[aria-pressed="true"] { background: var(--main-t); font-weight: 700; box-shadow: var(--pop); }
.choice[aria-pressed="true"] .dot { background: var(--main); box-shadow: inset 0 0 0 3px var(--paper); }
.next { margin-top: auto; }

/* ③ 결과 */
.r-intro { font-size: 13px; font-weight: 500; color: var(--muted); }
.r-intro b { display: block; font-size: 22px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.rcard { border-radius: 28px; overflow: hidden; background: var(--paper); border: var(--border); box-shadow: 4px 4px 0 var(--ink); }
.rcard .art { padding: 18px 20px; border-bottom: var(--border); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; background: var(--paper); border: var(--border); border-radius: 999px; padding: 1px 10px; }
.rcard .art h3 { font-weight: 800; font-size: 30px; line-height: 1.2; margin-top: 10px; }
.tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.rcard .inner { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.why { border-radius: 16px; padding: 12px 14px; font-size: 14px; font-weight: 500; list-style: none; }
.why b { display: block; margin-bottom: 4px; font-weight: 700; }
.why li { padding-left: 20px; position: relative; }
.why li::before { content: "★"; position: absolute; left: 0; top: 1px; font-size: 12px; }
.price { display: flex; justify-content: space-between; align-items: baseline; }
.price span { font-size: 13px; font-weight: 500; color: var(--muted); }
.price b { font-size: 22px; font-weight: 800; }
.sub-card {
  width: 100%; text-align: left; border-radius: 20px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; border: var(--border);
}
.sub-card .sw { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; border: var(--border); }
.sub-card .txt { flex: 1; font-size: 12px; }
.sub-card .txt small { font-weight: 500; color: var(--muted); }
.sub-card .txt b { display: block; font-size: 16px; font-weight: 700; }
.sub-card .arrow { font-weight: 800; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; background: var(--main); border: 1.5px solid var(--ink); border-radius: 999px; padding: 0 8px; margin-top: 4px; }
.r-actions { display: flex; gap: 10px; margin-top: auto; }
.r-actions .btn { flex: 1; }
.r-note { font-size: 12px; color: var(--muted); font-weight: 500; text-align: center; }
.r-note button { text-decoration: underline; font-weight: 700; color: var(--ink); }

/* ④ 전체 스터디 */
.list-title { font-weight: 800; font-size: 24px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 10px; }
.lcard {
  width: 100%; text-align: left;
  display: flex; gap: 12px; background: var(--paper); border: var(--border); border-radius: 20px; padding: 8px; align-items: stretch;
}
.lcard:hover { box-shadow: var(--pop); }
.lcard .sw { width: 60px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; font-size: 17px; border: var(--border); }
.lcard .info { flex: 1; font-size: 12px; padding: 2px 0; }
.lcard .info b { font-size: 15px; font-weight: 700; }
.lcard .info .lv { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.lcard .info p { color: var(--muted); margin: 1px 0 3px; }
.lcard .info .pr { font-weight: 700; }

/* ───── 푸터 ───── */
.footer { background: var(--basic); padding: 24px 22px 22px; border-top: 3px solid var(--ink); }
.footer .big { font-weight: 800; font-size: 44px; line-height: 1; }
.footer .links { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.footer .links a { font-size: 12px; font-weight: 700; background: var(--paper); border: var(--border); border-radius: 999px; padding: 3px 12px; }
.footer .sign { border-top: 2px dashed var(--ink); padding-top: 12px; font-size: 11px; font-weight: 500; display: flex; flex-direction: column; gap: 2px; }

/* ───── 자세히 보기 시트 ───── */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(43, 42, 76, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--paper); border: 3px solid var(--ink); border-bottom: none;
  border-radius: 28px 28px 0 0; animation: up .2s ease-out;
}
@media (min-width: 520px) {
  .sheet-bg { align-items: center; }
  .sheet { border-bottom: 3px solid var(--ink); border-radius: 28px; box-shadow: 6px 6px 0 var(--ink); }
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .art { padding: 20px 20px 18px; border-bottom: var(--border); position: relative; }
.sheet .art h3 { font-weight: 800; font-size: 26px; line-height: 1.2; margin-top: 8px; }
.sheet .close { position: absolute; right: 14px; top: 14px; }
.sheet .inner { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.sheet .desc { font-weight: 500; }
.sheet .points { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.sheet .points li { padding-left: 20px; position: relative; }
.sheet .points li::before { content: "●"; position: absolute; left: 2px; font-size: 9px; top: 5px; }

/* ───── 토스트 ───── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
  padding: 10px 18px; border-radius: 999px;
}

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