/* =========================================================
   Samae — romantic love site
   Colors come from --accent / --accent-2 (chosen in Settings)
   ========================================================= */
:root {
  --accent: #F2B705;
  --accent-2: #FF7A45;
  --on-accent: #2B2118;
  --ph-blue: #0038A8;
  --ph-red: #CE1126;
  --ph-sun: #FCD116;

  /* backgrounds follow the chosen theme colors */
  --base: #FFFDF8;
  --bg: color-mix(in srgb, var(--accent) 12%, var(--base));
  --bg-2: color-mix(in srgb, var(--accent-2) 16%, var(--base));
  --card: color-mix(in srgb, var(--accent) 4%, rgba(255, 255, 255, .88));
  --card-solid: color-mix(in srgb, var(--accent) 4%, #ffffff);
  --ink: #2B2118;
  --muted: color-mix(in srgb, var(--accent) 25%, #7C7064);
  --line: color-mix(in srgb, var(--accent) 22%, rgba(43, 33, 24, .07));
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-softer: color-mix(in srgb, var(--accent) 8%, transparent);
  --accent-ink: color-mix(in srgb, var(--accent) 62%, var(--ink));
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent-2) 35%, rgba(0,0,0,.25));
  --shadow-sm: 0 4px 14px -6px rgba(43, 33, 24, .18);
  --radius: 22px;
  --radius-sm: 14px;
  --font: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
  --script: 'Dancing Script', 'Brush Script MT', cursive;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
html.dark {
  --base: #120E0B;
  --bg: color-mix(in srgb, var(--accent) 14%, var(--base));
  --bg-2: color-mix(in srgb, var(--accent-2) 16%, var(--base));
  --card: color-mix(in srgb, var(--accent) 8%, rgba(30, 24, 19, .88));
  --card-solid: color-mix(in srgb, var(--accent) 8%, #1F1914);
  --ink: #FBF3E4;
  --muted: color-mix(in srgb, var(--accent) 25%, #B3A592);
  --line: color-mix(in srgb, var(--accent) 22%, rgba(255, 240, 210, .08));
  --accent-ink: color-mix(in srgb, var(--accent) 75%, #fff);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-sm: 0 4px 14px -6px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg-2); min-height: 100%; transition: background-color .4s; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 100% -10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 62%),
    radial-gradient(900px 560px at -10% 105%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 62%),
    radial-gradient(700px 420px at 50% 55%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + var(--safe-b));
}
a { color: var(--accent-ink); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.script { font-family: var(--script); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- Filipino flag stripe + background hearts ---------- */
.flag-stripe {
  position: fixed; inset: 0 0 auto 0; height: 5px; z-index: 60; display: flex;
}
.flag-stripe::before {
  content: ''; width: 34px; background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%); position: absolute; left: 0; top: 0; bottom: 0; z-index: 1;
}
.flag-stripe i { flex: 1; }
.flag-stripe i:first-child { background: var(--ph-blue); }
.flag-stripe i:last-child { background: var(--ph-red); }

.bg-hearts { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-hearts span {
  position: absolute; bottom: -40px; width: 18px; height: 18px; opacity: .22;
  background: var(--accent); transform: rotate(45deg);
  animation: rise 18s linear infinite;
}
.bg-hearts span::before, .bg-hearts span::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: inherit;
}
.bg-hearts span::before { left: -9px; }
.bg-hearts span::after { top: -9px; }
.bg-hearts span:nth-child(1) { left: 6%;  animation-delay: 0s;  transform: rotate(45deg) scale(.7); }
.bg-hearts span:nth-child(2) { left: 18%; animation-delay: 6s;  background: var(--accent-2); }
.bg-hearts span:nth-child(3) { left: 32%; animation-delay: 11s; transform: rotate(45deg) scale(.5); }
.bg-hearts span:nth-child(4) { left: 48%; animation-delay: 3s; }
.bg-hearts span:nth-child(5) { left: 62%; animation-delay: 14s; background: var(--accent-2); }
.bg-hearts span:nth-child(6) { left: 76%; animation-delay: 8s;  transform: rotate(45deg) scale(.6); }
.bg-hearts span:nth-child(7) { left: 88%; animation-delay: 1s; }
.bg-hearts span:nth-child(8) { left: 95%; animation-delay: 10s; background: var(--accent-2); }
@keyframes rise {
  0%   { bottom: -40px; opacity: 0; }
  10%  { opacity: .22; }
  100% { bottom: 110vh; opacity: 0; margin-left: 40px; }
}
@media (prefers-reduced-motion: reduce) { .bg-hearts, .spin-slow { animation: none !important; display: none; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 5px; z-index: 50; margin: 10px auto 0; max-width: 1180px;
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  background: var(--card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm);
  width: calc(100% - 24px);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); white-space: nowrap; }
.sun { flex: none; filter: drop-shadow(0 2px 6px rgba(252, 209, 22, .5)); }
.spin-slow { animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.topnav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.topnav a {
  position: relative; padding: 7px 12px; border-radius: 999px; color: var(--ink); font-weight: 600; font-size: .9rem;
  transition: background .2s;
}
.topnav a:hover { background: var(--accent-softer); }
.topnav a.active { background: var(--grad); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-solid);
  display: grid; place-items: center; cursor: pointer; font-size: 1rem; color: var(--ink);
}
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--ph-red); color: #fff; font-size: .7rem; font-weight: 700; vertical-align: top;
}

/* ---------- Layout ---------- */
.container { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 22px 16px 30px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.card {
  background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 700; color: var(--accent-ink); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-solid);
  color: var(--ink); font: 700 .95rem var(--font); cursor: pointer; transition: transform .15s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: var(--on-accent); border: 0; box-shadow: var(--shadow); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--ph-red); }
.btn-sm { padding: 7px 13px; font-size: .82rem; }
.btn-block { width: 100%; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 12px; color: var(--ink); }
input, textarea, select {
  width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--card-solid); color: var(--ink);
  font: 500 1rem var(--font); transition: border .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; min-height: 110px; }
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }
input[type=color] { padding: 4px; height: 46px; cursor: pointer; }
input[type=file] { padding: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
fieldset { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; color: var(--accent-ink); }
legend small { color: var(--muted); font-weight: 500; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: color-mix(in srgb, #14A37F 14%, transparent); color: #0f7a5f; }
.flash-err { background: color-mix(in srgb, var(--ph-red) 12%, transparent); color: var(--ph-red); }
html.dark .flash-ok { color: #6ee7c4; }

/* ---------- Auth ---------- */
.auth-page { display: grid; place-items: center; padding: 30px 16px; }
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px; text-align: center;
  background: var(--card); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 30px; padding: 34px 28px; box-shadow: var(--shadow);
}
.auth-card form, .install-card { text-align: left; }
.install-card { max-width: 560px; }
.install-card h1, .install-card p, .install-card .auth-heart { text-align: center; }
.auth-heart { font-size: 2.6rem; margin-bottom: 4px; }
.auth-sun { display: flex; justify-content: center; margin-bottom: 6px; }
.auth-title { font-family: var(--script); font-size: 3rem; margin: 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-stars { display: flex; justify-content: center; gap: 10px; margin: 6px 0 14px; }
.auth-card .tagalog { font-family: var(--script); font-size: 1.4rem; color: var(--accent-ink); margin: 0 0 18px; }

/* ---------- Home ---------- */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 18px;
}
.hero-main {
  background: var(--grad); color: var(--on-accent); border: 0;
}
.hero-main::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.35), transparent 70%);
}
.hero-main .eyebrow, .hero-main a { color: inherit; opacity: .85; }
.hero-main h1 { margin-bottom: 6px; }
.hero-sun { position: absolute; right: 18px; bottom: -20px; opacity: .35; }
.together { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.together .unit {
  background: rgba(255,255,255,.25); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(6px);
  border-radius: 16px; padding: 10px 14px; min-width: 72px; text-align: center;
}
.together .num { font: 700 1.6rem var(--serif); display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.together .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; opacity: .85; }
.monthsary-banner {
  margin-bottom: 18px; text-align: center; padding: 26px 20px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--ph-blue) 92%, #000), var(--ph-blue) 50%, var(--ph-red) 50%, color-mix(in srgb, var(--ph-red) 85%, #000));
  color: #fff; border: 0;
}
.monthsary-banner h2 { font-family: var(--script); font-size: 2.3rem; margin: 6px 0; }
.monthsary-banner .sun { margin: 0 auto; }

