/* ═══════════════════════════════════════════
   혼공댕 App — Dark-first SaaS UI
   Matches landing page design system
   ═══════════════════════════════════════════ */

:root {
  --indigo: #6366f1;
  --indigo-light: #818cf8;
  --indigo-dark: #4f46e5;
  --green: #22c55e;
  --green-light: #4ade80;
  --green-dark: #16a34a;
  --pink: #f472b6;
  --amber: #fbbf24;
  --cyan: #22d3ee;
  --red: #ef4444;
  --red-light: #fca5a5;
  --orange: #f97316;

  /* Dark theme (default) */
  --bg: #0a0a0b;
  --bg-secondary: #111118;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --surface-border: rgba(255,255,255,0.08);
  --glass: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.1);
  --glass-strong: rgba(255,255,255,0.1);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #94a3b8;
  --glow-indigo: rgba(99,102,241,0.4);
  --glow-green: rgba(34,197,94,0.3);
  --card-shadow: 0 4px 24px rgba(0,0,0,0.3);
  --success: #22c55e;
  --success-light: rgba(34,197,94,0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245,158,11,0.15);
  --danger: #ef4444;
  --danger-light: rgba(239,68,68,0.15);
  --primary: var(--indigo);
  --primary-light: rgba(99,102,241,0.15);
  --accent: var(--indigo);
  --accent-light: rgba(99,102,241,0.15);
  --accent-glow: rgba(99,102,241,0.4);

  /* Spacing */
  --radius: 16px;
  --radius-lg: 24px;
  --font: 'Noto Sans KR', 'Inter', -apple-system, 'Pretendard', system-ui, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t: 0.3s var(--ease);

  /* Layout */
  --header-h: 60px;
  --tabbar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Performance & mobile UX */
html { overscroll-behavior-y: contain; -webkit-tap-highlight-color: transparent; }
body { touch-action: manipulation; }
img, picture { content-visibility: auto; }

/* Light theme */
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-secondary: #eef2ff;
  --surface: rgba(0,0,0,0.03);
  --surface-hover: rgba(0,0,0,0.05);
  --surface-border: rgba(0,0,0,0.08);
  --glass: rgba(255,255,255,0.7);
  --glass-border: rgba(0,0,0,0.08);
  --glass-strong: rgba(255,255,255,0.85);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #475569;
  --glow-indigo: rgba(99,102,241,0.25);
  --glow-green: rgba(34,197,94,0.2);
  --card-shadow: 0 4px 24px rgba(0,0,0,0.08);
  --success-light: rgba(34,197,94,0.12);
  --warning-light: rgba(245,158,11,0.12);
  --danger-light: rgba(239,68,68,0.12);
  --primary-light: rgba(99,102,241,0.12);
}

/* Parent mode theme override — teal accent */
body.parent-mode {
  --indigo: #0d9488;
  --indigo-light: #2dd4bf;
  --indigo-dark: #0f766e;
  --indigo-hover: #0f766e;
  --glow-indigo: rgba(13,148,136,0.4);
  --primary: #0d9488;
  --primary-light: rgba(13,148,136,0.15);
  --accent: #0d9488;
  --accent-light: rgba(13,148,136,0.15);
}
body.parent-mode .header { border-bottom-color: rgba(13,148,136,0.3); }
body.parent-mode .tab-item.active { color: #0d9488; border-top-color: #0d9488; }

/* ─── Reset ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Ambient glow */
body::before {
  content: '';
  position: fixed;
  top: -40%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(99,102,241,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════
   Top Header Bar
   ═══════════════════════════ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(10,10,11,0.7);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: background var(--t);
}
[data-theme="light"] .app-header { background: rgba(248,250,252,0.8); }

.header-child-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
  cursor: pointer;
  border: 2px solid var(--indigo);
  transition: all var(--t);
  flex-shrink: 0;
}
.header-child-avatar:hover { transform: scale(1.1); box-shadow: 0 0 12px var(--glow-indigo); }

.header-child-emoji {
  font-size: 1.6em;
  cursor: pointer;
  transition: transform var(--t);
  flex-shrink: 0;
}
.header-child-emoji:hover { transform: scale(1.2); }

.header-info { flex: 1; min-width: 0; }
.header-child-name {
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--t);
  color: var(--text-secondary);
}
.header-icon-btn:hover { background: var(--surface-hover); color: var(--text); }

.lang-toggle-mini {
  position: relative;
  display: inline-block;
}
.lang-toggle-mini .lang-current {
  padding: 4px 8px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 8px;
  transition: all var(--t);
}
.lang-toggle-mini .lang-current:hover { background: var(--surface-hover); }
.lang-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--card-bg, var(--bg-secondary));
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
  backdrop-filter: blur(12px);
}
.lang-menu.active { display: block; }
.lang-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  transition: background 0.15s;
  white-space: nowrap;
}
.lang-menu button:hover { background: rgba(99,102,241,0.2); color: #fff; }
.lang-menu button.active {
  color: var(--indigo-light, #818cf8);
  font-weight: 700;
  background: rgba(99,102,241,0.1);
}

/* ─── Header BI (Brand Identity) ─── */
.header-bi {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.bi-mascot {
  width: 44px;
  height: 44px;
  border-radius: 0;
  object-fit: contain;
  transition: transform var(--t);
}
.bi-mascot:hover { transform: scale(1.15); }
.bi-text {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--indigo-light), var(--green-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
}
.user-info:hover .user-avatar-img { border-color: var(--indigo-hover); }
.account-menu {
  display: none;
  position: absolute;
  top: 48px;
  right: 80px;
  background: var(--bg-secondary);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 8px 0;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 300;
}
.account-menu.active { display: block; }
.account-menu .account-menu-header {
  padding: 8px 16px;
  font-size: 0.75em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 4px;
}
.account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.85em;
  cursor: pointer;
  transition: background 0.15s;
}
.account-menu button:hover { background: var(--primary-light); }
.notif-wrapper { position: relative; }
.notif-bell { position: relative; font-size: 1.1em; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 0.6em; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.notif-panel {
  display: none; position: absolute; top: 40px; right: 0;
  background: var(--bg-secondary); border: 1px solid var(--surface-border);
  border-radius: 12px; min-width: 280px; max-width: 340px;
  max-height: 400px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 310;
}
.notif-panel.active { display: block; }
.notif-panel-header { padding: 12px 16px; font-weight: 700; font-size: 0.9em; border-bottom: 1px solid var(--surface-border); }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--surface-border); cursor: pointer; transition: background 0.15s; }
.notif-item:hover { background: var(--primary-light); }
.notif-item.read { opacity: 0.6; }
.notif-icon { font-size: 1.2em; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 0.82em; line-height: 1.4; }
.notif-time { font-size: 0.7em; color: var(--text-muted); margin-top: 2px; }
.notif-action { margin-top: 6px; padding: 4px 10px; background: var(--indigo); color: #fff; border: none; border-radius: 8px; font-size: 0.75em; cursor: pointer; }
.notif-action:hover { background: var(--indigo-hover); }
/* Toggle switch for notification settings */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface-border); border-radius: 12px; transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--indigo); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.notif-setting-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--surface-border); }
.notif-setting-row:last-child { border-bottom: none; }
.notif-setting-label { font-size: 0.85em; font-weight: 500; }
.notif-channel-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.notif-channel-row .coming-soon-badge { font-size: 0.7em; padding: 2px 8px; background: var(--warning-light); color: var(--warning); border-radius: 8px; font-weight: 600; }
.avatar-choice {
  cursor: pointer; text-align: center; padding: 10px 14px;
  border: 2px solid var(--surface-border); border-radius: 14px;
  transition: all 0.15s;
}
.avatar-choice:hover { border-color: rgba(99,102,241,0.4); }
.avatar-choice.selected { border-color: var(--indigo); background: rgba(99,102,241,0.1); box-shadow: 0 0 12px var(--glow-indigo); }
.user-avatar-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--indigo);
}
.user-name-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#login-btn {
  width: auto;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 4px;
}

/* ─── 3-Week View ─── */
.three-week-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}

.week-section {
  transition: all var(--t);
}
.week-section .week-section-label {
  font-size: 0.72em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  padding-left: 2px;
}
.week-section.past-week {
  opacity: 0.4;
  filter: grayscale(0.5);
  transform: scale(0.95);
  transform-origin: center top;
}
.week-section.current-week {
  /* normal — full color, full size */
}
.week-section.next-week {
  transform: scale(0.9);
  transform-origin: center top;
  opacity: 0.75;
}

/* Child switcher dropdown */
.child-switcher {
  display: none;
  position: absolute;
  top: calc(var(--header-h) + 4px);
  left: 16px;
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 8px;
  z-index: 110;
  box-shadow: var(--card-shadow);
  min-width: 200px;
}
.child-switcher.open { display: block; }
.child-switcher-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--t);
  font-weight: 600;
  font-size: 0.9rem;
}
.child-switcher-item:hover { background: var(--primary-light); }
.child-switcher-item.active { background: var(--primary-light); color: var(--indigo-light); }
.child-switcher-item img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
}

/* ═══════════════════════════
   Bottom Tab Bar
   ═══════════════════════════ */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  background: rgba(10,10,11,0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid var(--surface-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  transition: background var(--t);
}
[data-theme="light"] .tab-bar { background: rgba(248,250,252,0.9); }

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all var(--t);
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  font-family: var(--font);
}
.tab-item:hover { color: var(--text-secondary); }
.tab-item.active { color: var(--indigo-light); }

.tab-icon { font-size: 1.35rem; line-height: 1; }
.tab-label { font-size: 0.65rem; font-weight: 600; }

.tab-item.active .tab-icon { transform: scale(1.1); }
.tab-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--indigo);
  border-radius: 0 0 3px 3px;
}
.tab-item { position: relative; }

/* ═══════════════════════════
   Main Content Area
   ═══════════════════════════ */
.app-content {
  padding-top: var(--header-h);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.container { max-width: 768px; margin: 0 auto; padding: 16px; }

/* ─── Views ─── */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════
   Glass Card
   ═══════════════════════════ */
.card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: all var(--t);
  box-shadow: var(--card-shadow);
}
.card:hover { border-color: rgba(99,102,241,0.2); }

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════
   Onboarding Flow
   ═══════════════════════════ */
.onboarding-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: linear-gradient(180deg, #0a0a0b 0%, #1a1a2e 50%, #0a0a0b 100%);
  color: #f1f5f9;
  overflow-y: auto;
}
.onboarding-screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.onboarding-step {
  display: none;
  max-width: 480px;
  width: 90%;
  text-align: center;
  animation: fadeIn 0.4s ease;
}
.onboarding-step.active { display: block; }

.onboarding-mascots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}
.onboarding-mascots img {
  width: clamp(80px, 18vw, 120px);
  border-radius: 16px;
  animation: mascotFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(99,102,241,0.3));
}
.onboarding-mascots img:nth-child(2) { animation-delay: 0.5s; }

