@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #f2f0fa;
  --bg-deep: #e7e3f7;
  --surface: #ffffff;
  --ink: #1b1830;
  --ink-soft: #4a4666;
  --muted: #7c7796;
  --line: #e3dff2;
  --accent: #5b4bd6;
  --accent-soft: #ede9ff;
  --radius: 18px;
  --shadow: 0 14px 34px -18px rgba(38, 26, 92, 0.35);
}

/* 그룹별 강조색 ------------------------------------------------ */
.g1 { --accent: #5b4bd6; --accent-soft: #ece9ff; }
.g2 { --accent: #0f8f86; --accent-soft: #dff5f2; }
.g3 { --accent: #c2601f; --accent-soft: #fdeee0; }
.g4 { --accent: #b03b62; --accent-soft: #fce8ef; }
.g5 { --accent: #2a6fbe; --accent-soft: #e4eefb; }
.g6 { --accent: #4a7c2f; --accent-soft: #e9f4e2; }
.g7 { --accent: #8a5a12; --accent-soft: #fbf0dc; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 24px 80px;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 50% -220px, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--bg-deep) 0%, rgba(231, 227, 247, 0) 340px);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
}

.page { max-width: 1080px; margin: 0 auto; }

/* 헤더 ---------------------------------------------------------- */
.hero { padding: 72px 0 52px; text-align: center; }

.eyebrow {
  display: inline-block;
  margin: 0 0 22px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 5.2vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.22;
}

.hero p {
  max-width: 34em;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

/* 그룹 카드 격자 ------------------------------------------------ */
.groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 20px 40px -20px rgba(38, 26, 92, 0.45);
}

.card .icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border-radius: 13px;
  background: var(--accent-soft);
  font-size: 1.4rem;
  line-height: 1;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card .tagline {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}

.card .desc {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.card .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
}

.card .chev {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.card .chev svg { display: block; }

.card.empty { box-shadow: none; background: rgba(255, 255, 255, 0.55); }
.card.empty .icon { background: #eeebf7; color: var(--muted); }
.card.empty .tagline,
.card.empty .foot { color: var(--muted); }
.card.empty .chev { background: #eeebf7; }

/* 실험실 하위 카드 ---------------------------------------------- */
.subgroups {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.subcard {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.subcard:hover,
.subcard:focus-visible { transform: translateY(-3px); border-color: var(--accent); }

.subcard .icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 1.15rem;
  line-height: 1;
}

.subcard h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.subcard .count { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.subcard.filled .count { color: var(--accent); }
.subcard.vacant { background: rgba(255, 255, 255, 0.55); }
.subcard.vacant .icon { background: #eeebf7; }

/* 그룹 페이지 --------------------------------------------------- */
.back {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 7px;
  margin-bottom: 30px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.back:hover { color: var(--accent); }

.group-head { padding: 56px 0 40px; }

.group-head .badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  border-radius: 15px;
  background: var(--accent-soft);
  font-size: 1.6rem;
  line-height: 1;
}

.group-head h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.group-head p { max-width: 40em; margin: 0; color: var(--ink-soft); }

.tools { display: grid; gap: 14px; }

.tool {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.tool:hover,
.tool:focus-visible { border-color: var(--accent); transform: translateX(3px); }

.tool .mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}

.tool .body { flex: 1 1 auto; min-width: 0; }
.tool h3 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.tool p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.tool .go { flex: none; color: var(--accent); font-size: 0.88rem; font-weight: 600; }

/* 빈 그룹 안내 -------------------------------------------------- */
.blank {
  padding: 56px 30px;
  border: 1px dashed #cfc8ea;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.blank h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; }
.blank p { margin: 0 auto; max-width: 32em; color: var(--muted); font-size: 0.92rem; }

.blank code {
  padding: 2px 7px;
  border-radius: 6px;
  background: #efecfa;
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

/* 설명형 본문 (단계별 학습 콘텐츠) -------------------------------- */
.lesson { max-width: 760px; }

.lesson h2 {
  margin: 40px 0 14px;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lesson h2:first-child { margin-top: 0; }

.lesson h3 { margin: 24px 0 10px; font-size: 1.02rem; font-weight: 700; }

.lesson p { margin: 0 0 14px; color: var(--ink-soft); }

.lesson ol,
.lesson ul { margin: 0 0 14px; padding-left: 1.3em; color: var(--ink-soft); }

.lesson li { margin-bottom: 7px; }
.lesson li::marker { color: var(--accent); font-weight: 700; }
.lesson strong { color: var(--ink); }

.callout {
  margin: 18px 0;
  padding: 16px 20px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.callout h4 { margin: 0 0 6px; font-size: 0.9rem; font-weight: 700; }
.callout p:last-child { margin-bottom: 0; }

.callout.tip { border-color: transparent; background: var(--accent-soft); }
.callout.tip h4 { color: var(--accent); }

.callout.warn { border-color: #f3d9b0; background: #fdf3e2; }
.callout.warn h4 { color: #a15c1f; }
.callout.warn p { color: #8a5420; }

.table-scroll { overflow-x: auto; margin: 8px 0 20px; }

.compare-table {
  width: 100%;
  min-width: 480px;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.compare-table th,
.compare-table td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.compare-table th { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.compare-table td { color: var(--ink-soft); }

/* 실습 위젯 ------------------------------------------------------ */
.practice {
  margin: 22px 0;
  padding: 20px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.practice > .practice-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.practice h4 { margin: 0 0 4px; font-size: 0.98rem; font-weight: 700; }
.practice .practice-desc { margin: 0 0 16px; color: var(--muted); font-size: 0.85rem; }

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 5px; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.field textarea { resize: vertical; min-height: 64px; }
.field input:focus,
.field select:focus,
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

.result-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-box:empty::before { content: "값을 입력하면 여기에 결과가 나타납니다."; color: var(--muted); }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover { opacity: 0.88; }

.btn.secondary { background: var(--accent-soft); color: var(--accent); }

.check-list { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 16px; }

.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.check-list input[type="checkbox"] { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }

.status-box {
  margin-top: 4px;
  padding: 12px 16px;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 700;
  background: #eeebf7;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.status-box.ok { background: #e4f3e0; color: #2f7a1f; }

.count-hint { margin-top: 6px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.count-hint.over { color: #b23b3b; }

.slider-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.slider-row label { flex: none; width: 64px; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.slider-row input[type="range"] { flex: 1 1 auto; accent-color: var(--accent); }
.slider-row .slider-val { flex: none; width: 42px; text-align: right; font-weight: 700; color: var(--accent); font-size: 0.9rem; }

/* 비밀번호 게이트 ------------------------------------------------ */
.gate {
  max-width: 360px;
  margin: 96px auto 0;
  padding: 40px 32px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.gate .badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border-radius: 15px;
  background: var(--accent-soft);
  font-size: 1.6rem;
  line-height: 1;
}

.gate h1 {
  margin: 0 0 10px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.gate p { margin: 0 0 22px; color: var(--ink-soft); font-size: 0.92rem; }

.gate-form { display: flex; gap: 8px; }

.gate-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
}

.gate-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gate-form button {
  flex: none;
  padding: 11px 18px;
  border: none;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.gate-form button:hover { opacity: 0.92; }

.gate-error {
  margin: 14px 0 0;
  color: #c23b3b;
  font-size: 0.86rem;
  font-weight: 600;
}

/* 바닥글 -------------------------------------------------------- */
.foot-note {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

/* 반응형 -------------------------------------------------------- */
@media (max-width: 900px) {
  .groups { grid-template-columns: repeat(2, 1fr); }
  .subgroups { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  body { padding: 0 18px 56px; }
  .groups { grid-template-columns: 1fr; }
  .subgroups { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 48px 0 36px; }
  .tool { gap: 14px; padding: 18px; }
  .tool .go { display: none; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

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