:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #171a2b;
  --muted: #5f6680;
  --line: #e1e4ef;
  --accent: #4257f5;
  --accent-soft: #e9ecff;
  --accent-text: #ffffff;
  --hero-a: #eef0ff;
  --hero-b: #fdf1f7;
  --wait: #d64545;
  --go: #1fa463;
  --shadow: 0 1px 2px rgba(23, 26, 43, 0.04), 0 6px 20px rgba(23, 26, 43, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11131b;
    --card: #1b1e2b;
    --text: #eef0f8;
    --muted: #9da4ba;
    --line: #2b2f41;
    --accent: #7d8dff;
    --accent-soft: #252a4a;
    --accent-text: #0d1020;
    --hero-a: #1a1d33;
    --hero-b: #2a1b2a;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.65;
  word-break: keep-all;
}

/* 머리말, 꼬리말 */
header.site {
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .inner, main, footer.site .inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}
header.site .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
header.site a.logo {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
header.site a.logo::before { content: "🧪 "; }
header.site nav a {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 99px;
}
footer.site {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}
footer.site .inner { padding-top: 18px; padding-bottom: 28px; }
footer.site a { color: var(--muted); margin-right: 12px; }

/* 본문 공통 */
main { padding-top: 28px; padding-bottom: 56px; }
h1 { font-size: 1.75rem; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; margin: 40px 0 8px; letter-spacing: -0.01em; }
p.lead { color: var(--muted); margin: 0 0 24px; }
a { color: var(--accent); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.center { text-align: center; }
.big { font-size: 2.6rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

button, .btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  padding: 13px 22px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover { filter: brightness(1.07); }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

/* 첫 화면 */
.hero {
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 24px;
  margin-bottom: 30px;
}
.hero .badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--card);
  border-radius: 99px;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.hero h1 { font-size: 2rem; }
.hero p { margin: 0; color: var(--muted); max-width: 30em; }
.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 30px 0 12px;
}
.section-title h2 { margin: 0; }
.section-title span { color: var(--muted); font-size: 0.9rem; }
.grid { display: grid; gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }
a.tile {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}
a.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
a.tile .icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--accent-soft);
}
a.tile h3 { margin: 0 0 2px; font-size: 1.05rem; }
a.tile p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
a.tile .tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

/* 게임 공통 */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
  text-align: center;
}
.stats > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}
.stat { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
#pad {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  min-height: 300px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
#pad.wait { background: var(--wait); color: #fff; border-color: transparent; }
#pad.go { background: var(--go); color: #fff; border-color: transparent; }
#pad .title { font-size: 1.6rem; font-weight: 800; }
#pad .sub { margin-top: 6px; opacity: 0.9; }
ol.rounds { padding-left: 20px; }
.digits {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  min-height: 1.4em;
  margin: 14px 0;
  overflow-wrap: anywhere;
}
.num-input {
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  width: 100%;
  max-width: 340px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
.color-grid {
  display: grid;
  gap: 6px;
  max-width: 440px;
  margin: 0 auto;
  touch-action: manipulation;
}
.color-grid button {
  aspect-ratio: 1;
  padding: 0;
  border-radius: 10px;
}
.color-grid button:hover { filter: none; }
.color-grid.shake { animation: shake 0.25s; }
@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* 성향 테스트 */
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width 0.25s; }
.q-title { font-size: 1.25rem; font-weight: 700; margin: 18px 0 16px; }
.options { display: grid; gap: 10px; }
.options button {
  text-align: left;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 500;
  padding: 16px 18px;
}
.options button:hover { border-color: var(--accent); filter: none; }
ul.points { padding-left: 20px; margin: 6px 0 14px; }

/* 다른 테스트 추천 */
#more { margin-top: 44px; }
#more h2 { margin-top: 0; }

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