/* ====== EF Pet 3.0 - Global Styles ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #6C5CE7; --primary-light: #A29BFE; --primary-dark: #4834D4;
  --bg: #F8F7FF; --card: #FFFFFF; --text: #2D3436; --text-light: #636E72;
  --success: #00B894; --warning: #FDCB6E; --danger: #E17055;
  --ice: #74B9FF; --star: #FDCB6E; --fox: #FF9800;
  --radius: 16px; --shadow: 0 4px 15px rgba(108,92,231,0.12);
  --radius-sm: 10px; --radius-lg: 20px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg); color: var(--text); max-width: 430px; margin: 0 auto;
  min-height: 100vh; overflow-x: hidden; padding-bottom: 70px;
}
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 10px 0; box-shadow: var(--shadow); }
.card-flat { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 8px 0; border: 1px solid #F0EEF6; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; gap: 6px;
}
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn-pill { border-radius: 20px; padding: 8px 18px; }
.progress-bar { height: 8px; background: #E8E6F0; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.page { display: none; padding: 12px; }
.page.active { display: block; }
.tag { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; margin: 2px; }
.tag-ice { background: #DFE6E9; color: #0984E3; }
.tag-star { background: #FFF3CD; color: #E17055; }
.tag-fox { background: #FFE0B2; color: #F57C00; }
.phase-badge {
  display: inline-block; padding: 4px 12px; border-radius: 8px;
  font-size: 11px; font-weight: 600; color: #fff; margin-bottom: 8px;
}
.phase-a { background: linear-gradient(135deg, #00B894, #00CEC9); }
.phase-b { background: linear-gradient(135deg, #6C5CE7, #A29BFE); }
.phase-c { background: linear-gradient(135deg, #E17055, #FD79A8); }
.phase-desc { font-size: 12px; color: var(--text-light); margin-bottom: 8px; line-height: 1.5; }
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; background: var(--card);
  display: flex; justify-content: space-around; padding: 8px 0 12px;
  box-shadow: 0 -2px 15px rgba(0,0,0,.06); z-index: 100;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  font-size: 10px; color: var(--text-light); cursor: pointer; transition: color .2s;
  padding: 4px 8px; border-radius: 8px;
}
.nav-item.active { color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 20px; margin-bottom: 2px; }
.pet-display { text-align: center; padding: 20px 0; position: relative; }
.pet-svg-wrap { width: 160px; height: 160px; margin: 0 auto; position: relative; }
.pet-svg-wrap svg { width: 100%; height: 100%; }
.pet-name { font-size: 18px; font-weight: 700; margin: 8px 0 4px; color: var(--primary); }
.pet-level { font-size: 13px; color: var(--text-light); }
.xp-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-left: 16px; padding-right: 16px; margin-left: auto; margin-right: auto; }
.xp-row { display: flex; align-items: center; gap: 8px; }
.xp-row .label { font-size: 12px; min-width: 60px; text-align: right; }
.home-stats { display: flex; justify-content: space-around; margin: 10px 0; padding: 10px 0; }
.home-stat { text-align: center; }
.home-stat .val { font-size: 20px; font-weight: 700; color: var(--primary); }
.home-stat .lbl { font-size: 11px; color: var(--text-light); }
.feed-section { margin-top: 12px; }
.feed-section h4 { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.food-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.food-item {
  background: linear-gradient(135deg, #F8F7FF, #E8E6F0);
  border-radius: 12px; padding: 10px 8px; text-align: center;
  cursor: pointer; transition: transform .2s;
}
.food-item:active { transform: scale(.93); }
.food-item .emoji { font-size: 24px; }
.food-item .count { font-size: 14px; font-weight: 700; color: var(--primary); }
.food-item .name { font-size: 10px; color: var(--text-light); }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 10px; padding: 14px 12px;
  background: var(--card); border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.04);
  cursor: pointer; transition: all .2s; border: 2px solid transparent;
}
.task-item.completed { border-color: var(--success); opacity: .7; }
.task-item:active { transform: scale(.98); }
.task-item .task-icon { font-size: 22px; min-width: 30px; text-align: center; }
.task-item .task-info { flex: 1; }
.task-item .task-name { font-size: 13px; font-weight: 600; }
.task-item .task-desc { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.task-check {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #DDD;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all .2s; flex-shrink: 0; background: #fff;
}
.task-item.completed .task-check {
  background: var(--success); border-color: var(--success); color: #fff;
  box-shadow: 0 0 10px rgba(39,174,96,.5);
}
.task-detail-panel {
  background: #F8F7FF; border-radius: 12px; padding: 14px; margin-top: 6px;
  font-size: 12px; line-height: 1.7; color: var(--text);
}
.task-detail-section { margin-top: 10px; }
.task-detail-section:first-child { margin-top: 0; }
.task-detail-label { font-weight: 700; font-size: 12px; margin-bottom: 4px; color: var(--primary); }
.task-expand-btn {
  font-size: 11px; color: var(--primary); cursor: pointer;
  padding: 4px 8px; border-radius: 6px; background: #F0EEF6;
  border: none; transition: all .2s; margin-top: 4px;
}
.task-expand-btn:active { background: var(--primary-light); color: #fff; }
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  text-align: center; box-shadow: var(--shadow); cursor: pointer; transition: transform .2s;
}
.game-card:active { transform: scale(.95); }
.game-card .game-emoji { font-size: 36px; margin-bottom: 8px; }
.game-card .game-name { font-size: 14px; font-weight: 600; }
.game-card .game-desc { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.game-card .game-score { font-size: 11px; color: var(--primary); font-weight: 600; margin-top: 4px; }
.pet-select-overlay {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; height: 100%;
  background: linear-gradient(180deg, #6C5CE7 0%, #A29BFE 100%);
  z-index: 200; display: none; flex-direction: column;
  align-items: center; justify-content: center; padding: 20px;
}
.pet-select-overlay.show { display: flex; }
.pet-select-overlay h1 { color: #fff; font-size: 24px; margin-bottom: 8px; text-shadow: 0 2px 10px rgba(0,0,0,.2); }
.pet-select-overlay p { color: rgba(255,255,255,.85); font-size: 14px; margin-bottom: 24px; text-align: center; }
.pet-cards { display: flex; gap: 12px; width: 100%; max-width: 380px; }
.pet-choice {
  flex: 1; background: rgba(255,255,255,.15); backdrop-filter: blur(10px);
  border-radius: 16px; padding: 12px 8px; text-align: center; cursor: pointer;
  transition: all .3s; border: 2px solid transparent;
}
.pet-choice:active, .pet-choice.selected { border-color: #fff; transform: scale(1.03); background: rgba(255,255,255,.25); }
.pet-choice .pet-title { color: #fff; font-size: 14px; font-weight: 700; }
.pet-choice .pet-sub { color: rgba(255,255,255,.7); font-size: 11px; margin-top: 4px; }
.overlay {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; height: 100%;
  background: rgba(0,0,0,.5); z-index: 150; display: none;
  align-items: center; justify-content: center;
}
.overlay.show { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius-lg); padding: 20px;
  width: 90%; max-width: 380px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h2 { text-align: center; margin-bottom: 12px; font-size: 18px; }
.encyclopedia-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ency-card {
  border-radius: 12px; padding: 8px; text-align: center; background: #F0EEF6;
  transition: all .2s; position: relative;
}
.ency-card.unlocked { background: linear-gradient(135deg, #F8F7FF, #E8E6F0); }
.ency-card .ency-icon { width: 60px; height: 60px; margin: 4px auto; }
.ency-card .ency-icon svg { width: 100%; height: 100%; }
.ency-card .ency-name { font-size: 11px; font-weight: 600; margin-top: 4px; }
.ency-card .ency-stage { font-size: 10px; color: var(--text-light); }
.ency-card.locked .ency-icon svg { filter: grayscale(1) brightness(.6); }
.ency-card.locked::after {
  content: '?'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 24px; color: rgba(0,0,0,.3);
}
.settings-section { margin-bottom: 16px; }
.settings-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--primary); }
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #F0EEF6;
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 13px; }
.setting-value { font-size: 13px; color: var(--text-light); }
.settings-btn {
  padding: 8px 16px; border: 2px solid var(--danger); background: transparent;
  color: var(--danger); border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.settings-btn:active { background: var(--danger); color: #fff; }
.game-container {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; height: 100%;
  background: var(--bg); z-index: 180; display: none; flex-direction: column;
}
.game-container.show { display: flex; }
.game-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--card); box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.game-header h3 { font-size: 16px; }
.game-close { font-size: 24px; cursor: pointer; padding: 4px 8px; border: none; background: none; color: var(--text); }
.game-body {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 20px; gap: 16px; overflow-y: auto;
}
.game-result { text-align: center; }
.game-result .score { font-size: 36px; font-weight: 700; color: var(--primary); }
.game-result .reward { font-size: 14px; color: var(--text-light); margin-top: 8px; }
@keyframes breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.03)} }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
@keyframes twinkle { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.1);opacity:.7} }
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }
.animate-breathe { animation: breathe 3s ease-in-out infinite; }
.animate-float { animation: float 4s ease-in-out infinite; }
.animate-twinkle { animation: twinkle 2s ease-in-out infinite; }
.animate-slide-up { animation: slideUp .3s ease-out; }
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #FDCB6E, #F39C12);
  color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
}
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 20px; border-radius: 12px;
  font-size: 13px; z-index: 300; opacity: 0; transition: opacity .3s;
  pointer-events: none; max-width: 300px; text-align: center;
}
.toast.show { opacity: 1; }
.tab-btns { display: flex; gap: 6px; margin-bottom: 12px; }
.tab-btn {
  flex: 1; padding: 8px; border: none; border-radius: 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: #F0EEF6; color: var(--text-light); transition: all .2s;
}
.tab-btn.active { background: var(--primary); color: #fff; }
/* Timer */
.timer-circle-wrap { position: relative; width: 200px; height: 200px; margin: 20px auto; }
.timer-circle-wrap svg { transform: rotate(-90deg); }
.timer-circle-bg { fill: none; stroke: #E8E6F0; stroke-width: 8; }
.timer-circle-fg { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 36px; font-weight: 700; color: var(--primary);
}
.timer-controls { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.timer-presets { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.timer-preset {
  padding: 6px 14px; border-radius: 20px; font-size: 12px;
  border: 2px solid #E8E6F0; background: var(--card); cursor: pointer;
  font-weight: 600; transition: all .2s;
}
.timer-preset:active, .timer-preset.active { border-color: var(--primary); background: #F0EEF6; color: var(--primary); }
/* Mood */
.mood-panel {
  background: linear-gradient(135deg, #F8F7FF, #E8E6F0);
  border-radius: var(--radius); padding: 16px; margin: 10px 0; text-align: center;
}
.mood-panel h3 { font-size: 15px; margin-bottom: 12px; }
.mood-options { display: flex; justify-content: center; gap: 12px; margin: 12px 0; }
.mood-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid transparent;
  background: var(--card); font-size: 28px; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.mood-btn:active { transform: scale(.9); }
.mood-btn.selected { border-color: var(--primary); transform: scale(1.1); }
.mood-hint { font-size: 11px; color: var(--text-light); margin-top: 8px; line-height: 1.5; }
/* Status */
.status-toggle { display: flex; gap: 8px; margin: 10px 0; }
.status-btn {
  flex: 1; padding: 10px; border-radius: 12px; border: 2px solid #E8E6F0;
  background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .2s; text-align: center;
}
.status-btn:active { transform: scale(.96); }
.status-btn.active { border-color: var(--warning); background: #FFF8E1; color: #F39C12; }
/* Journal */
.journal-card {
  background: linear-gradient(135deg, #DFE6E9, #F8F7FF);
  border-radius: var(--radius); padding: 14px; margin: 8px 0;
}
.journal-card h4 { font-size: 13px; margin-bottom: 8px; }
.journal-input {
  width: 100%; padding: 8px 12px; border: 2px solid #E8E6F0; border-radius: 10px;
  font-size: 13px; outline: none; transition: border-color .2s; resize: vertical; font-family: inherit;
}
.journal-input:focus { border-color: var(--primary-light); }
.journal-note {
  background: var(--card); border-radius: 10px; padding: 10px;
  margin-top: 8px; font-size: 12px; color: var(--text-light); line-height: 1.5;
}
/* Remember 3 */
.r3-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid #F0EEF6;
}
.r3-item:last-child { border-bottom: none; }
.r3-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.r3-input {
  flex: 1; border: none; background: transparent; font-size: 14px;
  outline: none; padding: 4px; border-bottom: 1px dashed #DDD;
}
.r3-review {
  background: #FFF3CD; border-radius: 10px; padding: 12px; margin-top: 8px;
  font-size: 13px; line-height: 1.6;
}
.r3-review-item { padding: 2px 0; }
/* Eval */
.eval-stars { display: flex; gap: 4px; margin: 8px 0; }
.eval-star { font-size: 28px; cursor: pointer; transition: transform .15s; filter: grayscale(1); }
.eval-star.active { filter: grayscale(0); }
.eval-star:active { transform: scale(1.2); }
/* Week chart */
.week-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; margin: 12px 0; }
.week-bar-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; height: 100%; justify-content: flex-end;
}
.week-bar {
  width: 100%; max-width: 36px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--primary-light));
  transition: height .5s ease; min-height: 2px;
}
.week-bar.today { background: linear-gradient(180deg, var(--success), #55efc4); }
.week-label { font-size: 10px; color: var(--text-light); margin-top: 4px; }
/* Routine */
.routine-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #F0EEF6;
}
.routine-item:last-child { border-bottom: none; }
.routine-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #DDD;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; cursor: pointer; transition: all .2s;
}
.routine-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.routine-label { font-size: 13px; flex: 1; }
.routine-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.routine-tag.ic { background: #DFE6E9; color: #0984E3; }
.routine-tag.wm { background: #FFF3CD; color: #E17055; }
.routine-tag.cf { background: #FFE0B2; color: #F57C00; }
/* Task free select */
.task-free-select { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.task-free-opt {
  padding: 4px 10px; border-radius: 8px; font-size: 12px;
  border: 1px solid #DDD; cursor: pointer; transition: all .2s;
}
.task-free-opt:active, .task-free-opt.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Progress dots */
.progress-week { display: flex; gap: 4px; margin-top: 8px; }
.progress-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; background: #F0EEF6; color: var(--text-light);
}
.progress-dot.done { background: var(--success); color: #fff; }
.progress-dot.today { border: 2px solid var(--primary); }
/* Info banner */
.info-banner {
  background: linear-gradient(135deg, #74B9FF, #A29BFE);
  border-radius: var(--radius); padding: 14px 16px; margin: 10px 0;
  color: #fff; font-size: 13px; line-height: 1.5;
}
.info-banner.warning { background: linear-gradient(135deg, #FFEAA7, #FDCB6E); color: #2D3436; }
.info-banner.success { background: linear-gradient(135deg, #00B894, #55efc4); }
/* Section */
.section-title {
  font-size: 15px; font-weight: 700; margin: 16px 0 8px;
  display: flex; align-items: center; gap: 6px;
}
/* Parent stats */
.parent-stat-row { display: flex; justify-content: space-around; margin: 12px 0; }
.parent-stat { text-align: center; }
.parent-stat .val { font-size: 24px; font-weight: 700; color: var(--primary); }
.parent-stat .lbl { font-size: 11px; color: var(--text-light); margin-top: 2px; }
/* Switch toggle */
.switch-wrap { display: flex; align-items: center; gap: 8px; }
.switch { position: relative; width: 44px; height: 24px; }
.switch input { display: none; }
.switch-slider {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: #DDD; border-radius: 12px; cursor: pointer; transition: .2s;
}
.switch-slider::before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
/* Scrollbar */
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: #DDD; border-radius: 2px; }
