/* ============================================================
   THEME SYSTEM — variables driven by data-mode + data-theme
   ============================================================ */
:root {
  --radius: 18px;
  --accent: #7aa2ff;
  --accent-2: #ff8ec8;
  --neb-1: rgba(150, 90, 255, .34);
  --neb-2: rgba(255, 110, 180, .26);
  --neb-3: rgba(80, 150, 255, .28);
  --neb-4: rgba(40, 130, 190, .22);
}

/* ---- accent themes ---- */
[data-theme="cosmic"] { --accent: #7aa2ff; --accent-2: #ff8ec8;
  --neb-1: rgba(150,90,255,.34); --neb-2: rgba(255,110,180,.26); --neb-3: rgba(80,150,255,.28); --neb-4: rgba(40,130,190,.22); }
[data-theme="sunset"] { --accent: #ff9e64; --accent-2: #ff5e9c;
  --neb-1: rgba(255,90,120,.32); --neb-2: rgba(255,160,80,.26); --neb-3: rgba(180,80,200,.26); --neb-4: rgba(255,120,90,.2); }
[data-theme="forest"] { --accent: #5fd0a0; --accent-2: #9be36f;
  --neb-1: rgba(60,200,150,.3); --neb-2: rgba(150,220,110,.24); --neb-3: rgba(50,160,180,.26); --neb-4: rgba(40,150,120,.2); }
[data-theme="rose"] { --accent: #ff7eb6; --accent-2: #ffd36e;
  --neb-1: rgba(255,120,170,.34); --neb-2: rgba(255,180,120,.24); --neb-3: rgba(220,90,160,.28); --neb-4: rgba(255,140,170,.2); }

/* ---- modes ---- */
[data-mode="dark"] {
  --text: #e9ebff; --muted: #9aa0c4; --line: rgba(255,255,255,.10);
  --glass: rgba(22,25,52,.55); --glass-solid: #161a34; --surface: rgba(28,32,62,.6);
  --bg-base: #05060f; --star: 255,255,255; --field: rgba(255,255,255,.05);
  --shadow: 0 0 0 1px rgba(255,255,255,.06), 0 8px 30px rgba(8,10,30,.55);
  --shadow-lg: 0 0 0 1px rgba(255,255,255,.08), 0 20px 60px rgba(4,6,20,.7);
}
[data-mode="light"] {
  --text: #20243f; --muted: #6b7193; --line: rgba(25,30,70,.12);
  --glass: rgba(255,255,255,.66); --glass-solid: #ffffff; --surface: rgba(255,255,255,.8);
  --bg-base: #eef1fb; --star: 90,100,170; --field: rgba(20,24,60,.04);
  --shadow: 0 1px 2px rgba(20,24,60,.08), 0 8px 26px rgba(20,24,60,.10);
  --shadow-lg: 0 12px 44px rgba(20,24,60,.20);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text); background: var(--bg-base); min-height: 100vh;
  font-size: 15px; line-height: 1.5; letter-spacing: -0.01em; font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; transition: background .4s, color .4s;
}
.hidden { display: none !important; }

/* Typography rhythm */
h1, h2, h3 { letter-spacing: -0.02em; }
.brand-name, .login-card h1 { letter-spacing: 0; }
input, textarea, button, select { font-family: inherit; letter-spacing: inherit; }
::placeholder { letter-spacing: -0.01em; }

/* Baseline so no input ever renders as default white/unthemed */
input, textarea, select { background: var(--field); color: var(--text); border: 1px solid var(--line); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); cursor: pointer; }
/* stop browser autofill from forcing a white/yellow background */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--glass-solid) inset;
  caret-color: var(--text);
}

/* ============================================================
   BACKGROUND LAYERS
   ============================================================ */
.bg-gradient, .galaxy, .galaxy-band, .bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bg-gradient {
  background:
    radial-gradient(48% 38% at 50% 38%, var(--neb-1), transparent 70%),
    radial-gradient(44% 36% at 26% 64%, var(--neb-2), transparent 72%),
    radial-gradient(46% 40% at 74% 30%, var(--neb-3), transparent 72%),
    radial-gradient(70% 60% at 50% 108%, var(--neb-4), transparent 70%);
  transition: background .5s;
}
.galaxy { display: none; animation: drift 48s ease-in-out infinite alternate;
  background:
    radial-gradient(40% 30% at 50% 42%, var(--neb-1), transparent 72%),
    radial-gradient(36% 30% at 70% 32%, var(--neb-3), transparent 74%); }
.galaxy-band { display: none; inset: -30% -20%; transform: rotate(-24deg); transform-origin: center;
  background:
    linear-gradient(90deg, transparent 30%, rgba(190,180,255,.16) 42%, rgba(255,220,240,.26) 50%, rgba(190,200,255,.16) 58%, transparent 70%),
    linear-gradient(90deg, transparent 36%, rgba(255,200,170,.10) 50%, transparent 64%);
  filter: blur(22px); animation: bandsway 90s ease-in-out infinite alternate; }
.galaxy-band::after { content:''; position:absolute; inset:0;
  background: linear-gradient(90deg, transparent 46%, rgba(5,6,15,.5) 50%, transparent 54%); filter: blur(8px); }
/* galaxy + band only on the starfield background */
[data-bg="stars"] .galaxy, [data-bg="stars"] .galaxy-band { display: block; }
/* soft vignette for depth on the starry sky */
[data-bg="stars"] .bg-gradient::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(125% 95% at 50% 35%, transparent 52%, rgba(0, 0, 0, .38) 100%);
}
[data-mode="light"] [data-bg="stars"] .bg-gradient::after { background: radial-gradient(125% 95% at 50% 35%, transparent 60%, rgba(40, 40, 90, .12) 100%); }
[data-mode="light"] .galaxy-band { opacity: .4; }