.partner-card { display: flex; flex-direction: column; gap: 12px; }
.person { display: flex; align-items: center; gap: 14px; }
.avatar { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); background: var(--accent-soft); flex: none; }
.avatar-sm { width: 40px; height: 40px; border-width: 2px; }
.avatar-wrap { position: relative; }
.dot { position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%; background: #b9b0a5; border: 2px solid var(--card-solid); }
.dot.on { background: #22c55e; }
.mood-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); font-weight: 600; font-size: .9rem; }

.love-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.love-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--card-solid); cursor: pointer; font: 700 .8rem var(--font); color: var(--ink);
  transition: transform .15s, background .2s;
}
.love-btn span { font-size: 1.7rem; }
.love-btn:hover { background: var(--accent-soft); transform: translateY(-2px); }
.love-btn:active { transform: scale(.94); }

.mood-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mood-opt {
  border: 1.5px solid var(--line); background: var(--card-solid); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  font: 600 .85rem var(--font); color: var(--ink);
}
.mood-opt.sel { border-color: var(--accent); background: var(--accent-soft); }

.quote-card { text-align: center; padding: 28px 22px; }
.quote-card .q { font-family: var(--script); font-size: 1.7rem; line-height: 1.3; color: var(--accent-ink); margin: 8px 0 10px; }
.tagalog-card .tl { font-family: var(--script); font-size: 2rem; margin: 4px 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.countdown { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.countdown div { background: var(--accent-soft); border-radius: 14px; padding: 8px 10px; min-width: 58px; text-align: center; }
.countdown b { display: block; font: 700 1.35rem var(--serif); font-variant-numeric: tabular-nums; }
.countdown small { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }

.mini-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-gallery img { aspect-ratio: 1; object-fit: cover; border-radius: 12px; cursor: zoom-in; }
.progress { height: 12px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad); border-radius: inherit; transition: width .6s; }
.song { display: flex; flex-direction: column; gap: 10px; }
.song audio { width: 100%; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); font-size: .72rem; font-weight: 700; color: var(--accent-ink); }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .big { font-size: 2.6rem; display: block; margin-bottom: 6px; }

