* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  overscroll-behavior: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
}

#screen-content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.1rem 1.5rem;
}

/* ---- Bottom tab bar ---- */
#tab-bar {
  flex: 0 0 auto;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 6px;
  background: none;
  border: none;
  font-family: inherit;
  color: var(--color-text-muted);
  cursor: pointer;
}
.tab-item .tab-icon { font-size: 19px; line-height: 1; }
.tab-item .tab-label { font-size: 10px; font-weight: 600; }
.tab-item.active { color: var(--color-pink); }

/* ---- Generic section/text styles shared across screens ---- */
.eyebrow { font-size: 13px; color: var(--color-text-muted); margin-bottom: 4px; }
.title { font-size: 18px; font-weight: 600; margin-bottom: 1rem; }
.greeting { font-size: 18px; font-weight: 600; margin-bottom: 2px; }
.date { font-size: 13px; color: var(--color-text-muted); margin-bottom: 1.25rem; }
.section-title {
  font-size: 13px; font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 10px;
}

.placeholder-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 3rem 1rem; color: var(--color-text-muted);
  gap: 8px;
}
.placeholder-screen .placeholder-emoji { font-size: 32px; }
.placeholder-screen .placeholder-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.placeholder-screen .placeholder-sub { font-size: 13px; line-height: 1.5; max-width: 280px; }

/* ---- Vision strip ---- */
.vision-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 1.5rem; scrollbar-width: none; }
.vision-strip::-webkit-scrollbar { display: none; }
.vision-card {
  flex: 0 0 auto; width: 84px; height: 108px; border-radius: 12px;
  background: linear-gradient(135deg, var(--color-pink-bg), var(--color-pink-bg-strong));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--color-pink-dark); text-align: center; padding: 6px;
  cursor: pointer; border: none; overflow: hidden; position: relative;
}
.vision-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; position: absolute; inset: 0; }
.vision-card.add { background: var(--color-surface-muted); border: 1.5px dashed var(--color-border); color: var(--color-text-faint); cursor: pointer; }

