:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #7a7163;
  --accent: #e8a33d;
  --accent-dark: #c9852a;
  --line: #ece3d4;
  --danger: #c0492f;
  --ok: #4a8f5b;
  --radius: 18px;
  --tap: 56px;
}

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.4;
}

.hidden { display: none !important; }

/* gate */
.gate { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.gate-card { background: var(--card); border-radius: var(--radius); padding: 28px; max-width: 420px; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.big-emoji { font-size: 64px; }
.gate code { background: #f3ece0; padding: 2px 6px; border-radius: 6px; font-size: 15px; }

/* topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-size: 22px; font-weight: 700; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 14px; color: var(--muted); }

main { padding: 16px 18px 40px; max-width: 520px; margin: 0 auto; }
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* next-feed card */
.next-card { background: var(--card); border-radius: var(--radius); padding: 22px; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.05); margin-bottom: 18px; }
.next-label { color: var(--muted); font-size: 16px; }
.countdown { font-size: 40px; font-weight: 800; letter-spacing: .5px; margin: 6px 0; }
.countdown.due { color: var(--danger); }
.next-sub { color: var(--muted); font-size: 15px; }
.next-reason { color: var(--accent-dark); font-size: 14px; margin-top: 6px; line-height: 1.3; }

/* mic */
.mic { width: 100%; border: none; border-radius: var(--radius); background: linear-gradient(160deg, var(--accent), var(--accent-dark)); color: #fff; padding: 26px; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 6px 18px rgba(232,163,61,.35); transition: transform .08s; }
.mic:active { transform: scale(.98); }
.mic.recording { background: linear-gradient(160deg, #d9534f, #b03a36); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 6px 18px rgba(217,83,79,.35);} 50% { box-shadow: 0 6px 30px rgba(217,83,79,.65);} }
.mic-icon { font-size: 46px; }
.mic-text { font-size: 18px; font-weight: 600; }
.mic-status { text-align: center; color: var(--muted); min-height: 22px; margin: 8px 0 4px; }

/* big buttons (same footprint as the mic) */
.big-btn { width: 100%; border: none; border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 14px 0; transition: transform .08s; }
.big-btn:active { transform: scale(.98); }
.big-icon { font-size: 44px; }
.big-text { font-size: 18px; font-weight: 600; }
.ask-big { background: linear-gradient(160deg, #5a9c8f, #3f7166); color: #fff; box-shadow: 0 6px 18px rgba(63,113,102,.3); }

/* buttons */
.row { display: flex; gap: 12px; margin: 14px 0; }
.row > * { flex: 1; }
button { font-family: inherit; cursor: pointer; }
.secondary { min-height: var(--tap); border: 1px solid var(--line); background: var(--card); border-radius: 14px; font-size: 17px; color: var(--ink); }
.primary { min-height: var(--tap); border: none; background: var(--accent); color: #fff; border-radius: 14px; font-size: 18px; font-weight: 700; }
.danger { min-height: var(--tap); border: 1px solid var(--danger); background: #fff; color: var(--danger); border-radius: 14px; font-size: 16px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 6px; }
.chip { border: 1px solid var(--accent); color: var(--accent-dark); background: #fff; border-radius: 999px; padding: 12px 16px; font-size: 16px; min-height: 48px; }
.chip:active { background: #fdf3e2; }

.section-title { color: var(--muted); font-size: 15px; margin: 18px 0 8px; }

/* recent / timeline */
.recent-list, .timeline { display: flex; flex-direction: column; gap: 0; }
.feed-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.feed-item .t { font-size: 15px; color: var(--muted); }
.feed-item .l { font-size: 19px; font-weight: 600; }
.feed-item .edit { color: var(--accent-dark); font-size: 14px; border: none; background: none; }
.gap { text-align: center; color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.day-head { font-weight: 700; color: var(--muted); margin: 16px 0 8px; }

/* view head */
.view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.view-head h2 { margin: 0; font-size: 22px; }
.back { background: none; border: none; color: var(--accent-dark); font-size: 17px; padding: 6px 0; }

/* form */
.fld-label { display: block; color: var(--muted); font-size: 15px; margin: 16px 0 6px; }
.fld.hidden { display: none; }
.seg { display: flex; gap: 8px; }
.seg-btn { flex: 1; min-height: var(--tap); border: 1px solid var(--line); background: var(--card); border-radius: 12px; font-size: 17px; }
.seg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 26px; }
.stepper input { flex: 1; min-height: 56px; text-align: center; font-size: 24px; border: 1px solid var(--line); border-radius: 12px; }
#feed-form input[type=text], #feed-form input[type=datetime-local] { width: 100%; min-height: var(--tap); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 17px; background: var(--card); }
.transcript { background: #f3ece0; border-radius: 12px; padding: 10px 14px; color: var(--muted); font-size: 15px; margin-top: 14px; }
.form-actions { margin-top: 22px; }

/* ask */
.ask-box { display: flex; gap: 10px; margin: 12px 0; }
.ask-box input { flex: 1; min-height: var(--tap); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 17px; }
.ask-box .primary { flex: 0 0 90px; }
.answer { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-height: 60px; font-size: 18px; white-space: pre-wrap; }
.answer.loading { color: var(--muted); }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #2b2b2b; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 60; }
