/* 색 테마: 차콜(짙은 회색) + 라임 강조색. 폰 설정과 상관없이 항상 이 색으로 보임 */
:root {
  color-scheme: dark;
  --bg: #0f0f11;          /* 배경 */
  --surface: #1c1c20;     /* 카드, 상자 */
  --surface-2: #26262b;   /* 한 단계 밝은 상자 (연산 버튼 등) */
  --text: #f2f2f4;
  --muted: #8b8b93;
  --line: #2e2e34;
  --accent: #c6f432;      /* 강조색: 라임 */
  --accent-soft: #2a3310; /* 강조색을 옅게 깐 배경 */
  --accent-text: #111306; /* 강조색 위 글자 */
  --op: var(--surface-2);
  --op-text: #f2f2f4;
  --hint: #f2f2f4;        /* 힌트 표시: 흰색 (어떤 강조색과도 겹치지 않게) */
  --danger: #ff5a5f;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 6px 16px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ----- 상단 ----- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
}

.pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 오늘의 문제를 아직 안 풀었으면 빨간 점 */
.pill.new::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.levels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow);
}

.levels button {
  background: transparent;
  padding: 8px 4px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
}

.levels button.active {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

/* ----- 모드 ----- */
.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modes button {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.modes b { font-size: 16px; }
.modes span { font-size: 12px; color: var(--muted); }

.modes button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.modes button.active b { color: var(--accent); }

/* ----- 화면 공통: 위쪽 줄 (뒤로가기 · 제목 · 설정) ----- */
.screen-top {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  min-height: 40px;
}

.screen-title {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 26px;
  line-height: 1;
  padding-bottom: 3px;
  color: var(--text);
}

.section-label {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ----- 첫 화면 ----- */
.home-hero {
  text-align: center;
  padding: 40px 0 24px;
}

.home-title {
  margin: 0;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.home-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.menu-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  transition: transform 0.1s, border-color 0.1s;
}

.menu-card:active { transform: scale(0.98); border-color: var(--accent); }

.menu-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
}

.menu-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-text b { font-size: 20px; }
.menu-text small { font-size: 14px; color: var(--muted); }

.chev {
  font-size: 28px;
  color: var(--muted);
}

/* ----- 난이도 고르기 ----- */
/* 난이도 카드: 한 줄에 하나씩 세로로 (왼쪽 이름·설명, 오른쪽 아이콘·최고 기록) */
.level-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.level-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title icon"
    "desc  best";
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  min-height: 80px;
  transition: transform 0.1s, border-color 0.1s;
}

.level-card:active { transform: scale(0.98); border-color: var(--accent); }

.level-card b { grid-area: title; font-size: 20px; }
.level-card small { grid-area: desc; font-size: 13px; color: var(--muted); }

.level-card em {
  grid-area: best;
  justify-self: end;
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

/* 난이도별 색: 쉬움 → 보통 → 어려움으로 갈수록 강조색이 진해짐 (진하기는 applyAccent가 계산) */
.lv-easy   { background: var(--lv1-bg); border-color: var(--lv1-line); }
.lv-normal { background: var(--lv2-bg); border-color: var(--lv2-line); }
.lv-hard   { background: var(--accent); border-color: var(--accent); }
.lv-hard b, .lv-hard small, .lv-hard em { color: var(--accent-text); }
.lv-hard small { opacity: 0.75; }

/* 난이도 막대 ▮▯▯ */
.lv-bars {
  grid-area: icon;
  justify-self: end;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.lv-bars i {
  width: 6px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.25;
}

.lv-bars i:nth-child(1) { height: 8px; }
.lv-bars i:nth-child(2) { height: 13px; }
.lv-bars i:nth-child(3) { height: 18px; }
.lv-bars i.on { opacity: 1; }
.lv-easy .lv-bars, .lv-normal .lv-bars { color: var(--accent); }
.lv-hard .lv-bars { color: var(--accent-text); }

/* 화면이 짧은 폰에서는 카드를 조금 납작하게 */
@media (max-height: 640px) {
  .level-card { min-height: 66px; padding: 12px 16px; }
  .level-card b { font-size: 18px; }
  .level-grid { gap: 8px; }
}

/* 타임어택 스톱워치 */
.lv-watch {
  grid-area: icon;
  justify-self: end;
  color: var(--accent);
  display: flex;
}

.daily-card { position: relative; }

.daily-card .menu-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

/* 오늘의 문제를 아직 안 풀었으면 빨간 점 */
.daily-card.new .menu-icon::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 60px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

/* ----- 목표 ----- */
.target-box {
  background: var(--surface);
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

/* ----- 타임어택 시계 ----- */
.timer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.timer-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.timer-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.timer-text {
  min-width: 3.2em;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer.stopwatch { justify-content: center; }
.timer.stopwatch .timer-bar { display: none; }
.timer.stopwatch .timer-text { min-width: 0; color: var(--muted); }

.timer.low .timer-bar i { background: var(--danger); }
.timer.low .timer-text { color: var(--danger); animation: pulse 1s infinite; }

.bonus {
  position: absolute;
  right: 0;
  top: -22px;
  font-weight: 800;
  color: var(--accent);
  opacity: 0;
}

.bonus.minus { color: var(--danger); }
.bonus.show { animation: float-up 1s ease-out; }

@keyframes float-up {
  0% { opacity: 1; transform: translateY(8px); }
  100% { opacity: 0; transform: translateY(-8px); }
}

@keyframes pulse {
  50% { opacity: 0.4; }
}

.target-label {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.target {
  font-size: 56px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.guide {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  min-height: 1.4em;
}

.guide.tut {
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

/* 튜토리얼에서 눌러야 할 곳: 깜빡이는 테두리 */
.tut-target {
  animation: tut-pulse 1.2s ease-in-out infinite;
}

@keyframes tut-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent); }
  50% { box-shadow: 0 0 0 6px var(--accent); }
}

/* ----- 숫자 카드 ----- */
.cards {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 96px;
  flex: 1;
  align-items: center;
}

.card {
  flex: 1 1 0;
  min-width: 0;
  max-width: 88px;
  aspect-ratio: 1;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.card .value {
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.card[data-len="3"] .value { font-size: 26px; }
.card[data-len="4"] .value { font-size: 20px; }
.card[data-len="5"] .value,
.card[data-len="6"] .value,
.card[data-len="7"] .value { font-size: 15px; }

.card .expr {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card:active { transform: scale(0.95); }

.card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-4px);
}

.card.selected .value { color: var(--accent); }

.card.hinted { border-color: var(--hint); }

.card.pop { animation: pop 0.25s ease-out; }
.card.shake { animation: shake 0.35s; }

@keyframes pop {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ----- 연산 버튼 ----- */
.ops {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.op {
  background: var(--op);
  color: var(--op-text);
  font-size: 24px;
  font-weight: 700;
  height: 56px;
  border-radius: 14px;
  transition: transform 0.1s, background 0.1s;
}

.ops.basic { grid-template-columns: repeat(4, 1fr); }
.op[hidden] { display: none; }

.op:active { transform: scale(0.94); }

.op.active {
  background: var(--accent);
  color: var(--accent-text);
  transform: translateY(-3px);
}

/* ----- 도구 버튼 ----- */
.tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tools button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 2px;
  font-size: 13px;
  line-height: 1.2;
  min-height: 46px;
  overflow-wrap: anywhere; /* 독일어처럼 긴 단어도 버튼 안에 들어가게 */
}

.tools button:active { transform: scale(0.96); }
.tools button.disabled { opacity: 0.35; }

.stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
}

.stats b { color: var(--text); }

/* ----- 코인 ----- */
/* 동전 모양: 강조색 원 + 안쪽 테두리 */
.coin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 2.5px var(--accent), inset 0 0 0 3.5px var(--accent-text);
  vertical-align: -2px;
  flex: none;
}

.coin.big { width: 26px; height: 26px; box-shadow: inset 0 0 0 4px var(--accent), inset 0 0 0 6px var(--accent-text); vertical-align: -5px; }

.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.coin-chip:active { transform: scale(0.95); }
.coin-chip.bump { animation: coin-bump 0.5s ease-out; }

@keyframes coin-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); border-color: var(--accent); }
  100% { transform: scale(1); }
}

.top-center { display: flex; justify-content: center; }

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.label-row .section-label { margin: 0; }

.stats { align-items: center; }
.stats .coin-chip { padding: 4px 10px; font-size: 13px; }

/* 버튼 안의 "● 3" 가격 */
.tools .cost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.tools .cost .coin { width: 10px; height: 10px; box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3px var(--accent-text); vertical-align: 0; }

/* 코인 창 */
.shop-balance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 30px;
  font-weight: 800;
  margin: 4px 0 12px;
}

.shop-label {
  margin: 14px 0 8px;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
}

.shop-label:first-child { margin-top: 0; }

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  text-align: left;
}

