/* ============ 小鱼儿的日程 · 卡通童趣风格 ============ */
:root {
  --bg: #FFF9EC;
  --card: #FFFFFF;
  --ink: #4A3B32;
  --muted: #A08C7D;
  --coral: #FF8A5C;
  --coral-d: #EF6E3E;
  --yellow: #FFD93D;
  --yellow-d: #F2B705;
  --teal: #4ECDC4;
  --teal-d: #35B3AA;
  --pink: #FF6B9D;
  --green: #7ED957;
  --green-d: #5CB83A;
  --red: #FF5C5C;
  --red-bg: #FFECEC;
  --done-bg: #F0FAE7;
  --radius: 20px;
  --shadow: 0 6px 0 rgba(239, 110, 62, 0.15);
  --shadow-sm: 0 4px 0 rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Comic Sans MS", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(255, 217, 61, 0.28) 10px, transparent 11px),
    radial-gradient(rgba(78, 205, 196, 0.18) 8px, transparent 9px);
  background-size: 90px 90px, 90px 90px;
  background-position: 0 0, 45px 45px;
  font-size: 16px;
  line-height: 1.5;
}

#app { max-width: 680px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding: 0 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; position: sticky; top: 0; z-index: 50;
  background: linear-gradient(var(--bg) 82%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-fish { font-size: 30px; display: inline-block; animation: brandBob 2.6s ease-in-out infinite; }
@keyframes brandBob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }
.brand h1 { font-size: 22px; margin: 0; letter-spacing: 1px; }

.gear-btn {
  width: 52px; height: 52px; border: none; border-radius: 50%;
  background: var(--card); font-size: 24px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform 0.3s;
}
.gear-btn:active { transform: scale(0.92); }
.gear-btn.open { transform: rotate(120deg); }

