/* ============ CARDS ============ */
.card { min-width: 0; background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; transition: transform 0.22s ease, box-shadow 0.22s ease; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ============ QUOTE ============ */
.quote-card { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-radius: var(--radius); padding: 20px; margin-bottom: 16px; position: relative; overflow: hidden; }
.quote-card::before { content: '"'; position: absolute; top: -10px; left: 10px; font-size: 80px; opacity: 0.15; font-family: Georgia, serif; }
.quote-text { font-size: 14px; line-height: 1.6; position: relative; z-index: 1; }
.quote-author { font-size: 12px; opacity: 0.7; margin-top: 8px; text-align: right; }

/* ============ PROGRESS / HERO ============ */
.progress-section { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.progress-ring-container { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.progress-ring-fill { fill: none; stroke: var(--primary); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.progress-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 16px; font-weight: 700; color: var(--primary); }
.progress-info { min-width: 0; }
.progress-info h3 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.progress-info p { font-size: 12px; color: var(--text-muted); }

/* hero (character card on today page) */
.hero-card {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 18px 16px 16px;
  background: linear-gradient(140deg, var(--primary) 0%, var(--accent) 100%);
  color: white; box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
  isolation: isolate;
}
.hero-card::after {
  content: ''; position: absolute; right: -40px; bottom: -50px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.36), transparent 70%);
  z-index: -1;
}
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-avatar {
  width: 64px; height: 64px; border-radius: 22px;
  background: rgba(255,255,255,0.22); display: flex; align-items: center; justify-content: center;
  font-size: 32px; backdrop-filter: blur(8px); flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.4);
}
.hero-meta { flex: 1; min-width: 0; }
.hero-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.hero-name { font-size: 17px; font-weight: 800; }
.hero-rank-chip {
  font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.35);
  backdrop-filter: blur(4px);
}
.hero-sub { font-size: 12px; opacity: 0.85; font-weight: 600; overflow-wrap: anywhere; }
.hero-stats { display: flex; gap: 10px; margin-top: 12px; }
.hero-stat {
  flex: 1; background: rgba(255,255,255,0.18); border-radius: 14px; padding: 8px 4px;
  text-align: center; backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.22);
}
.hero-stat strong { display: block; font-size: 18px; font-weight: 800; line-height: 1.1; }
.hero-stat span { display: block; margin-top: 2px; font-size: 10px; opacity: 0.85; font-weight: 700; }
.hero-mission {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.22);
}
.hero-mission span { font-size: 11px; font-weight: 800; opacity: 0.78; white-space: nowrap; }
.hero-mission strong { font-size: 12px; line-height: 1.35; text-align: right; }

/* XP bar */
.xp-track {
  margin-top: 12px; padding: 8px 12px; border-radius: 14px;
  background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.22);
}
.xp-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; font-weight: 700; opacity: 0.9; margin-bottom: 6px; }
.xp-meta span { min-width: 0; overflow-wrap: anywhere; }
.xp-bar { position: relative; height: 8px; background: rgba(255,255,255,0.22); border-radius: 999px; overflow: hidden; }
.xp-bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, #fde68a, #f97316, #ec4899);
  border-radius: 999px; transition: width 0.6s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 0 8px rgba(253,224,71,0.6);
}
.xp-bar-fill::after {
  content: ''; position: absolute; inset: 0; border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: xpShimmer 2.2s linear infinite;
}
@keyframes xpShimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(120%); } }

/* daily quests */
.quest-card { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.quest-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.quest-head h3 { font-size: 14px; font-weight: 800; }
.quest-progress-text { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.quest-list { display: flex; flex-direction: column; gap: 8px; }
.quest-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg); border-radius: 14px; border: 1px solid var(--border);
  transition: all 0.22s ease;
}
.quest-row:not(.done):hover { transform: translateX(4px); }
.quest-row.done { background: var(--success-light); border-color: transparent; }
.quest-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: transparent; font-size: 13px; font-weight: 800;
  background: white;
}
.quest-row.done .quest-check { background: var(--success); border-color: var(--success); color: white; }
.quest-body { flex: 1; min-width: 0; }
.quest-title { font-size: 13px; font-weight: 700; color: var(--text); }
.quest-row.done .quest-title { color: var(--text-secondary); text-decoration: line-through; }
.quest-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.quest-reward { font-size: 11px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.quest-row.done .quest-reward { color: var(--success); }

/* achievement strip */
.achievement-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.achievement-pill { min-width: 0; padding: 10px 8px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); text-align: center; }
.achievement-pill strong { display: block; font-size: 15px; color: var(--primary); }
.achievement-pill span { display: block; margin-top: 2px; font-size: 10px; font-weight: 800; color: var(--accent); }