/* ---- Mood check-in ---- */
.mood-row { display: flex; gap: 8px; margin-bottom: 10px; }
.mood-btn {
  flex: 1; padding: 10px 0; border-radius: 12px; border: 1px solid var(--color-border);
  background: var(--color-surface); font-size: 22px; cursor: pointer; text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.mood-btn.selected { background: var(--color-pink-bg); border-color: var(--color-pink); }
.mood-label { font-size: 10px; color: var(--color-text-muted); display: block; margin-top: 2px; }

.mood-note-toggle {
  background: none; border: none; color: var(--color-pink-dark); font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 2px 2px; margin-bottom: 8px; font-family: inherit;
}
.mood-note-input {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  padding: 8px 10px; font-size: 13px; font-family: inherit; resize: none; margin-bottom: 8px;
  background: var(--color-surface-muted);
}
.log-btn {
  width: 100%; padding: 10px; border-radius: var(--radius-sm); border: none;
  background: var(--color-border); color: #fff; font-size: 13px; font-weight: 600;
  margin-bottom: 8px; cursor: not-allowed; transition: background 0.15s;
}
.log-btn.ready { background: var(--color-pink); cursor: pointer; }
.checkin-history { display: flex; align-items: center; gap: 6px; margin: 0 0 1.5rem; min-height: 30px; flex-wrap: wrap; }
.checkin-empty { font-size: 12px; color: var(--color-text-muted); }
.mood-chip {
  width: 28px; height: 28px; border-radius: 50%; background: var(--color-pink-bg);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  border: 1px solid var(--color-pink-bg-strong); flex-shrink: 0; overflow: hidden; white-space: nowrap;
}
.mood-chip.latest { border-color: var(--color-pink); box-shadow: 0 0 0 2px rgba(212,83,126,0.15); }
.checkin-overflow { font-size: 11px; color: var(--color-text-muted); margin-left: 2px; }

/* ---- Today snapshot ---- */
.snapshot-card { background: var(--color-surface-muted); border-radius: var(--radius-md); padding: 1rem; margin-bottom: 1.5rem; }
.snapshot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.snapshot-title { font-size: 14px; font-weight: 600; }
.snapshot-tag { font-size: 11px; background: var(--color-pink); color: #fff; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.snapshot-tag.done { background: var(--color-teal); }
.snapshot-tag.overdue { background: var(--color-amber); }
.snapshot-list { font-size: 13px; color: var(--color-text-soft); line-height: 1.7; margin: 0 0 10px; }
.snapshot-link { font-size: 13px; color: var(--color-pink-dark); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; margin-bottom: 8px; }

/* ---- Next dose (HRT tracker) ---- */
.hrt-method-row { display: flex; gap: 8px; }
.hrt-method-btn {
  flex: 1; padding: 10px 0; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  background: var(--color-surface); font-size: 13px; font-weight: 600; color: var(--color-text-soft);
  cursor: pointer; font-family: inherit;
}
.hrt-subrow { display: flex; justify-content: space-between; align-items: center; }
.hrt-text-link {
  background: none; border: none; color: var(--color-pink-dark); font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 2px; font-family: inherit;
}
.hrt-log-entry { font-size: 12px; color: var(--color-text-soft); padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.hrt-log-entry:last-child { border-bottom: none; }
#hrtLogPanel:not([hidden]) { margin-top: 8px; }

/* ---- Comfort button (Home) ---- */
.comfort-btn {
  width: 100%; padding: 14px; border-radius: var(--radius-md); border: none;
  background: linear-gradient(135deg, var(--color-pink-bg-strong), var(--color-teal-bg));
  color: var(--color-pink-deep); font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.comfort-note { font-size: 11px; color: var(--color-text-muted); text-align: center; margin-top: 8px; }
.notif-details { margin-top: 18px; }
.notif-details > summary {
  font-size: 12px; color: var(--color-text-muted); cursor: pointer; padding: 6px 0;
  text-align: center; list-style: none;
}
.notif-details > summary::-webkit-details-marker { display: none; }
.notif-details[open] > summary { margin-bottom: 8px; }
.notif-details textarea { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }

.version-stamp { font-size: 9px; color: var(--color-text-faint); text-align: center; margin-top: 14px; opacity: 0.6; }

/* ---- Overlays (full-screen, app-wide — not clipped to a screen card anymore) ---- */
.overlay {
  position: fixed; inset: 0; background: var(--color-surface);
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  display: none; flex-direction: column; z-index: 100; overflow-y: auto;
}
.overlay.open { display: flex; }
.overlay-close {
  align-self: flex-end; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--color-border); background: var(--color-surface); font-size: 15px; cursor: pointer;
  margin-bottom: 8px; flex-shrink: 0;
}

/* Vision lightbox specifics */
.lightbox-img {
  border-radius: var(--radius-md); background: linear-gradient(135deg, var(--color-pink-bg), var(--color-pink-bg-strong));
  display: flex; align-items: center; justify-content: center; color: var(--color-pink-dark);
  font-size: 13px; text-align: center; padding: 1rem; margin-bottom: 12px;
  min-height: 240px; overflow: hidden;
}
.lightbox-img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-md); }
.lightbox-caption {
  font-size: 13px; color: var(--color-text-soft); line-height: 1.6; width: 100%;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px;
  resize: none; font-family: inherit; background: var(--color-surface-muted);
}
.lightbox-caption-hint { font-size: 11px; color: var(--color-text-muted); margin: 6px 0 0; }
.lightbox-delete {
  margin-top: 14px; width: 100%; padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-soft);
  font-size: 13px; font-weight: 600; cursor: pointer;
}

/* Comfort panel specifics */
.comfort-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.comfort-sub { font-size: 12px; color: var(--color-text-muted); margin-bottom: 1.25rem; }
.affirmation-card {
  background: var(--color-pink-bg); border-radius: var(--radius-md); padding: 1.25rem 1rem; text-align: center;
  font-size: 15px; color: var(--color-pink-deep); font-weight: 500; margin-bottom: 10px; min-height: 60px;
  display: flex; align-items: center; justify-content: center;
}
.affirmation-btn {
  width: 100%; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  background: var(--color-surface); font-size: 13px; font-weight: 600; color: var(--color-text-soft); cursor: pointer;
  margin-bottom: 1.5rem;
}
.ground-toggle {
  width: 100%; padding: 12px; border-radius: var(--radius-sm); border: none;
  background: var(--color-teal-bg); color: var(--color-teal-dark); font-size: 13px; font-weight: 600; cursor: pointer;
  margin-bottom: 10px;
}
.ground-step {
  background: var(--color-surface-muted); border-radius: var(--radius-md); padding: 1rem; display: none;
  text-align: center;
}
.ground-step.active { display: block; }
.ground-count { font-size: 26px; font-weight: 700; color: var(--color-teal-dark); margin-bottom: 4px; }
.ground-prompt { font-size: 13px; color: var(--color-text-soft); margin-bottom: 12px; }
.ground-nav { display: flex; gap: 8px; }
.ground-nav button {
  flex: 1; padding: 9px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-surface); font-size: 12px; cursor: pointer; font-family: inherit;
}

/* =====================================================================
   Private Space — deliberately its own dark theme, scoped locally so it
   never bleeds into the rest of the (light, warm) app.
   ===================================================================== */