@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.onboarding-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--indigo-light), var(--cyan), var(--green-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.onboarding-subtitle {
  font-size: 1rem;
  color: #94a3b8;
  margin-bottom: 32px;
  line-height: 1.7;
}

.onboarding-progress {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}
.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: all var(--t);
}
.onboarding-dot.active { background: var(--indigo); width: 24px; border-radius: 4px; }
.onboarding-dot.done { background: var(--green); }

/* Login button */
.ob-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: var(--font);
}
.ob-btn-google {
  background: white;
  color: #1f2937;
}
.ob-btn-google:hover { background: #f1f5f9; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,255,255,0.15); }
.ob-btn-pin {
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.3);
}
.ob-btn-pin:hover { background: rgba(99,102,241,0.25); }
.ob-btn-skip {
  background: transparent;
  color: #64748b;
  font-size: 0.85em;
  padding: 10px;
}
.ob-btn-primary {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-dark));
  color: white;
  box-shadow: 0 4px 24px var(--glow-indigo);
}
.ob-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px var(--glow-indigo); }
.ob-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.ob-btn-success {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  box-shadow: 0 4px 24px var(--glow-green);
}

.ob-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: #475569;
  font-size: 0.85em;
}
.ob-divider::before, .ob-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.1);
}

/* Mascot selection */
.mascot-choice {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 24px 0;
}
.mascot-option {
  padding: 20px;
  border: 3px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--t);
  text-align: center;
  min-width: 140px;
  background: rgba(255,255,255,0.03);
}
.mascot-option:hover { border-color: rgba(99,102,241,0.4); }
.mascot-option.selected { border-color: var(--indigo); background: rgba(99,102,241,0.1); box-shadow: 0 0 24px var(--glow-indigo); }
.mascot-option img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: contain;
  margin-bottom: 8px;
}
.mascot-option-label { font-weight: 700; font-size: 0.95rem; }

/* Child profile form */
.ob-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: #f1f5f9;
  font-size: 1rem;
  font-family: var(--font);
  margin-bottom: 12px;
  transition: border-color var(--t);
}
.ob-input:focus { outline: none; border-color: var(--indigo); }
.ob-input::placeholder { color: #64748b; }

/* Subject selection grid */
.subject-pick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 20px 0;
  text-align: left;
}
.subject-pick-item {
  padding: 12px 16px;
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--t);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.03);
}
.subject-pick-item:hover { border-color: rgba(99,102,241,0.3); }
.subject-pick-item.selected { border-color: var(--indigo); background: rgba(99,102,241,0.12); }
.subject-pick-item .pick-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all var(--t);
  flex-shrink: 0;
}
.subject-pick-item.selected .pick-check {
  background: var(--indigo);
  border-color: var(--indigo);
}

/* ─── Quiz Onboarding Cards ─── */
.quiz-progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 20px;
  max-width: 480px;
  width: 90%;
}
.quiz-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--green));
  border-radius: 3px;
  transition: width 0.4s var(--ease);
}
.quiz-progress-label {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 36px;
  text-align: center;
}

.quiz-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 24px 0;
  max-width: 420px;
  width: 100%;
}
.quiz-cards.quiz-cards-multi {
  grid-template-columns: repeat(3, 1fr);
}
.quiz-cards.quiz-cards-vertical {
  grid-template-columns: 1fr;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 14px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.quiz-card:hover { border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.06); }
.quiz-card:active { transform: scale(0.97); }
.quiz-card.selected {
  border-color: var(--indigo);
  background: rgba(99,102,241,0.15);
  box-shadow: 0 0 20px var(--glow-indigo);
}

.quiz-card.quiz-card-wide {
  flex-direction: row;
  justify-content: flex-start;
  padding: 16px 20px;
  gap: 14px;
}
.quiz-card.quiz-card-wide .quiz-card-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.quiz-card.quiz-card-wide .quiz-card-desc {
  font-size: 0.82em;
  color: #94a3b8;
  margin-top: 2px;
}

.quiz-card.quiz-card-mascot {
  padding: 18px 14px;
}

.quiz-card-emoji { font-size: 2.2em; }
.quiz-card-label { font-size: 1em; font-weight: 700; color: #f1f5f9; margin-top: 4px; }

.quiz-mascot-img {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: contain;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 12px rgba(99,102,241,0.3));
}

@media (max-width: 400px) {
  .quiz-cards { gap: 8px; }
  .quiz-cards.quiz-cards-multi { grid-template-columns: repeat(2, 1fr); }
  .quiz-card { padding: 14px 10px; }
  .quiz-card-emoji { font-size: 1.4em; }
  .quiz-mascot-img { width: 56px; height: 56px; }
}

/* ═══════════════════════════
   Intro Onboarding Slides
   ═══════════════════════════ */
.intro-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0a0a0b 0%, #0f172a 50%, #0a0a0b 100%);
  overflow: hidden;
}
.intro-slides-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.intro-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 20px;
}
.intro-slide.active {
  opacity: 1;
  pointer-events: auto;
}
.intro-slide-inner {
  max-width: 480px;
  width: 100%;
  text-align: center;
  padding: 0 16px;
}

