/* closely — layout and components. Every colour, font and radius comes from theme.css. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--backdrop);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}
button { font-family: inherit; color: inherit; }

#app {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 460px) {
  #app {
    margin: 18px 0;
    min-height: calc(100vh - 36px);
    border-radius: 34px;
    box-shadow: 0 24px 70px rgba(var(--shadow-rgb), .18);
    border: 1px solid var(--line);
  }
}

.screen {
  padding: 18px 18px calc(96px + env(safe-area-inset-bottom));
  animation: screenIn .22s ease;
  min-height: 100vh;
  min-height: 100dvh;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- typography helpers ---------- */
.h1 { font-size: 21px; font-weight: 800; }
.h2 { font-size: 14px; font-weight: 800; }
.sub { font-size: 12px; color: var(--muted-2); }
.link { font-size: 12px; color: var(--accent-text); font-weight: 700; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px 0; }
.topbar .icon-btn { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--text); display: flex; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.back-row { display: flex; align-items: center; gap: 10px; padding: 4px 0 14px; }
.back-btn {
  width: 34px; height: 34px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 16px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.back-row .h1 { font-size: 18px; font-weight: 900; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}
.card-lg { border-radius: 26px; box-shadow: var(--shadow); }

/* ---------- buttons ---------- */
.btn {
  background: var(--accent-fill); color: var(--on-accent); border: 0; border-radius: var(--radius-pill);
  padding: 12px 20px; font-size: 13.5px; font-weight: 800; cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: var(--accent-press); }
.btn-block { width: 100%; }
.btn-soft {
  background: var(--soft); color: var(--text-3); border: 1px solid var(--line);
}
.btn-soft:hover { background: var(--accent-soft-2); }

/* ---------- home ---------- */
.greeting { padding: 10px 2px 0; font-size: 20px; font-weight: 800; }
.greeting .heart { color: var(--accent); }

.mood-card {
  margin-top: 12px; background: var(--soft); border-radius: 18px; padding: 14px;
  display: flex; gap: 12px; align-items: flex-start;
}
.mood-card .title { font-size: 13.5px; font-weight: 800; }
.mood-card .note { margin-top: 4px; font-size: 12px; color: var(--muted); }
.mood-card .note .heart { color: var(--accent); }
.mood-card .btn { margin-top: 10px; padding: 8px 16px; font-size: 12.5px; }
.mood-card .slot { width: 66px; height: 66px; flex-shrink: 0; }

.stat-row { display: flex; gap: 10px; margin-top: 12px; }
.stat {
  flex: 1; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 10px 14px;
}
.stat .num { font-size: 18px; font-weight: 900; }
.stat .lbl { font-size: 11px; color: var(--muted-2); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 0; }
.section-head .h2 { font-size: 13.5px; }

.tile-row { display: flex; gap: 8px; margin-top: 10px; }
.tile {
  flex: 1; background: var(--soft-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-align: center; cursor: pointer; transition: transform .12s ease;
}
.tile:active { transform: scale(.96); }
.tile .i { font-size: 17px; }
.tile .t { font-size: 9.5px; font-weight: 700; color: var(--text-3); line-height: 1.2; }

.moments-row { display: flex; gap: 8px; margin-top: 10px; }
.moments-row .slot { flex: 1; height: 74px; }

/* ---------- image slots ---------- */
.slot {
  position: relative; overflow: hidden; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent-soft-2), var(--accent-soft));
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 10.5px; font-weight: 700; text-align: center;
  border: 0; padding: 0;
}
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.circle { border-radius: var(--radius-pill); }
.slot .ph { padding: 4px; pointer-events: none; }
.slot .ph .pe { font-size: 20px; display: block; margin-bottom: 2px; }

/* ---------- avatar ---------- */
.avatar { width: 30px; height: 30px; border-radius: var(--radius-pill); font-size: 13px; }