.private-space-root {
  --ps-bg: #1c1420;
  --ps-panel: #2a1e28;
  --ps-panel-2: #352634;
  --ps-border: rgba(255,255,255,0.08);
  --ps-text: #f3e9f0;
  --ps-text-muted: #b79bb0;
  --ps-accent: #ff6fa8;
  --ps-accent-soft: #4d1c33;
  --ps-on-accent: #1c1420;

  margin: -1.5rem -1.1rem -1.5rem;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.1rem 1.5rem;
  min-height: 100%;
  background: var(--ps-bg);
  color: var(--ps-text);
}

.ps-toptabs {
  display: flex; gap: 6px; background: var(--ps-panel); border-radius: 14px;
  padding: 4px; margin-bottom: 16px; border: 0.5px solid var(--ps-border);
}
.ps-toptabs button {
  flex: 1; padding: 9px; border-radius: 10px; font-size: 13px; border: none;
  background: transparent; color: var(--ps-text-muted); cursor: pointer; font-weight: 500; font-family: inherit;
}
.ps-toptabs button.active { background: var(--ps-accent); color: var(--ps-on-accent); }

.ps-card { background: var(--ps-panel); border-radius: 16px; padding: 16px; border: 0.5px solid var(--ps-border); }

.ps-subtabs { display: flex; gap: 8px; margin-bottom: 14px; }
.ps-subtabs button {
  flex: 1; padding: 8px; border-radius: 999px; font-size: 12.5px; border: 0.5px solid var(--ps-border);
  background: var(--ps-panel-2); color: var(--ps-text-muted); cursor: pointer; font-family: inherit;
}
.ps-subtabs button.active { background: var(--ps-accent); color: var(--ps-on-accent); border: none; }

.ps-chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ps-chip { border-radius: 999px; padding: 7px 13px; font-size: 12.5px; cursor: pointer; border: 0.5px solid transparent; font-family: inherit; }
.ps-chip.dashed { border: 0.5px dashed var(--ps-text-muted); background: transparent; color: var(--ps-text-muted); }

.ps-upload-zone {
  border: 1px dashed var(--ps-text-muted); border-radius: 12px; padding: 26px 14px; text-align: center;
  color: var(--ps-text-muted); font-size: 13px; margin-bottom: 14px; cursor: pointer;
}
.ps-thumb-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; }
.ps-thumb {
  aspect-ratio: 1; background: var(--ps-panel-2); border-radius: 8px; border: 0.5px solid var(--ps-border);
  display: flex; align-items: center; justify-content: center; color: var(--ps-text-muted); font-size: 14px; min-width: 0;
  position: relative; overflow: hidden;
}
.ps-thumb img, .ps-thumb video { width: 100%; height: 100%; object-fit: cover; }
.ps-thumb .ps-thumb-kind-badge {
  position: absolute; bottom: 3px; left: 3px; font-size: 10px; color: #fff;
  background: rgba(0,0,0,0.5); border-radius: 4px; padding: 1px 4px; pointer-events: none;
}
.ps-thumb-delete {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2; line-height: 1;
}

.private-space-root select, .private-space-root textarea, .private-space-root input[type="range"] { font-family: inherit; }
.private-space-root select { background: var(--ps-panel-2); color: var(--ps-text); border: 0.5px solid var(--ps-border); border-radius: 8px; padding: 8px; width: 100%; margin-bottom: 8px; }
.private-space-root textarea {
  background: var(--ps-panel-2); color: var(--ps-text); border: 0.5px solid var(--ps-border); border-radius: 10px;
  padding: 10px; font-size: 13px; resize: none; width: 100%;
}
.ps-btn-primary { background: var(--ps-accent); color: var(--ps-on-accent); border: none; border-radius: 999px; padding: 9px; font-size: 13px; cursor: pointer; font-weight: 500; font-family: inherit; }
.ps-muted { color: var(--ps-text-muted); font-size: 12px; }