/* Slide 1 — Hook animations */
.intro-s1-lines {
  margin-bottom: 32px;
}
.intro-s1-line {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(10px);
}
.intro-s1-line.show {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.intro-s1-line.struck span {
  text-decoration: line-through;
  opacity: 0.45;
  transition: opacity 0.4s ease;
}
.intro-s1-result {
  opacity: 0;
  transform: translateY(10px);
}
.intro-s1-result.show {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.intro-s1-result p {
  font-size: 1.15rem;
  color: #f1f5f9;
  line-height: 1.7;
  margin-bottom: 8px;
}
.intro-author {
  color: var(--text-secondary) !important;
  font-size: 0.95rem !important;
  font-style: italic;
}

/* Slide 2 — VS */
.intro-s2-versus {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-bottom: 28px;
  font-size: 3em;
}
.intro-s2-emoji {
  font-size: 1em;
  animation: mascotFloat 3s ease-in-out infinite;
}
.intro-s2-emoji:nth-child(3) { animation-delay: 0.5s; }
.intro-s2-divider {
  font-size: 0.45em;
  font-weight: 900;
  color: var(--red);
  letter-spacing: 2px;
  transition: opacity 0.8s ease;
}
.intro-s2-divider.fade {
  opacity: 0.1;
}
.intro-main-text {
  font-size: 1.2rem;
  color: #f1f5f9;
  line-height: 1.7;
  margin-bottom: 6px;
}
.intro-reveal-text {
  font-size: 1.1rem;
  color: var(--indigo-light);
  font-weight: 700;
  margin-top: 16px;
  opacity: 0;
  transform: translateY(8px);
}
.intro-reveal-text.show {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Slide 3 — 전환 */
.intro-s3-icon {
  font-size: 2.5em;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}
.intro-s3-old {
  font-size: 1.2rem;
  color: #f1f5f9;
  margin-bottom: 8px;
  transition: all 0.6s ease;
}
.intro-s3-old.struck {
  text-decoration: line-through;
  opacity: 0.4;
}
.intro-s3-bridge {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 8px 0;
}
.intro-s3-new {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--indigo-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0;
  transform: scale(0.95);
}
.intro-s3-new.highlight {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.intro-s3-suffix {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 8px;
  opacity: 0;
}
.intro-s3-suffix.show {
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Slide 4 — Mockup card */
.intro-headline {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 12px;
}
.intro-s4-mockup {
  margin-top: 24px;
}
.intro-mockup-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px 20px;
  text-align: left;
  max-width: 320px;
  margin: 0 auto;
}
.mockup-header {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--indigo-light);
}
.mockup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mockup-row:last-child { border-bottom: none; }
.mockup-done { color: var(--green); font-weight: 600; }
.mockup-prog { color: var(--amber); font-weight: 600; }
.mockup-pct { color: var(--indigo-light); font-weight: 700; }

/* Slide 5 — Balance */
.intro-s5-balance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 24px 0 16px;
  font-size: 2.5em;
}
.intro-s5-emoji { animation: mascotFloat 3s ease-in-out infinite; }
.intro-s5-emoji:nth-child(3) { animation-delay: 0.5s; }
.intro-s5-scale {
  font-size: 1em;
  animation: pulse 2s ease-in-out infinite;
}
.intro-s5-schedule {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.schedule-block {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.schedule-block.study {
  background: rgba(99,102,241,0.15);
  color: var(--indigo-light);
  border: 1px solid rgba(99,102,241,0.3);
}
.schedule-block.game {
  background: rgba(34,197,94,0.15);
  color: var(--green-light);
  border: 1px solid rgba(34,197,94,0.3);
}

/* Slide 6 — Contract */
.intro-s6-contract {
  margin-top: 24px;
}
.contract-mockup {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 20px;
  max-width: 340px;
  margin: 0 auto;
  text-align: left;
}
.contract-title {
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--amber);
  margin-bottom: 14px;
}
.contract-terms {
  margin-bottom: 16px;
}
.contract-term {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.contract-term:last-child { border-bottom: none; }
.contract-signatures {
  display: flex;
  gap: 16px;
  justify-content: center;
}
.contract-sig {
  flex: 1;
  text-align: center;
}
.contract-sig span {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.sig-line {
  border-top: 2px dashed rgba(255,255,255,0.2);
  padding-top: 6px;
  font-size: 1.2em;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

/* Slide 7 — CTA */
.intro-s7-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.intro-s7-mascot {
  width: clamp(100px, 28vw, 160px);
  border-radius: 16px;
  margin-bottom: 24px;
  animation: mascotFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(99,102,241,0.3));
}
.intro-s7-text {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--indigo-light), var(--cyan), var(--green-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.intro-s7-btn {
  font-size: 1.1rem;
  padding: 16px 48px;
}

/* Dot indicators */
.intro-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 16px 0;
  flex-shrink: 0;
}
.intro-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: all 0.3s ease;
}
.intro-dot.active {
  background: var(--indigo);
  width: 24px;
  border-radius: 4px;
}

/* Skip button */
.intro-skip-btn {
  display: block;
  margin: 0 auto;
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s;
  font-family: var(--font);
  flex-shrink: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.intro-skip-btn:hover { color: rgba(255,255,255,0.6); }

/* Completion animation */
.ob-complete-emoji {
  font-size: 4rem;
  animation: mascotFloat 2s ease-in-out infinite;
  margin-bottom: 16px;
}

/* ═══════════════════════════
   PIN Login Modal (matches onboarding)
   ═══════════════════════════ */
.pin-login-card { text-align: center; }
.pin-input-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}
.pin-digit {
  width: 48px;
  height: 56px;
  border: 2px solid var(--surface-border);
  border-radius: 12px;
  font-size: 1.5em;
  font-weight: 800;
  text-align: center;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
}
.pin-digit:focus { border-color: var(--indigo); outline: none; }

/* ═══════════════════════════
   Child Selector Screen
   ═══════════════════════════ */
.child-selector {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: linear-gradient(180deg, #0a0a0b 0%, #1a1a2e 50%, #0a0a0b 100%);
  color: #f1f5f9;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.child-selector.active { display: flex; }

.child-selector-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(20px);
}
.child-selector h2 { font-size: 1.4em; font-weight: 800; margin-bottom: 8px; }
.child-selector p { color: #94a3b8; margin-bottom: 24px; }

.child-profiles { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 24px; }

.child-profile-btn {
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 20px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-width: 120px;
  color: #f1f5f9;
}
.child-profile-btn:hover { border-color: #6366f1; transform: translateY(-4px); box-shadow: 0 8px 24px rgba(99,102,241,0.2); }
.child-profile-btn .avatar { font-size: 2.5em; margin-bottom: 8px; display: block; }
.child-profile-btn .name { font-weight: 700; font-size: 1.1em; }
.child-profile-btn .age { font-size: 0.85em; color: #94a3b8; }

/* ═══════════════════════════
   Week Navigation
   ═══════════════════════════ */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  position: relative;
}
.week-nav button {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--t);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.week-nav button:hover { background: var(--primary-light); border-color: var(--indigo); }
.week-nav .today-btn { font-size: 0.75em; padding: 5px 12px; background: var(--indigo); color: #fff; border-color: var(--indigo); border-radius: 20px; margin-left: 8px; }
.week-nav .today-btn:hover { background: var(--indigo-hover); }
.week-nav .week-label {
  font-size: 1rem;
  font-weight: 700;
}

/* ─── Stat Cards ─── */
.stat-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  transition: all var(--t);
}
.stat-card:hover { border-color: rgba(99,102,241,0.2); }
.stat-emoji { font-size: 1.3em; }
.stat-value { font-size: 1.4em; font-weight: 800; background: linear-gradient(135deg, var(--indigo-light), var(--green-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 0.72em; color: var(--text-muted); margin-top: 2px; }

/* ─── Week Grid ─── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}
.day-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 2px solid transparent;
}
.day-card:hover { border-color: var(--indigo); transform: translateY(-2px); }
.day-card.today { border-color: var(--indigo); box-shadow: 0 0 16px var(--glow-indigo); background: rgba(99,102,241,0.1); }
.day-card.today .day-name { color: var(--indigo-light, #818cf8); font-weight: 800; }
.day-card.today .day-date { color: var(--indigo-light, #818cf8); font-size: 1.5em; }
.today-badge { font-size: 0.6em; font-weight: 800; color: #fff; background: var(--indigo, #6366f1); border-radius: 8px; padding: 1px 6px; margin: -2px auto 1px; letter-spacing: 0.5px; }
.day-card.complete { border-color: var(--green); }
.day-card.holiday-card { border-color: var(--cyan); background: rgba(34,211,238,0.08); }

.day-card .day-name {
  font-size: 0.7em;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.day-card .day-date { font-size: 1.3em; font-weight: 800; }
.day-card .day-icon { font-size: 1.2em; }
.day-card .day-progress {
  width: 100%;
  height: 4px;
  background: var(--surface-border);
  border-radius: 2px;
  overflow: hidden;
}
.day-card .day-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.day-card .day-times { font-size: 0.75em; font-weight: 600; color: var(--text-muted); }

/* ═══════════════════════════
   Daily View
   ═══════════════════════════ */
.day-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.back-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  transition: all var(--t);
}
.back-btn:hover { background: var(--primary-light); }
.day-header h2 { font-size: 1.1em; font-weight: 700; flex: 1; }
.day-progress-summary {
  font-size: 1rem;
  font-weight: 700;
  color: var(--indigo-light);
}

/* ─── Plan Chips ─── */
.plan-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.plan-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.plan-chip.unchecked { opacity: 0.35; filter: grayscale(0.5); }

.add-custom-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
  background: var(--surface);
  border: 2px dashed var(--text-muted);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.add-custom-btn:hover { background: var(--primary-light); border-color: var(--indigo); color: var(--indigo-light); }

/* ─── Progress Bar ─── */
.slots-progress { margin-bottom: 16px; }
.slots-progress-bar {
  width: 100%;
  height: 10px;
  background: var(--surface-border);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}
.slots-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--green));
  border-radius: 5px;
  transition: width 0.5s ease;
}
.slots-progress-text {
  font-size: 0.82em;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
}

/* ─── Slot Items ─── */
.slot-item {
  display: grid;
  grid-template-columns: 44px 1fr 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--surface-border);
  transition: all 0.3s;
}
.slot-item:last-child { border-bottom: none; }
.slot-item.school-slot {
  background: linear-gradient(135deg, rgba(5,150,105,0.08), rgba(16,185,129,0.04));
  border-left: 3px solid #059669;
  padding-left: 8px;
  margin: 2px -4px;
  border-radius: 8px;
}

.slot-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--indigo-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82em;
}
.slot-num.done { background: var(--success-light); color: var(--green); font-size: 1em; }

.slot-item select,
.slot-item input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  font-size: 0.88em;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.slot-item select { cursor: pointer; }
.slot-item select option { background: var(--bg); color: var(--text); }

.slot-done-check {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: var(--green);
}

.slot-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85em;
  padding: 4px;
  opacity: 0.3;
  transition: opacity 0.2s;
}
.slot-delete-btn:hover { opacity: 1; }

.add-slot-btn {
  margin-top: 12px;
  width: 100%;
  padding: 12px;
  background: var(--surface);
  border: 2px dashed var(--surface-border);
  border-radius: 10px;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.add-slot-btn:hover { border-color: var(--indigo); color: var(--indigo-light); background: var(--primary-light); }

/* ─── Slot Timer ─── */
.slot-timer-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 6px 44px;
  flex-wrap: wrap;
}
.slot-timer-controls { display: flex; gap: 4px; align-items: center; }
.slot-timer-btn {
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.82em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font);
}
.slot-timer-btn.start-btn { background: var(--primary-light); color: var(--indigo-light); }
.slot-timer-btn.start-btn:hover { background: var(--indigo); color: white; }
.slot-timer-btn.pause-btn { background: var(--warning-light); color: var(--amber); }
.slot-timer-btn.pause-btn:hover { background: var(--warning); color: white; }
.slot-timer-btn.end-btn { background: var(--danger-light); color: var(--red); }
.slot-timer-btn.end-btn:hover { background: var(--danger); color: white; }
.slot-timer-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.slot-timer-display {
  font-size: 1.1em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  min-width: 54px;
  text-align: center;
}
.slot-timer-display.running { color: var(--indigo-light); animation: timer-blink 1.2s ease-in-out infinite; }
.slot-timer-display.paused { color: var(--amber); }
.slot-timer-display.done { color: var(--green); }

@keyframes timer-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.slot-timer-info {
  font-size: 0.8em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.slot-timer-info .edit-time-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1em;
  padding: 0 2px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.slot-timer-info .edit-time-btn:hover { opacity: 1; }

.slot-item.timer-running { background: var(--primary-light); border-radius: 10px; padding: 10px 6px; margin: 0 -6px; }
.slot-item.timer-paused { background: var(--warning-light); border-radius: 10px; padding: 10px 6px; margin: 0 -6px; }
.slot-item.timer-done { background: var(--success-light); border-radius: 10px; padding: 10px 6px; margin: 0 -6px; }

/* ─── Progress Row ─── */
.progress-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  font-size: 0.82em;
  color: var(--text-secondary);
}
.progress-row input {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  font-size: 0.9em;
  text-align: center;
  background: var(--surface);
  color: var(--text);
}

/* ─── Review ─── */
.review-textarea {
  width: 100%;
  min-height: 100px;
  padding: 14px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  font-size: 0.95em;
  font-family: var(--font);
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  line-height: 1.6;
}
.review-textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--glow-indigo);
}

/* Parent Note */
.parent-note-area {
  width: 100%;
  min-height: 80px;
  padding: 14px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  font-size: 0.95em;
  font-family: var(--font);
  resize: vertical;
  background: rgba(251,191,36,0.06);
  color: var(--text);
  line-height: 1.6;
}

.parent-approve-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.approve-chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--surface-border);
  background: var(--surface);
  transition: all 0.2s;
  color: var(--text);
}
.approve-chip.approved { border-color: var(--green); background: var(--success-light); color: var(--green); }

/* ═══════════════════════════
   Monthly Calendar
   ═══════════════════════════ */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.month-nav button {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  transition: all var(--t);
}
.month-nav button:hover { background: var(--primary-light); }
.month-nav .month-label { font-size: 1rem; font-weight: 700; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
.cal-header-cell {
  text-align: center;
  font-size: 0.75em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 0;
  text-transform: uppercase;
}
.cal-cell {
  background: var(--glass);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all var(--t);
  border: 2px solid transparent;
}
.cal-cell:hover { border-color: var(--indigo); }
.cal-cell.today { border-color: var(--indigo); box-shadow: 0 0 8px var(--glow-indigo); }
.cal-cell.empty { background: transparent; cursor: default; border: none; }
.cal-cell.future { opacity: 0.4; }
.cal-cell.holiday { background: rgba(34,211,238,0.08); border-color: var(--cyan); }
.cal-cell.full { background: var(--success-light); }
.cal-cell.half { background: var(--warning-light); }
.cal-cell.low { background: var(--danger-light); }

.cal-date { font-size: 0.82em; font-weight: 700; }
.cal-times { font-size: 0.65em; font-weight: 600; color: var(--text-muted); }

/* ═══════════════════════════
   Books Tab
   ═══════════════════════════ */
.book-card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
  transition: all var(--t);
  cursor: pointer;
}
.book-card:hover { border-color: var(--indigo); transform: translateX(4px); }

.book-cover {
  width: 48px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
}
.book-cover-emoji {
  width: 48px;
  height: 64px;
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  flex-shrink: 0;
}
.book-info { flex: 1; min-width: 0; cursor: pointer; }
.book-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.book-complete-btn, .book-delete-btn {
  background: none; border: none; cursor: pointer; font-size: 1.1em; padding: 4px 6px;
  border-radius: 6px; transition: all 0.15s;
}
.book-complete-btn:hover { background: rgba(34,197,94,0.15); transform: scale(1.15); }
.book-delete-btn:hover { background: rgba(239,68,68,0.15); transform: scale(1.15); }
.book-info .book-title { font-weight: 700; font-size: 0.92em; word-break: break-word; line-height: 1.3; }
.book-info .book-meta { font-size: 0.78em; color: var(--text-muted); margin-top: 2px; }
.book-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.book-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--green));
  border-radius: 3px;
  transition: width 0.3s;
}
.book-pct { font-size: 0.85em; font-weight: 700; color: var(--indigo-light); flex-shrink: 0; }

.trophy-shelf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 12px;
  font-weight: 700;
}
.trophy-shelf-header img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }

.completed-book-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  margin-bottom: 8px;
  transition: all var(--t);
}
.completed-book-card:hover { border-color: var(--amber); box-shadow: 0 2px 12px rgba(251,191,36,0.15); }
.book-trophy { font-size: 1.4em; flex-shrink: 0; }

.completed-books-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.completed-books-filter button {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.78em;
  font-weight: 600;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.completed-books-filter button.active { background: var(--indigo); color: white; border-color: var(--indigo); }

/* ═══════════════════════════
   Game Time View
   ═══════════════════════════ */
.gametime-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.92em;
  margin-bottom: 16px;
  text-align: center;
}
.gametime-banner.freeze { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.gametime-banner.cheatday { background: var(--success-light); color: var(--green-light); border: 1px solid rgba(34,197,94,0.3); }

.gametime-balance-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
}
.gametime-balance-big {
  font-size: 3.2em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--indigo-light), var(--green-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
}
.gametime-balance-big.danger { background: linear-gradient(135deg, var(--red), var(--orange)); -webkit-background-clip: text; }

.gametime-available {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--green);
  margin-top: 4px;
}
.gametime-available.empty { color: var(--red); }

.gametime-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.gametime-meta-item { font-size: 0.82em; color: var(--text-muted); }

.gametime-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.gametime-actions button {
  padding: 10px 24px;
  border: none;
  border-radius: 12px;
  font-size: 0.95em;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
  font-family: var(--font);
}
.gametime-actions .use-btn {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-dark));
  color: white;
  box-shadow: 0 4px 16px var(--glow-indigo);
}
.gametime-actions .use-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px var(--glow-indigo); }
.gametime-actions .use-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.gametime-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.gametime-log-table th {
  text-align: left;
  padding: 8px 8px;
  border-bottom: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.82em;
}
.gametime-log-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.gametime-log-table .positive { color: var(--green); font-weight: 700; }
.gametime-log-table .negative { color: var(--red); font-weight: 700; }

/* Parent gametime actions */
.parent-gt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.parent-gt-actions button {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-size: 0.88em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.parent-gt-actions .bonus-btn { background: var(--success-light); color: var(--green); }
.parent-gt-actions .penalty-btn { background: var(--danger-light); color: var(--red); }
.parent-gt-actions .freeze-btn { background: rgba(59,130,246,0.12); color: #60a5fa; }
.parent-gt-actions .cheat-btn { background: var(--success-light); color: var(--green); }

/* ═══════════════════════════
   Plan View (과목 카테고리)
   ═══════════════════════════ */
.plan-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.plan-cat-card {
  background: var(--surface);
  border: 2px solid var(--surface-border);
  border-radius: 14px;
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s var(--ease);
  position: relative;
}
.plan-cat-card:hover { background: var(--surface-hover); }
.plan-cat-card.expanded {
  border-color: var(--indigo);
  background: var(--primary-light);
}
.plan-cat-card .plan-cat-emoji { font-size: 1.6em; display: block; margin-bottom: 4px; }
.plan-cat-card .plan-cat-name { font-size: 0.88em; font-weight: 700; color: var(--text); }
.plan-cat-card .plan-cat-count {
  font-size: 0.72em;
  color: var(--text-secondary);
  margin-top: 2px;
}
.plan-cat-subjects {
  margin-top: 10px;
  display: none;
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 12px;
}
.plan-cat-subjects.visible { display: block; }
.plan-subject-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--glass);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.plan-subject-toggle:hover { background: var(--surface-hover); }
.plan-subject-toggle.active {
  border-color: var(--green);
  background: var(--success-light);
}
.plan-subject-toggle .plan-subj-check {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8em;
  transition: all 0.15s;
  flex-shrink: 0;
}
.plan-subject-toggle.active .plan-subj-check {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.plan-subject-toggle .plan-subj-name { font-size: 0.88em; font-weight: 600; flex: 1; }
.plan-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82em;
  font-weight: 600;
  color: white;
  margin: 3px;
}
#plan-active-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ─── Drag & Drop Subject Move ─── */
.plan-subject-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  font-size: 1.1em;
  cursor: grab;
  flex-shrink: 0;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.plan-subject-drag-handle:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.plan-subject-drag-handle:active {
  cursor: grabbing;
}

/* Ghost element that follows pointer */
.dnd-ghost {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  padding: 8px 14px;
  background: var(--surface);
  border: 2px solid var(--indigo);
  border-radius: 10px;
  font-size: 0.88em;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  transform: scale(1.05);
  opacity: 0.92;
  white-space: nowrap;
  transition: opacity 0.15s;
}

/* Source item while dragging */
.plan-subject-toggle.dnd-dragging {
  opacity: 0.08;
  transform: scale(0.96);
  background: var(--surface-border) !important;
  transition: opacity 0.15s, transform 0.15s;
}

/* Category card as drop target */
.plan-cat-card.dnd-drop-target {
  border-color: var(--indigo) !important;
  background: var(--primary-light) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
  transform: scale(1.05);
  transition: all 0.15s ease;
}

/* Drop success flash */
.plan-cat-card.dnd-drop-success {
  animation: dnd-flash 0.4s ease;
}
@keyframes dnd-flash {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
  50% { box-shadow: 0 0 0 8px rgba(34,197,94,0.2); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* Overlay hint during drag */
.dnd-overlay-hint {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--indigo);
  color: white;
  text-align: center;
  font-size: 0.82em;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.dnd-overlay-hint.active {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════
   Day Plan DnD (Sprint 6)
   ═══════════════════════════════════════ */

/* Ghost chip following pointer */
.day-dnd-ghost {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  padding: 6px 12px;
  background: var(--indigo);
  border: 2px solid var(--indigo-light);
  border-radius: 8px;
  font-size: 0.78em;
  font-weight: 700;
  color: white;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
  transform: scale(1.08);
  opacity: 0.92;
  white-space: nowrap;
  transition: opacity 0.12s;
}

/* Source chip faded while dragging */
.subject-chip-small.day-chip-dragging {
  opacity: 0.15 !important;
  transform: scale(0.92);
  transition: opacity 0.15s, transform 0.15s;
}

/* All day columns glow subtly during drag */
.day-defaults-col.day-dnd-potential {
  border-color: rgba(99,102,241,0.25);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

/* Active drop target column */
.day-defaults-col.day-dnd-over {
  border-color: var(--indigo) !important;
  background: rgba(99,102,241,0.12) !important;
  box-shadow: inset 0 0 0 2px rgba(99,102,241,0.25), 0 0 12px rgba(99,102,241,0.15);
  transform: scale(1.02);
  transition: all 0.15s ease;
}

/* Insert position indicator line */
.day-dnd-insert-line {
  height: 3px;
  background: var(--indigo);
  border-radius: 2px;
  margin: 1px 2px;
  box-shadow: 0 0 6px rgba(99,102,241,0.5);
  animation: day-dnd-pulse 0.8s ease infinite alternate;
}
@keyframes day-dnd-pulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* Day chips container for proper layout */
.day-chips-container {
  min-height: 8px;
}

/* ═══════════════════════════
   Settings View
   ═══════════════════════════ */
.settings-section { margin-bottom: 16px; }
.settings-section h4 {
  font-size: 0.92em;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.subject-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 6px;
}
.subject-list-item .subject-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.subject-list-item .subject-name { flex: 1; font-weight: 600; font-size: 0.88em; }
.subject-list-item button {
  background: var(--glass);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  padding: 8px 10px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.subject-list-item button:active { background: var(--primary-light); transform: scale(0.95); }

/* Textbook item */
.textbook-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.85em;
}
.textbook-item .tb-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-border);
  border-radius: 3px;
  overflow: hidden;
}
.textbook-item .tb-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}

/* Day defaults grid */
.day-defaults-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 10px;
}
.day-defaults-col {
  text-align: center;
  min-width: 0;
  overflow: hidden;
  padding: 8px 3px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  min-height: 180px;
}
.day-defaults-col.weekend { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.2); }
.day-defaults-col .day-label {
  font-size: 0.78em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.day-defaults-col .subject-chip-small {
  font-size: 0.7em;
  padding: 3px 5px;
  border-radius: 6px;
  margin: 2px auto;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ─── Children Management ─── */
.child-mgmt-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 8px;
}
.child-mgmt-item .child-avatar { font-size: 1.8em; }
.child-mgmt-item .child-info { flex: 1; }
.child-mgmt-item .child-info .child-name { font-weight: 700; }
.child-mgmt-item .child-info .child-meta { font-size: 0.82em; color: var(--text-secondary); }
.child-mgmt-item button {
  background: var(--glass);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 1em;
}

/* Holiday items */
.holiday-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(34,211,238,0.06);
  border: 1px solid rgba(34,211,238,0.15);
  border-radius: 10px;
  margin-bottom: 6px;
}
.holiday-item .holiday-name { flex: 1; font-weight: 600; font-size: 0.9em; color: var(--cyan); }
.holiday-item .holiday-dates { font-size: 0.8em; color: var(--text-muted); }
.holiday-item button { background: none; border: none; cursor: pointer; font-size: 1em; padding: 4px; }

/* ═══════════════════════════
   Dashboard / Stats
   ═══════════════════════════ */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding: 10px 0;
}
.bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.bar-fill {
  width: 100%;
  max-width: 40px;
  border-radius: 6px 6px 0 0;
  transition: height 0.5s ease;
  min-height: 4px;
}
.bar-label {
  font-size: 0.65em;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  max-height: 50px;
  overflow: hidden;
}
.bar-value { font-size: 0.72em; font-weight: 700; margin-bottom: 4px; }

.trend-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.trend-label { width: 36px; font-size: 0.82em; font-weight: 600; color: var(--text-muted); text-align: right; }
.trend-bar-bg {
  flex: 1;
  height: 22px;
  background: var(--surface-border);
  border-radius: 6px;
  overflow: hidden;
}
.trend-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.72em;
  font-weight: 700;
  color: white;
}

/* Parent View */
.parent-day-row {
  display: grid;
  grid-template-columns: 80px 1fr 100px 100px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 6px;
}
.parent-day-date { font-weight: 700; font-size: 0.88em; }
.parent-day-slots { display: flex; flex-wrap: wrap; gap: 3px; }
.parent-slot-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}
.parent-slot-dot.done { background: var(--green); }
.parent-slot-dot.pending { background: var(--surface-border); }
.parent-day-rate { font-weight: 700; font-size: 0.88em; text-align: center; }

