/* ============================================================
   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); }
[data-theme="sakura"] { --accent: #ff7aa8; --accent-2: #ffc8dc;
  --neb-1: rgba(255,150,190,.34); --neb-2: rgba(255,200,220,.26); --neb-3: rgba(210,120,180,.24); --neb-4: rgba(150,90,150,.22); }

/* ---- 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; }

/* 🌸 Sakura — a soft Japanese spring sky behind the falling petals */
[data-bg="sakura"] .bg-gradient {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,190,215,.34), transparent 60%),
    radial-gradient(80% 60% at 82% 12%, rgba(255,160,195,.26), transparent 62%),
    radial-gradient(70% 55% at 12% 20%, rgba(210,140,190,.20), transparent 66%),
    linear-gradient(180deg, rgba(70,30,60,0) 40%, rgba(120,52,92,.34) 100%);
}
[data-bg="sakura"] .bg-gradient::after { /* a faint blossom moon + gentle vignette */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(closest-side at 78% 16%, rgba(255,236,245,.5), rgba(255,236,245,0) 70%),
    radial-gradient(130% 100% at 50% 30%, transparent 55%, rgba(35,10,30,.42) 100%);
}
[data-mode="light"][data-bg="sakura"] { --bg-base: #fff4f8; }
[data-mode="light"][data-bg="sakura"] .bg-gradient {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,205,225,.7), transparent 62%),
    radial-gradient(80% 60% at 82% 12%, rgba(255,190,215,.5), transparent 64%),
    linear-gradient(180deg, rgba(255,240,246,0) 45%, rgba(255,214,230,.6) 100%);
}
[data-mode="light"][data-bg="sakura"] .bg-gradient::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(130% 100% at 50% 30%, transparent 62%, rgba(190,120,150,.14) 100%);
}

@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; }
html[data-session="1"] #login-screen { display: none; } /* don't flash login while validating a saved session */
.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; flex-wrap: wrap;
  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: 5px; border-radius: 16px; border: 1px solid var(--line);
  flex: 1 1 auto; min-width: 0; flex-wrap: wrap; row-gap: 5px; justify-content: center; 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); }
/* the moment editor: a drag-to-resize box that scrolls its own overflow */
.resizable-body { overflow-y: auto; }
.edit-resizer { display: flex; align-items: center; justify-content: center; gap: 8px; height: 26px; margin-top: 6px;
  cursor: ns-resize; touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  transition: background .15s; }
.edit-resizer:hover, .edit-resizer.dragging { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.edit-resizer .er-grip { width: 40px; height: 5px; border-radius: 999px; background: var(--accent); opacity: .55; transition: opacity .15s; }
.edit-resizer:hover .er-grip, .edit-resizer.dragging .er-grip { opacity: 1; }
.edit-resizer .er-hint { font-size: 11px; font-weight: 600; color: var(--accent); opacity: .85; }
.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); }
/* keep the preview from dominating a long memory — it gets its own scrollbar */
#edit-preview { max-height: 32vh; overflow-y: auto; }

.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; }
/* Older / Newer pager — keeps only one page of days in the DOM at a time */
.feed-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.feed-pager .pager-btn { flex: 0 0 auto; border: 1px solid var(--line); background: var(--field); color: var(--text);
  font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 999px; cursor: pointer; transition: border-color .15s, opacity .15s; }
.feed-pager .pager-btn:hover:not(:disabled) { border-color: var(--accent); }
.feed-pager .pager-btn:disabled { opacity: .35; cursor: default; }
.feed-pager .pager-info { flex: 1 1 auto; text-align: center; font-size: 12.5px; color: var(--muted); }
.day-card { background: var(--glass); backdrop-filter: blur(12px); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  /* skip rendering (layout + paint + the blur) for day-cards that are off-screen — huge scroll win on long feeds.
     'auto 480px' reserves an estimated height first, then remembers each card's real size so the scrollbar stays put. */
  content-visibility: auto; contain-intrinsic-size: auto 480px; }
.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; flex-direction: column; 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-head { display: flex; align-items: center; gap: 10px; }
.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; }
.otd-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.otd-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; max-width: 220px; padding: 6px 10px 6px 6px;
  border: 1px solid var(--line); background: var(--glass); border-radius: 12px; cursor: pointer; text-align: left; color: inherit; }
.otd-chip:hover { border-color: var(--accent); }
.otd-thumb { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; flex: 0 0 auto; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 18%, transparent); font-size: 16px; }
.otd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.otd-chip-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.otd-ago { font-size: 11px; color: var(--accent); font-weight: 600; }
.otd-snip { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Instagram-style reactions on a moment --- */
.ig-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; position: relative; }
.ig-like { border: none; background: transparent; cursor: pointer; font-size: 23px; line-height: 1; padding: 2px;
  border-radius: 50%; -webkit-tap-highlight-color: transparent; transition: transform .12s ease; }
.ig-like:active { transform: scale(.9); }
.ig-like .ig-heart { display: inline-block; }
.ig-like.liked .ig-heart { filter: drop-shadow(0 0 7px rgba(255,90,120,.6)); }
.ig-like.pop { animation: heart-pop .5s cubic-bezier(.2,.7,.3,1.3); }
@keyframes heart-pop { 0% { transform: scale(1); } 25% { transform: scale(.75); } 55% { transform: scale(1.4); } 80% { transform: scale(.92); } 100% { transform: scale(1); } }
.ig-react-btn { border: none; background: transparent; cursor: pointer; font-size: 19px; line-height: 1; padding: 2px;
  color: var(--muted); border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.ig-react-btn:hover { color: var(--accent); transform: scale(1.12); }
.ig-react-summary { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; margin-left: 2px;
  padding: 2px 9px 2px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); }
.ig-faces { display: inline-flex; } .ig-face { font-size: 14px; margin-left: -5px; } .ig-face:first-child { margin-left: 0; }
.ig-count { font-size: 12px; color: var(--muted); font-weight: 700; }

/* the pop-up reaction tray (long-press the heart, tap ☺, or tap the summary) */
.ig-tray { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 40; display: flex; gap: 3px; padding: 5px 8px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.ig-tray-emoji { border: none; background: transparent; cursor: pointer; font-size: 25px; line-height: 1; padding: 3px;
  border-radius: 50%; transform: scale(0); animation: tray-in .3s forwards cubic-bezier(.2,.8,.3,1.5); -webkit-tap-highlight-color: transparent; }
.ig-tray-emoji:hover { transform: scale(1.35) !important; }
.ig-tray-emoji.active { background: color-mix(in srgb, var(--accent) 28%, transparent); }
@keyframes tray-in { to { transform: scale(1); } }

.moment-comment-count { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* full-screen effects layer for floating + bursting hearts */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.float-heart { position: absolute; transform: translate(-50%, -50%); will-change: transform, opacity;
  animation: float-up 1.25s ease-out forwards; }
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -180%) scale(1.1) rotate(var(--dr)); } }
.burst-heart { position: absolute; font-size: 96px; transform: translate(-50%, -50%) scale(0); will-change: transform, opacity;
  filter: drop-shadow(0 5px 16px rgba(255,60,100,.55)); animation: heart-burst 1s ease-out forwards; }
@keyframes heart-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-12deg); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(6deg); }
  30% { transform: translate(-50%, -50%) scale(.92) rotate(-3deg); }
  45% { transform: translate(-50%, -50%) scale(1.06) rotate(0); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.05); } }
@media (prefers-reduced-motion: reduce) {
  .ig-like.pop, .ig-tray-emoji, .float-heart, .burst-heart { animation: none; }
  .ig-tray-emoji { transform: scale(1); }
}