/* Bucket */
.bucket-item.done .title { text-decoration: line-through; color: var(--muted); }
.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; cursor: pointer;
  display: grid; place-items: center; font-size: .9rem; color: var(--on-accent); flex: none;
}
.done .check { background: var(--grad); border-color: transparent; }

/* Gallery */
.gallery { columns: 3 260px; column-gap: 16px; }
.memory {
  break-inside: avoid; margin-bottom: 16px; background: var(--card-solid); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.memory img { width: 100%; cursor: zoom-in; }
.memory .body { padding: 12px 14px 14px; }
.memory h3 { margin: 0 0 4px; font-size: 1.05rem; }
.memory .meta { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.polaroid { transform: rotate(-1deg); }
.memory:nth-child(even) { transform: rotate(.8deg); }

/* Letters */
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.envelope {
  position: relative; display: block; padding: 22px 18px 18px; border-radius: 18px; color: var(--ink);
  background: linear-gradient(160deg, var(--card-solid), color-mix(in srgb, var(--accent) 10%, var(--card-solid)));
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: transform .2s;
}
.envelope:hover { transform: translateY(-3px) rotate(-.5deg); }
.envelope::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 46%;
  background: color-mix(in srgb, var(--accent) 22%, transparent); clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 18px 18px 0 0;
}
.envelope .seal { position: relative; z-index: 1; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; background: var(--ph-red); color: #fff; display: grid; place-items: center; font-size: 1.2rem; box-shadow: 0 4px 10px rgba(206,17,38,.35); }
.envelope h3 { text-align: center; margin: 0 0 4px; }
.envelope p { text-align: center; margin: 0; font-size: .82rem; color: var(--muted); }
.envelope.locked { filter: saturate(.6); }
.envelope.new::after { content: 'NEW'; position: absolute; top: 10px; right: 10px; background: var(--ph-red); color: #fff; font-size: .65rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.letter-paper {
  max-width: 720px; margin: 0 auto; padding: 40px 34px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 6%, #FFFDF6); color: #3a2e22;
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(0,56,168,.08) 31px 32px);
  box-shadow: var(--shadow); position: relative;
}
html.dark .letter-paper { background-color: color-mix(in srgb, var(--accent) 10%, #241D16); color: #f3e8d6; }
.letter-paper h2 { font-family: var(--script); font-size: 2.2rem; color: var(--ph-red); }
.letter-paper .content { font-size: 1.08rem; line-height: 32px; white-space: pre-wrap; }
.letter-paper .sign { font-family: var(--script); font-size: 1.6rem; text-align: right; margin-top: 20px; }

/* Reasons */
.reasons-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.note {
  padding: 18px; border-radius: 6px 18px 6px 18px; background: color-mix(in srgb, var(--accent) 22%, var(--card-solid));
  box-shadow: var(--shadow-sm); position: relative; font-weight: 600;
}
.note:nth-child(3n+2) { background: color-mix(in srgb, var(--accent-2) 20%, var(--card-solid)); transform: rotate(1deg); }
.note:nth-child(3n) { transform: rotate(-1deg); }
.note .n { font-family: var(--script); font-size: 1.4rem; color: var(--accent-ink); display: block; }
.note form { position: absolute; top: 6px; right: 6px; }
.x-btn { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: .9rem; padding: 4px; }

/* Dates */
.date-item .big-emoji { font-size: 1.8rem; width: 48px; height: 48px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 14px; flex: none; }
.days-left { text-align: right; font-weight: 700; }
.days-left b { font: 700 1.4rem var(--serif); color: var(--accent-ink); display: block; line-height: 1; }

/* Settings */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.theme-opt { position: relative; cursor: pointer; margin: 0; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt .sw {
  display: block; border-radius: 16px; padding: 12px; border: 2px solid var(--line); background: var(--card-solid); text-align: center; font-size: .82rem;
}
.theme-opt .chip { display: block; height: 44px; border-radius: 10px; margin-bottom: 8px; }
.theme-opt input:checked + .sw { border-color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Chat ---------- */
.page-chat { padding-bottom: 0; }
.page-chat .container { padding-bottom: 0; }
.chat {
  display: flex; flex-direction: column; height: calc(100dvh - 104px - 76px - var(--safe-b));
  background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head .status { font-size: .8rem; color: var(--muted); }
.chat-head .status.on { color: #16a34a; }
.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.day-sep { align-self: center; margin: 10px 0; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); font-size: .75rem; font-weight: 700; color: var(--accent-ink); }
.msg { display: flex; flex-direction: column; max-width: 78%; align-self: flex-start; position: relative; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble {
  padding: 9px 13px 6px; border-radius: 20px 20px 20px 6px; background: var(--card-solid); border: 1px solid var(--line);
  word-wrap: break-word; overflow-wrap: anywhere; cursor: pointer; box-shadow: var(--shadow-sm);
}
.mine .bubble { background: var(--grad); color: var(--on-accent); border: 0; border-radius: 20px 20px 6px 20px; }
.mine .bubble a { color: inherit; text-decoration: underline; }
.bubble img { border-radius: 14px; margin: 2px 0 6px; max-height: 320px; cursor: zoom-in; }
.bubble .meta { display: block; text-align: right; font-size: .68rem; opacity: .7; margin-top: 2px; }
.bubble.deleted { font-style: italic; opacity: .6; }
.msg .react { position: absolute; bottom: -10px; font-size: .95rem; background: var(--card-solid); border-radius: 999px; padding: 0 5px; box-shadow: var(--shadow-sm); }
.msg:not(.mine) .react { right: -8px; }
.msg.mine .react { left: -8px; }
.msg.has-react { margin-bottom: 10px; }
.msg-actions { display: none; gap: 4px; margin-top: 4px; background: var(--card-solid); padding: 4px 6px; border-radius: 999px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.msg.show-actions .msg-actions { display: flex; }
.msg-actions button { border: 0; background: transparent; font-size: 1.15rem; cursor: pointer; padding: 2px 4px; border-radius: 8px; }
.msg-actions button:hover { background: var(--accent-soft); }
.msg-actions .del { font-size: .78rem; font-weight: 700; color: var(--ph-red); }
.typing { padding: 0 18px 6px; font-size: .8rem; color: var(--muted); min-height: 20px; }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 1px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-form textarea { margin: 0; min-height: 46px; max-height: 140px; border-radius: 22px; padding: 12px 16px; resize: none; }
.chat-form .icon-btn { width: 46px; height: 46px; flex: none; font-size: 1.2rem; }
.chat-form .send { background: var(--grad); color: var(--on-accent); border: 0; }
.quick-emoji { display: flex; gap: 6px; padding: 6px 12px 0; overflow-x: auto; }
.quick-emoji button { border: 0; background: var(--accent-softer); border-radius: 999px; padding: 4px 10px; font-size: 1.1rem; cursor: pointer; flex: none; }
.img-preview { display: flex; align-items: center; gap: 10px; padding: 8px 14px 0; }
.img-preview img { height: 64px; border-radius: 10px; }
.load-older { align-self: center; }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  display: none; position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 55;
  background: var(--card); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 6px;
  justify-content: space-around;
}
.bottomnav a, .bottomnav button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px;
  border-radius: 18px; font: 700 .68rem var(--font); color: var(--muted); background: transparent; border: 0; cursor: pointer;
}
.bottomnav .ico { font-size: 1.25rem; line-height: 1.2; }
.bottomnav .active { color: var(--accent-ink); background: var(--accent-soft); }
.bottomnav .badge { position: absolute; top: 2px; right: calc(50% - 22px); }

.sheet { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--accent) 15%, rgba(20, 12, 4, .4)); display: flex; align-items: flex-end; }
.sheet-panel {
  width: 100%; background: var(--card-solid); border-radius: 26px 26px 0 0; padding: 10px 14px calc(20px + var(--safe-b));
  animation: up .25s ease;
}
@keyframes up { from { transform: translateY(100%); } }
.sheet-grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 12px; }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 10px; border-radius: 14px; color: var(--ink); font: 600 1rem var(--font); background: none; border: 0; cursor: pointer; text-align: left; }
.sheet-item span { font-size: 1.3rem; width: 30px; text-align: center; }
.sheet-item:hover { background: var(--accent-softer); }

/* ---------- Lightbox / toasts / bursts ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(10, 6, 2, .9); display: grid; place-items: center; padding: 20px; }
.lightbox img { max-height: 90vh; max-width: 100%; border-radius: 12px; }
.lb-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 1.2rem; cursor: pointer; }
.toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 380px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--card-solid);
  border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; animation: pop .3s ease;
}
.toast .ti { font-size: 1.5rem; }
@keyframes pop { from { transform: translateY(-10px) scale(.95); opacity: 0; } }
.burst { position: fixed; z-index: 96; pointer-events: none; font-size: 2rem; animation: burst 2.2s ease-out forwards; }
@keyframes burst {
  0% { transform: translateY(0) scale(.5); opacity: 0; }
  15% { opacity: 1; transform: translateY(-20px) scale(1.2); }
  100% { transform: translateY(-60vh) scale(1) rotate(25deg); opacity: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .topnav { flex-wrap: nowrap; }
  .topnav a { padding: 7px 8px; font-size: .82rem; white-space: nowrap; }
  .brand span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 980px) {
  .topnav { display: none; }
  .top-actions { margin-left: auto; }
  .bottomnav { display: flex; }
  .hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .container { padding: 16px 12px 24px; }
  .card { padding: 16px; }
  .topbar { border-radius: 20px; }
  .mini-gallery { grid-template-columns: repeat(3, 1fr); }
  .mini-gallery img:nth-child(4) { display: none; }
  .letter-paper { padding: 28px 18px; }
  .msg { max-width: 86%; }
  .chat { height: calc(100dvh - 92px - 84px - var(--safe-b)); }
  .together { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .together .unit { min-width: 0; padding: 8px 4px; }
  .together .num { font-size: 1.25rem; }
  .together [data-u="t"] { font-size: .95rem; padding-top: 5px; }
  .together .lbl { font-size: .6rem; }
}