.parent-comment-btn {
  padding: 6px 12px;
  background: var(--primary-light);
  color: var(--indigo-light);
  border: none;
  border-radius: 8px;
  font-size: 0.8em;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

/* ═══════════════════════════
   Modals
   ═══════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 700;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 300px;
  max-width: 600px;
  width: 92%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  max-height: 80vh;
  overflow-y: auto;
}
.modal-box h3 { margin-bottom: 16px; font-weight: 700; }
.modal-box input,
.modal-box select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  font-size: 0.95em;
  font-family: var(--font);
  margin-bottom: 12px;
  background: var(--surface);
  color: var(--text);
}
select option { background: #1e1e2e; color: #e0e0e0; }
select optgroup { background: #2a2a3e; color: #a0a0c0; font-weight: 700; font-style: normal; }
.modal-box select option { background: var(--bg); color: var(--text); }
.modal-box .modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-box .modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88em;
  cursor: pointer;
  font-family: var(--font);
}

.btn-primary { background: var(--indigo); color: white; }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-cancel { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--surface-border) !important; }
.btn-danger { background: var(--red); color: white; }
.btn-success { background: var(--green); color: white; }

/* ═══════════════════════════
   Celebration & Effects
   ═══════════════════════════ */
.celebration-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.celebration-modal.active { display: flex; }

.celebration-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: celebrationPop 0.5s ease;
}
@keyframes celebrationPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.celebration-emoji { font-size: 4em; margin-bottom: 16px; animation: dogBounce 0.6s ease infinite alternate; }
.celebration-title { font-size: 1.5em; font-weight: 800; color: var(--indigo-light); margin-bottom: 8px; }
.celebration-subtitle { font-size: 1em; color: var(--text-secondary); margin-bottom: 20px; }
.celebration-content button {
  padding: 12px 32px;
  background: var(--indigo);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
}

@keyframes dogBounce {
  0% { transform: translateY(0) rotate(-5deg); }
  100% { transform: translateY(-10px) rotate(5deg); }
}

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall 3s ease-out forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Game Warning */
.game-warning-flash {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(239,68,68,0.2);
  z-index: 400;
  align-items: center;
  justify-content: center;
  animation: flashBg 0.5s ease 3;
  backdrop-filter: blur(4px);
}
.game-warning-flash.active { display: flex; }

.game-warning-popup {
  background: var(--bg-secondary);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.game-warning-popup .warn-emoji { font-size: 3em; }
.game-warning-popup .warn-title { font-size: 1.3em; font-weight: 800; color: var(--red); margin: 8px 0 4px; }
.game-warning-popup .warn-subtitle { font-size: 0.95em; color: var(--text-secondary); margin-bottom: 16px; }
.game-warning-popup button { padding: 10px 28px; background: var(--indigo); color: white; border: none; border-radius: 10px; font-size: 1em; font-weight: 700; cursor: pointer; font-family: var(--font); }

@keyframes flashBg {
  0%, 100% { background: rgba(239,68,68,0.1); }
  50% { background: rgba(239,68,68,0.3); }
}

/* VFX */
.paw-trail {
  position: fixed;
  font-size: 1.4em;
  pointer-events: none;
  z-index: 998;
  animation: pawTrailAnim 1.2s ease-out forwards;
}
@keyframes pawTrailAnim {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  20% { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(0.6) rotate(15deg) translateY(-40px); opacity: 0; }
}
.star-burst { position: fixed; inset: 0; pointer-events: none; z-index: 997; }
.star-burst .star { position: absolute; font-size: 1.5em; animation: starExplode 1.5s ease-out forwards; }
@keyframes starExplode { 0% { transform: translate(0,0) scale(0); opacity: 1; } 50% { opacity: 1; } 100% { opacity: 0; } }
@keyframes screenShake { 0%,100% { transform: translateX(0); } 10%,50%,90% { transform: translateX(-4px); } 30%,70% { transform: translateX(4px); } }
.shake { animation: screenShake 0.4s ease; }
@keyframes slotCompletePulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); } 70% { box-shadow: 0 0 0 15px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.slot-complete-pulse { animation: slotCompletePulse 0.8s ease; }
.floating-bone { position: fixed; font-size: 2em; pointer-events: none; z-index: 998; animation: floatBone 2s ease-out forwards; }
@keyframes floatBone { 0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; } 50% { transform: translateY(-60px) rotate(180deg) scale(1.3); opacity: 1; } 100% { transform: translateY(-120px) rotate(360deg) scale(0.5); opacity: 0; } }
.level-up-flash { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 3em; font-weight: 900; pointer-events: none; z-index: 999; text-shadow: 0 4px 12px rgba(0,0,0,0.3); animation: levelUpFlash 1.5s ease-out forwards; }
@keyframes levelUpFlash { 0% { transform: translate(-50%,-50%) scale(0); opacity: 0; } 30% { transform: translate(-50%,-50%) scale(1.4); opacity: 1; } 60% { transform: translate(-50%,-50%) scale(1); opacity: 1; } 100% { transform: translate(-50%,-50%) scale(1.2); opacity: 0; } }
.sparkle-ring { position: fixed; top: 50%; left: 50%; width: 200px; height: 200px; transform: translate(-50%,-50%); pointer-events: none; z-index: 997; }

@keyframes slideDown { 0% { transform: translateY(-100%); } 100% { transform: translateY(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* ─── Mascot helper for empty states ─── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 12px;
  margin: 0 auto 16px;
  opacity: 0.7;
  animation: mascotFloat 3s ease-in-out infinite;
}
.empty-state .empty-emoji {
  font-size: 3em;
  margin-bottom: 12px;
  animation: mascotFloat 3s ease-in-out infinite;
}
.empty-state p { font-size: 0.95em; line-height: 1.6; }

/* ─── Save Status ─── */
.save-status {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  right: 16px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.82em;
  font-weight: 600;
  z-index: 150;
  transition: all 0.3s;
  opacity: 0;
  transform: translateY(10px);
  backdrop-filter: blur(12px);
}
.save-status.show { opacity: 1; transform: translateY(0); }
.save-status.saving { background: var(--warning-light); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.save-status.saved { background: var(--success-light); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.save-status.error { background: var(--danger-light); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

/* ─── Paw loading ─── */
.paw-loading {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 30px;
}
.paw-loading .paw { font-size: 1.5em; animation: pawStep 1.2s ease-in-out infinite; opacity: 0.3; }
.paw-loading .paw:nth-child(1) { animation-delay: 0s; }
.paw-loading .paw:nth-child(2) { animation-delay: 0.2s; }
.paw-loading .paw:nth-child(3) { animation-delay: 0.4s; }
.paw-loading .paw:nth-child(4) { animation-delay: 0.6s; }
@keyframes pawStep { 0%,100% { opacity: 0.2; transform: scale(0.8) rotate(-15deg); } 50% { opacity: 1; transform: scale(1.1) rotate(0deg); } }

/* ─── Book Search ─── */
.book-search-container { position: relative; margin-bottom: 12px; }
.book-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  font-size: 0.95em;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
}
.book-search-input:focus { outline: none; border-color: var(--indigo); }
.book-search-results {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  max-height: 350px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--card-shadow);
  margin-top: 4px;
}
.book-search-results.active { display: block; }
.book-search-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface-border);
  transition: background 0.15s;
}
.book-search-item:last-child { border-bottom: none; }
.book-search-item:hover { background: var(--primary-light); }
.book-search-item img { width: 40px; height: 56px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.book-search-item .book-info { flex: 1; }
.book-search-item .book-info .book-title { font-weight: 600; font-size: 0.88em; word-break: break-word; line-height: 1.3; }
.book-search-item .book-info .book-author { font-size: 0.78em; color: var(--text-secondary); }
.book-search-item .book-info .book-pages { font-size: 0.75em; color: var(--indigo-light); }
.book-search-loading { text-align: center; padding: 16px; color: var(--text-secondary); font-size: 0.9em; }

/* ─── Scan Book ─── */
.scan-cover-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary-light);
  border: 2px dashed var(--indigo);
  border-radius: 10px;
  font-size: 0.95em;
  font-weight: 700;
  color: var(--indigo-light);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--font);
}
.scan-cover-btn:hover { background: var(--indigo); color: white; border-style: solid; }
.scan-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10,10,11,0.9);
  border-radius: var(--radius-lg);
  z-index: 10;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}
.scan-overlay.active { display: flex; }
.scan-overlay .scan-paws { display: flex; gap: 10px; }
.scan-overlay .scan-paw { font-size: 1.8em; animation: pawStep 1.2s ease-in-out infinite; opacity: 0.3; }
.scan-overlay .scan-paw:nth-child(1) { animation-delay: 0s; }
.scan-overlay .scan-paw:nth-child(2) { animation-delay: 0.2s; }
.scan-overlay .scan-paw:nth-child(3) { animation-delay: 0.4s; }
.scan-overlay .scan-text { font-size: 1.1em; font-weight: 700; color: var(--indigo-light); animation: pulse 1.5s ease-in-out infinite; }

/* ─── Quantity complete ─── */
.quantity-complete-btn {
  background: var(--success-light);
  color: var(--green);
  border: 2px solid var(--green);
  border-radius: 10px;
  padding: 8px 20px;
  font-size: 0.92em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.quantity-complete-btn:hover { background: var(--green); color: white; }

/* ─── Dog Mascot (bottom-left) ─── */
.dog-mascot {
  display: none; /* Hidden on mobile - we use mascots in empty states instead */
}

/* Show on desktop */
@media (min-width: 768px) {
  .dog-mascot {
    display: block;
    position: fixed;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
    left: 16px;
    z-index: 90;
    cursor: pointer;
    user-select: none;
    transition: transform 0.3s;
  }
  .dog-mascot img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 0;
    animation: mascotFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(99,102,241,0.3));
  }
  .dog-mascot:hover { transform: scale(1.2); }
  .dog-mascot .dog-speech {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--glass-strong);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 0.78em;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: var(--card-shadow);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
  }
  .dog-mascot:hover .dog-speech { opacity: 1; }
}

/* ═══════════════════════════
   Responsive
   ═══════════════════════════ */
@media (max-width: 767px) {
  .week-grid { gap: 4px; }
  .day-card { padding: 6px 4px; min-height: 85px; }
  .day-card .day-date { font-size: 1.1em; }
  .slot-item {
    grid-template-columns: 32px 1fr 32px;
    gap: 6px;
  }
  .slot-item .slot-note-input { display: none; }
  .slot-timer-row { padding-left: 8px !important; }
  .parent-day-row { grid-template-columns: 1fr 1fr; }
  .day-defaults-grid { grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .day-defaults-col .subject-chip-small { font-size: 0.62em; padding: 2px 3px; }
  .cal-cell { min-height: 44px; padding: 4px 2px; }
  .cal-date { font-size: 0.75em; }
  .cal-times { font-size: 0.6em; }
  .stat-card { min-width: 80px; padding: 10px 8px; }
  .stat-value { font-size: 1.2em; }
}

@media (min-width: 768px) {
  .container { padding: 24px; }
}

/* ─── Scrollbar styling ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Selection ─── */
::selection { background: rgba(99,102,241,0.3); color: white; }

/* Time select for timer */
.time-select {
  padding: 8px 6px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  font-size: 0.85em;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  cursor: pointer;
}

/* ═══════════════════════════
   Weekly Stats Section
   ═══════════════════════════ */
.stat-bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 8px 0; overflow: hidden; }
.stat-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; }
.stat-bar { width: 100%; border-radius: 4px 4px 0 0; transition: height 0.3s; min-height: 2px; }
.stat-bar-label { font-size: 0.65em; margin-top: 4px; color: var(--text-muted); }
.stat-bar-value { font-size: 0.7em; font-weight: 700; margin-bottom: 2px; }
.stat-bar-item.today-bar .stat-bar { box-shadow: 0 0 8px var(--glow-indigo); }
.stat-bar-item.today-bar .stat-bar-label { color: var(--indigo-light); font-weight: 700; }