.modal-social { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.comments { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; max-height: 40vh; overflow-y: auto; }
.comment { display: flex; align-items: flex-start; gap: 8px; position: relative; }
.comment .c-main { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; }
.comment .c-name { font-weight: 600; font-size: 13px; }
.comment .c-time { font-size: 11px; color: var(--muted); }
.comment .c-body { font-size: 14px; white-space: pre-wrap; word-break: break-word; margin-top: 1px; }
.comment .c-del { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
  opacity: 0; padding: 0 4px; }
.comment:hover .c-del { opacity: .7; }
.comment .c-del:hover { color: #ff6b6b; opacity: 1; }
.comment-form { display: flex; gap: 8px; align-items: center; }
.comment-input { flex: 1; padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass);
  color: inherit; font-size: 14px; font-family: inherit; }
.comment-input:focus { outline: none; border-color: var(--accent); }

/* --- Dizz's cycle tracker 🌸 --- */
.cycle-status { --phase: #ff8ec8; border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--phase) 7%, var(--glass)); backdrop-filter: blur(10px); }
.cycle-status.empty { display: flex; align-items: center; gap: 12px; }
.cycle-status .cs-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cs-emoji { font-size: 32px; width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%;
  background: color-mix(in srgb, var(--phase) 24%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--phase) 16%, transparent); }
.cs-main { flex: 1; min-width: 0; }
.cs-title { font-weight: 700; font-size: 16px; }
.cs-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cs-facts { display: flex; gap: 8px; margin-top: 14px; }
.cs-fact { flex: 1; text-align: center; padding: 9px 4px; border-radius: 12px; background: color-mix(in srgb, var(--phase) 12%, transparent); }
.cs-fact .cf-n { display: block; font-size: 20px; font-weight: 700; color: var(--phase); }
.cs-fact .cf-l { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.cs-fertile { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.cs-note { color: var(--muted); font-size: 11px; }
.cs-reg { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--phase); white-space: nowrap;
  background: color-mix(in srgb, var(--phase) 15%, transparent); padding: 4px 11px; border-radius: 999px; }
.cs-conf { color: var(--muted); font-weight: 600; font-size: 12px; }
.cs-windows { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.cs-win { font-size: 12.5px; }
.cw-ico { margin-right: 3px; }
.cs-hint { margin-top: 10px; font-size: 11.5px; color: var(--muted); font-style: italic; }
.cycle-status.is-late { --phase: #ffb066; border-color: color-mix(in srgb, #ffb066 45%, var(--line)); }
.cycle-status.is-late .cs-title { color: var(--phase); }

.cycle-section-head { font-size: 15px; font-weight: 700; margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }

/* --- Our Fantasies 🔥 --- */
#view-fantasy .section-title { color: #ff7a6b; }
#view-fantasy .bucket-item { border-color: color-mix(in srgb, #ff7a6b 25%, var(--line)); }
#view-fantasy .primary-btn { background: linear-gradient(90deg, #ff5a7a, #ff8a5a); }
/* discreet media: blurred until deliberately tapped */
.bucket-media.discreet { position: relative; }
.bucket-media.discreet .media-thumb { overflow: hidden; }
.bucket-media.discreet .media-thumb img, .bucket-media.discreet .media-thumb .video-ph, .bucket-media.discreet .media-thumb .play-badge {
  filter: blur(16px) saturate(.8); transform: scale(1.08); }
.bucket-media.discreet::after { content: '🔒 tap to reveal'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8); pointer-events: none; }

/* Cycle quick actions + daily check-in */
.cycle-quick { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cq-btn { border: 1px solid color-mix(in srgb, #ff8ec8 45%, var(--line)); background: color-mix(in srgb, #ff8ec8 12%, var(--glass));
  color: var(--text); border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.cq-btn:hover { background: color-mix(in srgb, #ff8ec8 22%, var(--glass)); }
.cq-btn.suggest { border-color: color-mix(in srgb, #8ad6a8 55%, var(--line)); background: color-mix(in srgb, #8ad6a8 12%, var(--glass)); font-weight: 500; }

/* patterns mined from check-ins */
.cycle-patterns { border: 1px solid color-mix(in srgb, #b79cff 35%, var(--line)); border-radius: 16px; padding: 14px;
  margin-bottom: 14px; background: color-mix(in srgb, #b79cff 6%, var(--glass)); }
.cycle-patterns.hidden { display: none; }
.cp-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.cp-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; border-bottom: 1px dashed color-mix(in srgb, var(--line) 60%, transparent); }
.cp-row:last-of-type { border-bottom: none; }
.cp-tag { flex: 0 0 auto; font-weight: 600; background: color-mix(in srgb, #b79cff 18%, transparent); border-radius: 999px; padding: 2px 10px; }
.cp-when { flex: 1; color: var(--muted); }
.cp-when b { color: var(--text); }
.cp-n { font-size: 11px; color: var(--muted); font-weight: 700; }
.cp-note { margin-top: 8px; font-size: 11.5px; color: #b79cff; font-weight: 600; }
.cycle-checkin { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; background: var(--glass); }
.cc-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.cc-sub { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.cc-saved { float: right; font-size: 11.5px; font-weight: 700; color: #8ad6a8; opacity: 0; transition: opacity .25s; }
.cc-saved.show { opacity: 1; }
.cc-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.cc-label { flex: 0 0 44px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 6px; }
.cc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-chip { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px;
  padding: 5px 11px; font-size: 12.5px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cc-chip.on { border-color: #ff8ec8; background: color-mix(in srgb, #ff8ec8 22%, transparent); font-weight: 600; }
.cc-note { width: 100%; margin-top: 4px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--field); color: var(--text); font-family: inherit; font-size: 13px; }

/* Cycle calendar */
.cycle-cal { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; background: var(--glass); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-weight: 700; font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--muted); padding: 2px 0; }
.cal-day { position: relative; aspect-ratio: 1; display: grid; place-items: center; font-size: 12.5px; border-radius: 10px; border: 1px solid transparent; }
.cal-day.p-period { background: color-mix(in srgb, #ff6b8a 30%, transparent); font-weight: 700; }
.cal-day.p-fertile { background: color-mix(in srgb, #8ad6a8 22%, transparent); }
.cal-day.p-pms { background: color-mix(in srgb, #c9a0ff 20%, transparent); }
.cal-day.p-predicted { border-color: #ff6b8a; border-style: dashed; }
.cal-day.p-today { box-shadow: 0 0 0 2px var(--accent); font-weight: 700; }
.cal-dot { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.cal-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 3px; vertical-align: -1px; }
.lg.p { background: color-mix(in srgb, #ff6b8a 40%, transparent); }
.lg.pr { border: 1px dashed #ff6b8a; }
.lg.f { background: color-mix(in srgb, #8ad6a8 35%, transparent); }
.lg.pm { background: color-mix(in srgb, #c9a0ff 32%, transparent); }
.lg.s { background: var(--accent); border-radius: 50%; width: 6px; height: 6px; }

/* Cycle length trend chart */
.cycle-chart { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; background: var(--glass); }
.cch-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.cycle-chart svg { width: 100%; height: auto; color: var(--muted); }
.cch-bar { fill: color-mix(in srgb, #ff8ec8 55%, transparent); }
.cch-val { font-size: 9px; fill: var(--text); font-weight: 700; }
.cch-lab { font-size: 8px; fill: var(--muted); }

.cf-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cy-remind-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.cy-remind-label input { accent-color: #ff8ec8; }

/* Cycle insights (local AI) */
.cycle-ai { border: 1px solid color-mix(in srgb, #c9a0ff 40%, var(--line)); border-radius: 16px; padding: 14px;
  margin-bottom: 16px; background: color-mix(in srgb, #c9a0ff 7%, var(--glass)); }
.cai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cai-title { font-weight: 700; font-size: 14px; }
.cai-badge { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.cai-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cai-chip { border: 1px solid var(--line); background: var(--glass); color: var(--text); border-radius: 999px;
  padding: 6px 12px; font-size: 12.5px; cursor: pointer; }
.cai-chip:hover { border-color: #c9a0ff; }
.cai-ask { display: flex; gap: 8px; }
#cai-input { flex: 1; padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--field);
  color: var(--text); font-family: inherit; font-size: 14px; }
#cai-input:focus { outline: none; border-color: #c9a0ff; }
.cai-answer { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--glass);
  border: 1px solid var(--line); font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.cai-thinking { color: var(--muted); font-style: italic; }

.cycle-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.cf-dates { display: flex; gap: 10px; flex-wrap: wrap; }
.cf-dates label { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cf-dates input, #cy-note { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--field);
  color: var(--text); font-family: inherit; font-size: 14px; }
.cf-opt { opacity: .6; }
.cycle-form .primary-btn { align-self: flex-start; }

.cycle-list { display: flex; flex-direction: column; gap: 10px; }
.cycle-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-left: 4px solid var(--by, #ff8ec8); border-radius: 12px; background: var(--glass); }
.ci-main { flex: 1; min-width: 0; }
.ci-range { font-weight: 600; font-size: 14px; }
.ci-open { color: var(--muted); font-weight: 400; font-style: italic; }
.ci-gap { font-size: 12px; color: var(--accent); margin-top: 2px; }
.ci-note { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.ci-del { opacity: .55; }
.cycle-item:hover .ci-del { opacity: 1; }

.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; }
/* ===== Fireplace Mode — cozy cabin scene ===== */
.fire-scene { position: fixed; inset: 0; z-index: 165; display: grid; place-items: center; padding: 14px;
  background: radial-gradient(70% 50% at 50% 100%, rgba(120,55,15,.45), transparent 70%), linear-gradient(180deg, #120d1a, #0a0710 60%, #160d08);
  animation: fadein .6s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.fire-room { position: relative; width: 100%; max-width: 580px; height: min(90vh, 820px); border-radius: 22px; overflow: hidden;
  border: 1px solid rgba(120,80,50,.3); background: linear-gradient(180deg, #1c1410, #140d0a); box-shadow: inset 0 0 120px rgba(0,0,0,.6);
  display: flex; flex-direction: column; }
.fire-top { padding: 18px 16px 6px; padding-top: calc(18px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fire-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 14px 12px; }
.fire-room::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(62% 46% at 50% 100%, rgba(255,150,60,.22), transparent 70%); animation: roomflicker 3s ease-in-out infinite; }
@keyframes roomflicker { 0%,100% { opacity: .78; } 50% { opacity: 1; } }
.fire-window { position: absolute; top: 18px; left: 18px; width: 116px; height: 88px; border-radius: 8px; overflow: hidden;
  border: 4px solid #2a1d14; background: linear-gradient(180deg, #0b1430, #1a2550); box-shadow: inset 0 0 20px rgba(0,0,0,.5); }
.fire-stars { position: absolute; inset: 0; opacity: .85;
  background-image: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 60% 50%, #fff, transparent), radial-gradient(1px 1px at 82% 22%, #cdf, transparent), radial-gradient(1px 1px at 40% 72%, #fff, transparent); }
.fire-weather { position: absolute; inset: 0; opacity: .4; background-image: repeating-linear-gradient(100deg, transparent 0 8px, rgba(180,200,255,.15) 8px 9px); background-size: 100% 120px; animation: rainfall .6s linear infinite; }
.fire-clock { text-align: center; color: #ffd9a8; }
#fire-clock-time { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; display: block; text-shadow: 0 0 16px rgba(255,150,60,.5); }
.fire-clock-label { font-size: 11px; color: #b89a82; }
.fire-presence { padding: 7px 14px; border-radius: 999px;
  background: rgba(40,28,20,.7); border: 1px solid rgba(255,170,90,.25); color: #ffd9a8; font-size: 13px; max-width: 90%; text-align: center; }
.fire-presence.together { box-shadow: 0 0 22px rgba(255,130,60,.35); }
.hearth { position: relative; width: min(230px, 70vw); aspect-ratio: 230 / 150; max-height: 150px; flex-shrink: 0;
  border-radius: 120px 120px 14px 14px / 92px 92px 14px 14px; background: radial-gradient(circle at 50% 92%, #2a1a10, #0c0805);
  border: 6px solid #3a2415; box-shadow: 0 0 50px rgba(255,120,40,.4), inset 0 -10px 30px rgba(255,120,40,.3); overflow: hidden; transition: box-shadow .3s; }
.hearth.flare { box-shadow: 0 0 90px rgba(255,150,50,.85), inset 0 -10px 50px rgba(255,160,60,.6); }
.fire-flames { position: absolute; inset: 0; width: 100%; height: 100%; }
.hearth .logs { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 26px; filter: brightness(.7) sepia(.5); }
.fire-fuel { font-size: 12px; color: #e0b487; text-align: center; }
.fire-fuel.low { color: #ffb14d; }
.fire-fuel.out { color: #9aa6c4; }
#m-log.pulse { animation: logpulse 1.1s ease-in-out infinite; opacity: 1; }
@keyframes logpulse { 0%,100% { transform: scale(1); filter: none; } 50% { transform: scale(1.25); filter: drop-shadow(0 0 10px rgba(255,170,80,.9)); } }
/* marshmallow on a stick over the fire */
.marshmallow { position: absolute; bottom: 70px; left: 50%; width: 22px; height: 26px; border-radius: 50%;
  background: #f7ecd2; transform: translateX(-50%); transition: background .4s; box-shadow: 0 0 14px rgba(255,160,60,.5); }
.marshmallow::after { content: ''; position: absolute; top: 50%; left: 100%; width: 90px; height: 2px; background: linear-gradient(90deg, #6b4a2a, #3a2415); transform: rotate(18deg); transform-origin: left center; }
.mantel { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.m-item { font-size: 24px; cursor: pointer; opacity: .55; transition: .2s; }
.m-item:hover { opacity: 1; transform: translateY(-3px) scale(1.1); }
#m-candle.lit { opacity: 1; filter: drop-shadow(0 0 10px rgba(255,200,80,.9)); }
#m-mug.placed { opacity: 1; }
.fire-notes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fire-note { position: absolute; max-width: 200px; background: #fdf6e3; color: #3a2a18; padding: 8px 12px; border-radius: 4px;
  font-family: 'Caveat', cursive; font-size: 18px; line-height: 1.2; box-shadow: 0 6px 18px rgba(0,0,0,.4); transition: opacity 1.5s; }
.fire-note .fn-who { display: block; font-size: 11px; color: #9a7c50; }
.fire-note.fade { opacity: 0; }
.fire-note.fade-heart { background: transparent; box-shadow: none; font-size: 40px; animation: float-up 1.5s ease-out forwards; }
.fire-bar { flex-shrink: 0; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(10,7,5,.92)); display: flex; flex-direction: column; gap: 10px; }
.fire-sounds { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.fire-sounds::-webkit-scrollbar { display: none; }
.fire-snd { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; border: 1px solid rgba(255,170,90,.2);
  background: rgba(40,28,20,.6); color: #e8d2b8; border-radius: 12px; padding: 6px 10px; cursor: pointer; font-size: 10px; }
.fire-snd .fs-e { font-size: 18px; }
.fire-snd.active { border-color: #ff9e4d; background: rgba(255,140,60,.22); color: #fff; }
.fire-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fire-note-input { flex: 1 1 100%; }
.fire-note-input { flex: 1; background: rgba(255,255,255,.06); border: 1px solid rgba(255,170,90,.2); color: #fff; border-radius: 999px; padding: 9px 14px; outline: none; font-size: 14px; }
.fire-note-input::placeholder { color: #b89a82; }
.fire-ctl { border: 1px solid rgba(255,170,90,.25); background: rgba(40,28,20,.6); color: #ffd9a8; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 15px; }
.fire-ctl.active { background: rgba(120,120,255,.28); }
.fire-ctl.leave { background: linear-gradient(90deg, #a05a2a, #c23b86); color: #fff; border: none; font-weight: 600; }
.fire-ctl.off { background: rgba(255,90,110,.3); }
/* in-call video panel */
.fire-call { position: absolute; top: 14px; right: 14px; width: 150px; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(10,7,5,.7); border: 1px solid rgba(255,170,90,.3); border-radius: 14px; padding: 8px; backdrop-filter: blur(6px); }
.fire-call.video { width: min(260px, 60vw); }
.fire-remote { width: 100%; border-radius: 10px; background: #000; display: none; aspect-ratio: 3/4; object-fit: cover; }
.fire-call.video .fire-remote { display: block; }
.local-wrap { position: absolute; bottom: 50px; right: 10px; width: 64px; aspect-ratio: 3/4; display: none; z-index: 3; touch-action: none; }
.fire-call.video .local-wrap { display: block; }
.fire-local { width: 100%; height: 100%; border-radius: 8px; background: #000; object-fit: cover; border: 1px solid rgba(255,255,255,.35); display: block; cursor: move; }
.local-resize { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; cursor: nwse-resize;
  background: rgba(255,255,255,.85); border: 2px solid rgba(0,0,0,.4); touch-action: none; }
.local-resize::after { content: '⤡'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #222; }
.call-grip { cursor: move; color: #ffd9a8; opacity: .7; font-size: 16px; padding: 0 4px; align-self: center; touch-action: none; user-select: none; }
/* beauty & light filter panel */
.fx-panel { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); z-index: 5; width: min(280px, 86vw);
  background: rgba(12,9,18,.92); border: 1px solid rgba(255,170,90,.3); border-radius: 14px; padding: 12px; backdrop-filter: blur(10px); box-shadow: 0 12px 36px rgba(0,0,0,.5); }
.fx-panel.hidden { display: none; }
.fx-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fx-preset { flex: 1 1 auto; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: #fff; font-size: 12px; cursor: pointer; }
.fx-preset.active { border-color: var(--accent); background: rgba(122,162,255,.25); }
.fx-row { display: flex; align-items: center; gap: 10px; color: #ffe9cf; font-size: 12.5px; margin: 8px 0; }
.fx-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.fire-call.maximized .fx-panel { bottom: calc(80px + env(safe-area-inset-bottom)); }
.fire-call-status { color: #ffd9a8; font-size: 13px; font-weight: 600; min-height: 16px; }
.fire-call-ctl { display: flex; gap: 8px; }
.call-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,170,90,.3); background: rgba(40,28,20,.8); color: #ffd9a8; cursor: pointer; font-size: 16px; }
.call-btn.off { background: rgba(255,90,110,.3); }
.call-btn.end { background: #d23b4e; border-color: transparent; color: #fff; }
.fire-call-ctl { flex-wrap: wrap; justify-content: center; }
.call-btn { width: 36px; height: 36px; font-size: 15px; }
.call-quality { font-size: 11px; color: #ffd9a8; opacity: .85; min-height: 14px; }
.fire-remote { cursor: zoom-in; }
/* maximized call — fill the screen, see each other fully (works on PC + phone) */
.fire-call.maximized { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; z-index: 80;
  background: #000; border: none; border-radius: 0; padding: 0; gap: 0; align-items: stretch; backdrop-filter: none; }
.fire-call.maximized .fire-remote { display: block; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; object-fit: contain; background: #000; cursor: zoom-out; }
.fire-call.maximized .local-wrap { display: block; width: min(140px, 28vw); aspect-ratio: 3/4;
  bottom: calc(96px + env(safe-area-inset-bottom)); right: 16px; }
.fire-call.maximized .fire-local { border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.fire-call.maximized .call-quality { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 16px; z-index: 2;
  background: rgba(0,0,0,.4); padding: 3px 9px; border-radius: 999px; }
.fire-call.maximized .fire-call-status { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 2; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.fire-call.maximized .fire-call-ctl { position: absolute; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 2;
  background: rgba(0,0,0,.45); padding: 8px 12px; border-radius: 999px; backdrop-filter: blur(10px); }
.fire-call.maximized .call-btn { width: 46px; height: 46px; font-size: 18px; }
/* incoming call prompt (body-level overlay) */
/* floating mini-call (stays running after you leave the fireplace) */
.fire-call.floating { position: fixed; top: auto; left: auto; bottom: calc(20px + env(safe-area-inset-bottom)); right: 16px; width: 132px; z-index: 190;
  cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.fire-call.floating.video .fire-remote { aspect-ratio: 3/4; }
.fire-call.floating .fire-call-status, .fire-call.floating .call-quality, .fire-call.floating #call-switch,
.fire-call.floating #call-screen, .fire-call.floating #call-pip, .fire-call.floating #call-full { display: none; }
.fire-call.floating .fire-call-ctl { gap: 5px; }
.fire-call.floating .call-btn { width: 30px; height: 30px; font-size: 13px; }
.fire-call.floating .local-wrap { width: 40px; bottom: 44px; }
.fire-call.floating .local-resize { display: none; }

.fire-incoming { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.fire-incoming.hidden { display: none; }
.fi-card { background: linear-gradient(160deg,#2a1c14,#140d08); border: 1px solid rgba(255,170,90,.35); border-radius: 20px; padding: 26px 28px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); max-width: 320px; }
.fi-emoji { font-size: 42px; animation: fi-ring 1s ease-in-out infinite; }
@keyframes fi-ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-18deg); } 40% { transform: rotate(14deg); } 60% { transform: rotate(-10deg); } 80% { transform: rotate(6deg); } }
.fi-text { color: #ffe9cf; font-size: 16px; font-weight: 600; margin: 12px 0 18px; }
.fi-actions { display: flex; gap: 14px; justify-content: center; }
.fi-btn { border: none; border-radius: 999px; padding: 11px 22px; font-size: 15px; font-weight: 700; cursor: pointer; }
.fi-btn.accept { background: #2ecc71; color: #06210f; }
.fi-btn.decline { background: #d23b4e; color: #fff; }
@media (max-width: 760px) {
  .fire-scene { padding: 0; }
  .fire-room { height: 100dvh; max-width: none; border-radius: 0; border: none; }
  .fire-window { width: 88px; height: 64px; top: 12px; left: 12px; }
  #fire-clock-time { font-size: 26px; }
  .mantel { gap: 14px; }
  .m-item { font-size: 26px; }
  .fire-note-input { font-size: 16px; }
}

/* ============================================================
   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; }
.account-danger { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.account-danger-note { font-size: 12px; color: var(--muted); margin: 0 0 8px; line-height: 1.4; }
.ghost-btn.danger { color: #ff7676; border-color: rgba(255,118,118,.4); width: 100%; }
.ghost-btn.danger:hover { background: rgba(255,118,118,.12); }

/* 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: 150;
  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: 140; 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 wrap to multiple rows so every tab is reachable without sideways scrolling */
  .tabs { order: 3; flex-basis: 100%; width: 100%; flex-wrap: wrap; overflow-x: visible; justify-content: center; gap: 5px; border-radius: 16px; }
  .tab { padding: 7px 11px; font-size: 13px; }
  .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)); } }

/* 📖 Stories (private roleplay / novels) */
#view-stories #story-new { display: block; margin: 0 auto 18px; }
.stories-list { max-width: 880px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
/* a story card looks like a little book */
.story-card { display: flex; flex-direction: column; text-align: left; cursor: pointer; overflow: hidden; padding: 0;
  background: var(--glass); border: 1px solid var(--line); border-radius: 14px; color: var(--text); box-shadow: var(--shadow);
  transition: transform .14s, border-color .15s, box-shadow .15s; position: relative; }
.story-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.story-cover { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #0a0712; display: block; }
.story-cover-ph { display: grid; place-items: center; font-size: 46px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(122,162,255,.18), transparent 70%), #0c0a18; }
.story-card-body { padding: 11px 13px 14px; display: flex; flex-direction: column; gap: 4px; }
.story-card-title { font-size: 16px; font-weight: 600; line-height: 1.3; font-family: 'Lora', Georgia, serif; }
.story-card-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; max-height: 2.8em; overflow: hidden; }
.story-card-badge { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 600; color: #fff;
  background: rgba(8,6,18,.66); border: 1px solid rgba(255,255,255,.18); padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(4px); }

.story-overlay { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(6,5,12,.7); backdrop-filter: blur(6px); overflow-y: auto; }
.story-overlay.hidden { display: none; }
.story-edit-card, .story-read-card { width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, var(--glass-solid, #161a34), var(--bg-base)); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow-lg); }

/* ---- editors ---- */
.se-head { display: flex; gap: 10px; align-items: center; }
.se-title { flex: 1; background: var(--field); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 18px; font-weight: 700; outline: none; }
.se-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.se-hint { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.se-body { min-height: 40vh; resize: vertical; background: var(--field); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 16px 18px;
  font-size: 17px; line-height: 1.7; outline: none; font-family: 'Lora', Georgia, serif; }
.se-synopsis { min-height: 90px; }
.se-body:focus, .se-title:focus { border-color: var(--accent); }
.se-media { display: flex; gap: 8px; flex-wrap: wrap; }
.se-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.se-cover-row { display: flex; align-items: center; gap: 12px; }
.se-cover { width: 78px; height: 104px; border-radius: 10px; border: 1px solid var(--line); background: #0c0a18; display: grid; place-items: center; font-size: 28px; overflow: hidden; flex: none; }
.se-cover img { width: 100%; height: 100%; object-fit: cover; }
.se-bar { display: flex; align-items: center; gap: 8px; }
.se-spacer { flex: 1; }
.se-divider { height: 1px; background: var(--line); margin: 4px 0; }
.se-chapters-head { display: flex; align-items: center; justify-content: space-between; }
.se-chapters { display: flex; flex-direction: column; gap: 8px; }
.se-chapter-row { display: flex; align-items: center; gap: 8px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.se-ch-num { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 6px; background: rgba(122,162,255,.16); color: var(--accent); font-size: 12px; font-weight: 700; }
.se-ch-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.se-ch-btns { display: flex; gap: 2px; }
.se-ch-btns .icon-btn { padding: 4px 7px; font-size: 14px; }

/* ---- reader (book view) ---- */
.reader-overlay { padding: 0; }
.reader-overlay .story-read-card { max-width: 1000px; max-height: 100vh; height: 100vh; border-radius: 0; padding: 0; gap: 0; }
@media (min-width: 880px) { .reader-overlay { padding: 22px; } .reader-overlay .story-read-card { height: auto; max-height: 92vh; border-radius: 18px; } }
.sr-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2; background: var(--glass-solid, #161a34); }
.sr-bar h2 { flex: 1; margin: 0; font-size: 19px; font-weight: 600; font-family: 'Lora', Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-layout { display: flex; min-height: 0; flex: 1; overflow: hidden; }
.sr-toc { width: 220px; flex: none; border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 8px; display: flex; flex-direction: column; gap: 4px;
  background: rgba(0,0,0,.12); }
.sr-toc-item { text-align: left; background: transparent; border: 0; color: var(--text); border-radius: 10px; padding: 9px 11px; cursor: pointer;
  font-size: 14px; line-height: 1.3; display: flex; gap: 8px; align-items: baseline; transition: background .12s; }
.sr-toc-item:hover { background: rgba(255,255,255,.06); }
.sr-toc-item.active { background: rgba(122,162,255,.18); color: var(--accent); font-weight: 600; }
.sr-toc-item .n { color: var(--muted); font-size: 12px; flex: none; }
.sr-toc-item.active .n { color: var(--accent); }
.sr-toc-empty { color: var(--muted); font-size: 13px; padding: 10px; }
.sr-scroll { flex: 1; overflow-y: auto; min-width: 0; }
.sr-page { max-width: 640px; margin: 0 auto; padding: 26px 26px 60px; }
.sr-cover { margin-bottom: 16px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.sr-cover.hidden { display: none; }
.sr-cover img { width: 100%; max-height: 320px; object-fit: cover; display: block; }
.sr-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.sr-chapter-title { margin: 6px 0 20px; font-size: 25px; font-weight: 600; font-family: 'Lora', Georgia, serif; line-height: 1.25; }
.sr-chapter-title:empty { display: none; }
.sr-body { white-space: pre-wrap; font-size: 18px; line-height: 1.85; font-family: 'Lora', Georgia, serif; color: var(--text); letter-spacing: .15px; }
.sr-body.is-synopsis { font-style: italic; color: var(--muted); font-size: 19px; }
.sr-body .anim-emoji { width: 1.25em; height: 1.25em; vertical-align: -0.22em; }
.sr-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 22px; }
.sr-media img { width: 100%; border-radius: 12px; cursor: pointer; border: 1px solid var(--line); }
.sr-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line); }
.sr-nav button[disabled] { opacity: .35; pointer-events: none; }
.sr-progress { font-size: 12px; color: var(--muted); }
.sr-only-mobile { display: none; }
@media (max-width: 879px) {
  .sr-only-mobile { display: inline-flex; }
  .sr-toc { position: absolute; inset: 0 auto 0 0; z-index: 3; width: 78%; max-width: 300px; box-shadow: var(--shadow-lg);
    background: var(--glass-solid, #161a34); transform: translateX(-100%); transition: transform .22s; }
  .sr-toc.open { transform: translateX(0); }
  .sr-page { padding: 20px 18px 60px; }
  .sr-chapter-title { font-size: 23px; }
  .sr-body { font-size: 18px; }
}

/* 🧪 test account — only the fireplace (call receiver) is shown */
body.test-mode .topbar, body.test-mode .container, body.test-mode #daily-reminder, body.test-mode .day-nav { display: none !important; }

/* 🎬 Our Movies — watch together */
.movie-stage { position: relative; max-width: 900px; margin: 0 auto; background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.movie-video { display: block; width: 100%; max-height: 70vh; background: #000; object-fit: contain; }
.movie-react-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.movie-stage:fullscreen { width: 100vw; height: 100vh; background: #000; display: flex; align-items: center; }
.movie-stage:fullscreen .movie-video { max-height: 100vh; height: 100%; }
/* manual tilt to landscape (CSS fallback when the device won't auto-rotate) */
.movie-stage.rotated .movie-video { position: absolute; top: 50%; left: 50%; width: 100vh; height: 100vw; max-height: none;
  transform: translate(-50%, -50%) rotate(90deg); object-fit: contain; }
/* in-video overlay: chat + reactions + mic + fullscreen, auto-hides on inactivity in fullscreen */
/* compact card in the top-right — only as tall as its content, never covers the play bar */
.movie-overlay { position: absolute; top: 12px; right: 12px; bottom: auto; left: auto; width: min(300px, 46%); z-index: 5;
  display: flex; flex-direction: column; gap: 8px; padding: 10px; max-height: calc(100% - 90px);
  background: rgba(8,6,14,.55); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; backdrop-filter: blur(6px); transition: opacity .3s; }
.movie-stage:fullscreen .movie-overlay { max-height: calc(100% - 120px); }
.movie-overlay.ui-hidden { opacity: 0; pointer-events: none; }
.movie-chat-msgs { max-height: 170px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; scrollbar-width: thin; }
.voice-dbg { max-width: 900px; margin: 8px auto 0; text-align: center; font-size: 12.5px; color: #5fd6a0;
  font-family: ui-monospace, monospace; background: rgba(46,204,113,.1); border: 1px solid rgba(46,204,113,.3); border-radius: 10px; padding: 6px 10px; }
.voice-dbg:empty { display: none; }
.movie-chat-msgs:empty { display: none; }
.mc-line { font-size: 13px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.95); line-height: 1.3; }
.mc-line b { color: #ffd36e; } .mc-line.mine b { color: #8fe; }
.movie-overlay-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.movie-overlay-bar .movie-reacts { flex: 1 1 100%; margin: 0; justify-content: flex-start; flex-wrap: wrap; gap: 4px; overflow: visible; }
.movie-overlay-bar .movie-react-btn { font-size: 20px; padding: 3px 7px; background: rgba(255,255,255,.12); }
.movie-overlay .movie-btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }
@media (max-width: 760px) { .movie-overlay { width: min(300px, 64%); } .movie-chat-msgs { max-height: 120px; } }
.movie-chat-form { display: flex; gap: 8px; }
.movie-chat-input { flex: 1; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 999px; padding: 9px 14px; outline: none; font-size: 14px; }
.movie-chat-input::placeholder { color: rgba(255,255,255,.6); }
.float-react { position: absolute; bottom: 8%; font-size: 38px; animation: floatUp 3.4s ease-out forwards; will-change: transform, opacity; }
@keyframes floatUp { 0% { transform: translateY(0) scale(.6); opacity: 0; } 12% { opacity: 1; transform: translateY(-10px) scale(1.1); } 100% { transform: translateY(-72vh) scale(1) rotate(8deg); opacity: 0; } }
.movie-bar { max-width: 900px; margin: 10px auto 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.movie-status { color: var(--muted); font-size: 13px; }
.movie-status b { color: var(--text); }
.movie-actions { display: flex; gap: 8px; }
.movie-btn { border: 1px solid var(--line); background: var(--glass); color: var(--text); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.movie-btn.off { background: rgba(255,90,110,.3); }
.movie-btn.live { border-color: #2ecc71; box-shadow: 0 0 0 1px #2ecc71 inset; }
.movie-btn.talking { border-color: #2ecc71; box-shadow: 0 0 0 2px #2ecc71, 0 0 14px 3px rgba(46,204,113,.7); } /* glows when partner speaks */
.movie-btn.waiting { border-color: #ffb14d; box-shadow: 0 0 0 1px #ffb14d inset; } /* mic on, not yet connected */
.movie-reacts { max-width: 900px; margin: 12px auto 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.movie-react-btn { font-size: 24px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; cursor: pointer; transition: transform .1s; }
.movie-react-btn:hover { transform: translateY(-2px) scale(1.08); }
.movie-picker { max-width: 900px; margin: 18px auto 0; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; padding: 14px; backdrop-filter: blur(10px); }
.mp-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.mp-input { flex: 1 1 160px; min-width: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); font-size: 14px; outline: none; }
.mp-note { font-size: 12.5px; color: #ffb86e; min-height: 16px; margin: 4px 0 0; }
.mp-readonly { text-align: center; color: var(--muted); }
.movie-catalogue { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; max-height: 360px; overflow-y: auto; }
/* 🌹 the private shelf — a quiet little rose; opens a second catalogue with its own folder */
.movie-priv-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.movie-priv-btn { border: none; background: transparent; font-size: 26px; opacity: .55; cursor: pointer; padding: 6px 10px; border-radius: 10px; color: var(--muted); transition: opacity .2s; }
.movie-priv-btn:hover { opacity: 1; }
.movie-priv-btn.open { opacity: 1; background: rgba(255, 110, 150, .12); border: 1px solid rgba(255, 110, 150, .35); color: #ff9ec0; font-size: 13px; font-weight: 700; }
.cat-item { display: flex; flex-direction: column; gap: 0; text-align: left; cursor: pointer; padding: 0; overflow: hidden;
  background: var(--field); border: 1px solid var(--line); border-radius: 12px; color: var(--text); transition: transform .1s, border-color .15s; }
.cat-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.cat-item.playing { border-color: #2ecc71; box-shadow: 0 0 0 1px #2ecc71 inset; }
.cat-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #0a0712; display: block; }
.cat-img-ph { display: grid; place-items: center; font-size: 30px; }
.cat-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; }
.cat-title { font-size: 13px; font-weight: 600; line-height: 1.25; }
.cat-meta { font-size: 11px; color: var(--muted); }
.cat-meta .cat-sub { color: #5fd6a0; }
/* 📁 series subfolder cards + breadcrumb */
.cat-folder { position: relative; }
.cat-folder .cat-img, .cat-folder .cat-img-ph { filter: brightness(.82); }
.cat-folder:hover { border-color: #ffd27a; }
.cat-folder-badge { position: absolute; top: 6px; left: 6px; font-size: 15px; line-height: 1; padding: 3px 6px;
  background: rgba(0, 0, 0, .6); border-radius: 8px; backdrop-filter: blur(2px); }
.cat-crumb { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); margin: 2px 2px 4px; }
.cat-crumb .crumb-link { border: none; background: transparent; color: var(--accent); cursor: pointer; padding: 2px 4px; border-radius: 6px; font-size: 12px; }
.cat-crumb .crumb-link:hover { background: rgba(255, 255, 255, .08); }
.cat-crumb .crumb-cur { color: var(--text); font-weight: 600; padding: 2px 4px; }

/* ============================================================
   PLAY HUB + DOODLE & GUESS GAME
   ============================================================ */
.game-grid { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.game-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; cursor: pointer;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px); transition: transform .12s, border-color .2s; }
.game-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.game-card.soon { opacity: .55; cursor: default; }
.game-card.soon:hover { transform: none; border-color: var(--line); }
.gc-emoji { font-size: 30px; }
.gc-name { font-size: 17px; font-weight: 700; color: var(--text); }
.gc-desc { font-size: 12.5px; color: var(--muted); line-height: 1.35; }

.dg-overlay { position: fixed; inset: 0; z-index: 75; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(80% 60% at 50% 0%, rgba(60,40,90,.5), transparent 70%), #0a0712; animation: fadein .5s ease; }
.dg-overlay.hidden { display: none; }
.dg-room { position: relative; width: 100%; max-width: 640px; height: min(94vh, 900px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, #15131f, #0e0b16); border: 1px solid rgba(150,120,200,.25); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg); }
.dg-top { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(255,255,255,.04); border-bottom: 1px solid var(--line); }
.dg-close { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); cursor: pointer; font-size: 15px; }
.dg-hint { flex: 1; text-align: center; font-size: 20px; font-weight: 700; letter-spacing: 3px; color: var(--text); font-variant-numeric: tabular-nums; }
.dg-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 64px; }
.dg-timer { font-size: 18px; font-weight: 700; color: #ffd36e; font-variant-numeric: tabular-nums; }
.dg-timer.urgent { color: #ff6b6b; animation: pulse-t .5s ease-in-out infinite; }
@keyframes pulse-t { 50% { opacity: .4; } }
.dg-score { font-size: 12px; color: var(--muted); }

.dg-stage { position: relative; flex: 1; min-height: 0; background:
  repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 23px, rgba(255,255,255,.04) 23px 24px), #f7f3ea; }
.dg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.dg-banner { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 6; text-align: center;
  background: rgba(10,8,16,.86); color: #fff; padding: 20px 26px; border-radius: 18px; font-size: 18px; font-weight: 700; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.dg-banner.hidden { display: none; }
.dg-banner small { display: block; font-weight: 500; font-size: 14px; color: #ffd36e; margin-top: 6px; }

.dg-lobby, .dg-pick { position: absolute; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(12,9,20,.72); backdrop-filter: blur(6px); }
.dg-lobby.hidden, .dg-pick.hidden { display: none; }
.dg-lobby-card { background: linear-gradient(160deg,#211a30,#15101f); border: 1px solid rgba(150,120,200,.3); border-radius: 20px;
  padding: 26px; text-align: center; max-width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.dg-lobby-emoji { font-size: 44px; }
.dg-lobby-card h3 { margin: 8px 0; font-size: 22px; color: var(--text); }
.dg-lobby-card p { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0 0 16px; }
.dg-lobby-actions { display: flex; flex-direction: column; gap: 10px; }
.dg-lobby-note { font-size: 12.5px; color: #ffb86e; min-height: 16px; margin: 12px 0 0; }
.dg-pick h3 { color: #fff; margin: 0 0 16px; }
.dg-pick-words { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 420px; }
.dg-pick-word { background: rgba(255,255,255,.08); border: 1px solid rgba(150,120,200,.4); color: #fff; border-radius: 14px;
  padding: 14px 20px; font-size: 17px; font-weight: 600; cursor: pointer; transition: .15s; }
.dg-pick-word:hover { background: var(--accent); color: #0a0712; transform: translateY(-2px); }

.dg-tools { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: rgba(255,255,255,.03); border-top: 1px solid var(--line); }
.dg-tools.locked { opacity: .4; pointer-events: none; }
.dg-brushes, .dg-colors { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.dg-brushes::-webkit-scrollbar, .dg-colors::-webkit-scrollbar { display: none; }
.dg-brush { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 46px; padding: 6px 8px;
  border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text); border-radius: 12px; cursor: pointer; font-size: 10px; }
.dg-brush .b-e { font-size: 18px; }
.dg-brush.active { border-color: var(--accent); background: rgba(122,162,255,.22); }
.dg-swatch { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer; }
.dg-swatch.active { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 0 2px var(--accent); }
.dg-tool-row { display: flex; align-items: center; gap: 10px; }
.dg-size { flex: 1; accent-color: var(--accent); }
.dg-color-custom { width: 34px; height: 34px; padding: 0; border: none; background: none; border-radius: 8px; cursor: pointer; }
.dg-tbtn { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); cursor: pointer; font-size: 16px; }
.dg-tbtn.off { opacity: .45; }

.dg-guessbar { flex-shrink: 0; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.04); border-top: 1px solid var(--line); }
.dg-guessbar.hidden { display: none; }
.dg-guess { flex: 1; background: rgba(255,255,255,.08); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 11px 16px; outline: none; font-size: 15px; }
.dg-feed { flex-shrink: 0; max-height: 84px; overflow-y: auto; padding: 0 14px; display: flex; flex-direction: column; gap: 3px; }
.dg-feed:empty { display: none; }
.dg-feed .gf { font-size: 13px; color: var(--muted); }
.dg-feed .gf b { color: var(--text); }
.dg-feed .gf.correct { color: #5fd6a0; font-weight: 600; }
.dg-feed .gf.close { color: #ffd36e; }

.dg-rounds { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 14px; flex-wrap: wrap; }
.dg-rounds-lbl { font-size: 12px; color: var(--muted); margin-right: 4px; }
.dg-round-opt { min-width: 38px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); cursor: pointer; font-size: 14px; font-weight: 600; }
.dg-round-opt.active { border-color: var(--accent); background: rgba(122,162,255,.22); }
.dg-highscores { margin-top: 16px; }
.hs-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 6px; font-size: 12.5px; color: var(--text); padding: 4px 0; align-items: center; }
.hs-row.hs-head { color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hs-name { font-weight: 700; }
.hs-stat { color: var(--muted); text-align: center; }
.hs-stat b { color: var(--text); }

/* Play tab voting + scoreboard */
.play-vote { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vote-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; cursor: pointer;
  background: var(--field); border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: var(--text); transition: .15s; }
.vote-btn .v-e { font-size: 22px; }
.vote-btn .v-name { font-weight: 600; font-size: 14px; }
.vote-btn .v-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; min-height: 15px; }
.vote-btn .v-tag { font-size: 11px; color: var(--muted); background: rgba(255,255,255,.06); padding: 1px 7px; border-radius: 999px; }
.vote-btn .v-tag.you { color: var(--accent); background: rgba(122,162,255,.14); }
.vote-btn .v-tag.soon { color: #d9a441; background: rgba(217,164,65,.14); }
.vote-btn.mine { border-color: var(--accent); background: rgba(122,162,255,.08); }
.vote-btn.both { border-color: #2ecc71; box-shadow: 0 0 0 1px #2ecc71; }
.vote-btn.soon { opacity: .72; }
/* the Play button + status line under the picks */
.play-action { margin-top: 14px; display: flex; justify-content: center; }
.play-go { border: 0; cursor: pointer; color: #06210f; font-weight: 800; font-size: 16px; letter-spacing: .01em;
  padding: 13px 28px; border-radius: 999px; background: linear-gradient(135deg, #43e08a, #2ecc71);
  box-shadow: 0 8px 24px rgba(46,204,113,.4); animation: playpulse 1.8s ease-in-out infinite; transition: transform .12s; }
.play-go:hover { transform: translateY(-1px) scale(1.02); }
.play-go:active { transform: scale(.98); }
@keyframes playpulse { 0%,100% { box-shadow: 0 8px 24px rgba(46,204,113,.35); } 50% { box-shadow: 0 8px 34px rgba(46,204,113,.6); } }
.play-note { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; padding: 4px 6px; }
.play-note b { color: var(--text); }
.play-highscores .hs-row { grid-template-columns: 1.2fr 1fr 1fr 1fr; }

/* ===== shared mini-game shell (Tic-Tac-Toe, Starfall) ===== */
.mini-overlay { position: fixed; inset: 0; z-index: 76; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(80% 60% at 50% 0%, rgba(60,40,90,.5), transparent 70%), #0a0712; animation: fadein .4s ease; }
.mini-overlay.hidden { display: none; }
.mini-room, .coop-room { position: relative; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, #15131f, #0e0b16); border: 1px solid rgba(150,120,200,.25); border-radius: 22px; padding: 16px; box-shadow: var(--shadow-lg); }
.mini-top { display: flex; align-items: center; gap: 10px; }
.mini-title { flex: 1; font-weight: 700; font-size: 18px; }
.mini-status { text-align: center; font-size: 15px; color: var(--muted); min-height: 22px; font-weight: 600; }
.mini-status b { color: var(--accent); }
.mini-actions { display: flex; justify-content: center; }

/* Tic-Tac-Toe */
.ttt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 320px; width: 100%; margin: 0 auto; aspect-ratio: 1; }
.ttt-cell { border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 14px; display: grid; place-items: center;
  font-size: 46px; font-weight: 800; cursor: pointer; transition: background .12s, transform .08s; user-select: none; }
.ttt-cell:hover:not(.taken) { background: rgba(122,162,255,.12); }
.ttt-cell.taken { cursor: default; }
.ttt-cell.x { color: #7aa2ff; }
.ttt-cell.o { color: #ff8ec8; }
.ttt-cell.win { background: rgba(46,204,113,.22); animation: tttpop .3s ease; }
.ttt-cell.disabled { pointer-events: none; }
@keyframes tttpop { from { transform: scale(.7); } to { transform: scale(1); } }

/* Starfall co-op */
.coop-room { max-width: 520px; }
.coop-tag { font-size: 11px; font-weight: 700; color: #06210f; background: linear-gradient(135deg,#43e08a,#2ecc71); padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.coop-hud { flex: 1; text-align: right; font-weight: 700; font-size: 15px; color: var(--text); }
.coop-hud #coop-lives { color: #ff6b8a; letter-spacing: 2px; }
.coop-stage { position: relative; width: 100%; aspect-ratio: 3/4; max-height: 66vh; border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(180deg, #120a22 0%, #1c0f33 55%, #2a1145 100%); }
#coop-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.coop-splash { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8,5,18,.72); backdrop-filter: blur(3px); padding: 20px; text-align: center; }
.coop-splash.hidden { display: none; }
.coop-splash-card h3 { margin: 0 0 8px; font-size: 24px; }
.coop-splash-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: #d7d2ea; max-width: 340px; }
.coop-role { color: var(--accent); font-weight: 600; font-size: 13px; }
.coop-help { text-align: center; font-size: 12px; color: var(--muted); margin: 0; }

/* 💥 Tank Duel — retro artillery look (near-fullscreen game) */
.tank-overlay { padding: 0; display: flex; align-items: center; justify-content: center; background: #000; }
/* the battlefield keeps a 16:9 shape and fills as much of the screen as it can (letterboxed) */
.tank-overlay .tank-room { width: min(100vw, calc(100dvh * 16 / 9)); height: min(100dvh, calc(100vw * 9 / 16)); max-width: none; margin: 0; display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); padding-top: calc(8px + env(safe-area-inset-top));
  background: linear-gradient(180deg, #15131f, #0e0b16); border-radius: 0; position: relative; }
@media (min-width: 880px) { .tank-overlay .tank-room { border-radius: 16px; border: 1px solid rgba(150,120,200,.25); box-shadow: var(--shadow-lg); } }
/* phone: prompt to rotate to landscape */
#tank-rotate { display: none; }
.rotate-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: 20px; font-weight: 800; line-height: 1.3; }
.rotate-ico { font-size: 54px; animation: rotatePulse 1.6s ease-in-out infinite; }
@keyframes rotatePulse { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }
@media (orientation: portrait) and (pointer: coarse) {
  .tank-overlay:not(.hidden) #tank-rotate { display: flex; position: fixed; inset: 0; z-index: 60; align-items: center; justify-content: center; text-align: center; color: #cdb8ff; background: linear-gradient(180deg, #15131f, #0e0b16); }
  .tank-overlay:not(.hidden) .tank-room { visibility: hidden; }
}
.td-wname { cursor: pointer; }
.tank-wlist { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 6; max-height: 64%; overflow-y: auto;
  background: #14151d; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; padding: 8px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; box-shadow: var(--shadow-lg); }
.tank-wlist.hidden { display: none; }
.twl-item { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; padding: 8px 10px; border-radius: 9px; background: var(--field); border: 1px solid var(--line); color: var(--text); }
.twl-item.active { border-color: #ffb02e; background: rgba(255,176,46,.16); }
.twl-item .twl-e { font-size: 18px; }
.twl-item .twl-n { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.twl-item .twl-p { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.twl-rand { grid-column: 1 / -1; border-color: #ffb02e; background: rgba(255,176,46,.16); }
.tank-draft-actions { display: flex; justify-content: center; margin: 2px 0 8px; }
.tank-hud { display: flex; align-items: center; gap: 8px; }
.tank-p { display: flex; align-items: center; gap: 6px; }
.tp-name { font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.tp-name.tp1 { color: #7aa2ff; } .tp-name.tp2 { color: #ff8ec8; }
.tp-name.active-turn { text-shadow: 0 0 9px currentColor; } .tp-name.active-turn::before { content: '▸ '; }
.tp-score { font-weight: 800; font-size: 18px; color: #ffb02e; font-variant-numeric: tabular-nums; }
.tank-mid { flex: 1; text-align: center; display: flex; flex-direction: column; line-height: 1.15; }
.tank-mid #tank-round { font-size: 12px; color: var(--muted); font-weight: 700; }
.tank-wind { font-size: 12px; color: #9be36f; font-weight: 700; }
.tank-stage { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid rgba(150,120,200,.3);
  background: linear-gradient(180deg, #05030c 0%, #1a0730 55%, #3a0f4e 100%); }
#tank-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.tank-msg { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); font-weight: 800; font-size: 20px; color: #ffe08a;
  text-shadow: 0 2px 8px rgba(0,0,0,.7); pointer-events: none; }
.tank-msg.hidden { display: none; }
/* title / main screen (over the battlefield) */
.tank-title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  text-align: center; padding: 22px; background: rgba(8,4,20,.66); backdrop-filter: blur(3px); }
.tank-title.hidden { display: none; }
.tank-logo { font-weight: 900; font-size: clamp(34px, 9vw, 58px); line-height: .9; letter-spacing: .02em; color: #a86bff;
  text-shadow: 0 3px 0 #5a2ea0, 0 6px 18px rgba(0,0,0,.6); }
.tank-logo span { display: block; color: #ffb02e; text-shadow: 0 3px 0 #b8460a, 0 6px 18px rgba(0,0,0,.6); }
.tank-sub { margin: 0; max-width: 340px; font-size: 13.5px; line-height: 1.55; color: #dcd6ef; }
/* metallic control dock */
.tank-dock { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(180deg, #3a3d4d, #16171f); border: 1px solid rgba(255,255,255,.10); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
.tank-dock.hidden, .tank-panel.hidden { display: none; }
.td-weaprow { display: flex; align-items: center; gap: 8px; justify-content: center; }
.td-arrow, .td-mbtn { border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text); cursor: pointer; }
.td-arrow { width: 34px; height: 30px; font-size: 13px; }
.td-arrow:disabled, .td-mbtn:disabled { opacity: .35; cursor: default; }
.td-wname { flex: 1; max-width: 280px; text-align: center; font-weight: 700; font-size: 15px; color: #ffe08a;
  background: #0c0a14; border: 1px solid rgba(255,224,138,.3); border-radius: 8px; padding: 6px 8px; box-shadow: inset 0 0 10px rgba(255,180,60,.15); }
.td-main { display: flex; align-items: stretch; gap: 10px; }
.td-lbl { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.td-move { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 8px; border-radius: 9px; background: rgba(0,0,0,.25); }
.td-moverow { display: flex; align-items: center; gap: 5px; }
.td-mbtn { width: 26px; height: 26px; font-size: 12px; }
.td-moves { min-width: 16px; text-align: center; font-weight: 800; color: #9be36f; }
.td-ctl { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 8px; border-radius: 9px; background: rgba(0,0,0,.25); }
.td-ctl input[type="range"] { width: 100%; accent-color: #ffb02e; }
.td-size { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 7px; border-radius: 9px; background: rgba(0,0,0,.25); }
.td-sizerow { display: flex; gap: 3px; }
.td-sbtn { width: 22px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--muted); font-weight: 800; font-size: 12px; cursor: pointer; }
.td-sbtn.on { background: #ffb02e; color: #241a12; border-color: #ffb02e; }
.td-sbtn:disabled { opacity: .35; cursor: default; }
.td-val { font-size: 13px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.td-turn { text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); min-height: 15px; }
.tank-fire { border: 0; cursor: pointer; font-weight: 900; letter-spacing: .06em; font-size: 17px; color: #3a0b00;
  padding: 0 26px; border-radius: 10px; background: linear-gradient(180deg, #ffcf4d, #ff7a1a); box-shadow: 0 4px 0 #b8460a, 0 6px 16px rgba(255,120,20,.4); transition: transform .08s, box-shadow .08s; }
.tank-title .tank-fire { padding: 12px 34px; }
.tank-fire:active { transform: translateY(3px); box-shadow: 0 1px 0 #b8460a, 0 3px 10px rgba(255,120,20,.4); }
.tank-fire:disabled { filter: grayscale(.7) brightness(.7); cursor: default; box-shadow: 0 4px 0 #5a4030; }
.tank-pool { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; max-height: 210px; overflow-y: auto; padding: 2px; }
.tank-wpn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; padding: 8px 10px; border-radius: 10px;
  background: var(--field); border: 1px solid var(--line); color: var(--text); }
.tank-wpn .we { font-size: 20px; } .tank-wpn .wn { flex: 1; font-size: 13px; font-weight: 600; }
.tank-wpn .wtag { font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.tank-wpn.taken1 { opacity: .55; } .tank-wpn.taken1 .wtag { color: #7aa2ff; background: rgba(122,162,255,.16); }
.tank-wpn.taken2 { opacity: .55; } .tank-wpn.taken2 .wtag { color: #ff8ec8; background: rgba(255,142,200,.16); }
.tank-wpn.locked { pointer-events: none; }
.tank-win { text-align: center; margin: 4px 0 12px; font-size: 22px; }
.tank-results { display: flex; flex-direction: column; align-items: center; }
#tank-power { accent-color: #ff4747; }
#tank-angle { accent-color: #ffcf4d; }
.td-val { background: #0c0a14; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; padding: 2px 7px; align-self: center; box-shadow: inset 0 0 6px rgba(0,0,0,.5); }

/* Memory Match */
.mem-hud { flex: 1; text-align: right; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mem-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 340px; width: 100%; margin: 0 auto; }
.mem-card { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 30px; cursor: pointer; user-select: none; transition: transform .14s, background .14s; background: rgba(255,255,255,.05); }
.mem-card.down { background: linear-gradient(135deg, rgba(122,162,255,.20), rgba(255,142,200,.20)); }
.mem-card.down::after { content: '🌸'; opacity: .5; font-size: 22px; }
.mem-card.up { background: rgba(255,255,255,.12); transform: scale(1.02); }
.mem-card.matched { background: rgba(46,204,113,.18); border-color: rgba(46,204,113,.5); }
.mem-card.locked { pointer-events: none; }

@media (max-width: 760px) {
  .dg-room { max-width: none; height: 100dvh; border-radius: 0; border: none; }
  .dg-hint { font-size: 17px; letter-spacing: 2px; }
  .dg-guess { font-size: 16px; }
}