.shop-item:disabled { opacity: 0.45; }
.shop-item:not(:disabled):active { transform: scale(0.98); }

.shop-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.shop-name b { font-size: 16px; }
.shop-name small { font-size: 12px; color: var(--muted); }
#shop-packs .shop-name { flex-direction: row; align-items: center; gap: 8px; }

.shop-get, .shop-price {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
  font-size: 14px;
}

.shop-get .coin { background: var(--accent-text); box-shadow: inset 0 0 0 2.5px var(--accent-text), inset 0 0 0 3.5px var(--accent); }

.shop-note {
  margin: 0 0 8px;
  text-align: left;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-line;
}

/* ----- 알림 ----- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  width: max-content;
  max-width: calc(100% - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ----- 성공 화면 ----- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  /* 폰 위쪽 상태바·아래쪽 홈 바를 피해서 */
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}

.overlay[hidden] { display: none; }

.win-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  max-height: 100%; /* 화면보다 길면 창 안에서 스크롤 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  animation: pop 0.3s ease-out;
}

/* 제목과 아래 버튼은 고정, 가운데 내용만 스크롤되는 창 (설정, 순위표) */
.fit-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fit-card > * { flex: none; }

.fit-card .fit-scroll,
.fit-card .ranking-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}

.fit-card .fit-scroll .setting-link:last-child { margin-bottom: 0; }