.subject-stat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.subject-stat-bar { flex: 1; height: 20px; background: var(--surface-border); border-radius: 10px; overflow: hidden; }
.subject-stat-fill { height: 100%; border-radius: 10px; transition: width 0.3s; }
.subject-stat-name { font-size: 0.8em; min-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subject-stat-value { font-size: 0.75em; color: var(--text-secondary); min-width: 40px; text-align: right; }

.stats-section-title {
  font-size: 0.9em;
  font-weight: 700;
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.streak-display {
  text-align: center;
  padding: 12px;
}
.streak-number {
  font-size: 2.5em;
  font-weight: 900;
  background: linear-gradient(135deg, #f97316, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.streak-fire {
  display: inline-block;
  animation: fireFlicker 0.5s ease-in-out infinite alternate;
}
@keyframes fireFlicker {
  0% { transform: scale(1) rotate(-3deg); }
  100% { transform: scale(1.15) rotate(3deg); }
}
.streak-detail {
  font-size: 0.82em;
  color: var(--text-secondary);
  margin-top: 4px;
}

.month-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.month-overview-item {
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.month-overview-value {
  font-size: 1.3em;
  font-weight: 800;
  color: var(--indigo-light);
}
.month-overview-label {
  font-size: 0.72em;
  color: var(--text-muted);
  margin-top: 2px;
}
.top-subjects-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.top-subject-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82em;
  padding: 4px 8px;
  background: var(--surface);
  border-radius: 8px;
}
.top-subject-rank {
  font-weight: 800;
  color: var(--amber);
  min-width: 20px;
}

/* ═══════════════════════════════════════════
   Weekly Stats Enhancements
   ═══════════════════════════════════════════ */
/* Donut Ring */
.weekly-donut-wrap { text-align: center; margin-bottom: 12px; }
.weekly-donut-svg { display: block; margin: 0 auto; }
.weekly-donut-center { font-size: 1.6em; font-weight: 900; fill: var(--text); }
.weekly-donut-sub { font-size: 0.7em; fill: var(--text-secondary); }
/* Bar chart numbers */
.stat-bar-num { font-size: 0.6em; font-weight: 700; color: #fff; line-height: 1; white-space: nowrap; }
.stat-bar-num.inside { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); }
.stat-bar-num.outside { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); color: var(--text-muted); font-size: 0.55em; }
.stat-bar-item { position: relative; }
/* Best Day */
.stats-best-day { font-size: 0.85em; padding: 8px 12px; background: var(--surface); border-radius: 10px; margin-top: 8px; color: var(--amber); font-weight: 600; }
/* Balance Hint */
.stats-balance-hint { font-size: 0.8em; padding: 6px 10px; margin-top: 6px; color: var(--text-secondary); text-align: center; }
/* Missed summary & stacked bars */
.stats-missed-label { font-size: 0.82em; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; margin-top: 2px; }
.stats-missed-summary { font-size: 0.8em; color: var(--text-muted); margin-bottom: 6px; }
.missed-bar-stacked { display: flex; }
.missed-bar-done { height: 100%; background: var(--success); transition: width 0.3s; }
.missed-bar-missed { height: 100%; background: #ef4444; opacity: 0.7; transition: width 0.3s; }
.missed-bar-missed.orange { background: #f97316; }
.missed-stat-name { font-size: 0.8em; min-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.missed-stat-value { font-size: 0.75em; min-width: 70px; text-align: right; white-space: nowrap; }
.missed-stat-value .done { color: var(--success); font-weight: 700; }
.missed-stat-value .missed { color: #ef4444; font-weight: 700; }
.missed-stat-value .missed.orange { color: #f97316; }
.missed-stat-value .sep { color: var(--text-muted); }

/* ═══════════════════════════════════════════
   AI Insight Coach
   ═══════════════════════════════════════════ */
.ai-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface-border);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-insight-btn {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--indigo), #7c3aed);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.82em;
  cursor: pointer;
  transition: all var(--t);
  font-family: var(--font);
}
.ai-insight-btn:hover { opacity: 0.9; transform: scale(1.03); }
.ai-insight-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.plus-badge { display:inline-block; background:linear-gradient(135deg,var(--indigo),#7c3aed); color:#fff; font-size:0.65em; font-weight:700; padding:2px 6px; border-radius:6px; margin-left:6px; vertical-align:middle; letter-spacing:0.5px; }

.ai-insight-result {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(124,58,237,0.1));
  border-radius: 12px;
  padding: 14px;
  line-height: 1.7;
  font-size: 0.88em;
  white-space: pre-wrap;
}

.ai-insight-error {
  color: var(--danger);
  padding: 10px;
  text-align: center;
}

/* ═══════════════════════════════════════════
   XP / Level System
   ═══════════════════════════════════════════ */
.level-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
}
.level-badge:hover { background: var(--surface-hover); }
.level-num {
  font-size: 0.75em;
  font-weight: 800;
  color: var(--indigo-light);
}
.xp-bar-mini {
  width: 48px;
  height: 5px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
.xp-fill-mini {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-light));
  border-radius: 3px;
  transition: width 0.5s var(--ease);
}

/* Level-up popup */
.levelup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}
.levelup-overlay.active { display: flex; }

.levelup-card {
  text-align: center;
  padding: 40px 32px;
  background: var(--bg-secondary);
  border: 2px solid var(--indigo);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 60px var(--glow-indigo), 0 20px 60px rgba(0,0,0,0.5);
  max-width: 340px;
  width: 90%;
  position: relative;
  overflow: hidden;
  animation: levelUpBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes levelUpBounce {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
.levelup-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.levelup-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: lvlParticle 1.5s ease-out forwards;
}
@keyframes lvlParticle {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}
.levelup-star {
  position: absolute;
  font-size: 1.5em;
  animation: lvlStar 2s ease-out forwards;
  pointer-events: none;
}
@keyframes lvlStar {
  0% { transform: translate(0,0) rotate(0deg) scale(0); opacity: 1; }
  50% { transform: translate(var(--tx), var(--ty)) rotate(180deg) scale(1.2); opacity: 1; }
  100% { transform: translate(calc(var(--tx)*1.5), calc(var(--ty)*1.5)) rotate(360deg) scale(0); opacity: 0; }
}
.levelup-level-num {
  font-size: 4em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--indigo-light), var(--amber), var(--pink));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: lvlGradient 2s ease infinite;
  line-height: 1.1;
}
@keyframes lvlGradient {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.levelup-title-text {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 4px;
}
.levelup-subtitle {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.levelup-mascot-msg {
  font-size: 0.95em;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 20px;
}
.levelup-close-btn {
  padding: 10px 28px;
  background: var(--indigo);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
  transition: var(--t);
}
.levelup-close-btn:hover { background: var(--indigo-dark); transform: scale(1.05); }

/* XP gain toast */
.xp-toast {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  padding: 10px 18px;
  background: var(--indigo);
  color: white;
  font-weight: 700;
  font-size: 0.9em;
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--glow-indigo);
  transform: translateX(120%);
  transition: transform 0.4s var(--ease);
  pointer-events: none;
}
.xp-toast.show { transform: translateX(0); }

/* ═══════════════════════════════════════════
   Achievement / Badge System
   ═══════════════════════════════════════════ */

/* Achievement popup */
.achievement-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  z-index: 10001;
  padding: 32px 28px;
  background: var(--bg-secondary);
  border: 2px solid var(--amber);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 40px rgba(251,191,36,0.3), 0 20px 60px rgba(0,0,0,0.5);
  text-align: center;
  max-width: 320px;
  width: 85%;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
.achievement-popup.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.achievement-popup-title {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.achievement-popup-icon {
  font-size: 3em;
  margin: 8px 0;
  animation: achieveBounce 0.6s ease;
}
@keyframes achieveBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.achievement-popup-name {
  font-size: 1.2em;
  font-weight: 800;
  color: var(--text);
  margin: 4px 0;
}
.achievement-popup-xp {
  font-size: 0.95em;
  font-weight: 700;
  color: var(--indigo-light);
  margin-top: 8px;
}
.achievement-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.achievement-popup-backdrop.show { opacity: 1; pointer-events: auto; }

/* Badge grid (collection) */
.badge-collection-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  text-align: center;
  transition: var(--t);
  position: relative;
}
.badge-item.earned {
  border-color: var(--amber);
  background: rgba(251,191,36,0.06);
}
.badge-item.locked {
  opacity: 0.45;
  filter: grayscale(1);
}
.badge-icon {
  font-size: 2em;
  margin-bottom: 6px;
}
.badge-item.locked .badge-icon::after {
  content: '🔒';
  font-size: 0.5em;
  position: absolute;
  bottom: 50%;
  right: 30%;
}
.badge-name {
  font-size: 0.8em;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.badge-desc {
  font-size: 0.7em;
  color: var(--text-secondary);
}
.badge-date {
  font-size: 0.65em;
  color: var(--indigo-light);
  margin-top: 4px;
}
.badge-progress {
  font-size: 0.65em;
  color: var(--text-muted);
  margin-top: 3px;
}
.badge-progress-bar {
  width: 80%;
  height: 3px;
  background: var(--surface-border);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.badge-progress-fill {
  height: 100%;
  background: var(--indigo);
  border-radius: 2px;
  transition: width 0.5s var(--ease);
}

/* XP detail card in stats */
.xp-detail-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(99,102,241,0.02));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.xp-detail-level {
  font-size: 2.2em;
  font-weight: 900;
  color: var(--indigo-light);
  line-height: 1;
}
.xp-detail-info { flex: 1; }
.xp-detail-title-text {
  font-size: 0.95em;
  font-weight: 700;
  color: var(--text);
}
.xp-detail-bar {
  width: 100%;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  margin: 6px 0 4px;
  overflow: hidden;
}
.xp-detail-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-light));
  border-radius: 4px;
  transition: width 0.5s var(--ease);
}
.xp-detail-text {
  font-size: 0.75em;
  color: var(--text-secondary);
}

/* ─── Coach Tips (학습 코치 팁) ─── */
.coach-tip {
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(124,58,237,0.04));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 10px 0;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.coach-tip:hover { border-color: rgba(99,102,241,0.3); }
.coach-tip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82em;
  color: var(--text-secondary);
}
.coach-tip-header .mascot-icon { font-size: 1.1em; }
.coach-tip-header .tip-text { flex: 1; font-weight: 500; }
.coach-tip-header .tip-toggle {
  font-size: 0.75em;
  color: var(--indigo-light, #818cf8);
  transition: transform 0.2s;
}
.coach-tip.open .tip-toggle { transform: rotate(180deg); }
.coach-tip-body {
  display: none;
  padding: 10px 0 2px 28px;
  font-size: 0.78em;
  line-height: 1.7;
  color: var(--text-muted);
}
.coach-tip.open .coach-tip-body { display: block; }
.coach-tip-body .theory-tag {
  display: inline-block;
  background: rgba(99,102,241,0.1);
  color: var(--indigo-light, #818cf8);
  font-size: 0.85em;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 6px;
  font-weight: 600;
}
.coach-tip .tip-dismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7em;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  opacity: 0.4;
  transition: opacity 0.2s;
  z-index: 2;
  line-height: 1;
}
.coach-tip .tip-dismiss:hover { opacity: 1; }
.coach-tip-header .tip-toggle {
  margin-right: 16px;
}

/* ═══════════════════════════════════════════
   타임블록 타임라인 v2 — 기록 기반
   ═══════════════════════════════════════════ */

/* 헤더 */
.tb-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.tb-title {
  font-size: 0.9em;
  font-weight: 700;
  color: var(--text-primary);
}

/* 가로 스크롤 래퍼 */
.tb-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

/* 트랙 (상대 위치 컨테이너) */
.tb-track {
  position: relative;
  min-height: 70px;
  min-width: 300px;
}

/* 시간 라벨 */
.tb-hour-labels {
  position: relative;
  height: 18px;
  font-size: 0.65em;
  color: var(--text-secondary);
}
.tb-hour-label {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* 블록 컨테이너 */
.tb-blocks {
  position: relative;
  height: 48px;
  margin-top: 4px;
  transition: height 0.2s;
}
.tb-blocks.tb-multi-row {
  height: 96px;
}

/* 개별 블록 */
.tb-block {
  position: absolute;
  top: 0;
  height: 48px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.2s, box-shadow 0.2s;
  padding: 2px 4px;
  box-sizing: border-box;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  font-size: 0.72em;
  line-height: 1.2;
}
.tb-block:active {
  opacity: 0.8;
  transform: scale(0.97);
}

.tb-block-emoji {
  font-size: 1.1em;
}
.tb-block-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
.tb-block-time {
  font-size: 0.85em;
  opacity: 0.9;
  white-space: nowrap;
}

/* 진행 상태 */
.tb-done {
  opacity: 0.95;
  border: 2px solid rgba(255,255,255,0.4);
}
.tb-running {
  animation: tb-pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(34,197,94,0.5);
}
.tb-paused {
  opacity: 0.55;
  border: 2px dashed rgba(255,255,255,0.5);
}

@keyframes tb-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(34,197,94,0.4); }
  50% { opacity: 0.75; box-shadow: 0 0 14px rgba(34,197,94,0.7); }
}

