:root {
  --bg: #fdf8f1;
  --bg-soft: #fffdfa;
  --ink: #1f2430;
  --ink-soft: #5c6478;
  --line: #e7ded1;
  --accent: #e2622f;
  --accent-soft: #fceee6;
  --ok: #1f8a53;
  --ok-soft: #e4f5eb;
  --no: #c8323c;
  --no-soft: #fdeaec;
  --card-history: #7d5fd3;
  --card-garuda: #d99a17;
  --card-poke: #3a7fd5;
  --radius: 20px;
  --shadow: 0 6px 20px rgba(31, 36, 48, .08);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a21;
    --bg-soft: #1f232c;
    --ink: #f2efe9;
    --ink-soft: #a3abbd;
    --line: #2e3441;
    --accent: #ff8a52;
    --accent-soft: #33241c;
    --ok: #57d08c;
    --ok-soft: #1b2f24;
    --no: #ff7480;
    --no-soft: #33201f;
    --card-history: #a58cf0;
    --card-garuda: #f0bb47;
    --card-poke: #6ba6f0;
    --shadow: 0 6px 20px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  width: min(880px, 92vw);
  margin: 0 auto;
  padding: 32px 0 72px;
}

a { color: inherit; }

/* ---------- 헤더 ---------- */
.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 20px;
}
.site-head h1 {
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: -.02em;
}
.site-head h1 a { text-decoration: none; }
.site-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: .95rem;
}

.hero {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  letter-spacing: -.02em;
}
.hero p {
  margin: 0;
  color: var(--ink-soft);
}

/* ---------- 섹션 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 36px 0 14px;
  font-size: 1.1rem;
}
.section-title span.count {
  font-size: .8rem;
  color: var(--ink-soft);
  font-weight: 400;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.deck-card {
  display: block;
  text-decoration: none;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 6px solid var(--dot, var(--accent));
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.deck-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(31, 36, 48, .14);
}
.deck-card[data-color="history"] { --dot: var(--card-history); }
.deck-card[data-color="garuda"]  { --dot: var(--card-garuda); }
.deck-card[data-color="poke"]    { --dot: var(--card-poke); }

.deck-card .emoji { font-size: 1.9rem; line-height: 1; }
.deck-card h3 {
  margin: 12px 0 6px;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}
.deck-card p {
  margin: 0;
  font-size: .9rem;
  color: var(--ink-soft);
}
.deck-card .meta {
  margin-top: 14px;
  font-size: .8rem;
  color: var(--dot, var(--accent));
  font-weight: 600;
}

.soon {
  border: 1px dashed var(--line);
  border-left: 1px dashed var(--line);
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  cursor: default;
}
.soon:hover { transform: none; box-shadow: none; }

/* ---------- 퀴즈 ---------- */
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: .9rem;
  color: var(--ink-soft);
}
.progress {
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 22px;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .35s ease;
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  animation: pop .25s ease;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
.card .q {
  font-size: clamp(1.15rem, 3.6vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 20px;
}

.choices {
  display: grid;
  gap: 10px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 1rem;
  color: inherit;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.choice:hover:not(:disabled) { border-color: var(--accent); transform: translateX(2px); }
.choice:disabled { cursor: default; }
.choice .tag {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--line);
  font-size: .85rem;
  font-weight: 700;
}
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.correct .tag { background: var(--ok); color: #fff; }
.choice.wrong { border-color: var(--no); background: var(--no-soft); }
.choice.wrong .tag { background: var(--no); color: #fff; }
.choice.dim { opacity: .5; }

.explain {
  margin-top: 20px;
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  animation: pop .25s ease;
}
.explain b { display: block; margin-bottom: 4px; }
.explain p { margin: 0; font-size: .95rem; }

.actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  padding: 13px 22px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
  padding: 11px 20px;
}

/* ---------- 결과 ---------- */
.result { text-align: center; padding: 40px 24px; }
.result .score {
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 8px 0;
}
.result .msg { color: var(--ink-soft); margin: 0 0 8px; }
.result .actions { justify-content: center; }
.stamp { font-size: 3rem; line-height: 1; }

.foot {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: .85rem;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.foot a { text-decoration: none; }

/* ---------- 문제 만들기 ---------- */
.maker-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.maker-card h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.maker-card h3 .num {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: .85rem;
}

label.field {
  display: block;
  margin-bottom: 14px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
label.field > span { display: block; margin-bottom: 6px; }

input[type="text"], textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  resize: vertical;
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.choice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.choice-row input[type="radio"] {
  flex: none;
  width: 22px;
  height: 22px;
  accent-color: var(--ok);
  cursor: pointer;
}
.choice-row input[type="text"] { margin: 0; }
.hint {
  font-size: .8rem;
  color: var(--ink-soft);
  font-weight: 400;
  margin: 0 0 10px;
}

.emoji-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.emoji-pick button {
  font-size: 1.3rem;
  line-height: 1;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.emoji-pick button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn.small { padding: 8px 14px; font-size: .85rem; border-radius: 10px; }
.btn.danger { background: transparent; color: var(--no); border: 2px solid var(--line); padding: 6px 12px; font-size: .8rem; border-radius: 10px; }

.saved-note {
  font-size: .85rem;
  color: var(--ink-soft);
  margin: 0;
  min-height: 1.4em;
}
.notice {
  border-radius: 14px;
  padding: 12px 16px;
  margin: 16px 0 0;
  font-size: .9rem;
  background: var(--ok-soft);
  border: 1px solid var(--ok);
}
.notice.bad { background: var(--no-soft); border-color: var(--no); }
.notice p { margin: 0; }

.share-box {
  margin-top: 14px;
  background: var(--bg);
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .8rem;
  word-break: break-all;
  color: var(--ink-soft);
  max-height: 120px;
  overflow: auto;
}