@keyframes drift { from { transform: scale(1) translateY(0); } to { transform: scale(1.1) translateY(-2.5%); } }
@keyframes bandsway { from { transform: rotate(-24deg) translateY(0) scale(1); } to { transform: rotate(-21deg) translateY(-3%) scale(1.06); } }

#login-screen, .app, .modal-backdrop, .lightbox, .toast, .emoji-kb { position: relative; z-index: 1; }

/* Weather layer — reflects your partner's current mood, over the background */
.weather { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; overflow: hidden; }
[data-weather="rain"] .weather, [data-weather="storm"] .weather, [data-weather="sunny"] .weather,
[data-weather="rainbow"] .weather, [data-weather="cloudy"] .weather, [data-weather="moonlight"] .weather { opacity: 1; }
/* rain/storm streaks are drawn on the weather canvas; here just a mood tint */
.weather-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
[data-weather="rain"] .weather { box-shadow: inset 0 0 320px rgba(40, 60, 120, .22); }
[data-weather="storm"] .weather { box-shadow: inset 0 0 360px rgba(20, 30, 70, .42); }
[data-weather="storm"] .weather::after { content: ''; position: absolute; inset: 0; background: #cdd6ff; opacity: 0; animation: lightning 8s infinite; }
@keyframes lightning { 0%,95%,100% { opacity: 0; } 96% { opacity: .35; } 96.5% { opacity: 0; } 97.5% { opacity: .28; } 98% { opacity: 0; } }
[data-weather="sunny"] .weather { background: radial-gradient(70% 45% at 50% -5%, rgba(255, 221, 128, .20), transparent 70%); animation: sunpulse 7s ease-in-out infinite; }
@keyframes sunpulse { 0%,100% { opacity: .85; } 50% { opacity: 1; } }
[data-weather="rainbow"] .weather { background: radial-gradient(120% 80% at 50% 122%, transparent 60%, rgba(255,0,0,.05) 63%, rgba(255,150,0,.05) 66%, rgba(255,235,0,.05) 69%, rgba(0,200,80,.05) 72%, rgba(0,120,255,.05) 75%, rgba(150,0,200,.05) 78%, transparent 82%); }
[data-weather="cloudy"] .weather { background:
  radial-gradient(38% 26% at 28% 18%, rgba(170,180,200,.14), transparent 70%),
  radial-gradient(42% 28% at 72% 26%, rgba(160,170,195,.12), transparent 70%),
  radial-gradient(36% 24% at 50% 14%, rgba(180,188,210,.10), transparent 70%);
  animation: drift 70s ease-in-out infinite alternate; }
[data-weather="moonlight"] .weather { background: radial-gradient(45% 36% at 50% 8%, rgba(150,175,255,.16), transparent 70%); box-shadow: inset 0 0 300px rgba(20,30,70,.32); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 390px; background: var(--glass); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 26px; padding: 42px 32px; box-shadow: var(--shadow-lg); text-align: center; }
.login-heart { font-size: 50px; filter: drop-shadow(0 0 18px var(--accent)); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-8px) } }
.login-card h1 { font-family: 'Caveat', cursive; font-size: 44px; margin: 10px 0 2px; font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
#login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
#login-form label { font-size: 13px; color: var(--muted); font-weight: 500; }
.who-pick { display: flex; gap: 10px; }
.who-btn { flex: 1; padding: 11px; border-radius: 13px; border: 1px solid var(--line); background: var(--field);
  color: var(--text); font-weight: 600; font-size: 15px; cursor: pointer; transition: .18s; }
.who-btn:hover { border-color: var(--accent); }
.who-btn.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.who-btn[data-user="dizz"].active { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 18%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--accent-2) 40%, transparent); }
#login-form input[type=text], #login-form input[type=password] { padding: 13px 15px; border: 1px solid var(--line);
  border-radius: 13px; font-size: 15px; outline: none; background: var(--field); color: var(--text); }