@keyframes ps-twinkle { 0%,100% { opacity: 0.2; transform: scale(0.6); } 50% { opacity: 1; transform: scale(1.4); } }
@keyframes ps-tilePulse { 0%,100% { filter: brightness(1) saturate(1); } 50% { filter: brightness(1.4) saturate(1.9); } }
@keyframes ps-bgPulse { 0%,100% { background-color: #2b0f1c; } 50% { background-color: #4a1830; } }
@keyframes ps-spin { to { transform: rotate(360deg); } }

/* Focus view (one item at a time) */
.ps-focus-box {
  position: relative; height: 300px; border-radius: 14px; background: var(--ps-panel-2);
  border: 0.5px solid var(--ps-border); display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ps-focus-box img, .ps-focus-box video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ps-focus-icon { font-size: 40px; color: var(--ps-text-muted); }
.ps-progressbar { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--ps-accent); }
.ps-focus-nav { display: flex; justify-content: center; gap: 20px; margin-top: 10px; }
.ps-focus-nav button { background: none; border: none; color: var(--ps-text); font-size: 18px; cursor: pointer; }

/* Overstimulate grid view */
.ps-over-wrapper { position: relative; border-radius: 12px; overflow: hidden; background: #2b0f1c; padding: 4px; }
.ps-over-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); grid-auto-rows: 22vw;
  /* Deliberately not "dense" — when spans don't tessellate neatly, the leftover space
     stays empty instead of being backfilled, which is exactly the point: it lets
     Background video (or the wrapper's own dark background) show through. */
  gap: 8px; position: relative; z-index: 1;
}
.ps-over-tile {
  min-width: 0; min-height: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative; background: #3d1728; border: 1px solid #7a2c4a;
}
.ps-over-tile.focused { background: var(--ps-accent-soft); border: 2px solid var(--ps-accent); }
.ps-over-tile img, .ps-over-tile video { width: 100%; height: 100%; object-fit: cover; }
.ps-over-tile .ps-over-icon { color: #ff9fcb; }
.ps-over-tile.focused .ps-over-icon { color: #ffd6eb; }

/* Split screen — 2x2 wall of video panes that swap themselves on a timer */
.ps-split-wrap {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  border-radius: 12px; overflow: hidden; background: #2b0f1c; padding: 3px;
}
.ps-split-pane {
  position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 6px;
  background: #3d1728; border: 1px solid #7a2c4a;
  display: flex; align-items: center; justify-content: center;
}
.ps-split-pane video { width: 100%; height: 100%; object-fit: cover; }

/* "Tap for sound" chip — only appears when the browser blocked auto-unmute */
.ps-sound-chip {
  position: absolute; top: 10px; right: 10px; z-index: 8;
  background: rgba(0,0,0,0.65); color: #fff; border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; backdrop-filter: blur(4px);
}

/* Background video — full-bleed, dimmed so the grid/effects on top stay legible */
.ps-bg-video-layer { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.ps-bg-video-layer video { width: 100%; height: 100%; object-fit: cover; opacity: 0.5; }

/* Flying content — real thumbnails launching across the screen, alternating direction */
.ps-flying-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
@keyframes ps-fly-across {
  0% { left: -25%; opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { left: 125%; opacity: 0; }
}
@keyframes ps-fly-across-reverse {
  0% { left: 125%; opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { left: -25%; opacity: 0; }
}
.ps-flying-tile {
  position: absolute; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  animation-timing-function: linear; animation-iteration-count: infinite;
}
.ps-flying-tile img, .ps-flying-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-flying-icon {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: #3d1728; color: #ff9fcb; font-size: 22px;
}

.ps-spiral-wrap { position: absolute; inset: 0; z-index: 2; opacity: 0.25; pointer-events: none; overflow: hidden; }
.ps-spiral { position: absolute; inset: -50%; animation: ps-spin 6s linear infinite; }
.ps-spiral.bw { background: repeating-conic-gradient(#0f0f11 0deg 11.25deg, #f8f8fa 11.25deg 22.5deg); }
.ps-spiral.pastel { background: repeating-conic-gradient(#ec78aa 0deg 11.25deg, #c4a0e6 11.25deg 22.5deg); }

.ps-stars-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.ps-star { position: absolute; color: #ffe066; text-shadow: 0 0 6px #ffe066; animation: ps-twinkle 1.4s ease-in-out infinite; }

/* Dense grid — many more, tighter tiles, but still a varied mosaic (just a smaller one) */
.ps-over-grid.dense { grid-template-columns: repeat(7, minmax(0,1fr)); grid-auto-rows: 12vw; gap: 2px; }
.ps-over-grid.dense .ps-over-tile { border-radius: 3px; }

/* Floating bubbles — drift upward, then pop near the top instead of just fading */
.ps-orbs-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 4; }
@keyframes ps-orb-float {
  0% { top: 105%; opacity: 0; transform: scale(0.4); }
  12% { opacity: 0.9; transform: scale(1); }
  78% { opacity: 0.9; transform: scale(1); }
  90% { opacity: 1; transform: scale(1.3); }
  100% { top: -14%; opacity: 0; transform: scale(0.05); }
}
.ps-orb {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.25) 20%, rgba(255,111,168,0.4) 58%, rgba(255,111,168,0.1) 82%);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: inset 0 0 5px rgba(255,255,255,0.5), 0 0 8px rgba(255,111,168,0.35);
  animation-name: ps-orb-float; animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}

/* Pulse rings — expanding, fading rings from the center, two staggered */
.ps-pulse-rings-layer {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 2; overflow: hidden;
}
@keyframes ps-pulse-ring {
  0% { width: 20px; height: 20px; opacity: 0.8; }
  100% { width: 260px; height: 260px; opacity: 0; }
}
.ps-pulse-ring {
  position: absolute; border-radius: 50%; border: 3px solid rgba(255,111,168,0.8);
  box-shadow: 0 0 12px rgba(255,111,168,0.55);
  animation: ps-pulse-ring 2.6s ease-out infinite;
}
.ps-pulse-ring.ring-2 { animation-delay: 1.3s; }

/* Beat sync — a CSS-only rhythmic scale/brightness pulse standing in for real audio
   reactivity. True audio-reactive sync (matched to whatever's actually playing) would
   need the Web Audio API's analyser node hooked into the track — a bigger feature to
   consider later, not something a sine-wave loop like this can honestly deliver. */
@keyframes ps-beat-scale { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes ps-beat-tile { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.3); } }

/* Audio tab */
.ps-audio-wrap { position: relative; min-height: 380px; }
.ps-track-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.ps-track-row.current { background: var(--ps-panel-2); }
.ps-track-icon { width: 18px; color: var(--ps-text-muted); }
.ps-track-row.current .ps-track-icon { color: var(--ps-accent); }
.ps-track-name { font-size: 13px; }
.ps-bubble {
  position: absolute; width: 52px; height: 52px; border-radius: 50%; background: var(--ps-accent);
  display: flex; align-items: center; justify-content: center; cursor: grab; box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  z-index: 5; color: var(--ps-on-accent); font-size: 18px; touch-action: none;
}
.ps-bubble-panel {
  position: absolute; bottom: 14px; left: 14px; right: 14px; background: var(--ps-panel-2); border-radius: 14px;
  padding: 12px; border: 0.5px solid var(--ps-border); z-index: 6;
}
.ps-bubble-title { margin: 0 0 6px; font-size: 13px; font-weight: 500; }
.ps-bubble-sub { margin: 0 0 10px; }
.ps-bubble-controls { display: flex; justify-content: center; gap: 18px; }
.ps-bubble-controls button { background: none; border: none; color: var(--ps-text); font-size: 18px; cursor: pointer; }

/* Writing tab */
.ps-entry-card {
  padding: 12px; border-radius: 10px; background: var(--ps-panel-2); margin-bottom: 8px;
  cursor: pointer; border: 0.5px solid var(--ps-border);
}
.ps-entry-date { margin: 0 0 4px; }
.ps-entry-preview { margin: 0; font-size: 13px; }
.ps-saved-note { margin: 6px 0 0; opacity: 0; transition: opacity 0.3s; }
.ps-saved-note.show { opacity: 1; }

/* =====================================================================
   Mood screen
   ===================================================================== */
.view-toggle { display: flex; gap: 6px; margin-bottom: 1.25rem; }
.view-pill {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 9px;
  border: 1px solid var(--color-border); background: var(--color-surface); font-size: 13px; font-weight: 600;
  color: var(--color-text-soft); cursor: pointer; font-family: inherit;
}
.view-pill.active { background: var(--color-pink); border-color: var(--color-pink); color: #fff; }

.summary-card { background: var(--color-surface-muted); border-radius: var(--radius-md); padding: 1rem; margin-bottom: 1.5rem; }
.summary-line { font-size: 13px; color: var(--color-text-soft); line-height: 1.6; margin: 0; }
.summary-line strong { color: var(--color-text); }

.day-row { margin-bottom: 14px; }
.day-label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 6px; }
.day-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.day-empty { font-size: 12px; color: var(--color-text-faint); font-style: italic; }

.day-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; margin-bottom: 6px; }
.day-arrow { font-size: 11px; color: var(--color-text-faint-2); transition: transform 0.15s; display: inline-block; }
.day-arrow.open { transform: rotate(90deg); }
.day-detail {
  display: none; font-size: 12px; color: var(--color-text-soft); line-height: 1.8;
  background: var(--color-surface-muted); border-radius: 10px; padding: 8px 10px; margin-top: 6px;
}
.day-detail.open { display: block; }

.macro-stats { display: flex; gap: 8px; margin-bottom: 1.25rem; }
.macro-stat { flex: 1; background: var(--color-surface-muted); border-radius: 12px; padding: 0.75rem; text-align: center; }
.macro-stat-num { font-size: 18px; font-weight: 700; color: var(--color-pink-deep); }
.macro-stat-label { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 1rem; }
.cal-cell {
  aspect-ratio: 1; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--color-pink-deep);
}
.cal-cell.empty { background: transparent; }
.cal-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--color-text-muted); align-items: center; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: middle; }

.empty-note { font-size: 12px; color: var(--color-text-muted); text-align: center; padding: 1rem 0; }

/* =====================================================================
   Fitness screen
   ===================================================================== */
.divider { border-top: 1px solid var(--color-border); padding-top: 1rem; margin-bottom: 1.5rem; }

.day-toggle { display: flex; gap: 6px; margin-bottom: 1rem; }
.day-pill {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 9px;
  border: 1px solid var(--color-border); background: var(--color-surface); font-size: 13px; font-weight: 600;
  color: var(--color-text-soft); cursor: pointer; font-family: inherit;
}
.day-pill.active { background: var(--color-pink); border-color: var(--color-pink); color: #fff; }

.exercise-card { background: var(--color-pink-bg); border-radius: var(--radius-md); padding: 0.85rem 1rem; margin-bottom: 8px; }
.exercise-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.exercise-name { font-size: 14px; font-weight: 600; color: var(--color-pink-deep); }
.exercise-last { font-size: 12px; color: var(--color-pink-dark); }
.checkbox {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--color-pink-border); flex-shrink: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  background: var(--color-surface); transition: background 0.15s;
}
.checkbox.done { background: var(--color-pink); border-color: var(--color-pink); }
.checkbox.done::after { content: "✓"; color: #fff; font-size: 12px; }

.baseline-row { display: flex; gap: 8px; margin-bottom: 8px; }
.baseline-field { flex: 1; }
.baseline-field label { display: block; font-size: 11px; color: var(--color-text-muted); margin-bottom: 3px; }
.baseline-field input, .baseline-field select {
  width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--color-border);
  padding: 0 8px; font-size: 13px; background: var(--color-surface); font-family: inherit;
}
.calc-btn {
  width: 100%; height: 36px; border-radius: 8px; border: none;
  background: var(--color-pink); color: #fff; font-size: 13px; font-weight: 600;
  margin-top: 4px; cursor: pointer; font-family: inherit;
}
.calc-note { font-size: 12px; color: var(--color-text-muted); margin-top: 8px; line-height: 1.5; }

.set-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-pink-deep); margin-bottom: 6px; }
.set-label { width: 44px; color: var(--color-pink-dark); }
.set-input {
  width: 56px; height: 30px; border-radius: 7px; border: 1px solid var(--color-pink-border-2);
  background: var(--color-surface); text-align: center; font-size: 13px; font-family: inherit;
}
.set-x { color: var(--color-pink-dark); font-size: 12px; }
.set-pr {
  margin-left: auto; font-size: 11px; color: #0d7a4f; background: var(--color-teal-bg-3);
  padding: 2px 6px; border-radius: 6px; font-weight: 600;
}
.note { font-size: 12px; color: var(--color-text-muted); margin: 6px 2px 0; line-height: 1.5; }

.add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.add-row input {
  flex: 1; height: 36px; border-radius: 8px; border: 1px solid var(--color-border);
  padding: 0 10px; font-size: 14px; font-family: inherit;
}
.add-row button {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-surface); font-size: 16px; cursor: pointer;
}
.food-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 2px; border-bottom: 1px solid var(--color-border); }
.food-row span:last-child { color: var(--color-text-soft); font-size: 12px; }
.qty-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.qty-label { font-size: 12px; color: var(--color-text-muted); }
.qty-row input {
  width: 62px; height: 34px; border-radius: 8px; border: 1px solid var(--color-border);
  padding: 0 8px; font-size: 14px; font-family: inherit; text-align: center;
}
.qty-presets { display: flex; gap: 4px; }
.qty-preset {
  min-width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text-soft);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.qty-preset:active { background: var(--color-pink-bg); border-color: var(--color-pink); }