/* "지금 여기" 마커 */
.tb-now-marker {
  position: absolute;
  top: 0;
  width: 2px;
  height: calc(100% - 18px);
  margin-top: 18px;
  background: #ef4444;
  z-index: 10;
  pointer-events: none;
}
.tb-now-label {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6em;
  color: #ef4444;
  font-weight: 700;
  white-space: nowrap;
  background: var(--card-bg, #fff);
  padding: 0 3px;
  border-radius: 3px;
}

/* 통계 */
.tb-stats {
  margin-top: 8px;
  font-size: 0.78em;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 600;
}

/* 320px 모바일 최적화 */
@media (max-width: 380px) {
  .tb-block {
    font-size: 0.62em;
    padding: 1px 2px;
  }
  .tb-blocks {
    height: 42px;
  }
  .tb-blocks.tb-multi-row {
    height: 84px;
  }
}

/* ═══ Timeslot Feature ═══ */

/* Time badge on plan chips */
.timeslot-badge {
  font-size: 0.6em;
  color: rgba(255,255,255,0.85);
  margin-top: 1px;
  white-space: nowrap;
  line-height: 1.2;
}

/* Timeslot modal overlay */
.timeslot-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: tsModalFadeIn 0.15s ease;
}

.timeslot-modal {
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 400px;
  animation: tsModalSlideUp 0.2s ease;
}

.timeslot-modal h3 {
  margin: 0 0 16px 0;
  font-size: 1.1em;
}

.timeslot-modal label {
  display: block;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.timeslot-modal input[type="time"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1em;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.timeslot-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.timeslot-buttons button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
}

.timeslot-btn-delete {
  background: var(--danger, #ef4444);
  color: white;
}

.timeslot-btn-cancel {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border) !important;
}

.timeslot-btn-save {
  background: var(--indigo);
  color: white;
}

@keyframes tsModalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes tsModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Scheduled/planned blocks on timeline */
.tb-block.tb-scheduled {
  opacity: 0.4;
  border: 2px dashed currentColor !important;
  z-index: 0 !important;
}

/* ═══ Timeblock Enhanced (Sprint 2) ═══ */

/* Header with controls */
.timeblock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 10px 0;
  gap: 8px;
}

.timeblock-title {
  font-weight: 700;
  font-size: 0.95em;
  white-space: nowrap;
}

.timeblock-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.timeblock-view-btn {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78em;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.timeblock-view-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.timeblock-view-btn:active {
  transform: scale(0.95);
}

.timeblock-add-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.85em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.timeblock-add-btn:active {
  transform: scale(0.93);
  opacity: 0.8;
}

/* Empty state */
.timeblock-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85em;
}

.timeblock-empty-icon {
  font-size: 1.5em;
  opacity: 0.5;
}

.timeblock-empty-text {
  opacity: 0.7;
}

.timeblock-empty-add {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.timeblock-empty-add:active {
  transform: scale(0.95);
}

/* Stats enhanced */
.timeblock-stat-item {
  display: inline;
}

.timeblock-stat-sep {
  margin: 0 6px;
  opacity: 0.4;
}

/* Subject breakdown bars */
.timeblock-breakdown {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  padding: 0 4px;
}

.timeblock-breakdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 18px;
}

.timeblock-breakdown-bar {
  height: 6px;
  border-radius: 3px;
  min-width: 4px;
  transition: width 0.3s ease;
}

.timeblock-breakdown-label {
  font-size: 0.72em;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Modal overlay */
.timeblock-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: tbModalFadeIn 0.15s ease;
}

.timeblock-modal {
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 400px;
  animation: tbModalSlideUp 0.2s ease;
}

.timeblock-modal h3 {
  margin: 0 0 16px 0;
  font-size: 1.1em;
}

