/* 咪记 · 浅色极简风
   我 = 蓝（左），TA = 粉（右）。全局只用这两个强调色。 */

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --line: #e9e8e5;
  --line-strong: #d8d7d3;
  --text: #2c2c2a;
  --text-2: #5f5e5a;
  --text-3: #8d8c87;
  --me-fill: #b5d4f4;
  --me-deep: #378add;
  --me-soft: #e6f1fb;
  --ta-fill: #f4c0d1;
  --ta-deep: #d4537e;
  --ta-soft: #fbeaf0;
  --danger: #b3382c;
  --radius: 14px;
  --radius-sm: 10px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

#app { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }

h1 { font-size: 21px; font-weight: 500; margin: 0 0 4px; letter-spacing: 0.5px; }
h2 { font-size: 15px; font-weight: 500; margin: 0 0 12px; }
p  { margin: 0 0 12px; }

.muted  { color: var(--text-2); }
.hint   { color: var(--text-3); font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.mono   { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ── 卡片 ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.card.tight { padding: 14px 12px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ── 表单 ───────────────────────────────────────── */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }

input[type='email'], input[type='password'], input[type='text'], select {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px; /* 16px 以下 iOS 会自动放大页面 */
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 0.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  appearance: none;
}
input:focus, select:focus { border-color: var(--me-deep); }
input::placeholder { color: #b6b5b0; }

.btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--text);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn:active { opacity: 0.82; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn.ghost {
  color: var(--text-2);
  background: transparent;
  border: 0.5px solid var(--line-strong);
  font-weight: 400;
}
.btn.link {
  width: auto;
  padding: 4px 0;
  color: var(--me-deep);
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 400;
}

.tabs { display: flex; gap: 4px; background: #efefec; border-radius: var(--radius-sm); padding: 3px; margin-bottom: 18px; }
.tabs button {
  flex: 1;
  padding: 8px 0;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.tabs button.on { color: var(--text); background: var(--surface); font-weight: 500; }

.msg { font-size: 13px; padding: 9px 11px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.msg.err { color: var(--danger); background: #fbeeec; }
.msg.ok  { color: #1a7a3c; background: #eef8f0; }

/* ── 顶栏 ───────────────────────────────────────── */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.brand { font-size: 17px; font-weight: 500; letter-spacing: 1px; }
.brand span { color: var(--ta-deep); }

/* ── 日历 ───────────────────────────────────────── */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-size: 15px; font-weight: 500; }
.nav-btn {
  width: 30px; height: 30px;
  font-size: 15px; line-height: 1;
  color: var(--text-2);
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.nav-btn:active { background: #f1f1ee; }

.cal-week, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week { margin-bottom: 6px; }
.cal-week div { text-align: center; font-size: 12px; color: var(--text-3); }

.cal-days { position: relative; }
.day {
  position: relative;
  min-height: 46px;
  padding: 4px 3px 3px;
  border-radius: 9px;
  width: 100%;
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
.day:active { background: #f1f1ee; }
.day.out { opacity: 0.34; }
.day.today { box-shadow: inset 0 0 0 1.5px var(--text); }
.day .num { display: block; text-align: center; font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.day .halves { display: flex; gap: 2px; justify-content: center; }
.half { width: 13px; height: 20px; border-radius: 5px; background: #eeeeeb; }
.half.me.on { background: var(--me-fill); box-shadow: inset 0 0 0 0.5px var(--me-deep); }
.half.ta.on { background: var(--ta-fill); box-shadow: inset 0 0 0 0.5px var(--ta-deep); }

.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 14px; }
.legend .half { width: 14px; height: 10px; border-radius: 3px; }

/* ── 配对码 ─────────────────────────────────────── */
.code-box {
  text-align: center;
  padding: 16px 12px;
  background: var(--me-soft);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.code-box .code {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 7px;
  color: #185fa5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-input {
  font-size: 22px !important;
  letter-spacing: 5px;
  text-align: center;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}

/* ── 双人状态条 ─────────────────────────────────── */
.duo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.duo .chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2);
}
.duo .dot { width: 9px; height: 9px; border-radius: 50%; }
.duo .dot.me { background: var(--me-deep); }
.duo .dot.ta { background: var(--ta-deep); }
.streak { font-size: 13px; color: var(--ta-deep); font-weight: 500; }

.spinner {
  width: 22px; height: 22px;
  margin: 0 auto;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.foot-note { font-size: 11.5px; color: var(--text-3); margin-top: 22px; line-height: 1.7; }

/* ── 底部标签栏 ─────────────────────────────────── */
.screen { padding-bottom: 78px; }
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  gap: 4px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-top: 0.5px solid var(--line);
}
.tabbar button {
  flex: 1;
  padding: 8px 0;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-3);
  background: none;
  border: none;
  border-radius: 9px;
  cursor: pointer;
}
.tabbar button.on { color: var(--text); background: #f1f1ee; font-weight: 500; }

/* ── 筛选胶囊 ───────────────────────────────────── */
.chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-2);
  background: #f4f4f1;
  border: 0.5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}
.chip-btn.on { color: #fff; background: var(--text); border-color: var(--text); }

/* ── 动作列表 ───────────────────────────────────── */
.ex-list { display: flex; flex-direction: column; gap: 2px; }
.ex-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: none;
  border-radius: 12px;
  cursor: pointer;
}
.ex-row:active { background: #f4f4f1; }
.ex-art, .ex-ph {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 11px;
  background: #f4f4f2;
  object-fit: contain;
}
.ex-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-2);
}
.ex-ph.big { width: 128px; height: 128px; font-size: 44px; border-radius: 16px; }
.ex-meta { display: flex; flex-direction: column; min-width: 0; }
.ex-name { font-size: 14.5px; line-height: 1.35; }
.ex-sub { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.ex-type { flex: none; font-size: 11.5px; color: var(--text-3); max-width: 84px; text-align: right; }

/* ── 动作详情浮层 ───────────────────────────────── */
.sheet-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.28); z-index: 20; }
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 21;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 20px 20px 0 0;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-title { font-size: 18px; font-weight: 500; }
.sheet-art {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  border-radius: var(--radius);
  background: #f4f4f2;
  margin-bottom: 16px;
  overflow: hidden;
}
.sheet-art img { width: 170px; height: 170px; object-fit: contain; }
.sheet-rows { margin-bottom: 18px; }
.sheet-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13.5px;
  border-bottom: 0.5px solid var(--line);
}
.sheet-rows > div:last-child { border-bottom: none; }
.sheet-rows .k { color: var(--text-3); flex: none; }

/* 三帧演示动画：3 张图叠放，按 1/3 周期轮播透明度 */
.sheet-art img { position: absolute; opacity: 0; }
.sheet-art { position: relative; }
.sheet-art img.fA { animation: fA 1.5s ease-in-out infinite; }
.sheet-art img.fB { animation: fB 1.5s ease-in-out infinite; }
.sheet-art img.fC { animation: fC 1.5s ease-in-out infinite; }
@keyframes fA {
  0%, 30% { opacity: 1; }
  33.4%, 96.6% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes fB {
  0%, 30% { opacity: 0; }
  33.4%, 63% { opacity: 1; }
  66.7%, 100% { opacity: 0; }
}
@keyframes fC {
  0%, 63% { opacity: 0; }
  66.7%, 96.6% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet-art img.fA, .sheet-art img.fB { animation: none; opacity: 0; }
  .sheet-art img.fC { animation: none; opacity: 1; }
}

/* ── 今日清单 ───────────────────────────────────── */
.plan-list { display: flex; flex-direction: column; gap: 2px; }
.plan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}
.plan-art, .plan-ph {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f4f4f2;
  object-fit: contain;
}
.plan-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-2);
}
.icon-btn {
  flex: none;
  width: 28px;
  height: 28px;
  font-size: 17px;
  line-height: 1;
  color: var(--text-3);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:active { background: #f1f1ee; }

/* ── 记录中 ─────────────────────────────────────── */
.rec-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 12px;
  padding: 10px 0;
  background: var(--bg);
  border-bottom: 0.5px solid var(--line);
}
.rec-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.clk {
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}
.clk-min { font-size: 11.5px; font-weight: 400; color: var(--text-3); }

.rec-dur {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
}
.rec-dur input {
  width: 78px;
  padding: 7px 8px !important;
  font-size: 15px !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.rec-dur-u { color: var(--text-3); }

.zone-acts { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.zone-acts .btn.ghost { flex: 1; }
.zone-acts .btn.link.zone-del { flex: none; color: #a0413a; }

/* ── 从某天复制 ─────────────────────────────────── */
.copy-list { display: flex; flex-direction: column; gap: 6px; }
.copy-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 11px 13px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.copy-row:active { background: #f4f4f1; }
.copy-date { font-size: 14px; font-weight: 500; }
.copy-n { font-size: 11.5px; font-weight: 400; color: var(--text-3); margin-left: 8px; }
.copy-items {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.btn.rec-done { color: var(--text); font-size: 15px; font-weight: 500; }

.rec-timer {
  position: sticky;
  top: 52px;
  z-index: 4;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #eef2f7;
  margin-bottom: 12px;
}
.rec-timer.hidden { display: none; }
.rt-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
}
.rt-label { font-size: 12px; color: var(--text-2); }
.rt-time {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #185fa5;
}
.btn.link.rt-skip { color: var(--text-2); }

.rec-item { padding: 14px 12px; }
.rec-art, .rec-ph {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f4f4f2;
  object-fit: contain;
}
.rec-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-2);
}
.rec-name { font-size: 15px; line-height: 1.4; }
.rec-sub { font-size: 12px; color: var(--text-3); line-height: 1.5; }

.set-table { margin-top: 12px; }
.set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}
.set-row.done .set-cols { opacity: 0.55; }
.set-idx {
  flex: none;
  width: 18px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.set-cols {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.set-in {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 8px 10px !important;
  font-size: 15px !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.set-x { flex: none; font-size: 12px; color: var(--text-3); }
.set-check {
  flex: none;
  width: 34px;
  height: 34px;
  font-size: 15px;
  line-height: 1;
  color: var(--text-3);
  background: var(--surface);
  border: 0.5px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
}
.set-check.on {
  color: #fff;
  background: #1a7a3c;
  border-color: #1a7a3c;
}

/* ── 某一天：双片区 ─────────────────────────────── */
.day-title { flex: 1; text-align: center; font-size: 14px; font-weight: 500; white-space: nowrap; }
.head-spacer { flex: none; width: 52px; }

/* ── 统计 ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.stat-box {
  padding: 12px 8px;
  text-align: center;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-sm);
}
.stat-k { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.stat-v {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-u { font-size: 11.5px; font-weight: 400; color: var(--text-3); margin-left: 2px; }

.chart { display: block; }
.chart-empty { text-align: center; padding: 34px 0; margin: 0; }

.zone {
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  margin-bottom: 14px;
  border: 0.5px solid var(--line);
  background: var(--surface);
}
.zone.me { background: var(--me-soft); border-color: var(--me-fill); }
.zone.ta { background: var(--ta-soft); border-color: var(--ta-fill); }

.zone-head { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.zone-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.zone-head .dot.me { background: var(--me-deep); }
.zone-head .dot.ta { background: var(--ta-deep); }
.zone-name { font-size: 14px; font-weight: 500; }
.zone.me .zone-name { color: #185fa5; }
.zone.ta .zone-name { color: #993556; }
.zone-meta { font-size: 12px; color: var(--text-2); }

.dz-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  font-size: 13.5px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}
.dz-row:last-child { border-bottom: none; }
.dz-val { flex: none; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.cheer-btn { margin-top: 12px; border-color: var(--ta-fill); color: #993556; }
.cheer-badge {
  margin-top: 12px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  font-size: 12.5px;
  color: var(--text-2);
  text-align: center;
}