.gear-menu {
  position: absolute; right: 16px; top: 72px; z-index: 60;
  background: var(--card); border-radius: 18px; box-shadow: 0 10px 30px rgba(74, 59, 50, 0.18);
  padding: 8px; display: flex; flex-direction: column; min-width: 180px;
}
.gear-menu button {
  border: none; background: none; text-align: left; font: inherit; font-size: 16px;
  padding: 12px 14px; border-radius: 12px; cursor: pointer; color: var(--ink);
}
.gear-menu button:hover { background: #FFF2DF; }
.hidden { display: none !important; }

/* ---------- 主体 ---------- */
main { flex: 1; padding-bottom: 24px; }
.panel h2 { font-size: 20px; margin: 6px 0 14px; }

/* 小鱼吉祥物 */
.mascot { width: 190px; margin: 6px auto 0; position: relative; }
.mascot svg { width: 100%; display: block; overflow: visible; }
.fish .body   { fill: url(#bodyGrad); }
.fish .belly  { fill: #FFE9A8; }
.fish .tail, .fish .fin { fill: var(--yellow-d); }
.fish .cheek  { fill: #FF9BB5; opacity: 0.9; }
.fish .eye    { fill: #4A3B32; }
.fish .glare  { fill: #fff; }
.fish .mouth  { stroke: #4A3B32; stroke-width: 7; fill: none; stroke-linecap: round; }
.fish .brow   { stroke: #4A3B32; stroke-width: 6; fill: none; stroke-linecap: round; display: none; }
.fish .mouth-angry { display: none; }

.mood-normal .fish { animation: bob 3s ease-in-out infinite; }
.mood-normal .fish .tail { transform-origin: 60px 96px; animation: tailWag 1.2s ease-in-out infinite; }

.mood-happy .fish { animation: jump 0.7s ease-in-out infinite; transform-origin: center bottom; }
.mood-happy .fish .tail { transform-origin: 60px 96px; animation: tailWag 0.4s ease-in-out infinite; }
.sparkle { font-size: 26px; position: absolute; opacity: 0; }
.mood-happy .sparkle { animation: twinkle 0.9s ease-in-out infinite; }
.sparkle.s1 { top: -6px; left: 8px; } .sparkle.s2 { top: 10px; right: 0; animation-delay: 0.3s !important; }

.mood-angry .fish { animation: shake 0.45s ease-in-out infinite; }
.mood-angry .fish .mouth-smile { display: none; }
.mood-angry .fish .mouth-angry { display: block; }
.mood-angry .fish .brow { display: block; }
.mood-angry .fish .cheek { fill: #FF5C5C; }
.mood-angry .steam { display: block; }
.steam { display: none; position: absolute; top: -14px; right: 22px; font-size: 24px; animation: steamUp 1s ease-out infinite; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes tailWag { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(16deg); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px) rotate(-3deg); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3.5deg); } 75% { transform: rotate(3.5deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(0.6); opacity: 0.4; } 50% { transform: scale(1.2); opacity: 1; } }
@keyframes steamUp { 0% { transform: translateY(0); opacity: 0.9; } 100% { transform: translateY(-12px); opacity: 0; } }

/* 首页问候 */
.greet { text-align: center; margin: 2px 0 12px; }
.greet .hello { font-size: 19px; font-weight: bold; }
.greet .date { color: var(--muted); font-size: 14px; }

/* 今日进度条 */
.progress-pill {
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow-sm);
  padding: 8px 16px; margin: 0 auto 16px; width: fit-content; font-size: 15px;
}
.progress-pill b { color: var(--coral-d); }

/* 日程卡片 */
.period-block { margin-bottom: 18px; }
.period-chip {
  display: inline-block; background: var(--teal); color: #fff; font-weight: bold;
  padding: 4px 16px; border-radius: 999px; margin-bottom: 8px; box-shadow: 0 3px 0 var(--teal-d);
}
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; animation: popIn 0.25s ease;
}
@keyframes popIn { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card .info { min-width: 0; }
.card .time { font-size: 14px; color: var(--muted); display: block; }
.card .name { font-size: 17px; font-weight: bold; overflow-wrap: anywhere; }
.card .badge { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; margin-top: 4px; }
.card.st-active  { outline: 3px dashed var(--yellow); }
.card.st-active  .badge { background: #FFF3C4; color: #9A7B00; }
.card.st-overdue { background: var(--red-bg); box-shadow: 0 6px 0 rgba(255, 92, 92, 0.25); }
.card.st-overdue .badge { background: var(--red); color: #fff; animation: blink 1s infinite; }
.card.st-done { background: var(--done-bg); box-shadow: 0 6px 0 rgba(126, 217, 87, 0.3); }
@keyframes blink { 50% { opacity: 0.55; } }

/* 临时日程视觉区分 */
.period-chip.adhoc { background: var(--pink); box-shadow: 0 3px 0 #E14C80; }
.card.adhoc { border-left: 6px solid var(--pink); padding-left: 12px; }
.adhoc-tag { display: inline-block; font-size: 11px; background: var(--pink); color: #fff;
  padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }

.check-btn {
  border: none; background: var(--coral); color: #fff; font: inherit; font-size: 17px; font-weight: bold;
  padding: 12px 22px; border-radius: 999px; cursor: pointer; box-shadow: 0 5px 0 var(--coral-d);
  flex-shrink: 0; transition: transform 0.08s;
}
.check-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--coral-d); }
.check-btn.re { background: var(--pink); box-shadow: 0 5px 0 #E14C80; }
.done-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.done-mark { color: var(--green-d); font-weight: bold; font-size: 16px; }
.link-btn { border: none; background: none; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; padding: 2px; }

.empty {
  text-align: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 34px 20px; margin-top: 14px;
}
.empty .big { font-size: 46px; }
.empty p { color: var(--muted); }

/* ---------- 通用控件 ---------- */
.btn {
  border: none; font: inherit; font-weight: bold; cursor: pointer;
  background: var(--coral); color: #fff; border-radius: 999px;
  padding: 12px 20px; box-shadow: 0 5px 0 var(--coral-d); transition: transform 0.08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--coral-d); }
.btn.ghost { background: var(--card); color: var(--coral-d); box-shadow: 0 5px 0 rgba(0,0,0,0.08); border: 2px dashed var(--coral); }
.btn.teal { background: var(--teal); box-shadow: 0 5px 0 var(--teal-d); }
.btn.block { width: 100%; }

.mini {
  border: none; font: inherit; font-size: 13px; cursor: pointer; border-radius: 999px;
  background: #F5EDE2; color: var(--ink); padding: 7px 13px; flex-shrink: 0;
}
.mini.danger { background: #FFE3E3; color: #C43B3B; }
.mini.add { background: #E5F7F5; color: var(--teal-d); font-weight: bold; }

input[type="date"], input[type="time"], input[type="text"], select {
  font: inherit; color: var(--ink); border: 2px solid #F0E4D2; border-radius: 12px;
  padding: 8px 10px; background: #FFFDF7; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: var(--teal); }

/* ---------- 设置页 ---------- */
.field-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.field-row label { flex: 1; min-width: 150px; font-size: 14px; color: var(--muted); }
.field-row input { width: 100%; margin-top: 4px; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }

.day-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.day-tab {
  border: none; font: inherit; font-size: 14px; padding: 8px 13px; border-radius: 999px;
  background: var(--card); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm);
}
.day-tab.on { background: var(--coral); color: #fff; box-shadow: 0 4px 0 var(--coral-d); }

.period {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 14px;
}
.period-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.period-title { flex: 1; font-weight: bold; border-color: var(--teal); }
.item-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.item-row input[type="time"] { width: 104px; padding: 8px 6px; text-align: center; }
.item-row .dash { color: var(--muted); }
.item-name { flex: 1; min-width: 120px; }
.no-item { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }

.copy-row, .backup-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.copy-row select { flex: 1; }
hr.soft { border: none; border-top: 2px dashed #F0E4D2; margin: 20px 0 12px; }

/* ---------- 统计页 ---------- */
.dim-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.dim-tab {
  flex: 1; border: none; font: inherit; font-weight: bold; padding: 10px 0; border-radius: 999px;
  background: var(--card); cursor: pointer; box-shadow: var(--shadow-sm); color: var(--ink);
}
.dim-tab.on { background: var(--teal); color: #fff; box-shadow: 0 4px 0 var(--teal-d); }

.stat-hero {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px; padding: 18px; margin-bottom: 14px;
}
.ring { width: 110px; height: 110px; flex-shrink: 0; }
.ring .bg { fill: none; stroke: #F5EDE2; stroke-width: 12; }
.ring .fg { fill: none; stroke: var(--coral); stroke-width: 12; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 0.6s ease; }
.ring-wrap { position: relative; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: bold; }
.ring-center .pct { font-size: 22px; color: var(--coral-d); }
.ring-center .sub { font-size: 11px; color: var(--muted); }
.stat-num { font-size: 15px; color: var(--muted); }
.stat-num b { font-size: 24px; color: var(--ink); }

.stat-date-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.stat-date-row input { flex: 1; }

.item-stat { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 10px 14px; margin-bottom: 8px; }
.item-stat .row1 { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 6px; gap: 8px; }
.item-stat .bar { height: 10px; border-radius: 999px; background: #F5EDE2; overflow: hidden; }
.item-stat .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--yellow), var(--coral)); }

.trend { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px; margin-top: 14px; }
.trend h3 { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.trend-bars { display: flex; align-items: flex-end; gap: 8px; height: 96px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.trend-col .bar { width: 70%; max-width: 34px; background: linear-gradient(180deg, var(--teal), #7ED9D2); border-radius: 8px 8px 4px 4px; min-height: 4px; }
.trend-col .lb { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- 提醒页 ---------- */
.opt-row {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-sm);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px;
}
.opt-row .lab { font-weight: bold; }
.opt-row .desc { font-size: 13px; color: var(--muted); }

.switch { position: relative; width: 56px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: #E4D8C8; transition: 0.2s; cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 29px; }

.perm-box { text-align: center; padding: 6px 0 2px; }
.perm-state { font-size: 14px; color: var(--muted); margin-bottom: 10px; }

/* ---------- 其他 ---------- */
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0 18px; }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 999; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(74, 59, 50, 0.92); color: #fff; font-size: 15px;
  padding: 10px 22px; border-radius: 999px; z-index: 1000; animation: toastIn 0.25s ease;
  max-width: 86vw; text-align: center;
}
@keyframes toastIn { from { transform: translate(-50%, 14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* 友好模态弹窗（替代 native confirm） */
.modal {
  position: fixed; inset: 0; background: rgba(74, 59, 50, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 1100; padding: 18px;
  animation: modalFade 0.18s ease;
}
.modal.hidden { display: none !important; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--card); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 22px 20px 18px; max-width: 380px; width: 100%; text-align: center;
  animation: modalPop 0.22s ease;
}
@keyframes modalPop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-icon { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.modal-msg { white-space: pre-line; margin-bottom: 18px; font-size: 15px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* 打卡成功按钮彩蛋 */
.check-btn.boom { animation: boom 0.4s ease; }
@keyframes boom { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* 桌面端微调 */
@media (min-width: 700px) {
  body { font-size: 17px; }
  main { padding-bottom: 40px; }
  .card .name { font-size: 18px; }
}