/* ---------- partner live (together) ---------- */
.live-card {
  background: var(--live-card-bg);
  border: 1px solid var(--accent-line); border-radius: 26px; box-shadow: var(--shadow);
  padding: 20px 18px; display: flex; flex-direction: column; gap: 14px;
}
.live-head { display: flex; justify-content: space-between; align-items: center; }
.live-head .brand { font-size: 13px; font-weight: 900; letter-spacing: .06em; }
.live-head .online { font-size: 11px; font-weight: 700; color: var(--text-2); }
.live-head .online::before { content: '● '; color: var(--success); }
.live-center { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; }
.live-emoji {
  width: 84px; height: 84px; border-radius: var(--radius-pill); background: var(--highlight);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.live-mood { font-size: 24px; font-weight: 900; }
.live-note { font-size: 13px; color: var(--muted); }
.live-card .btn { box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 35%, transparent); padding: 12px 34px; font-size: 14px; }
.emoji-row { display: flex; justify-content: center; gap: 10px; }
.emoji-chip {
  width: 38px; height: 38px; border-radius: var(--radius-pill); background: var(--surface); border: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  box-shadow: 0 3px 8px rgba(var(--shadow-rgb), .1); cursor: pointer; transition: transform .12s ease;
}
.emoji-chip:active { transform: scale(1.2); }
.live-row { background: var(--surface); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.live-row .t { font-size: 12.5px; font-weight: 800; }
.live-row .s { font-size: 11.5px; color: var(--muted-2); }
.progress { margin-top: 8px; height: 6px; border-radius: var(--radius-pill); background: var(--accent-soft); overflow: hidden; }
.progress > div { height: 100%; border-radius: var(--radius-pill); background: var(--accent); }

/* ---------- streak ---------- */
.streak-card {
  margin-top: 16px; padding: 22px 18px; display: flex; flex-direction: column;
  gap: 16px; align-items: center;
}
.streak-ring {
  position: relative; width: 150px; height: 150px; border-radius: var(--radius-pill);
  border: 5px solid var(--accent-soft); display: flex; align-items: center; justify-content: center;
}
.streak-ring .fire {
  position: absolute; right: 2px; top: 14px; width: 34px; height: 34px; border-radius: var(--radius-pill);
  background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.streak-num { font-size: 40px; font-weight: 900; line-height: 1; }
.streak-sub { font-size: 14px; font-weight: 700; color: var(--text-3); }
.streak-hint { font-size: 12px; color: var(--muted-2); margin-top: 4px; }
.ministat-row { display: flex; gap: 6px; width: 100%; }
.ministat {
  flex: 1; background: var(--soft-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 4px; text-align: center;
}
.ministat .n { font-size: 16px; font-weight: 900; }
.ministat .l { font-size: 9px; color: var(--muted-2); font-weight: 700; }
.week { width: 100%; }
.week .h2 { font-size: 12px; margin-bottom: 8px; }
.week-days { display: flex; justify-content: space-between; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wd .dot {
  width: 28px; height: 28px; border-radius: var(--radius-pill); display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 800;
}
.wd .lbl { font-size: 9.5px; color: var(--muted-2); font-weight: 700; }

/* ---------- sheets ---------- */
#sheetRoot { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
#sheetBackdrop { position: absolute; inset: 0; background: var(--scrim); animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
#sheet {
  position: relative; width: 100%; max-width: 430px; background: var(--surface);
  border-radius: 26px 26px 0 0; padding: 12px 18px calc(22px + env(safe-area-inset-bottom));
  animation: sheetUp .26s cubic-bezier(.2, .9, .3, 1);
  max-height: 86vh; overflow-y: auto;
}
@keyframes sheetUp { from { transform: translateY(60%); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 44px; height: 5px; border-radius: var(--radius-pill); background: var(--line); margin: 0 auto 14px; }
.sheet-title { text-align: center; font-size: 16px; font-weight: 900; margin-bottom: 16px; }

.create-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; }
.create-item {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center;
  gap: 6px; cursor: pointer; padding: 0;
}
.create-item:active .ci { transform: scale(.92); }
.create-item .ci {
  width: 48px; height: 48px; border-radius: var(--radius-pill); background: var(--soft);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 20px; transition: transform .12s ease;
}
.create-item .cl { font-size: 11px; font-weight: 700; color: var(--text-2); }

.mood-pick-row { display: flex; gap: 8px; margin-top: 14px; }
.mood-pick {
  width: 46px; height: 46px; border-radius: var(--radius-pill); background: var(--soft-2);
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 21px; cursor: pointer; transition: transform .12s ease;
}
.mood-pick:active { transform: scale(1.1); }
.mood-pick.on { background: var(--accent-soft); border-color: var(--accent); }

.field { margin-top: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 800; color: var(--text-3); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px;
  font-size: 13px; font-family: inherit; color: var(--text); background: var(--surface); outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: none; min-height: 74px; }

.switch-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.switch-row .t { font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.switch { width: 44px; height: 26px; border-radius: var(--radius-pill); background: var(--line); border: 0; position: relative; cursor: pointer; transition: background .15s ease; }
.switch::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px;
  border-radius: var(--radius-pill); background: var(--surface); transition: transform .15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.photo-drop { margin-top: 12px; height: 120px; border-radius: 16px; width: 100%; }

/* ---------- questions ---------- */
.q-dots { display: flex; align-items: center; gap: 4px; justify-content: center; margin: 6px 0 2px; }
.q-dots .d { width: 8px; height: 8px; border-radius: 99px; background: var(--line); }
.q-dots .d.on { background: var(--accent); }
.q-dots .l { flex: 1; max-width: 60px; height: 2px; background: var(--line); }
.q-card {
  background: var(--soft-2); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 18px; text-align: center; font-size: 17px; font-weight: 800; line-height: 1.4;
  margin-top: 14px;
}
.answer-lbl { font-size: 11.5px; font-weight: 800; color: var(--muted-2); margin: 14px 0 6px; }
.answer-box { border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; font-size: 12.5px; line-height: 1.4; }
.answer-box.partner { background: var(--soft); border: 0; }
.answer-box .heart { color: var(--accent); }
.q-list-item {
  display: flex; align-items: center; gap: 11px; border: 1px solid var(--line);
  border-radius: 13px; padding: 11px 13px; margin-top: 8px; background: var(--surface);
}
.q-list-item .qq { flex: 1; font-size: 12.5px; font-weight: 700; }
.q-list-item .st { font-size: 10.5px; font-weight: 800; color: var(--success); }
.q-list-item .st.todo { color: var(--faint); }

/* ---------- activities ---------- */
.chip-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip {
  background: var(--soft); color: var(--text-3); font-size: 11px; font-weight: 800;
  padding: 7px 13px; border-radius: var(--radius-pill); border: 0; cursor: pointer;
}
.chip.on { background: var(--accent-fill); color: var(--on-accent); }
.dice-card {
  margin-top: 14px; background: var(--soft); border-radius: 18px; padding: 18px;
  text-align: center; cursor: pointer; transition: transform .12s ease; border: 0; width: 100%;
}
.dice-card:active { transform: scale(.97); }
.dice-card .t { font-size: 14.5px; font-weight: 900; }
.dice-card .s { font-size: 11.5px; color: var(--muted-2); }
.dice-card .die { font-size: 52px; margin-top: 8px; display: inline-block; }
.dice-card.rolling .die { animation: roll .5s ease; }
@keyframes roll { 50% { transform: rotate(360deg) scale(1.25); } }
.act-item {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; margin-top: 10px; background: var(--surface);
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.act-item.hl { border-color: var(--accent); background: var(--soft); }
.act-item .ai {
  width: 38px; height: 38px; border-radius: 10px; background: var(--soft);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0;
}
.act-item .t { font-size: 12.5px; font-weight: 800; }
.act-item .s { font-size: 11px; color: var(--muted-2); }
.act-item .chev { margin-left: auto; color: var(--faint); }

/* ---------- moments ---------- */
.seg-row { display: flex; align-items: center; gap: 18px; padding: 4px 2px 0; }
.seg { background: none; border: 0; font-size: 14px; font-weight: 700; color: var(--muted-2); padding: 0 0 6px; cursor: pointer; border-bottom: 2px solid transparent; }
.seg.on { font-weight: 900; color: var(--accent-text); border-bottom-color: var(--accent); }
.year-lbl { font-size: 14px; font-weight: 900; color: var(--text-3); margin: 16px 2px 4px; }
.tl-item {
  display: flex; align-items: center; gap: 12px; margin-top: 12px; cursor: pointer;
  background: none; border: 0; width: 100%; text-align: left; padding: 0;
}
.tl-item .d { width: 42px; font-size: 10.5px; font-weight: 800; color: var(--muted-2); text-align: right; line-height: 1.2; flex-shrink: 0; }
.tl-item .slot { width: 56px; height: 44px; flex-shrink: 0; border-radius: 10px; }
.tl-item .t { font-size: 12.5px; font-weight: 800; }
.tl-item .s { font-size: 11px; color: var(--muted-2); }

.otd-card { margin-top: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.otd-head { display: flex; justify-content: space-between; align-items: flex-start; }
.otd-head .t { font-size: 18px; font-weight: 900; }
.otd-photo { position: relative; border-radius: 18px; overflow: hidden; height: 220px; }
.otd-photo .slot { width: 100%; height: 100%; border-radius: 0; }
.otd-badge {
  position: absolute; left: 12px; bottom: 12px; background: var(--accent-fill); color: var(--on-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .05em; padding: 4px 10px;
  border-radius: var(--radius-pill); pointer-events: none;
}
.otd-title { font-size: 14.5px; font-weight: 800; }
.otd-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.otd-date { font-size: 11.5px; color: var(--faint); margin-top: 4px; }

.fab {
  position: fixed; right: max(18px, calc(50vw - 215px + 18px)); bottom: calc(96px + env(safe-area-inset-bottom));
  width: 46px; height: 46px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent);
  border: 0; font-size: 24px; cursor: pointer; box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 40%, transparent);
  z-index: 30;
}

/* ---------- memory detail ---------- */
.mem-hero { position: relative; height: 250px; border-radius: 22px; overflow: hidden; margin-top: 4px; }
.mem-hero .slot { width: 100%; height: 100%; border-radius: 0; }
.mem-hero .back-btn { position: absolute; left: 12px; top: 12px; background: rgba(0, 0, 0, .35); color: var(--on-accent); border: 0; z-index: 2; }
.mem-title { font-size: 17px; font-weight: 900; margin-top: 16px; }
.mem-meta { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.mem-desc { font-size: 13px; color: var(--text-3); margin-top: 8px; line-height: 1.45; }
.mem-by { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted-2); font-weight: 700; }
.comment { display: flex; gap: 8px; margin-top: 12px; }
.comment .cavatar { width: 26px; height: 26px; flex-shrink: 0; font-size: 11px; }
.comment .by { font-size: 11.5px; font-weight: 800; }
.comment .tx { font-size: 11.5px; color: var(--text-3); }
.comment .dt { font-size: 10px; color: var(--faint); }
.comment-bar { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.comment-bar input {
  flex: 1; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 10px 14px;
  font-size: 12px; font-family: inherit; outline: none;
}
.comment-bar input:focus { border-color: var(--accent); }
.love-btn {
  width: 36px; height: 36px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 15px; cursor: pointer; flex-shrink: 0;
}
.love-btn.on { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }

/* ---------- calendar ---------- */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.cal-head .m { font-size: 15px; font-weight: 900; }
.cal-nav { background: none; border: 0; font-size: 18px; color: var(--accent); cursor: pointer; padding: 4px 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; margin-top: 10px; }
.cal-grid .dow { font-size: 9.5px; font-weight: 800; color: var(--faint); padding: 4px 0; }
.cal-day { font-size: 11px; font-weight: 700; padding: 6px 0; border-radius: var(--radius-pill); color: var(--text-2); background: transparent; border: 0; }
.cal-day.ev { background: var(--accent-soft); color: var(--text); }
.cal-day.today { background: var(--accent-fill); color: var(--on-accent); }
.event-item {
  display: flex; align-items: center; gap: 11px; border: 1px solid var(--line);
  border-radius: 13px; padding: 9px 12px; margin-top: 9px; background: var(--surface);
}
.event-item .ei { width: 34px; height: 34px; border-radius: 9px; background: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.event-item .t { font-size: 12px; font-weight: 800; }
.event-item .s { font-size: 10.5px; color: var(--muted-2); }
.event-item .d { margin-left: auto; font-size: 10.5px; font-weight: 800; color: var(--accent-text); white-space: nowrap; }

/* ---------- love note widget (home) ---------- */
.note-card {
  margin-top: 14px; background: var(--accent-fill); border-radius: 20px; padding: 16px; color: var(--on-accent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 30%, transparent);
}
.note-card .k { font-size: 11px; font-weight: 800; opacity: .9; }
.note-card .t { font-size: 15px; font-weight: 800; margin-top: 8px; line-height: 1.35; }
.note-card .f { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.note-card .dt { font-size: 10.5px; opacity: .8; }
.note-card .hb { width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--on-accent) 25%, transparent); display: flex; align-items: center; justify-content: center; font-size: 13px; }

/* ---------- profile ---------- */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 16px; }
.profile-head .slot { width: 84px; height: 84px; font-size: 12px; }
.profile-head .n { font-size: 17px; font-weight: 900; }
.profile-row {
  display: flex; align-items: center; gap: 11px; border: 1px solid var(--line);
  border-radius: 13px; padding: 12px 13px; margin-top: 8px; background: var(--surface);
  cursor: pointer; width: 100%; text-align: left;
}
.profile-row .pi { font-size: 14px; }
.profile-row .t { flex: 1; font-size: 12.5px; font-weight: 700; }
.profile-row .chev { color: var(--faint); }

/* ---------- toast / burst ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom));
  transform: translateX(-50%); background: var(--text); color: var(--on-accent); font-size: 12.5px;
  font-weight: 700; padding: 10px 18px; border-radius: var(--radius-pill); z-index: 90;
  box-shadow: var(--toast-shadow); white-space: nowrap;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
#burstLayer { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.burst-heart { position: absolute; font-size: 20px; animation: floatUp 1.1s ease-out forwards; }
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-130px) scale(1.4); }
}

/* ---------- bottom nav ---------- */
#nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; background: var(--surface); border-top: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
}
@media (min-width: 460px) { #nav { bottom: 18px; border-radius: 0 0 34px 34px; } }
.nav-item {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 9.5px; font-weight: 700; color: var(--faint-2); cursor: pointer;
}
.nav-item.on { color: var(--accent-text); font-weight: 800; }
.nav-plus {
  width: 44px; height: 44px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent);
  border: 0; font-size: 24px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 40%, transparent); transition: transform .12s ease;
}
.nav-plus:active { transform: scale(.92) rotate(90deg); }

.empty { text-align: center; color: var(--muted-2); font-size: 12.5px; padding: 26px 10px; }

/* ================= new pages: goals / bucket / places ================= */
.check-item {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-top: 10px; background: var(--surface);
}
.check-item .ct { flex: 1; font-size: 13px; font-weight: 700; }
.check-item.done .ct { text-decoration: line-through; color: var(--faint); }
.check-box {
  width: 26px; height: 26px; border-radius: var(--radius-pill); border: 2px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 900; color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease;
}
.check-item.done .check-box { background: var(--success); border-color: var(--success); }
.del-btn {
  background: none; border: 0; color: var(--faint); font-size: 12px; cursor: pointer;
  padding: 6px; flex-shrink: 0; opacity: .6;
}
.del-btn:hover { color: var(--accent); opacity: 1; }
.add-row { display: flex; gap: 8px; margin-top: 16px; }
.add-row input {
  flex: 1; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 11px 16px;
  font-size: 12.5px; font-family: inherit; outline: none; background: var(--surface); color: var(--text);
}
.add-row input:focus { border-color: var(--accent); }
.add-row .btn { padding: 11px 20px; }

/* ================= albums ================= */
.album-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.album-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s ease;
}
.album-card:active { transform: scale(.97); }
.album-card .slot.album-cover { width: 100%; height: 108px; border-radius: 0; }
.album-meta { padding: 10px 12px; }
.album-meta .t { font-size: 12.5px; font-weight: 800; }
.album-meta .s { font-size: 10.5px; color: var(--muted-2); }
.mem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.mem-grid .slot.grid-thumb { width: 100%; aspect-ratio: 1; border-radius: 12px; }

/* ================= help / faq ================= */
.faq {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  margin-top: 10px; padding: 0 14px; overflow: hidden;
}
.faq summary {
  font-size: 13px; font-weight: 800; padding: 13px 0; cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.faq summary::after { content: '›'; color: var(--faint); transform: rotate(90deg); transition: transform .15s ease; }
.faq[open] summary::after { transform: rotate(-90deg); }
.faq p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0 0 14px; }

/* ================= theme swatches ================= */
.swatch-row { display: flex; gap: 12px; margin-bottom: 6px; }
.swatch {
  width: 38px; height: 38px; border-radius: var(--radius-pill); border: 3px solid transparent;
  cursor: pointer; transition: transform .12s ease;
}
.swatch:active { transform: scale(1.12); }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }

/* ================= surfaces on tokens (dark-mode ready) ================= */
.q-list-item, .act-item, .event-item, .profile-row, .live-row, .comment-bar input, .love-btn,
.emoji-chip { background: var(--surface); }
#sheet, #nav { background: var(--surface); }
.sheet-handle { background: var(--line); }
.streak-ring { border-color: var(--accent-soft); }
.field input, .field textarea, .field select { background: var(--surface); }
.answer-box { background: var(--surface); }
.q-dots .d { background: var(--line); }
.q-dots .d.on { background: var(--accent); }
#toast { background: var(--text); color: var(--bg); }

/* the "set your date" stat is a button that looks like its neighbour */
button.stat { font: inherit; color: inherit; text-align: start; cursor: pointer; }

/* ================= chat ================= */
.nav-item { position: relative; }
.nav-badge {
  position: absolute; top: -4px; inset-inline-end: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-pill); background: var(--danger); color: var(--on-accent);
  font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.nav-badge[hidden] { display: none; }
.screen.chat-mode { padding: 0; height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; animation: none; }
#chatRoot { display: flex; flex-direction: column; height: 100%; }
.chat-head {
  display: flex; align-items: center; gap: 8px; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
}
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .name { font-size: 16px; font-weight: 900; }
.chat-head .status { font-size: 11.5px; color: var(--accent-text); min-height: 14px; }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 5px; }
.chat-day {
  align-self: center; font-size: 11px; font-weight: 700; color: var(--muted-2); background: var(--soft);
  border-radius: var(--radius-pill); padding: 3px 12px; margin: 10px 0 4px;
}
.chat-older { align-self: center; background: none; border: 0; color: var(--accent-text); font: inherit; font-size: 12px; cursor: pointer; padding: 6px; }
.msg {
  max-width: 80%; padding: 8px 12px 6px; border-radius: 18px; font-size: 14px; line-height: 1.45;
  position: relative; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; -webkit-user-select: none; user-select: none;
}
.msg.mine { align-self: flex-end; background: var(--accent-fill); color: var(--on-accent); border-end-end-radius: 6px; }
.msg.theirs { align-self: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-end-start-radius: 6px; }
.msg .meta { font-size: 10.5px; opacity: .78; margin-top: 2px; text-align: end; white-space: nowrap; }
.msg .reply-q {
  border-inline-start: 3px solid currentColor; border-radius: 6px; padding: 3px 8px; margin-bottom: 5px;
  font-size: 12px; opacity: .85; background: color-mix(in srgb, currentColor 10%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg .reacts {
  position: absolute; bottom: -13px; inset-inline-end: 10px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: 13px; padding: 0 6px; line-height: 20px;
}
.msg.has-reacts { margin-bottom: 14px; }
.msg img.chat-photo { display: block; max-width: 100%; min-width: 120px; min-height: 80px; border-radius: 12px; margin: 2px 0; background: var(--soft); }
.msg audio { display: block; width: 220px; max-width: 100%; height: 36px; }
.msg .secs { font-size: 10.5px; opacity: .8; }
.msg.deleted { font-style: italic; opacity: .6; }
.msg.scheduled { opacity: .7; outline: 1px dashed var(--accent-line); outline-offset: 2px; }
.msg.pending { opacity: .6; }
.card-msg {
  align-self: center; max-width: 90%; margin: 6px 0; padding: 10px 14px; border-radius: 16px; font-size: 13px;
  background: var(--accent-soft-2); border: 1px solid var(--accent-line); text-align: center; line-height: 1.5;
}
.card-msg .lbl { font-size: 11px; font-weight: 800; color: var(--accent-text); }
.card-msg .q { font-weight: 800; margin: 3px 0 6px; }
.card-msg .ans { text-align: start; margin-top: 4px; }
.card-msg .ans b { color: var(--accent-text); }
.card-msg .note { color: var(--muted); margin-top: 3px; }
.nudge-msg { align-self: center; text-align: center; font-size: 12.5px; color: var(--muted); margin: 6px 0; }
.nudge-msg .big { display: block; font-size: 34px; line-height: 1.2; }
.chat-bar { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 12px; background: var(--soft); border-top: 1px solid var(--line); color: var(--text-2); }
.chat-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-bar .x { background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; }
.chat-compose {
  display: flex; align-items: flex-end; gap: 6px; background: var(--bg); border-top: 1px solid var(--line);
  padding: 8px 10px calc(74px + env(safe-area-inset-bottom));
}
.chat-compose textarea {
  flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px;
  font: inherit; font-size: 14px; line-height: 1.35; max-height: 120px; background: var(--surface); color: var(--text); outline: none;
}
.chat-compose textarea:focus { border-color: var(--accent); }
.chat-btn {
  width: 38px; height: 38px; flex: none; border: 0; border-radius: var(--radius-pill); cursor: pointer;
  background: var(--soft); color: var(--text); font-size: 17px; display: flex; align-items: center; justify-content: center;
}
.chat-btn.on { background: var(--accent-soft); }
.chat-btn.send { background: var(--accent-fill); color: var(--on-accent); }
.chat-recording { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); padding: 0 6px; height: 38px; }
.chat-recording .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recPulse 1s infinite; }
@keyframes recPulse { 50% { opacity: .3; } }
.react-row { display: flex; justify-content: space-between; gap: 4px; margin-bottom: 12px; }
.react-row button { font-size: 22px; width: 38px; height: 38px; border: 0; border-radius: var(--radius-pill); background: var(--soft); cursor: pointer; }
.found { border-bottom: 1px solid var(--line); padding: 9px 2px; font-size: 13px; }
.found .w { font-size: 11px; color: var(--muted-2); margin-bottom: 2px; }
@media (prefers-reduced-motion: reduce) { .chat-recording .dot { animation: none; } }