#login-form input::placeholder { color: var(--muted); }
#login-form input:focus { border-color: var(--accent); }
.login-error { color: #ff5d78; font-size: 13px; min-height: 16px; margin: 0; }
.login-hint { color: var(--muted); font-size: 12px; text-align: center; margin: 4px 0 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.primary-btn { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; border: none;
  padding: 12px 18px; border-radius: 13px; font-size: 15px; font-weight: 600; cursor: pointer; transition: .18s;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.primary-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-btn.small { padding: 9px 16px; font-size: 14px; }
.ghost-btn { background: var(--field); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 13px; border-radius: 11px; cursor: pointer; font-size: 14px; transition: .18s; }
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 17px; transition: .15s; }
.icon-btn:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.icon-btn.danger:hover { background: rgba(255,80,110,.18); }
.icon-btn.active { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ============================================================
   TOPBAR + TABS
   ============================================================ */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; background: color-mix(in srgb, var(--bg-base) 72%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-heart { font-size: 22px; filter: drop-shadow(0 0 10px var(--accent)); }
.brand-name { font-family: 'Caveat', cursive; font-size: 28px; font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand-day { font-size: 12px; color: var(--muted); white-space: nowrap; }

.tabs { display: flex; gap: 4px; background: var(--field); padding: 4px; border-radius: 999px; border: 1px solid var(--line);
  max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: none; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; flex: 0 0 auto; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: .18s; }
.tab.active { color: #fff; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }

.search-wrap { flex: 1; max-width: 420px; }
#search { width: 100%; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--field); color: var(--text); font-size: 14px; outline: none; }
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.menu-wrap { position: relative; }
.menu-trigger { font-size: 18px; line-height: 1; padding: 8px 12px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--glass-solid); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; z-index: 60; display: flex; flex-direction: column; gap: 2px; }
.menu-item { display: block; width: 100%; text-align: left; border: none; background: transparent; color: var(--text);
  padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; font-family: inherit; }
.menu-item:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }

/* Daily reminder banner */
.daily-reminder { display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  background: color-mix(in srgb, var(--accent-2) 16%, var(--glass-solid)); border-bottom: 1px solid var(--line); }
.dr-text { flex: 1; font-size: 13.5px; line-height: 1.4; }
.dr-btn { border: none; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff;
  font-weight: 600; padding: 8px 15px; border-radius: 999px; cursor: pointer; font-size: 13px; flex-shrink: 0; }
.dr-close { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; flex-shrink: 0; }

.togetherness { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); white-space: nowrap; }
.togetherness .dots { display: flex; }
.togetherness.together { color: #fff; border-color: transparent;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent-2) 45%, transparent));
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent); animation: glowpulse 3s ease-in-out infinite; }
@keyframes glowpulse { 0%,100%{ box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent) } 50%{ box-shadow: 0 0 32px color-mix(in srgb, var(--accent-2) 60%, transparent) } }
.togetherness.apart { color: var(--muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 12px; border: 2px solid var(--bg-base); margin-left: -8px; box-shadow: 0 0 12px currentColor; }
.avatar:first-child { margin-left: 0; }

/* ============================================================
   MOMENTS — day navigation + composer
   ============================================================ */
.container { max-width: 1000px; margin: 0 auto; padding: 24px 20px 90px; }
.day-nav { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto 18px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; backdrop-filter: blur(12px); }
.day-nav-label { font-weight: 600; font-size: 14px; flex: 1; text-align: center; }
#day-picker { background: var(--field); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 6px 8px; font-size: 13px; color-scheme: dark; }
[data-mode="light"] #day-picker { color-scheme: light; }

.composer { max-width: 640px; margin: 0 auto 30px; background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 17px; }
.composer-body { width: 100%; border: none; outline: none; font-size: 15px; line-height: 1.55; background: transparent;
  resize: none; font-family: inherit; min-height: 26px; color: var(--text); }
.composer-body::placeholder { color: var(--muted); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 10px; }
.composer-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.color-dots { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-left: 4px; }
.color-dot { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 1px solid rgba(128,128,128,.4); transition: transform .12s; }
.color-dot:hover { transform: scale(1.2); }
.color-dot.selected { box-shadow: 0 0 0 2px var(--accent), 0 0 12px var(--accent); }

/* Smart Compose suggestion chip */
.cc-suggest { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 7px 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, transparent); cursor: pointer; font-size: 14px; max-width: 100%; }
.cc-suggest .cc-text { color: var(--text); }
.cc-suggest .cc-key { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; white-space: nowrap; }
.cc-suggest:hover { border-style: solid; }

/* AI scan-all button */
.ai-scan-row { max-width: 640px; margin: 0 auto 16px; display: flex; justify-content: center; }
.ai-scan-row .ghost-btn { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* AI suggestions panel */
.ai-panel { max-width: 640px; margin: 0 auto 28px; background: var(--glass); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.ai-loading, .ai-empty { font-size: 14px; color: var(--muted); padding: 4px; }
.ai-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.ai-x { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.ai-group { margin-bottom: 12px; }
.ai-glabel { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--field);
  color: var(--text); padding: 8px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; text-align: left; transition: .15s; }
.ai-chip:hover { border-color: var(--accent); }
.ai-chip.added { border-color: transparent; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.ai-plus { font-weight: 700; color: var(--accent); }

.emoji-preview { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 12px;
  font-size: 15px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.emoji-preview::before { content: 'Preview '; font-size: 11px; color: var(--muted); }

.composer-media { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.composer-media:empty { margin-top: 0; }
.media-thumb { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-ph { width: 100%; height: 100%; background: radial-gradient(circle at 50% 38%, #2a2f55, #0a0c1c); }
.media-thumb .remove-media { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff; border: none; cursor: pointer; font-size: 13px; line-height: 1; }
.media-thumb .play-badge, .note-media-grid .cell .play-badge { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.8); }

/* ============================================================
   DAY FEED + MOMENTS
   ============================================================ */
.day-feed { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.day-card { background: var(--glass); backdrop-filter: blur(12px); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.day-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.day-head .day-sub { color: var(--muted); font-size: 12.5px; }
.day-people { margin-left: auto; display: flex; gap: 3px; }
.day-count { font-size: 12px; color: var(--muted); font-weight: 500; }
.day-moments { display: flex; flex-direction: column; }
.moment { display: flex; gap: 12px; padding: 14px 18px; cursor: pointer; transition: background .15s; border-bottom: 1px solid var(--line); }
.moment:last-child { border-bottom: none; }
.moment:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.moment-time { width: 64px; flex-shrink: 0; font-size: 12px; color: var(--muted); padding-top: 2px; }
.moment-main { flex: 1; min-width: 0; }
.moment-by { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.mini-avatar { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 9px; box-shadow: 0 0 8px currentColor; }
.moment-by .by-name { font-size: 12px; color: var(--muted); font-weight: 600; }
.moment-text { font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.moment.tinted { border-left: 3px solid var(--tint, transparent); }
.anim-emoji { width: 1.45em; height: 1.45em; vertical-align: -0.32em; display: inline-block; }
.moment-media { display: grid; gap: 3px; margin: 8px 0 2px; border-radius: 12px; overflow: hidden; }
.moment-media.n1 { grid-template-columns: 1fr; }
.moment-media.n2, .moment-media.n3, .moment-media.n4, .moment-media.nmany { grid-template-columns: 1fr 1fr; }
.moment-media .cell { position: relative; aspect-ratio: 1/1; background: #000; overflow: hidden; }
.moment-media.n1 .cell { aspect-ratio: 16/10; }
.moment-media .cell img, .moment-media .cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.moment-media .more-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 600; }
.moment-pin { margin-left: 6px; }

.empty-state { text-align: center; color: var(--muted); margin-top: 60px; }
.empty-emoji { font-size: 56px; filter: drop-shadow(0 0 16px var(--accent)); }

/* ============================================================
   BUCKET LIST / TO-DO
   ============================================================ */
.bucket-tabs { display: flex; gap: 8px; max-width: 640px; margin: 0 auto 16px; justify-content: center; }
.btab { border: 1px solid var(--line); background: var(--field); color: var(--muted); font-weight: 600;
  padding: 9px 18px; border-radius: 999px; cursor: pointer; transition: .18s; }
.btab.active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.bucket-add { display: flex; gap: 10px; max-width: 640px; margin: 0 auto 20px; }
#bucket-input { flex: 1; padding: 13px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--glass);
  color: var(--text); font-size: 15px; outline: none; backdrop-filter: blur(10px); }
#bucket-input::placeholder { color: var(--muted); }
#bucket-input:focus { border-color: var(--accent); }
.bucket-list { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.bucket-item { display: flex; flex-direction: column; padding: 14px 16px; background: var(--glass);
  backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); transition: .18s; }
/* tint the whole box by who it's by (Sayu = blue, Dizz = pink) */
.bucket-item.by-tinted { border-left: 4px solid var(--by); background: color-mix(in srgb, var(--by) 10%, var(--glass)); }
.bucket-item.done { opacity: .6; }
/* row 1: checkbox + the full-width text */
.bucket-row { display: flex; align-items: flex-start; gap: 12px; }
.bucket-text { flex: 1; min-width: 0; cursor: text; line-height: 1.5; overflow-wrap: anywhere; padding-top: 1px; }
.bucket-check { margin-top: 1px; }
/* row 2: controls, aligned under the text */
.bucket-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0 36px; }
.bucket-media { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0 36px; }
.bucket-attach, .bucket-edit { opacity: .7; }
.bucket-item:hover .bucket-attach, .bucket-item:hover .bucket-edit { opacity: 1; }
/* touch devices have no hover — keep action buttons visible */
@media (hover: none) {
  .bucket-del, .bucket-edit, .bucket-attach, .song-del, .song-edit, .place-del, .place-attach, .tl-del, .letter-del { opacity: 1 !important; }
}
.bucket-edit-input { flex: 1; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 10px;
  background: var(--field); color: var(--text); font-size: 15px; font-family: inherit; outline: none; }
.song-edit { opacity: .55; }
.song-item:hover .song-edit { opacity: 1; }
.song-item.editing { flex-wrap: wrap; }
.song-edit-input { flex: 1; min-width: 140px; padding: 9px 12px; border: 1px solid var(--accent); border-radius: 10px;
  background: var(--field); color: var(--text); font-size: 14px; font-family: inherit; outline: none; }
.bucket-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--accent); cursor: pointer;
  flex-shrink: 0; display: grid; place-items: center; font-size: 14px; color: #fff; transition: .15s; }
.bucket-item.done .bucket-check { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.bucket-text { flex: 1; font-size: 15px; word-break: break-word; }
.bucket-item.done .bucket-text { text-decoration: line-through; }
.bucket-meta { font-size: 11px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.prio { border: none; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  text-transform: uppercase; letter-spacing: .04em; font-family: inherit; }
.p-high { background: rgba(255, 80, 90, .22); color: #ff6b76; }
.p-med { background: rgba(255, 190, 70, .20); color: #ffc14d; }
.p-low { background: rgba(120, 180, 255, .18); color: #8fb6ff; }
.prio:hover { filter: brightness(1.12); }
.bucket-by { border: 1px solid color-mix(in srgb, var(--by, var(--line)) 50%, transparent);
  background: color-mix(in srgb, var(--by, transparent) 16%, transparent);
  color: var(--by, var(--muted)); font-weight: 600;
  font-size: 11px; padding: 3px 9px; border-radius: 999px; cursor: pointer; transition: .15s; font-family: inherit; }
.bucket-by:hover { filter: brightness(1.1); border-color: var(--by, var(--accent)); }
.bucket-doneby { margin-left: 2px; }
.bucket-del { opacity: 0; }
.bucket-item:hover .bucket-del { opacity: 1; }

/* ============================================================
   OUR SONGS
   ============================================================ */
.songs-title { max-width: 640px; margin: 0 auto 16px; font-size: 22px; letter-spacing: -0.02em; }
.song-add { display: flex; flex-wrap: wrap; gap: 10px; max-width: 640px; margin: 0 auto 20px; }
.song-add input { flex: 1; min-width: 160px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--glass); color: var(--text); font-size: 15px; outline: none; backdrop-filter: blur(10px); }
.song-add input::placeholder { color: var(--muted); }
.song-add input:focus { border-color: var(--accent); }
.song-list { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.song-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--glass);
  backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.song-num { width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 12px; font-weight: 700; }
.song-title { flex: 1; font-size: 15px; font-weight: 500; word-break: break-word; }
.song-play { flex-shrink: 0; text-decoration: none; color: #fff; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 30%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  padding: 7px 14px; border-radius: 999px; transition: .15s; }
.song-play:hover { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.song-del { opacity: 0; }
.song-item:hover .song-del { opacity: 1; }

/* ============================================================
   FOREVER LOVE CONTRACT
   ============================================================ */
.contract-card { max-width: 680px; margin: 0 auto; background: var(--glass); border: 1px solid var(--line);
  border-radius: 20px; padding: 30px 26px calc(26px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); backdrop-filter: blur(12px);
  position: relative; overflow: hidden; }
.contract-card::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 40% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.contract-title { text-align: center; font-family: 'Caveat', cursive; font-size: 38px; margin: 0 0 4px; font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.contract-between { text-align: center; font-weight: 600; margin: 0 0 2px; }
.contract-date { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.contract-intro { font-size: 14.5px; line-height: 1.6; margin: 0 0 18px; }
.article { margin-bottom: 16px; }
.article h3 { font-size: 15px; margin: 0 0 4px; color: var(--accent); }
.article p { font-size: 14px; line-height: 1.6; margin: 0 0 6px; color: var(--text); }
.contract-final { margin: 22px 0 10px; padding: 16px; border-radius: 14px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
.contract-final h3 { margin: 0 0 8px; font-size: 15px; }
.vow { font-style: italic; line-height: 1.65; font-size: 15px; margin: 0 0 10px; }
.signed { text-align: center; color: var(--muted); margin: 18px 0 10px; }
.signatures { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.sig { flex: 1; min-width: 180px; text-align: center; border-top: 1px dashed var(--line); padding-top: 10px; }
.sig-mark { font-size: 13px; color: var(--muted); }
.sig-name { font-family: 'Caveat', cursive; font-size: 30px; font-weight: 600; margin-top: 2px; }
.sig-sayu .sig-name { color: var(--accent); }
.sig-dizz .sig-name { color: var(--accent-2); }
.contract-signed-date { text-align: center; font-family: 'Caveat', cursive; font-size: 20px; margin: 0 0 16px; color: var(--accent-2); }
.witness { text-align: center; color: var(--muted); font-size: 13px; margin-top: 20px; }
.contract-actions { display: flex; justify-content: center; margin-top: 22px; }

/* Print / Save-as-PDF: clean light certificate, hide the rest of the app */
@media print {
  .bg-gradient, .galaxy, .galaxy-band, .bg-canvas, .topbar, #bubble-layer, #presence-banner,
  .toast, .fab, .emoji-kb, .sheet-backdrop, #contract-print, .contract-actions { display: none !important; }
  body { background: #fff !important; color: #1a1530 !important; }
  .view:not(#view-contract) { display: none !important; }
  #view-contract { display: block !important; }
  .container { padding: 0 !important; max-width: 100% !important; }
  .contract-card { box-shadow: none !important; border: 1px solid #d8cbe0 !important; background: #fff !important;
    backdrop-filter: none !important; max-width: 100% !important; color: #1a1530 !important; }
  .contract-card::before { display: none !important; }
  .contract-title { -webkit-text-fill-color: #c23b86 !important; color: #c23b86 !important; background: none !important; }
  .contract-between, .contract-intro, .article p, .vow, .contract-final h3, .signed { color: #1a1530 !important; }
  .contract-date, .witness, .sig-mark { color: #6b5e7a !important; }
  .contract-signed-date { color: #c23b86 !important; }
  .article h3 { color: #7a3a9e !important; }
  .contract-final { background: #faf3f7 !important; border-color: #e3c2d6 !important; }
  .sig-sayu .sig-name { color: #2b5bd7 !important; }
  .sig-dizz .sig-name { color: #c23b86 !important; }
}

/* ============================================================
   US TAB — mood, logger, affection, rituals + Places
   ============================================================ */
.us-card { max-width: 640px; margin: 0 auto 16px; background: var(--glass); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 18px; backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.us-h { margin: 0 0 10px; font-size: 16px; }
.us-sub { margin: -6px 0 12px; font-size: 12.5px; color: var(--muted); }
.us-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.us-btn { border: 1px solid var(--line); background: var(--field); color: var(--text); font-weight: 600; font-size: 14px;
  padding: 11px 16px; border-radius: 13px; cursor: pointer; transition: .15s; }
.us-btn:hover { border-color: var(--accent); }
.us-btn.active { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }

/* His & hers clock */
.clocks { display: flex; gap: 14px; }
.clock { flex: 1; text-align: center; padding: 16px 10px; border-radius: 16px; border: 1px solid var(--line);
  border-top: 3px solid var(--by, var(--accent)); background: color-mix(in srgb, var(--by, var(--accent)) 9%, var(--glass)); }
.clock-who { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.clock-time { display: flex; align-items: baseline; justify-content: center; gap: 5px; }
.ct-hm { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, var(--by, var(--accent)), color-mix(in srgb, var(--by, var(--accent)) 40%, var(--text)));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ct-ap { font-size: 13px; font-weight: 600; color: var(--muted); }
.clock-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.mood-display { display: flex; gap: 14px; margin-bottom: 14px; }
.mood-cell { flex: 1; text-align: center; padding: 14px 8px; border-radius: 14px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--by, var(--accent)) 10%, var(--glass)); border-left: 4px solid var(--by, var(--accent)); }
.mood-emoji { font-size: 34px; }
.mood-name { font-size: 12px; font-weight: 600; margin-top: 2px; }
.mood-word { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.mood-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.mood-opt { font-size: 22px; width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); cursor: pointer; transition: .15s; }
.mood-opt:hover { transform: scale(1.08); }
.mood-opt.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent); }

.logger { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.log-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--field); color: var(--text); cursor: pointer; transition: transform .15s, border-color .15s; }
.log-chip:hover { border-color: var(--accent); }
.log-chip.pop { transform: scale(1.12); }
.log-e { font-size: 24px; } .log-k { font-size: 11px; color: var(--muted); } .log-n { font-size: 16px; font-weight: 700; color: var(--accent); }

.on-this-day { display: flex; align-items: center; gap: 10px; max-width: 680px; margin: 0 auto 16px; padding: 12px 16px;
  border-radius: 14px; border: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 12%, var(--glass)); backdrop-filter: blur(10px); font-size: 14px; }
.otd-emoji { font-size: 20px; } .otd-text { flex: 1; }
.otd-btn { border: none; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; }

.place-card { background: var(--glass); border: 1px solid var(--line); border-left: 4px solid var(--by, var(--accent));
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.place-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.place-title { flex: 1; font-weight: 600; font-size: 15px; }
.place-map { text-decoration: none; color: var(--accent); font-size: 13px; font-weight: 600; }
.place-attach { opacity: .6; } .place-del { opacity: 0; }
.place-card:hover .place-del { opacity: 1; }

/* floating thought bubbles */
.bubble-layer { position: fixed; inset: 0; z-index: 150; pointer-events: none; overflow: hidden; }
.bubble { position: absolute; bottom: 12%; background: var(--glass-solid); border: 1px solid var(--line); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lg); animation: float-up 4.6s ease-out forwards; }
@keyframes float-up { 0% { transform: translateY(0) scale(.8); opacity: 0; } 12% { opacity: 1; transform: translateY(-10px) scale(1); } 100% { transform: translateY(-55vh) scale(1); opacity: 0; } }

.presence-banner { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 140;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent-2) 45%, transparent));
  color: #fff; padding: 8px 18px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow-lg); }

/* ritual overlays */
.ritual-overlay { position: fixed; inset: 0; z-index: 160; display: grid; place-items: center;
  background: radial-gradient(60% 60% at 50% 40%, rgba(20,15,40,.7), rgba(2,3,12,.96)); }
.ritual-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 24px; }
.ritual-close { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255,255,255,.08); color: #fff; font-size: 18px; cursor: pointer; }
.ritual-text { color: #e9ebff; font-size: 16px; margin: 0; }
.heart-big { font-size: 90px; filter: drop-shadow(0 0 30px rgba(255,120,160,.6)); transition: transform .2s; }
.heart-big.beating { animation: heartbeat 0.85s ease-in-out infinite; }
@keyframes heartbeat { 0%,100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.18); } }
.heart-hold { padding: 14px 30px; border-radius: 999px; border: none; font-size: 16px; font-weight: 700; cursor: pointer;
  background: linear-gradient(90deg, #ff5d8f, #ff8e53); color: #fff; user-select: none; touch-action: none; }
.breathe-circle { width: 180px; height: 180px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 18px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 60%, transparent), color-mix(in srgb, var(--accent-2) 30%, transparent));
  transform: scale(1); transition: transform 3.8s ease-in-out; box-shadow: 0 0 50px color-mix(in srgb, var(--accent) 40%, transparent); }
.breathe-circle.in, .breathe-circle.hold { transform: scale(1.5); }
.breathe-circle.out { transform: scale(.8); transition: transform 5.8s ease-in-out; }
.ritual-overlay.fireplace { background: radial-gradient(60% 60% at 50% 80%, rgba(120,50,10,.5), rgba(2,3,12,.97)); }
.fire { font-size: 100px; animation: flicker 1.6s ease-in-out infinite; filter: drop-shadow(0 0 40px rgba(255,140,40,.7)); }
@keyframes flicker { 0%,100% { transform: scale(1) rotate(-2deg); opacity: .95; } 50% { transform: scale(1.08) rotate(2deg); opacity: 1; } }

/* ============================================================
   SHARED SECTION HEADERS + OUR STORY + TIMELINE + LETTERS + VAULT
   ============================================================ */
.section-title { max-width: 680px; margin: 0 auto 6px; font-size: 22px; }
/* Gallery grid */
.gallery-grid { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 6px; }
.gal-cell { position: relative; aspect-ratio: 1/1; border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; border: 1px solid var(--line); }
.gal-cell img, .gal-cell .video-ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-cell:hover { transform: scale(1.02); transition: transform .12s; }
.gal-cell .play-badge { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.section-sub { max-width: 680px; margin: 0 auto 20px; color: var(--muted); font-size: 13px; }
input[type="date"], input[type="datetime-local"] { color-scheme: dark; }
[data-mode="light"] input[type="date"], [data-mode="light"] input[type="datetime-local"] { color-scheme: light; }

/* Our Story */
.story-grid { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.stat-card { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 18px 12px;
  text-align: center; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.stat-emoji { font-size: 24px; }
.stat-num { font-size: 30px; font-weight: 700; line-height: 1.1; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Timeline */
.row-add { display: flex; gap: 10px; max-width: 640px; margin: 0 auto 20px; flex-wrap: wrap; }
.row-add input:not(.emoji-field) { flex: 1; min-width: 140px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--glass); color: var(--text); font-size: 15px; outline: none; backdrop-filter: blur(10px); }
.emoji-field { width: 58px; text-align: center; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--glass); color: var(--text); font-size: 18px; outline: none; }
.row-add input:focus { border-color: var(--accent); }
.timeline { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: none; }
.tl-dot { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: color-mix(in srgb, var(--by, var(--accent)) 20%, var(--glass)); border: 2px solid var(--by, var(--accent)); box-shadow: 0 0 14px color-mix(in srgb, var(--by, var(--accent)) 40%, transparent); }
.tl-body { flex: 1; padding-top: 4px; } .tl-title { font-weight: 600; font-size: 15px; } .tl-date { font-size: 12px; color: var(--muted); }
.tl-del { opacity: 0; align-self: center; } .tl-item:hover .tl-del { opacity: 1; }

/* Letters */
.letter-form { max-width: 640px; margin: 0 auto 24px; display: flex; flex-direction: column; gap: 10px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 16px; backdrop-filter: blur(10px); }
.letter-form input, .letter-form textarea { border: 1px solid var(--line); border-radius: 12px; background: var(--field);
  color: var(--text); padding: 12px 14px; font-size: 15px; font-family: inherit; outline: none; resize: none; }
.letter-form input:focus, .letter-form textarea:focus { border-color: var(--accent); }
.letter-when { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.letter-when button { margin-left: auto; }
.letter-list { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.letter-card { background: var(--glass); border: 1px solid var(--line); border-left: 4px solid var(--by, var(--accent));
  border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.letter-card.locked { opacity: .9; }
.letter-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.letter-title { font-weight: 600; font-size: 15px; } .letter-meta { font-size: 12px; color: var(--muted); }
.letter-locked { margin-top: 8px; color: var(--muted); font-style: italic; font-size: 14px; }
.letter-bodytext { margin-top: 8px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.55; }
.letter-del { opacity: .5; margin-top: 8px; }
.letter-card:hover .letter-del { opacity: 1; }

/* Vault */
.vault-recorder { max-width: 640px; margin: 0 auto 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vault-recorder input { flex: 1; min-width: 160px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--glass); color: var(--text); font-size: 15px; outline: none; backdrop-filter: blur(10px); }
#voice-record.recording { background: linear-gradient(90deg, #ff5d6c, #ff8e53); }
.voice-status { font-size: 13px; color: var(--muted); }
.voice-list { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.voice-item { display: flex; align-items: center; gap: 12px; background: var(--glass); border: 1px solid var(--line);
  border-left: 4px solid var(--by, var(--accent)); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); backdrop-filter: blur(10px); flex-wrap: wrap; }
.voice-info { min-width: 110px; } .voice-label-text { font-weight: 600; font-size: 14px; } .voice-meta { font-size: 11px; color: var(--muted); }
.voice-item audio { flex: 1; min-width: 180px; height: 38px; }

/* ============================================================
   NIGHT JOURNAL
   ============================================================ */
.journal-tonight { max-width: 640px; margin: 0 auto 28px; background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.jt-title { margin: 0 0 2px; font-size: 19px; }
.jt-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.journal-form { display: flex; flex-direction: column; gap: 18px; }
.journal-q label { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 8px; color: var(--text); line-height: 1.4; }
.journal-input { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--field);
  color: var(--text); padding: 14px 16px; font-size: 15px; line-height: 1.6; resize: none; outline: none;
  font-family: inherit; min-height: 72px; box-sizing: border-box; }
.journal-input:focus { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--field)); }
.journal-input::placeholder { color: var(--muted); }
.jt-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.jt-saved { color: #43d18a; font-size: 13px; }

.diary-heading { max-width: 640px; margin: 0 auto 14px; font-size: 16px; }
.diary-feed { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.diary-body { padding: 4px 0; }
.diary-entry { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.diary-entry:last-child { border-bottom: none; }
.diary-who { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.diary-qa { margin-bottom: 10px; }
.diary-q { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.diary-a { font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.diary-waiting { padding: 12px 18px; color: var(--muted); font-size: 13px; font-style: italic; }

/* ============================================================
   MODALS (edit moment / account / theme)
   ============================================================ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3,4,14,.7); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 50; padding: 20px; }
[data-mode="light"] .modal-backdrop { background: rgba(40,44,80,.4); }
.modal { width: 100%; max-width: 600px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  padding: 20px 22px; background: var(--glass-solid); border: 1px solid var(--line); border-radius: var(--radius); }
.modal-meta { font-size: 12px; color: var(--muted); margin-top: 12px; padding-top: 4px; }
.edit-time-row, .composer-time { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; font-size: 13px; color: var(--muted); }
.edit-time-row { padding-top: 12px; border-top: 1px solid var(--line); }
#edit-time, #new-time { background: var(--field); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 7px 9px; font-size: 13px; font-family: inherit; color-scheme: dark; }
#edit-time:focus, #new-time:focus { border-color: var(--accent); outline: none; }
[data-mode="light"] #edit-time, [data-mode="light"] #new-time, [data-mode="light"] #diary-picker { color-scheme: light; }
.account-modal, .theme-panel { max-width: 400px; }
.account-title { margin: 0 0 14px; font-size: 20px; }
.account-who { color: var(--muted); font-size: 13px; margin: -8px 0 16px; }
#password-form { display: flex; flex-direction: column; gap: 10px; }
#password-form input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px;
  outline: none; background: var(--field); color: var(--text); }
#password-form input:focus { border-color: var(--accent); }
.password-msg { font-size: 13px; min-height: 16px; margin: 0; }
.password-msg.error { color: #ff5d78; }
.password-msg.success { color: #43d18a; }
.account-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* theme panel */
.theme-section { margin-bottom: 18px; }
.theme-section > label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--field);
  color: var(--text); cursor: pointer; font-weight: 600; transition: .15s; }
.seg button.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.swatches { display: flex; gap: 12px; }
.swatch { width: 42px; height: 42px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: .15s; position: relative; }
.swatch.active { border-color: var(--text); transform: scale(1.08); }
.bg-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bg-opt { padding: 12px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--field);
  color: var(--text); cursor: pointer; text-align: center; font-size: 12px; font-weight: 600; transition: .15s; }
.bg-opt .bg-emoji { font-size: 22px; display: block; margin-bottom: 4px; }
.bg-opt.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* ============================================================
   EMOJI KEYBOARD
   ============================================================ */
.emoji-kb { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 460px; z-index: 70;
  background: var(--glass-solid); border: 1px solid var(--line); border-bottom: none; border-radius: 18px 18px 0 0;
  box-shadow: 0 -16px 50px rgba(2,3,12,.6); display: flex; flex-direction: column; height: 320px;
  animation: sheetup .25s ease; }
.kb-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.kb-tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.kb-tabs::-webkit-scrollbar { display: none; }
.kb-tab { border: none; background: transparent; font-size: 19px; padding: 6px 8px; border-radius: 10px; cursor: pointer; flex-shrink: 0; }
.kb-tab.active { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.kb-grid { flex: 1; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; align-content: start; }
.kb-grid button { border: none; background: transparent; font-size: 24px; aspect-ratio: 1/1; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.kb-grid button:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.kb-grid img { width: 30px; height: 30px; }

/* ============================================================
   LIGHTBOX + TOAST + FAB + sheets
   ============================================================ */
/* Welcome back */
.welcome-modal { max-width: 380px; text-align: center; }
.welcome-emoji { font-size: 48px; animation: float 6s ease-in-out infinite; }
.welcome-title { font-family: 'Caveat', cursive; font-size: 30px; margin: 6px 0 2px; font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.welcome-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.welcome-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.welcome-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.wl-emoji { font-size: 24px; }
.wl-label { flex: 1; text-align: left; font-size: 14px; font-weight: 500; }
.wl-count { font-weight: 700; color: var(--accent); }
.welcome-modal .account-actions { justify-content: center; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 100; display: grid; place-items: center; padding: 30px; cursor: zoom-out; }
.lightbox-inner img, .lightbox-inner video { max-width: 92vw; max-height: 90vh; border-radius: 10px; box-shadow: 0 0 50px color-mix(in srgb, var(--accent) 30%, transparent); }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--glass-solid);
  border: 1px solid var(--line); color: var(--text); padding: 12px 20px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-lg); z-index: 200; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } }

.sheet-head { display: none; }
.fab { display: none; }
.btn-icon { display: none; }
.btn-label { display: inline; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(3,4,14,.6); backdrop-filter: blur(3px); }

/* ============================================================
   PHONE LAYOUT — native-app feel
   ============================================================ */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .brand { order: 1; }
  .topbar-right { order: 2; margin-left: auto; gap: 6px; }
  /* tabs get their own full-width row and scroll horizontally */
  .tabs { order: 3; flex-basis: 100%; width: 100%; justify-content: flex-start; -webkit-overflow-scrolling: touch; }
  .tab { padding: 8px 14px; font-size: 14px; }
  .search-wrap { order: 4; flex-basis: 100%; max-width: none; }
  .brand-name { font-size: 24px; } .brand-day { display: none; }
  .btn-label { display: none; } .btn-icon { display: inline; font-size: 17px; }
  .ghost-btn { padding: 9px 11px; } .icon-btn { width: 44px; height: 44px; }
  .togetherness span.label { display: none; }
  .togetherness.together span.label { display: inline; font-size: 12px; }

  .container { padding: 16px 12px calc(96px + env(safe-area-inset-bottom)); }
  .day-feed, .day-nav, .composer, .bucket-list, .bucket-add, .bucket-tabs { max-width: none; }

  /* composer → slide-up sheet, opened by the FAB */
  #view-moments .composer { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 60;
    border-radius: 24px 24px 0 0; transform: translateY(118%); transition: transform .32s cubic-bezier(.4,0,.2,1);
    max-height: 90vh; overflow-y: auto; padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 50px rgba(2,3,12,.7); }
  #view-moments .composer.sheet-open { transform: translateY(0); }
  .sheet-head { display: flex; align-items: center; gap: 10px; position: relative; padding: 10px 0 12px; }
  .sheet-head .sheet-title { font-weight: 600; font-size: 16px; }
  .sheet-head .icon-btn { margin-left: auto; }
  .sheet-grip { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 42px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 25%, transparent); }
  .composer-body { font-size: 16px; min-height: 80px; }

  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom));
    width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer; z-index: 56; color: #fff; font-size: 34px; font-weight: 300; line-height: 1;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 50%, transparent); }
  .fab:active { transform: scale(.92); }
  body.on-bucket .fab { display: none; }

  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0;
    padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); animation: sheetup .3s cubic-bezier(.4,0,.2,1); }
  .account-modal, .theme-panel { max-width: none; }
  .emoji-kb { max-width: none; height: 50vh; }
  #login-form input, #password-form input, #search, #bucket-input { font-size: 16px; }
  .moment-time { width: 52px; }

  /* Journal: roomier write boxes on phones */
  .journal-tonight { max-width: none; padding: 18px 16px; }
  .journal-form { gap: 20px; }
  .journal-input { font-size: 16px; min-height: 96px; padding: 14px; }
  .journal-q label { font-size: 15px; }
  .diary-feed, .diary-heading { max-width: none; }
  .jt-title { font-size: 20px; }
}
@keyframes sheetup { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (display-mode: standalone) { .topbar { padding-top: calc(12px + env(safe-area-inset-top)); } }
