:root {
  color-scheme: light dark;
  --bg: #f2f2f6;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #7a7a80;
  --accent: #2e7d32;
  --accent-soft: rgba(46, 125, 50, 0.12);
  --danger: #c62828;
  --danger-soft: rgba(198, 40, 40, 0.1);
  --pending: #b8860b;
  --pending-soft: rgba(184, 134, 11, 0.12);
  --neutral-soft: rgba(122, 122, 128, 0.12);
  --border: #e4e4e8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f12;
    --card: #1b1b1f;
    --text: #f2f2f2;
    --muted: #97979f;
    --accent: #4caf50;
    --accent-soft: rgba(76, 175, 80, 0.16);
    --danger: #ef5350;
    --danger-soft: rgba(239, 83, 80, 0.14);
    --pending: #e0b23a;
    --pending-soft: rgba(224, 178, 58, 0.14);
    --neutral-soft: rgba(151, 151, 159, 0.14);
    --border: #2b2b30;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 로그인 ---------- */
.login-box {
  max-width: 360px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
}
.login-icon { font-size: 40px; margin-bottom: 4px; }
.login-box h1 { margin: 0 0 4px; font-size: 22px; }
.login-box input {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  background: var(--card);
  color: var(--text);
  text-align: center;
  letter-spacing: 1px;
}
.login-box input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.login-box form { width: 100%; margin-top: 20px; }
.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}
.sub { color: var(--muted); margin: 0 0 8px; font-size: 14px; }

/* ---------- 대시보드 ---------- */
.dashboard {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted);
  transition: background 0.2s;
}
.brand-dot.on { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.brand-dot.off { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
h1 { font-size: 19px; margin: 0; font-weight: 700; }
/* 카드 제목(캐릭터 이름 등)이 더 눈에 띄어야 해서, 섹션 제목은 psection-label과 같은
   "조용한 라벨" 톤으로 낮춘다 (리뷰 공통 지적 - 위계가 흐릿함, 2026-07-30). */
h2 {
  font-size: 13px;
  margin: 0;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.status-row { display: flex; justify-content: space-between; align-items: center; }
.label { color: var(--muted); font-size: 14px; }
.value { font-weight: 700; font-size: 15px; }

.controls { display: flex; gap: 10px; padding: 12px; }
.btn {
  flex: 1;
  min-height: 48px;
  padding: 14px 8px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.06s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn-start { background: var(--accent); }
.btn-pause { background: var(--pending); }
.btn-stop { background: var(--danger); }
.btn-notify { background: #1565c0; width: 100%; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; text-align: center; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
}

/* ---------- 오늘 현황 ---------- */
#summary-section { margin-top: 22px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding: 0 2px;
}
.section-sub { color: var(--muted); font-size: 12.5px; }

.summary-cards { display: flex; flex-direction: column; gap: 12px; }
.empty-note { color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }

.char-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
}
.char-name { font-weight: 700; font-size: 16px; margin-bottom: 10px; }

.psection-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.psection-label:first-child { margin-top: 0; }

.badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.done { background: var(--accent-soft); color: var(--accent); }
/* "대기"는 경고가 아니라 중립 상태라서, 진짜 주의가 필요한 색(주황/빨강)과 안 섞이게
   회색 계열로 뺐다 (리뷰 지적 - 초록/주황이 배지·토글·버튼에 다 쓰여 색이 남발됨, 2026-07-30). */
.badge.pending { background: var(--neutral-soft); color: var(--muted); }

.attention-box {
  margin-bottom: 12px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
}
.attention-title { font-size: 13px; font-weight: 800; color: var(--danger); margin-bottom: 4px; }
.attention-item { font-size: 12.5px; color: var(--danger); line-height: 1.5; }

.currency-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.currency-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12.5px;
}
.currency-chip .name { color: var(--muted); }
.currency-chip .count { font-weight: 700; }
.currency-empty { color: var(--muted); font-size: 12.5px; }

/* ---------- 오늘 던전 설정 (프로필 관리) ---------- */
#profile-mgmt-section { margin-top: 22px; }
.bulk-btns { display: flex; gap: 8px; margin-bottom: 12px; }
.btn-chip {
  flex: 1;
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.btn-chip:active { transform: scale(0.97); }

.profile-cards { display: flex; flex-direction: column; gap: 12px; }

.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
  transition: opacity 0.15s;
}
.profile-card.dimmed { opacity: 0.5; }

.profile-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.profile-card-name { font-weight: 700; font-size: 15px; }

/* iOS 스타일 토글 스위치 - 터치로 누르기 편하게 충분히 크게 */
.toggle { position: relative; display: inline-block; width: 42px; height: 25px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s;
  cursor: pointer;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 21px; height: 21px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(17px); }

.toggle-chip-grid { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.toggle-chip { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

.repeat-section { display: flex; flex-direction: column; gap: 8px; }
.repeat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.repeat-input-wrap { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.repeat-input {
  width: 56px;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}