.timeblock-modal label {
  display: block;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.timeblock-select,
.timeblock-modal input[type="time"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.05em;
  margin-bottom: 12px;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.timeblock-warn {
  color: var(--warning, #f59e0b);
  font-size: 0.82em;
  padding: 4px 0;
}

.timeblock-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.timeblock-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.timeblock-btn:active {
  transform: scale(0.97);
}

.timeblock-btn-save {
  background: var(--indigo);
  color: white;
}

.timeblock-btn-cancel {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border) !important;
}

.timeblock-btn-delete {
  background: var(--danger, #ef4444);
  color: white;
}

/* Quick subject chips in modal */
.timeblock-quick-label {
  font-size: 0.78em;
  color: var(--text-muted);
  margin-top: 12px;
  margin-bottom: 6px;
}

.timeblock-quick-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeblock-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 0.78em;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
}

.timeblock-quick-chip:active {
  transform: scale(0.93);
  opacity: 0.8;
}

@keyframes tbModalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes tbModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Completed block on timeline */
.tb-block.tb-completed {
  opacity: 0.95;
  border: 2px solid rgba(255,255,255,0.3);
}

/* Mobile: wider blocks touch target */
@media (max-width: 380px) {
  .timeblock-header {
    flex-wrap: wrap;
  }
  .timeblock-controls {
    flex-wrap: wrap;
  }
  .timeblock-modal {
    padding: 20px 16px;
  }
  .timeblock-btn {
    padding: 10px;
    font-size: 0.85em;
  }
  .timeblock-breakdown-item {
    height: 14px;
  }
}

/* ═══════════════════════════════════════════
   Category Picker Modal (Sprint 3)
   ═══════════════════════════════════════════ */

.category-picker-box {
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 16px !important;
}

.category-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.category-picker-header h3 { margin: 0; font-size: 1.1em; }
.category-picker-close {
  background: var(--surface);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 1em;
  cursor: pointer;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
}

.category-picker-search-wrap { margin-bottom: 12px; }
.category-picker-search {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92em;
  font-family: var(--font);
  box-sizing: border-box;
}
.category-picker-search:focus {
  border-color: var(--indigo);
  outline: none;
  box-shadow: 0 0 0 3px var(--glow-indigo);
}

.category-picker-section { margin-bottom: 14px; }
.category-picker-section-label {
  font-size: 0.78em;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-picker-recent {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.category-picker-recent-chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: none;
  color: #fff;
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: transform 0.1s, box-shadow 0.2s;
}
.category-picker-recent-chip:active { transform: scale(0.95); }

.category-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.category-picker-chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.category-picker-chip:hover { background: var(--surface-hover); }
.category-picker-chip.active {
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.category-picker-chip-count {
  font-size: 0.8em;
  opacity: 0.7;
  margin-left: 2px;
}

.category-picker-subject-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.category-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.92em;
  font-family: var(--font);
  text-align: left;
  width: 100%;
  transition: background 0.15s, transform 0.1s;
}
.category-picker-item:hover { background: var(--surface-hover); }
.category-picker-item:active { transform: scale(0.98); }
.category-picker-item-emoji { font-size: 1.2em; }
.category-picker-item-color {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-picker-item-name { flex: 1; }
.category-picker-goal {
  font-size: 0.75em;
  color: var(--text-muted);
}

.category-picker-all-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.category-picker-item-compact {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82em;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.category-picker-item-compact:hover {
  background: var(--surface-hover);
}
.category-picker-item-compact:active { transform: scale(0.95); }

.category-picker-flat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-picker-empty {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 0.9em;
}

.category-picker-subjects-section {
  animation: catPickerSlide 0.2s ease;
}
@keyframes catPickerSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   Self-Evaluation System (Sprint 3)
   ═══════════════════════════════════════════ */

.eval-modal-box {
  max-width: 420px;
  padding: 20px !important;
}
.eval-modal-box h3 {
  margin: 0 0 16px 0;
  font-size: 1em;
}

.eval-section {
  margin-bottom: 16px;
}
.eval-label {
  font-size: 0.88em;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.eval-hint {
  font-weight: 400;
  font-size: 0.85em;
  color: var(--text-muted);
}

.eval-stars {
  display: flex;
  gap: 6px;
}
.eval-star {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border: 2px solid var(--surface-border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  font-family: var(--font);
  color: var(--text);
}
.eval-star:hover {
  border-color: var(--indigo-light);
  background: var(--primary-light);
}
.eval-star.active {
  border-color: var(--indigo);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--glow-indigo);
}
.eval-star-emoji { font-size: 1.5em; }
.eval-star-num { font-size: 0.7em; color: var(--text-muted); font-weight: 700; }

.eval-memo-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88em;
  font-family: var(--font);
  box-sizing: border-box;
}
.eval-memo-input:focus {
  border-color: var(--indigo);
  outline: none;
}

.eval-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.eval-skip-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.88em;
  cursor: pointer;
  font-family: var(--font);
}
.eval-save-btn {
  flex: 2;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--indigo);
  color: #fff;
  font-size: 0.88em;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
}
.eval-save-btn:active { transform: scale(0.98); }

/* Evaluation badge in slot */
.eval-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--indigo-light);
  margin-left: 6px;
  cursor: pointer;
  white-space: nowrap;
}

/* Evaluation Stats Card */
.eval-stats-card h3 { margin: 0 0 12px 0; font-size: 1em; }
.eval-stats-grid { display: flex; flex-direction: column; gap: 10px; }
.eval-stat-row {
  display: grid;
  grid-template-columns: 100px 1fr 40px;
  align-items: center;
  gap: 8px;
}
.eval-stat-subject {
  font-size: 0.82em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eval-stat-bars { display: flex; flex-direction: column; gap: 3px; }
.eval-stat-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.eval-stat-label {
  font-size: 0.68em;
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
}
.eval-stat-bar {
  flex: 1;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
.eval-stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.eval-focus-bar { background: var(--indigo); }
.eval-understand-bar { background: var(--green); }
.eval-stat-val {
  font-size: 0.72em;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
}
.eval-stat-count {
  font-size: 0.68em;
  color: var(--text-muted);
  text-align: right;
}

@media (max-width: 380px) {
  .eval-star { padding: 6px 6px; }
  .eval-star-emoji { font-size: 1.2em; }
  .eval-stat-row { grid-template-columns: 80px 1fr 30px; }
  .category-picker-box { padding: 12px !important; }
}

/* ════════════════════════════════════════════
   Sprint 4: Weekly Retrospective
   ════════════════════════════════════════════ */

#retro-container h3 {
  margin: 0 0 14px 0;
  font-size: 1.05em;
}

.retro-eval-summary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.retro-eval-title {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.retro-eval-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.retro-eval-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 70px;
}

.retro-eval-emoji { font-size: 1.6em; }
.retro-eval-value { font-size: 1.2em; font-weight: 800; color: var(--indigo-light); }
.retro-eval-label { font-size: 0.72em; color: var(--text-muted); font-weight: 600; }

.retro-no-eval {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85em;
  padding: 10px;
  margin-bottom: 12px;
}

.retro-field {
  margin-bottom: 12px;
}

.retro-label {
  display: block;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.retro-textarea {
  width: 100%;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.88em;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.retro-textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.retro-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.retro-save-btn {
  padding: 8px 20px;
  background: var(--indigo);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.88em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.retro-save-btn:hover { opacity: 0.9; transform: scale(1.02); }
.retro-save-btn:active { transform: scale(0.98); }

.retro-save-status {
  font-size: 0.82em;
  font-weight: 600;
  transition: opacity 0.3s;
}
.retro-save-status.success { color: var(--success); }
.retro-save-status.error { color: var(--danger); }

/* ════════════════════════════════════════════
   Sprint 4: Growth Trends
   ════════════════════════════════════════════ */

#trends-container h3 {
  margin: 0 0 14px 0;
  font-size: 1.05em;
}

.trend-no-data {
  text-align: center;
  padding: 24px 16px;
}

.trend-no-data-emoji { font-size: 2.5em; margin-bottom: 8px; }
.trend-no-data-text { font-size: 1em; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; }
.trend-no-data-desc { font-size: 0.82em; color: var(--text-muted); }

.trend-section {
  margin-bottom: 20px;
}

.trend-section:last-child { margin-bottom: 0; }

.trend-section-title {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Bar chart for weekly rate */
.trend-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 0 8px;
}

.trend-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}

.trend-bar-item.trend-current .trend-bar {
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.trend-bar-item.trend-current .trend-bar-label {
  font-weight: 800;
  color: var(--indigo-light);
}

.trend-bar-value {
  font-size: 0.75em;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-align: center;
}

.trend-bar {
  width: 100%;
  max-width: 50px;
  border-radius: 6px 6px 0 0;
  transition: height 0.5s ease;
  min-height: 3px;
}

.trend-bar-label {
  font-size: 0.7em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

/* Focus/Understanding dual bar chart */
.trend-line-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 0 8px;
}

.trend-line-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.trend-line-item.trend-current .trend-bar-label {
  font-weight: 800;
  color: var(--indigo-light);
}

.trend-line-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  width: 100%;
  max-width: 50px;
  height: 80%;
}

.trend-line-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  min-height: 3px;
}

.trend-focus-bar { background: var(--indigo); opacity: 0.85; }
.trend-understand-bar { background: var(--green); opacity: 0.85; }

.trend-line-values {
  display: flex;
  gap: 4px;
  font-size: 0.68em;
  font-weight: 700;
  margin-top: 2px;
}

.trend-focus-val { color: var(--indigo-light); }
.trend-understand-val { color: var(--green); }

.trend-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 10px;
}

.trend-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72em;
  color: var(--text-muted);
  font-weight: 600;
}

.trend-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.trend-focus-dot { background: var(--indigo); }
.trend-understand-dot { background: var(--green); }

/* Streak trend row */
.trend-streak-row {
  display: flex;
  gap: 8px;
}

.trend-streak-item {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  transition: all 0.2s;
}

.trend-streak-item.trend-current {
  border-color: var(--indigo);
  background: rgba(99, 102, 241, 0.08);
}

.trend-streak-value {
  font-size: 1.1em;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

@media (max-width: 380px) {
  .trend-bar-chart,
  .trend-line-chart { height: 100px; }
  .trend-bar-label { font-size: 0.62em; }
  .retro-eval-stats { gap: 10px; }
  .retro-eval-emoji { font-size: 1.3em; }
}

/* ════════════════════════════════════════════
   Sprint 7: 회고 개선 루프
   ════════════════════════════════════════════ */

/* Previous Week Goal Banner */
.retro-prev-goal-banner { background: var(--glass); border: 1px solid var(--indigo); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.retro-prev-goal-label { font-size: 0.85em; font-weight: 700; color: var(--indigo-light); margin-bottom: 4px; }
.retro-prev-goal-text { font-size: 0.95em; font-weight: 600; margin-bottom: 8px; }
.retro-goal-status-row { display: flex; align-items: center; gap: 8px; }
.retro-goal-status-label { font-size: 0.82em; font-weight: 600; color: var(--text-muted); }
.retro-goal-status-select { padding: 4px 8px; border: 1px solid var(--surface-border); border-radius: 8px; background: var(--surface); font-size: 0.82em; font-family: var(--font); color: var(--text); }

/* Improvement Suggestions */
.retro-suggestions { margin-top: 14px; }
.retro-suggestions-title { font-size: 0.9em; font-weight: 700; margin-bottom: 8px; }
.retro-suggestion-card { display: flex; align-items: center; gap: 8px; padding: 10px; background: var(--glass); border: 1px solid var(--surface-border); border-radius: 8px; margin-bottom: 6px; font-size: 0.85em; }
.retro-suggestion-emoji { font-size: 1.1em; flex-shrink: 0; }
.retro-suggestion-text { line-height: 1.4; }

/* Monthly Retrospective */
.monthly-retro-title { font-size: 1em; font-weight: 700; margin-bottom: 12px; }
.monthly-retro-section { margin-bottom: 16px; }
.monthly-retro-section-title { font-size: 0.85em; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.monthly-retro-bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 0; }
.monthly-retro-bar-group { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; justify-content: flex-end; }
.monthly-retro-bars { display: flex; gap: 3px; align-items: flex-end; height: 80%; width: 100%; justify-content: center; }
.monthly-retro-bar { width: 14px; border-radius: 4px 4px 0 0; min-height: 3px; transition: height 0.3s ease; }
.monthly-retro-bar.focus { background: var(--indigo); }
.monthly-retro-bar.understand { background: var(--success); }
.monthly-retro-bar-label { font-size: 0.68em; color: var(--text-muted); margin-top: 4px; font-weight: 600; text-align: center; }
.monthly-retro-bar-value { font-size: 0.65em; color: var(--text-muted); margin-bottom: 2px; font-weight: 600; }
.monthly-retro-legend { display: flex; gap: 12px; justify-content: center; margin-top: 6px; font-size: 0.75em; }
.monthly-retro-legend-item { display: flex; align-items: center; gap: 4px; }
.monthly-retro-legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.monthly-retro-legend-dot.focus { background: var(--indigo); }
.monthly-retro-legend-dot.understand { background: var(--success); }
.monthly-retro-goal-list { list-style: none; padding: 0; margin: 0; }
.monthly-retro-goal-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--glass); border: 1px solid var(--surface-border); border-radius: 8px; margin-bottom: 6px; font-size: 0.85em; }
.monthly-retro-goal-status { flex-shrink: 0; font-size: 1.1em; }
.monthly-retro-goal-text { flex: 1; }
.monthly-retro-goal-week { font-size: 0.75em; color: var(--text-muted); flex-shrink: 0; }
.monthly-retro-stats-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.monthly-retro-stat { text-align: center; padding: 10px 14px; background: var(--glass); border: 1px solid var(--surface-border); border-radius: 10px; min-width: 80px; }
.monthly-retro-stat-value { font-size: 1.3em; font-weight: 800; color: var(--indigo-light); }
.monthly-retro-stat-label { font-size: 0.72em; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.monthly-retro-empty { text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.9em; }

#offline-bar { display: none; position: fixed; top: 0; left: 0; right: 0; background: #f59e0b; color: #1a1a1a; text-align: center; padding: 8px 16px; font-size: 0.82em; font-weight: 600; z-index: 10000; }

/* Earn toast */
.earn-toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px); background: #10b981; color: white; padding: 12px 20px; border-radius: 12px; font-size: 0.9em; font-weight: 600; opacity: 0; transition: all 0.3s; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.earn-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Toast Notifications ─── */
.hgd-toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px); padding: 12px 24px; border-radius: 12px; font-size: 0.9em; font-weight: 600; opacity: 0; transition: opacity 0.3s, transform 0.3s; z-index: 10001; pointer-events: auto; cursor: pointer; max-width: 90vw; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.hgd-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hgd-toast-info { background: var(--indigo, #6366f1); color: #fff; }
.hgd-toast-success { background: var(--green, #22c55e); color: #fff; }
.hgd-toast-error { background: var(--red, #ef4444); color: #fff; }
.hgd-toast-warning { background: var(--orange, #f97316); color: #fff; }

/* ─── Reduced motion preference ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