/* quieter buttons for account actions; red only for the irreversible one */
.btn.btn-quiet { background: var(--soft); color: var(--text); box-shadow: none; }
.btn.btn-danger { background: var(--danger); color: var(--on-accent); box-shadow: none; }
.btn.btn-danger-quiet { background: transparent; color: var(--danger-text); box-shadow: none; }

/* past days under the daily question */
.q-list-item.past { display: block; }
.q-list-item.past .qd { font-size: 11px; font-weight: 700; color: var(--muted-2); margin-bottom: 3px; }
.q-list-item.past .qa { font-size: 12.5px; margin-top: 6px; line-height: 1.45; }
.q-list-item.past .qa b { color: var(--accent-text); font-weight: 800; }
.q-list-item.past .qa.muted { color: var(--muted-2); }

/* ================= dark mode =================
   The dark palette is in theme.css; only structure that differs lives here. */
html.dark #app { border-color: var(--line); }
html.dark #app, html.dark #sheet { color: var(--text); }
html.dark #sheet, html.dark #nav { background: var(--surface); color: var(--text); }

/* ================= RTL ================= */
[dir="rtl"] #app, [dir="rtl"] #sheet { font-family: var(--font-arabic); }
html:lang(ko) #app, html:lang(ko) #sheet,
html:lang(ja) #app, html:lang(ja) #sheet,
html:lang(zh-Hans) #app, html:lang(zh-Hans) #sheet,
html:lang(zh-Hant) #app, html:lang(zh-Hant) #sheet {
  font-family: var(--font-cjk);
}
[dir="rtl"] .tl-item .d { text-align: left; }
[dir="rtl"] .otd-badge { left: auto; right: 12px; }
[dir="rtl"] .mem-hero .back-btn { left: auto; right: 12px; }
[dir="rtl"] .fab { right: auto; left: max(18px, calc(50vw - 215px + 18px)); }
[dir="rtl"] .switch::after { left: auto; right: 3px; }
[dir="rtl"] .switch.on::after { transform: translateX(-18px); }