.record-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 800;
}

.record-badge[hidden] { display: none; }
.record-badge.pop { animation: record-pop 0.6s ease-out; }

@keyframes record-pop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

/* 신기록 꽃가루 (터치는 그대로 아래로 통과) */
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.confetti[hidden] { display: none; }

.win-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
}

.win-expr {
  margin: 12px 0 24px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-line;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ----- 글자 입력 ----- */
.text-input {
  width: 100%;
  font: inherit;
  font-size: 18px;
  text-align: center;
  padding: 12px;
  margin: -8px 0 20px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ----- 순위표 ----- */
.ranking-status {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.ranking-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-height: 45vh;
  overflow-y: auto;
  text-align: left;
}

.ranking-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.ranking-list li.me {
  background: var(--accent-soft);
  border-radius: 10px;
  font-weight: 700;
}

.ranking-list .rank {
  width: 2em;
  text-align: center;
  font-weight: 800;
  color: var(--muted);
}

.ranking-list li:nth-child(1) .rank,
.ranking-list li:nth-child(2) .rank,
.ranking-list li:nth-child(3) .rank { color: var(--accent); }

.ranking-list .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-list .time { font-variant-numeric: tabular-nums; }

/* 순위 기간 탭 (오늘 / 이번 주 / 전체) */
.seg-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 12px;
}

.seg-tabs button {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 4px;
  font-size: 14px;
}

.seg-tabs button.active {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

/* 닉네임 신고 버튼 */
.report-btn {
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  padding: 2px 4px;
  opacity: 0.6;
}

/* ----- 기록 화면 ----- */
.stats-body { padding-right: 6px; }

.stats-body h3 {
  font-size: 15px;
  color: var(--accent);
  margin: 18px 0 10px;
}

.stats-body h3:first-child { margin-top: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat b { font-size: 18px; color: var(--text); }
.stat span { font-size: 11px; color: var(--muted); line-height: 1.3; }

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stat-table th, .stat-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  color: var(--text);
}

.stat-table th:first-child { text-align: left; color: var(--muted); font-weight: 600; }
.stat-table tr:first-child th { color: var(--muted); font-weight: 600; }

/* ----- 강조색 고르기 ----- */
.swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

#dialog-extra { margin: -8px 0 20px; }

.swatch {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px transparent;
  transition: transform 0.1s, box-shadow 0.1s;
}

.swatch.on {
  box-shadow: 0 0 0 2px var(--text);
  transform: scale(1.08);
}

.setting-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  text-align: left;
}

/* ----- 설정 ----- */
.settings-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  cursor: pointer;
}

.switch-row input { display: none; }

.switch {
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }

.setting-link {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  padding: 14px 4px;
  margin-bottom: 20px;
  font-size: 17px;
  border-bottom: 1px solid var(--line);
}

.setting-link.danger { color: var(--danger); }

/* 언어 고르기 */
.lang-select {
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  max-width: 55%;
}

/* ----- 개인정보처리방침 같은 긴 글 ----- */
.doc-card {
  max-width: 480px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.doc-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
}

.doc-body h1 { font-size: 20px; margin: 0 0 4px; }
.doc-body h2 { font-size: 16px; margin: 22px 0 6px; color: var(--accent); }
.doc-body h3 { font-size: 14px; margin: 14px 0 4px; }
.doc-body a { color: var(--accent); }
.doc-body p, .doc-body li { color: var(--muted); }
.doc-body ul { padding-left: 18px; }

.secondary {
  margin-top: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  padding: 10px;
  width: 100%;
}

.primary {
  background: var(--accent);
  color: var(--accent-text);
  font-size: 18px;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 14px;
  width: 100%;
}