/* ============ ENTRIES ============ */
.entry-input-group { display: flex; flex-direction: column; gap: 10px; }
.entry-row { display: flex; align-items: center; gap: 8px; }
.entry-number { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.entry-number.filled { background: var(--primary); color: white; }
.entry-input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; color: var(--text); background: var(--bg); outline: none; transition: border-color 0.2s; min-width: 0; }
.entry-input:focus { border-color: var(--primary); background: white; }
.entry-input::placeholder { color: var(--text-muted); }
.tag-select { padding: 5px 8px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 11px; color: var(--text-secondary); background: white; outline: none; cursor: pointer; flex-shrink: 0; }
.entry-remove-btn { width: 26px; height: 26px; border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.entry-remove-btn:hover { background: #fef2f2; color: var(--danger); }
.entry-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.entry-add-btn { flex: 1; padding: 10px; border: 2px dashed var(--border); border-radius: 10px; background: none; color: var(--text-muted); font-size: 13px; cursor: pointer; transition: all 0.2s; }
.entry-add-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.save-btn { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.save-btn:hover { background: var(--primary-dark); }
.save-btn:disabled { opacity: 0.5; cursor: default; }

/* ============ SHARE CARD ============ */
.share-card-container { position: fixed; left: -9999px; top: 0; z-index: -1; }
.share-card { width: 375px; max-width: 100vw; padding: 26px 22px; background: linear-gradient(160deg, #111827 0%, #4f46e5 48%, #f59e0b 100%); color: white; font-family: var(--font-stack); }
.share-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.share-card-header h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.share-card-header p { font-size: 12px; opacity: 0.7; }
.share-character { width: 62px; height: 62px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 32px; border: 2px solid rgba(255,255,255,0.42); box-shadow: 0 12px 30px rgba(0,0,0,0.18); flex: none; }
.share-slogan { font-size: 13px; font-weight: 800; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.15); margin-bottom: 14px; border: 1px solid rgba(255,255,255,0.18); }
.share-card-entries { background: rgba(255, 255, 255, 0.15); border-radius: 16px; padding: 16px; margin-bottom: 16px; backdrop-filter: blur(10px); }
.share-section-title { font-size: 11px; font-weight: 900; letter-spacing: 0.04em; opacity: 0.75; margin-bottom: 6px; }
.share-card-entry { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.share-card-entry + .share-card-entry { border-top: 1px solid rgba(255, 255, 255, 0.15); }
.share-card-num { width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.share-card-text { font-size: 14px; line-height: 1.5; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.share-card-tag { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.2); white-space: nowrap; }
.share-card-qr {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.15); border-radius: 14px; padding: 12px 14px;
  margin-bottom: 16px;
}
.share-qr-img { width: 72px; height: 72px; border-radius: 8px; background: white; flex-shrink: 0; image-rendering: pixelated; }
.share-qr-info { flex: 1; min-width: 0; }
.share-qr-label { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.share-qr-url { font-size: 9px; opacity: 0.6; word-break: break-all; line-height: 1.4; }
.share-card-footer { display: flex; justify-content: space-between; align-items: center; }
.share-card-footer .streak { font-size: 14px; font-weight: 600; }
.share-card-footer .brand { font-size: 11px; opacity: 0.6; }
.share-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.share-card-stat { text-align: center; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.18); border-radius: 14px; padding: 10px 6px; }
.share-card-stat .val { font-size: 22px; font-weight: 800; }
.share-card-stat .lbl { font-size: 10px; opacity: 0.7; }
.share-xp-track { background: rgba(255,255,255,0.13); border: 1px solid rgba(255,255,255,0.16); border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.share-xp-track div:first-child { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; margin-bottom: 7px; }
.share-xp-track span { opacity: 0.78; font-weight: 800; }
.share-xp-track strong { font-weight: 900; }
.share-xp-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.24); overflow: hidden; }
.share-xp-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#fde68a,#fb923c,#ec4899); }

.share-preview { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 300; align-items: center; justify-content: center; flex-direction: column; padding: 20px; }
.share-preview.show { display: flex; }
.share-preview img { max-width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); margin-bottom: 16px; }
.share-preview-actions { display: flex; gap: 10px; }
.share-preview-btn { padding: 12px 24px; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; }
.share-preview-btn.primary { background: white; color: var(--primary); }
.share-preview-btn.secondary { background: rgba(255, 255, 255, 0.2); color: white; }

/* ============ CALENDAR ============ */
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-header h3 { font-size: 16px; font-weight: 600; }
.cal-nav-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; color: var(--text-secondary); font-size: 16px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.calendar-weekday { text-align: center; font-size: 11px; color: var(--text-muted); padding: 4px 0; font-weight: 500; }
.calendar-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; border-radius: 10px; cursor: pointer; color: var(--text); transition: all 0.2s; }
.calendar-day:hover { background: var(--bg); }
.calendar-day.empty { cursor: default; }
.calendar-day.today { font-weight: 700; border: 2px solid var(--primary); }
.calendar-day.has-entry { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.calendar-day.heat-1 { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-weight: 700; }
.calendar-day.heat-2 { background: color-mix(in srgb, var(--primary) 32%, transparent); color: var(--primary-dark); font-weight: 700; }
.calendar-day.heat-3 { background: color-mix(in srgb, var(--primary) 54%, transparent); color: white; font-weight: 700; }
.calendar-day.heat-4 { background: linear-gradient(135deg, var(--accent), var(--primary)); color: white; font-weight: 800; box-shadow: 0 6px 14px rgba(124,58,237,0.22); }
.calendar-day.selected { box-shadow: 0 0 0 2px var(--accent); }
.history-detail { border-top: 1px solid var(--border); padding-top: 16px; }
.history-date { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); }
.history-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.history-tag { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--primary-light); color: var(--primary); white-space: nowrap; }
.history-text { font-size: 14px; line-height: 1.5; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cal-legend { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 10px; color: var(--text-muted); margin: -4px 0 14px; }
.cal-legend .swatch { width: 14px; height: 14px; border-radius: 4px; }

/* ============ DREAMS ============ */
.dream-input-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dream-input { flex: 1 1 150px; min-width: 0; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; background: var(--bg); }
.dream-input:focus { border-color: var(--primary); background: white; }
.dream-add-btn { padding: 10px 16px; background: var(--primary); color: white; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.dream-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.dream-item:last-child { border-bottom: none; }
.dream-check { width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: none; color: var(--text); }
.dream-check.done { background: var(--success); border-color: var(--success); color: white; }
.dream-content { flex: 1; min-width: 0; }
.dream-name { font-size: 14px; font-weight: 500; }
.dream-name.done { text-decoration: line-through; color: var(--text-muted); }
.dream-cost-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.dream-cost-label { font-size: 11px; color: var(--text-muted); }
.dream-progress-bar { flex: 1; min-width: 0; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.dream-progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.dream-amount { font-size: 11px; color: var(--accent); font-weight: 600; }
.dream-delete { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; font-size: 18px; }
.jar-card { background: linear-gradient(135deg, #fbbf24, #f59e0b); border-radius: var(--radius); padding: 20px; color: white; text-align: center; margin-bottom: 16px; }
.jar-icon { font-size: 40px; margin-bottom: 8px; }
.jar-amount { font-size: 28px; font-weight: 800; }
.jar-label { font-size: 12px; opacity: 0.85; margin-top: 4px; }
.jar-actions { display: flex; gap: 8px; margin-top: 12px; }
.jar-btn { flex: 1; padding: 8px; border: 2px solid rgba(255, 255, 255, 0.4); border-radius: 10px; background: rgba(255, 255, 255, 0.15); color: white; font-size: 13px; font-weight: 600; cursor: pointer; }

/* ============ STATS ============ */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); text-align: center; transition: transform 0.22s ease, box-shadow 0.22s ease; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.chart-container { min-width: 0; background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.chart-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.chart-canvas { width: 100%; height: 200px; }
.tag-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-stat { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg); border-radius: 20px; font-size: 13px; }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; }
.radar-canvas { width: 100%; height: 240px; }

/* ============ PROFILE ============ */
.profile-section { margin-bottom: 20px; }
.profile-section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; padding-left: 4px; }
.profile-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.profile-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.profile-row:last-child { border-bottom: none; }
.profile-row-label { flex: none; font-size: 14px; color: var(--text-secondary); }
.profile-row-value { min-width: 0; font-size: 14px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.profile-row-action { font-size: 13px; color: var(--primary); cursor: pointer; font-weight: 600; background: none; border: none; padding: 4px 8px; }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; margin: 0 auto 12px; }
.profile-name { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.profile-username { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.profile-logout-btn { width: 100%; padding: 14px; background: none; border: 1.5px solid var(--danger); color: var(--danger); border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.profile-logout-btn:hover { background: #fef2f2; }

/* theme picker */
.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px; }
.theme-tile {
  position: relative; cursor: pointer; border-radius: 16px; overflow: hidden;
  border: 2px solid transparent; aspect-ratio: 1;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.theme-tile:hover { transform: translateY(-3px) scale(1.02); }
.theme-tile.active { border-color: var(--primary); box-shadow: 0 8px 18px rgba(0,0,0,0.12); }
.theme-tile .swatch { position: absolute; inset: 0; }
.theme-tile .label {
  position: absolute; left: 6px; right: 6px; bottom: 6px;
  background: rgba(255,255,255,0.86); color: var(--text);
  padding: 4px 6px; border-radius: 8px; text-align: center; font-size: 11px; font-weight: 800;
  backdrop-filter: blur(4px);
}
.theme-tile.active .label { background: var(--primary); color: white; }

/* character picker */
.character-picker { display: grid; gap: 10px; padding: 14px; }
.character-tile {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--bg); text-align: left; color: var(--text);
}
.character-tile.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 8px 18px rgba(79,70,229,0.12); }
.character-icon {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center; color: white; font-size: 22px;
}
.character-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.character-copy strong { font-size: 14px; line-height: 1.2; }
.character-copy small { font-size: 11px; color: var(--text-secondary); line-height: 1.35; overflow-wrap: anywhere; }

/* ============ LANGUAGE SWITCH ============ */
.lang-switch {
  display: inline-flex; flex: none; gap: 2px; padding: 3px;
  border-radius: 999px;
  background: var(--primary-light);
  border: 1px solid var(--border);
}
.lang-switch button {
  border: none; background: transparent;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; color: var(--text-secondary);
  cursor: pointer; transition: all 0.2s ease; line-height: 1;
}
.lang-switch button.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.lang-switch.auth-lang {
  position: absolute; top: 16px; right: 16px; z-index: 5;
  background: rgba(255,255,255,0.6); backdrop-filter: blur(10px);
}

/* ============ ONBOARDING ============ */
.onboarding-overlay { display: none; position: fixed; inset: 0; background: white; z-index: 500; }
.onboarding-overlay.show { display: flex; flex-direction: column; }
.onboarding-slides { flex: 1; overflow: hidden; position: relative; }
.onboarding-slide { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 30px; text-align: center; opacity: 0; transform: translateX(100%); transition: all 0.4s ease; }
.onboarding-slide.active { opacity: 1; transform: translateX(0); }
.onboarding-slide.left { opacity: 0; transform: translateX(-100%); }
.onboarding-slide .icon { font-size: 72px; margin-bottom: 24px; }
.onboarding-slide h2 { font-size: 22px; font-weight: 800; margin-bottom: 10px; color: var(--text); }
.onboarding-slide p { font-size: 15px; color: var(--text-secondary); line-height: 1.7; max-width: 300px; }
.onboarding-dots { display: flex; justify-content: center; gap: 8px; padding: 16px; }
.onboarding-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all 0.3s; }
.onboarding-dot.active { background: var(--primary); width: 24px; border-radius: 4px; }
.onboarding-bottom { padding: 16px 30px 40px; display: flex; gap: 12px; }
.onboarding-skip { flex: 1; padding: 14px; background: none; border: 1.5px solid var(--border); border-radius: 12px; font-size: 15px; color: var(--text-secondary); cursor: pointer; }
.onboarding-next { flex: 2; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; }

/* ============ MODAL ============ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 200; align-items: flex-end; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card); border-radius: 20px 20px 0 0; padding: 24px 20px 40px; width: 100%; max-width: 480px; max-height: 70vh; overflow-y: auto; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal-input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; outline: none; margin-bottom: 12px; }
.modal-input:focus { border-color: var(--primary); }
.modal-btn { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.modal-btn.secondary { background: var(--bg); color: var(--text); margin-top: 8px; }

/* ============ TOAST / FEEDBACK ============ */
.toast { position: fixed; top: 20px; left: 50%; width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%) translateY(-100px); background: var(--text); color: white; padding: 12px 24px; border-radius: 12px; font-size: 14px; z-index: 400; transition: transform 0.3s ease; overflow-wrap: anywhere; text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.5; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* default tag colors */
.tag-学习 { background: #dbeafe; color: #2563eb; }
.tag-工作 { background: #fce7f3; color: #db2777; }
.tag-社交 { background: #d1fae5; color: #059669; }
.tag-健康 { background: #fed7aa; color: #ea580c; }
.tag-创意 { background: #e9d5ff; color: #9333ea; }
.tag-理财 { background: #fef3c7; color: #d97706; }
.tag-生活 { background: #e0e7ff; color: #4f46e5; }

/* ============ ACHIEVEMENT TOAST / CONFETTI ============ */
.achievement-toast {
  position: fixed; left: 50%; top: 78px; z-index: 420;
  width: min(360px, calc(100% - 32px));
  transform: translateX(-50%) translateY(-16px) scale(0.96); opacity: 0; pointer-events: none;
  background: linear-gradient(135deg, #f97316, #ec4899, #7c3aed); color: white;
  border-radius: 24px; padding: 14px 16px;
  box-shadow: 0 24px 70px rgba(236, 72, 153, 0.32);
  display: flex; align-items: center; gap: 12px;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.achievement-toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.achievement-toast .medal {
  width: 44px; height: 44px; border-radius: 16px; background: rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.achievement-toast strong { display: block; font-size: 15px; }
.achievement-toast span { display: block; margin-top: 2px; font-size: 12px; opacity: 0.82; font-weight: 700; }

.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 410; }
.confetti-piece {
  position: absolute; top: -16px; width: 9px; height: 14px; border-radius: 3px;
  animation: confettiFall 1100ms cubic-bezier(.32,.07,.62,1) forwards;
}
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

/* level-up burst */
.level-up-card {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.6); opacity: 0;
  z-index: 450; pointer-events: none;
  padding: 22px 30px; border-radius: 26px; min-width: 260px; text-align: center;
  background: linear-gradient(140deg, #fde68a, #f97316, #ec4899, #7c3aed);
  color: white; box-shadow: 0 30px 80px rgba(124, 58, 237, 0.45);
  transition: opacity 0.32s ease, transform 0.4s cubic-bezier(.2,.7,.2,1.4);
}
.level-up-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.level-up-card .ring { font-size: 14px; font-weight: 800; opacity: 0.92; }
.level-up-card .big { font-size: 36px; font-weight: 900; margin: 4px 0 2px; letter-spacing: 1px; text-shadow: 0 4px 18px rgba(0,0,0,0.18); }
.level-up-card .sub { font-size: 13px; font-weight: 700; opacity: 0.92; }

/* badge gallery */
.badge-filter { display: flex; gap: 8px; margin-bottom: 14px; }
.badge-filter button {
  flex: 1; padding: 8px 6px; border: none; border-radius: 12px;
  background: var(--card); color: var(--text-secondary);
  font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow);
}
.badge-filter button.active { background: var(--primary); color: white; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.badge-tile {
  position: relative; min-height: 132px; border-radius: 18px;
  background: var(--card); box-shadow: var(--shadow); padding: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; transition: transform 0.2s ease;
}
.badge-tile .name,
.badge-tile .desc,
.badge-progress-text { overflow-wrap: anywhere; }

@media (max-width: 360px) {
  .main { padding-left: 14px; padding-right: 14px; }
  .theme-picker,
  .badge-grid,
  .achievement-strip { gap: 8px; }
  .profile-row { padding-left: 14px; padding-right: 14px; }
}
.badge-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.badge-tile .icon { font-size: 30px; line-height: 1; margin-bottom: 6px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.10)); }
.badge-tile .name { font-size: 11px; font-weight: 800; color: var(--text); }
.badge-tile .desc { font-size: 9px; color: var(--text-muted); margin-top: 2px; font-weight: 600; }
.badge-state {
  margin-top: 6px; font-size: 9px; color: var(--accent); font-weight: 900;
}
.badge-progress {
  width: 100%; height: 5px; margin-top: 7px;
  background: var(--border); border-radius: 999px; overflow: hidden;
}
.badge-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 999px; transition: width 0.4s ease;
}
.badge-progress-text {
  margin-top: 3px; font-size: 9px; color: var(--text-muted); font-weight: 800;
}
.badge-tile.locked .icon { filter: grayscale(1) opacity(0.4); }
.badge-tile.locked .name { color: var(--text-muted); }
.badge-tile.locked::after {
  content: '🔒'; position: absolute; top: 6px; right: 6px; font-size: 11px;
}
.badge-tile.unlocked {
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 18%, white), white);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.badge-summary {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.badge-summary .num { font-size: 22px; font-weight: 900; color: var(--primary); }
.badge-summary .lbl { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.badge-summary .pct-bar { flex: 1; height: 8px; background: var(--border); border-radius: 999px; margin: 0 14px; overflow: hidden; }
.badge-summary .pct-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; transition: width 0.6s ease; }