/* ================= fixes ================= */
/* the #sheetRoot display:flex rule outspecifies the UA [hidden] rule — restore it */
#sheetRoot[hidden] { display: none; }
#toast[hidden] { display: none; }

/* icon glyphs must resolve to a color-emoji font, not the text font's monochrome fallback */
.tile .i, .create-item .ci, .event-item .ei, .act-item .ai, .slot .ph .pe,
.profile-row .pi, .live-emoji, .mood-pick, .emoji-chip, .dice-card .die,
.streak-ring .fire, .note-card .hb, .otd-head span, .mem-hero ~ * .heart {
  font-family: var(--font-emoji);
}

/* ================= smart layer ================= */
.coach { margin-top: 14px; padding: 14px 14px 8px; }
.coach-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 900; margin-bottom: 6px; padding: 0 2px; }
.coach-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  background: var(--soft-2); border: 1px solid var(--line); border-radius: 13px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: transform .12s ease;
}
.coach-item:active { transform: scale(.98); }
.coach-item .ci-icon { font-size: 19px; flex-shrink: 0; font-family: var(--font-emoji); }
.coach-item .ci-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.coach-item .ci-t { font-size: 12.5px; font-weight: 800; }
.coach-item .ci-s { font-size: 11px; color: var(--muted-2); }
.coach-item .chev { color: var(--faint); }