.food-remove {
  width: 20px; height: 20px; border-radius: 50%; border: none; margin-left: 6px;
  background: var(--color-pink-bg-strong); color: var(--color-pink-dark); font-size: 12px;
  font-weight: 700; cursor: pointer; vertical-align: middle; line-height: 1;
}

.totals-block { margin-bottom: 12px; }
.total-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.total-label { color: var(--color-text-soft); }
.total-value { font-weight: 600; color: var(--color-text); }
.total-track { height: 6px; background: var(--color-bg); border-radius: 4px; overflow: hidden; margin-bottom: 3px; }
.total-fill { width: 0%; height: 100%; background: var(--color-pink); transition: width 0.2s, background 0.2s; }
.total-goal { font-size: 11px; color: var(--color-text-muted); }

.weight-caption { font-size: 12px; color: var(--color-text-muted); margin: 6px 0 0; }

/* =====================================================================
   Routine screen — shared checklist classes (Toolkit reuses these too)
   ===================================================================== */
.routine-toggle { display: flex; gap: 6px; margin-bottom: 1rem; }
.routine-pill {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 9px;
  border: 1px solid var(--color-border); background: var(--color-surface); font-size: 13px; font-weight: 600;
  color: var(--color-text-soft); cursor: pointer; font-family: inherit;
}
.routine-pill.active { background: var(--color-pink); border-color: var(--color-pink); color: #fff; }

.progress-line { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; }
.progress-track { flex: 1; height: 9px; background: var(--color-bg); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--color-pink); border-radius: 6px; transition: width 0.3s ease-out, background 0.2s; }
.progress-fill.done { background: var(--color-teal); }
.progress-label { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }

.check-item, .task-item {
  display: flex; align-items: center; gap: 10px; background: var(--color-surface-muted);
  border-radius: 10px; padding: 0.7rem 0.85rem; margin-bottom: 6px;
}
.check-box {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--color-pink-border);
  flex-shrink: 0; cursor: pointer; background: var(--color-surface);
  display: flex; align-items: center; justify-content: center;
}
.check-box.done { background: var(--color-pink); border-color: var(--color-pink); }
.check-box.done::after { content: "✓"; color: #fff; font-size: 12px; }
.check-label { font-size: 13px; flex: 1; }
.check-item.done .check-label, .task-item.done .check-label { text-decoration: line-through; color: var(--color-text-faint); }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.edit-toggle {
  font-size: 12px; font-weight: 600; color: var(--color-pink-dark); background: none; border: none;
  cursor: pointer; padding: 4px 2px; font-family: inherit;
}
.item-delete {
  display: none; width: 22px; height: 22px; border-radius: 50%; border: none;
  background: var(--color-pink-bg-strong); color: var(--color-pink-dark); font-size: 13px; font-weight: 700;
  align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.editing .item-delete { display: flex; }
.editing .check-box { opacity: 0.4; pointer-events: none; }

.drag-handle {
  color: var(--color-text-faint-2); font-size: 13px; cursor: grab; padding: 0 2px;
  flex-shrink: 0; touch-action: none; user-select: none; line-height: 1;
}
.check-item.dragging, .task-item.dragging {
  opacity: 0.85; box-shadow: 0 6px 16px rgba(0,0,0,0.15); transform: scale(1.02);
  position: relative; z-index: 10; cursor: grabbing;
}
.check-item.dragging .drag-handle, .task-item.dragging .drag-handle { cursor: grabbing; }

.gentle-note { font-size: 12px; color: var(--color-text-muted); text-align: center; margin: -6px 0 1.5rem; line-height: 1.5; }

/* =====================================================================
   Wishlist screen
   ===================================================================== */
.cat-row { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 1.25rem; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-pill {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 20px; border: 1px solid var(--color-border);
  background: var(--color-surface); font-size: 12px; font-weight: 600; color: var(--color-text-soft); cursor: pointer; font-family: inherit;
}
.cat-pill.active { background: var(--color-pink); border-color: var(--color-pink); color: #fff; }

.link-hint { font-size: 11px; color: var(--color-text-muted); margin: -2px 0 1.25rem 2px; }
.item-link {
  font-size: 11px; color: var(--color-pink-dark); text-decoration: none; display: inline-flex;
  align-items: center; gap: 3px; margin-top: 3px;
}

.item-card {
  display: flex; align-items: center; gap: 10px; background: var(--color-surface-muted);
  border-radius: 12px; padding: 0.75rem; margin-bottom: 8px;
}
.item-thumb {
  width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg, var(--color-pink-bg), var(--color-pink-bg-strong));
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-price { font-size: 12px; color: var(--color-text-muted); }
.item-tag {
  font-size: 10px; background: var(--color-border); color: var(--color-text-soft); padding: 2px 6px;
  border-radius: 5px; margin-top: 3px; display: inline-block;
}
.item-check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--color-pink-border);
  flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  background: var(--color-surface);
}
.item-check.got { background: var(--color-teal); border-color: var(--color-teal); }
.item-check.got::after { content: "✓"; color: #fff; font-size: 12px; }
.item-card.got .item-name { text-decoration: line-through; color: var(--color-text-faint); }
.item-card.got .item-thumb { opacity: 0.5; }

/* =====================================================================
   Chat screen
   ===================================================================== */
.chat-header-row { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; }
.chat-settings-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--color-border);
  background: var(--color-surface); font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.chat-messages {
  display: flex; flex-direction: column; gap: 8px; min-height: 200px; max-height: 50vh;
  overflow-y: auto; margin-bottom: 10px; padding: 4px;
}
.chat-bubble {
  max-width: 80%; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.chat-bubble.user { align-self: flex-end; background: var(--color-pink-bg-strong); color: var(--color-pink-deep); border-bottom-right-radius: 4px; }
.chat-bubble.assistant { align-self: flex-start; background: var(--color-surface-muted); color: var(--color-text); border-bottom-left-radius: 4px; }
.chat-thinking { align-self: flex-start; font-size: 12px; color: var(--color-text-muted); font-style: italic; padding: 4px 6px; }
.chat-error { align-self: center; font-size: 12px; color: #a33322; background: #fbeaea; border-radius: 8px; padding: 8px 10px; text-align: center; }

.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1; min-height: 40px; max-height: 120px; border-radius: 10px; border: 1px solid var(--color-border);
  padding: 10px; font-size: 14px; font-family: inherit; resize: vertical;
}
.chat-input-row button {
  height: 40px; padding: 0 16px; border-radius: 10px; border: none;
  background: var(--color-pink); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.chat-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-attach-btn {
  height: 40px; width: 40px; padding: 0; flex-shrink: 0; border-radius: 10px;
  border: 1px solid var(--color-border); background: var(--color-surface);
  font-size: 17px; cursor: pointer;
}

/* Staged attachment preview, above the input */
.chat-attach-preview { position: relative; display: inline-block; margin-bottom: 8px; }
.chat-attach-preview img {
  height: 68px; width: auto; max-width: 140px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--color-border); display: block;
}
.chat-attach-remove {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--color-text); color: #fff; font-size: 13px; font-weight: 700;
  cursor: pointer; line-height: 1;
}
.chat-bubble-img {
  max-width: 100%; border-radius: 10px; display: block; margin-bottom: 6px;
}
.chat-bubble-img.placeholder {
  height: 90px; display: flex; align-items: center; justify-content: center;
  background: var(--color-bg); font-size: 22px;
}

/* Markdown inside assistant bubbles */
.chat-bubble .md-p { margin: 0 0 8px; }
.chat-bubble .md-p:last-child { margin-bottom: 0; }
.chat-bubble .md-h { margin: 8px 0 6px; font-size: 14px; font-weight: 600; }
.chat-bubble .md-list { margin: 0 0 8px; padding-left: 20px; }
.chat-bubble .md-list li { margin-bottom: 3px; }
.chat-bubble code {
  background: var(--color-bg); border-radius: 4px; padding: 1px 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
}
.chat-bubble .md-pre {
  background: var(--color-bg); border-radius: 8px; padding: 8px 10px; overflow-x: auto; margin: 0 0 8px;
}
.chat-bubble .md-pre code { background: none; padding: 0; }
.chat-bubble .md-quote {
  margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--color-pink-bg-strong);
  color: var(--color-text-soft);
}
.chat-bubble a { color: var(--color-pink-dark); }

/* Proposed action — nothing is written until Confirm is tapped */
.chat-action-card {
  align-self: stretch; background: var(--color-surface); border: 1.5px solid var(--color-pink);
  border-radius: 14px; padding: 12px; margin: 4px 0;
}
.chat-action-title { font-size: 13px; font-weight: 600; color: var(--color-pink-deep); margin-bottom: 4px; }
.chat-action-detail { font-size: 13px; color: var(--color-text-soft); line-height: 1.5; margin-bottom: 10px; }
.chat-action-btns { display: flex; gap: 8px; }
.chat-action-btns button {
  flex: 1; padding: 9px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.chat-action-cancel { border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-soft); }
.chat-action-confirm { border: none; background: var(--color-pink); color: #fff; }
.chat-action-notice {
  align-self: center; font-size: 12px; color: var(--color-teal-dark);
  background: var(--color-teal-bg-2); border-radius: 8px; padding: 6px 10px;
}

#memoryProfile {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  padding: 10px; font-size: 13px; font-family: inherit; resize: vertical;
  background: var(--color-surface-muted);
}
.chat-media-notice {
  align-self: stretch; background: var(--color-pink-bg); border-radius: 10px;
  padding: 8px 10px; font-size: 12px; color: var(--color-pink-deep); line-height: 1.4;
}

.chat-memory-notice {
  align-self: stretch; display: flex; align-items: center; gap: 8px;
  background: var(--color-teal-bg-2); border-radius: 10px; padding: 8px 10px;
  font-size: 12px; color: var(--color-teal-dark); line-height: 1.4;
}
.chat-memory-notice span { flex: 1; }
.chat-memory-notice button {
  border: none; background: none; color: var(--color-teal-dark); font-size: 12px;
  font-weight: 600; text-decoration: underline; cursor: pointer; flex-shrink: 0; font-family: inherit;
}

.memory-fact {
  display: flex; align-items: flex-start; gap: 8px; background: var(--color-surface-muted);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px;
  color: var(--color-text-soft); line-height: 1.45;
}
.memory-fact span { flex: 1; }
.memory-fact-remove {
  width: 22px; height: 22px; border-radius: 50%; border: none; flex-shrink: 0;
  background: var(--color-pink-bg-strong); color: var(--color-pink-dark);
  font-size: 13px; font-weight: 700; cursor: pointer; line-height: 1;
}

.context-toggle-row {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  color: var(--color-text); cursor: pointer;
}
.context-toggle-row input { width: 18px; height: 18px; flex-shrink: 0; }