.harmony-ring {
  width: 96px; height: 96px; border-radius: var(--radius-pill); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.hr-inner {
  width: 72px; height: 72px; border-radius: var(--radius-pill); background: var(--surface);
  display: flex; align-items: baseline; justify-content: center; gap: 1px; padding-top: 22px;
}
.hr-inner b { font-size: 24px; font-weight: 900; line-height: 1; }
.hr-inner span { font-size: 11px; color: var(--muted-2); font-weight: 700; }

.strip-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.strip-lbl { width: 58px; font-size: 11px; font-weight: 800; color: var(--muted-2); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.strip-cell {
  flex: 1; min-width: 16px; height: 24px; border-radius: 6px; background: var(--soft);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  font-family: var(--font-emoji);
}
.strip-cell.empty { color: var(--faint); background: transparent; border: 1px dashed var(--line); }

.bal-row { margin: 10px 0; }
.bal-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.bal-bar { height: 8px; border-radius: var(--radius-pill); background: var(--accent-soft); overflow: hidden; }
.bal-bar > div { height: 100%; background: var(--accent); border-radius: var(--radius-pill); min-width: 4px; }

.ll-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ll-chip {
  flex: 1; min-width: 30%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--soft-2); border: 2px solid var(--line); border-radius: 13px;
  padding: 10px 4px; cursor: pointer; transition: transform .12s ease;
}
.ll-chip:active { transform: scale(.95); }
.ll-chip.on { background: var(--accent-soft); border-color: var(--accent); }
.ll-chip .ll-i { font-size: 19px; font-family: var(--font-emoji); }
.ll-chip .ll-t { font-size: 10.5px; font-weight: 800; color: var(--text-2); text-align: center; }

.plan-card { margin-top: 12px; padding: 14px 16px; }
.plan-line { display: flex; align-items: center; gap: 12px; margin: 10px 0 12px; }
.plan-actions { display: flex; gap: 8px; }

.freeze-chip {
  display: inline-block; margin-top: 8px; background: var(--soft); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 3px 12px; font-size: 11.5px; font-weight: 800;
}
.strip-cell.empty { height: 22px; }
