/* ========== VARIABLES (LIGHT SCRAPBOOK & COZY NIGHT MODE) ========== */
:root {
  --rose: #e8587a;
  --rose-l: #f28da0;
  --rose-p: #c93d62;
  --rose-f: #fde8ed;
  --cream: #fffaf4;
  --caramel: #c4832a;
  --caramel-d: #9a6015;
  --caramel-l: #f5d09c;
  --caramel-f: #fff5e6;
  --purple: #a78bfa;
  --purple-l: #c4b5fd;

  --card: rgba(255, 252, 248, 0.93);
  --card-dudu: rgba(255, 250, 242, 0.94);
  --card-bubu: rgba(255, 247, 250, 0.94);
  --surface: rgba(255, 255, 255, 0.82);
  --nav-bg: rgba(255, 248, 244, 0.9);
  --modal-bg: rgba(255, 252, 248, 0.97);
  --note-bg: #fffbeb;
  --note-border: #fde68a;

  --text: #2d1a14;
  --text2: #4a2c20;
  --textl: #7a5c52;
  --textm: #a08070;
  --border-soft: rgba(232, 88, 122, 0.15);

  --sh: 0 6px 24px rgba(180, 90, 90, 0.09), 0 1px 4px rgba(180, 90, 90, 0.05);
  --shm: 0 12px 36px rgba(180, 90, 90, 0.16);
  --r: 16px;
  --rm: 22px;
  --rl: 30px;
  --rf: 9999px;
  --tr: .26s cubic-bezier(.4, 0, .2, 1);
}

/* 🌙 Chế độ Đèn Ngủ Ấm (Cozy Night Mode) */
[data-theme="night"] {
  --rose: #f47296;
  --rose-l: #f9a8bf;
  --rose-p: #fb85a6;
  --rose-f: rgba(244, 114, 150, 0.16);
  --cream: #261b18;
  --caramel: #eab364;
  --caramel-d: #f5c984;
  --caramel-l: rgba(234, 179, 100, 0.35);
  --caramel-f: rgba(234, 179, 100, 0.12);

  --card: rgba(40, 29, 27, 0.92);
  --card-dudu: rgba(44, 33, 26, 0.93);
  --card-bubu: rgba(45, 28, 34, 0.93);
  --surface: rgba(54, 39, 36, 0.88);
  --nav-bg: rgba(33, 23, 22, 0.92);
  --modal-bg: rgba(38, 27, 25, 0.98);
  --note-bg: rgba(66, 51, 31, 0.85);
  --note-border: rgba(234, 179, 100, 0.32);

  --text: #fcefe9;
  --text2: #edd5ca;
  --textl: #c7a99b;
  --textm: #9c7e71;
  --border-soft: rgba(244, 114, 150, 0.2);

  --sh: 0 8px 28px rgba(0, 0, 0, 0.38);
  --shm: 0 14px 40px rgba(0, 0, 0, 0.52);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Be Vietnam Pro', sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
  transition: color var(--tr);
}

/* Fixed background layer — mượt trên iOS Safari */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: -2;
  transition: filter .4s ease;
}

[data-theme="night"] body::after {
  filter: brightness(0.32) saturate(0.85) sepia(0.18);
}

/* Warm overlay */
body.logged-in::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 242, 246, 0.55) 0%, rgba(255, 249, 240, 0.52) 100%);
  pointer-events: none;
  z-index: -1;
}

[data-theme="night"] body.logged-in::before {
  background: linear-gradient(160deg, rgba(26, 17, 16, 0.72) 0%, rgba(34, 22, 20, 0.75) 100%);
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font-family: inherit;
}

#app {
  position: relative;
  z-index: 1;
}

/* ========== ICON PILL BUTTON (Theme Toggle) ========== */
.icon-pill-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--tr);
}

.icon-pill-btn:hover {
  transform: rotate(15deg) scale(1.06);
  border-color: var(--rose);
}

/* ========== OVERLAY / MODAL ========== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 20, 22, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

#loginOverlay {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ========== LOGIN ========== */
.login-wrap {
  width: 100%;
  max-width: 440px;
  animation: popIn .4s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.login-card {
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--rl);
  padding: 32px 28px 28px;
  box-shadow: var(--shm);
  border: 1.5px solid var(--border-soft);
  position: relative;
}

.login-theme-btn-wrap {
  position: absolute;
  top: 16px;
  right: 16px;
}

.login-site-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2.65rem;
  font-weight: 700;
  color: var(--rose);
  text-align: center;
  display: block;
  margin-bottom: 4px;
}

.login-site-sub {
  text-align: center;
  font-size: .85rem;
  color: var(--textl);
  margin-bottom: 20px;
  line-height: 1.55;
}

.login-cursive-sub {
  margin-bottom: 6px;
  font-family: 'Dancing Script', cursive;
  font-size: 1.35rem;
  color: var(--text2);
  font-weight: 700;
}

.login-footer-note {
  text-align: center;
  font-size: .75rem;
  margin-top: 14px;
  color: var(--text);
  background: var(--card);
  padding: 6px 14px;
  border-radius: var(--rf);
  display: block;
  width: fit-content;
  margin-inline: auto;
  box-shadow: var(--sh);
}

.tab-sw {
  display: flex;
  background: rgba(232, 88, 122, .08);
  border-radius: var(--rf);
  padding: 4px;
  margin-bottom: 22px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 9px 6px;
  border-radius: var(--rf);
  border: none;
  background: transparent;
  font-size: .83rem;
  font-weight: 700;
  color: var(--textl);
  transition: var(--tr);
}

.tab-btn.on {
  background: var(--surface);
  color: var(--rose);
  box-shadow: 0 2px 10px rgba(232, 88, 122, .16);
}

#tabDudu.on {
  color: var(--caramel-d);
}

.tab-panel {
  display: none;
}

.tab-panel.on {
  display: block;
  animation: fadeIn .25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 11px 15px;
  background: var(--surface);
  border: 1.5px solid rgba(150, 110, 100, 0.22);
  border-radius: var(--r);
  font-size: .92rem;
  color: var(--text);
  outline: none;
  transition: var(--tr);
}

.input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(232, 88, 122, .15);
}

.input::placeholder {
  color: var(--textm);
}

.pwd-wrapper {
  position: relative;
}

.eye-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--textm);
  font-size: 1.1rem;
  user-select: none;
}

.err {
  font-size: .8rem;
  color: #ef4444;
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .25);
  border-radius: var(--r);
  padding: 9px 13px;
  margin-bottom: 14px;
  display: none;
}

.err.on {
  display: block;
  animation: fadeIn .25s ease;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--rf);
  font-size: .875rem;
  font-weight: 600;
  transition: var(--tr);
  white-space: nowrap;
}

.btn-rose {
  background: linear-gradient(135deg, #f07090, #e8587a, #c93d62);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232, 88, 122, .35);
}

.btn-rose:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(232, 88, 122, .45);
}

.btn-caramel {
  background: linear-gradient(135deg, #df9b40, #c4832a, #9e6316);
  color: #fff;
  box-shadow: 0 4px 16px rgba(196, 131, 42, .35);
}

.btn-caramel:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(196, 131, 42, .45);
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
}

.btn-outline {
  background: var(--surface);
  color: var(--rose);
  border: 1.5px solid var(--rose-l);
}

.btn-outline:hover:not(:disabled) {
  background: var(--rose-f);
  border-color: var(--rose);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--textl);
}

.btn-ghost:hover {
  background: var(--rose-f);
  color: var(--rose);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, .28);
}

.btn-danger:hover {
  transform: translateY(-2px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: .78rem;
}

.btn-block {
  width: 100%;
}

.reader-hint {
  font-size: .77rem;
  color: var(--textm);
  text-align: center;
  margin-top: 12px;
  line-height: 1.6;
}

/* ========== NAVBAR ========== */
.navbar {
  background: var(--nav-bg);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border-bottom: 1.5px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 0;
  box-shadow: 0 2px 16px rgba(0, 0, 0, .06);
}

.nav-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  font-family: 'Dancing Script', cursive;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--rose);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-tab-bar {
  display: flex;
  gap: 6px;
}

.nav-tab {
  padding: 7px 14px;
  border-radius: var(--rf);
  border: 1.5px solid var(--border-soft);
  background: var(--surface);
  color: var(--textl);
  font-size: .8rem;
  font-weight: 600;
  transition: var(--tr);
}

.nav-tab.on,
.nav-tab:hover {
  background: linear-gradient(135deg, #f07090, #e8587a);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(232, 88, 122, .32);
}

.role-pill {
  font-size: .74rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--rf);
}

.role-dudu {
  background: var(--caramel-f);
  color: var(--caramel-d);
  border: 1px solid var(--caramel-l);
}

.role-bubu {
  background: var(--rose-f);
  color: var(--rose-p);
  border: 1px solid rgba(232, 88, 122, .3);
}

.role-reader {
  background: rgba(167, 139, 250, 0.16);
  color: #7c3aed;
}

[data-theme="night"] .role-reader {
  color: #c4b5fd;
}

/* ========== CONTAINER ========== */
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ========== COUPLE HERO (LOVE DAYS + LIVE STATUS) ========== */
.couple-hero {
  margin-top: 20px;
  margin-bottom: 14px;
  background: var(--card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--rm);
  padding: 20px 22px 18px;
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--sh);
}

.love-counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-soft);
}

.love-avatar-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 78px;
}

.love-avatar-badge video {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--surface);
  padding: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dudu-badge video {
  border: 2px solid var(--caramel);
}

.bubu-badge video {
  border: 2px solid var(--rose);
}

.love-avatar-badge span {
  font-size: .76rem;
  font-weight: 700;
  color: var(--text2);
}

.love-days-center {
  text-align: center;
  flex: 1;
}

.love-days-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--rose);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.love-days-num {
  font-family: 'Dancing Script', cursive;
  font-size: 2.7rem;
  font-weight: 700;
  color: var(--rose);
  line-height: 1.1;
  margin: 2px 0;
}

.love-days-num small {
  font-size: 1.35rem;
  font-weight: 600;
}

.love-days-since {
  font-size: .74rem;
  color: var(--textm);
}

/* Live Couple Status Bubbles */
.couple-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.status-bubble {
  padding: 11px 14px;
  border-radius: var(--r);
  border: 1.5px solid transparent;
  transition: var(--tr);
  position: relative;
}

.status-dudu {
  background: var(--caramel-f);
  border-color: rgba(196, 131, 42, 0.22);
}

.status-bubu {
  background: var(--rose-f);
  border-color: rgba(232, 88, 122, 0.22);
}

.status-bubble.editable {
  cursor: pointer;
}

.status-bubble.editable:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh);
}

.status-who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .72rem;
  font-weight: 700;
  color: var(--textl);
  margin-bottom: 4px;
}

.status-edit-hint {
  font-size: .68rem;
  color: var(--rose);
  background: var(--surface);
  padding: 1px 7px;
  border-radius: var(--rf);
}

.status-text {
  font-size: .86rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

/* ========== COUNTDOWN BAR ========== */
.countdown-bar {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--rm);
  padding: 12px 20px;
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cd-label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text2);
}

.cd-units {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cd-unit {
  text-align: center;
}

.cd-val {
  font-family: 'Dancing Script', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rose);
  display: block;
  line-height: 1;
}

.cd-lbl {
  font-size: .58rem;
  color: var(--textm);
  text-transform: uppercase;
}

.cd-sep {
  font-size: 1.1rem;
  color: var(--rose-p);
  font-weight: 700;
}

/* ========== SCRAPBOOK TOOLBAR (AUTHOR FILTER + JAR + SORT) ========== */
.scrapbook-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 4px;
  flex-wrap: wrap;
}

.author-filter-group {
  display: inline-flex;
  background: var(--card);
  padding: 4px;
  border-radius: var(--rf);
  border: 1.5px solid var(--border-soft);
  gap: 4px;
}

.af-btn {
  padding: 6px 13px;
  border-radius: var(--rf);
  border: none;
  background: transparent;
  font-size: .78rem;
  font-weight: 700;
  color: var(--textl);
  transition: var(--tr);
}

.af-btn.on {
  background: linear-gradient(135deg, #f07090, #e8587a);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 88, 122, 0.3);
}

.af-btn.af-dudu.on {
  background: linear-gradient(135deg, #df9b40, #c4832a);
  box-shadow: 0 2px 8px rgba(196, 131, 42, 0.32);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.jar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--rf);
  font-size: .78rem;
  font-weight: 700;
  border: 1.5px solid rgba(196, 131, 42, 0.35);
  background: var(--caramel-f);
  color: var(--caramel-d);
  transition: var(--tr);
}

.jar-btn:hover {
  transform: translateY(-2px) rotate(-2deg);
  box-shadow: 0 4px 12px rgba(196, 131, 42, 0.25);
}

.jar-btn.shaking .jar-ico {
  display: inline-block;
  animation: jarShake .5s ease;
}

@keyframes jarShake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-18deg) scale(1.15); }
  40% { transform: rotate(16deg) scale(1.15); }
  60% { transform: rotate(-12deg); }
  80% { transform: rotate(10deg); }
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--rf);
  font-size: .78rem;
  font-weight: 700;
  border: 1.5px solid var(--border-soft);
  background: var(--card);
  color: var(--rose-p);
  transition: var(--tr);
}

.sort-toggle:hover {
  background: var(--rose-f);
  border-color: var(--rose);
}

.sort-toggle .sort-icon {
  display: inline-block;
  transition: transform .3s ease;
}

.sort-toggle.asc .sort-icon {
  transform: scaleY(-1);
}

/* ========== MOOD FILTER AREA ========== */
.mood-filter-wrap {
  padding: 8px 0 4px;
}

.mood-filter-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.mood-filter-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--textm);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.mood-search-wrap {
  position: relative;
  flex: 1;
  min-width: 150px;
  max-width: 260px;
}

.mood-search {
  width: 100%;
  padding: 5px 30px 5px 12px;
  border-radius: var(--rf);
  border: 1.5px solid var(--border-soft);
  background: var(--card);
  font-size: .77rem;
  color: var(--text);
  outline: none;
  transition: var(--tr);
}

.mood-search:focus {
  border-color: var(--rose);
}

.mood-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: .85rem;
  color: var(--textm);
  display: none;
}

.mood-search-clear.show {
  display: block;
}

.mood-filters {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: thin;
}

.mpill {
  padding: 6px 14px;
  border-radius: var(--rf);
  font-size: .78rem;
  font-weight: 600;
  border: 1.5px solid var(--border-soft);
  background: var(--card);
  color: var(--textl);
  transition: var(--tr);
  white-space: nowrap;
  flex-shrink: 0;
}

.mpill.on,
.mpill:hover {
  background: linear-gradient(135deg, #f07090, #e8587a);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(232, 88, 122, .26);
}

/* ========== SCRAPBOOK TIMELINE & ENTRY CARDS ========== */
.entries.timeline-list {
  padding: 10px 0 16px 22px;
  position: relative;
}

.entries.timeline-list::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 22px;
  bottom: 28px;
  width: 2px;
  background: repeating-linear-gradient(
    to bottom,
    var(--rose-l) 0,
    var(--rose-l) 6px,
    transparent 6px,
    transparent 12px
  );
  opacity: 0.65;
}

.ecard {
  position: relative;
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--rm);
  margin-bottom: 22px;
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--sh);
  animation: slideUp .38s ease both;
  transition: transform var(--tr), box-shadow var(--tr);
}

/* Timeline dot */
.ecard::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 24px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--rose);
  border: 2.5px solid var(--cream);
  box-shadow: 0 0 0 2px rgba(232, 88, 122, 0.25);
  z-index: 2;
}

/* Dudu Card Styling (Warm Caramel) */
.ecard.ecard-dudu {
  background: var(--card-dudu);
  border-left: 4.5px solid var(--caramel);
}

.ecard.ecard-dudu::before {
  background: var(--caramel);
  box-shadow: 0 0 0 2px rgba(196, 131, 42, 0.28);
}

/* Bubu Card Styling (Sweet Rose) */
.ecard.ecard-bubu {
  background: var(--card-bubu);
  border-left: 4.5px solid var(--rose);
}

.ecard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shm);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ecard-head {
  padding: 15px 20px 12px;
  border-bottom: 1px dashed var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.ecard-head-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.author-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface);
  padding: 2px;
  flex-shrink: 0;
}

.ecard-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.author-badge-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.author-chip {
  font-size: .69rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: var(--rf);
}

.chip-dudu {
  background: var(--caramel-f);
  color: var(--caramel-d);
}

.chip-bubu {
  background: var(--rose-f);
  color: var(--rose-p);
}

.ecard-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.4rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.ecard-dudu .ecard-title {
  color: var(--caramel-d);
}

.ecard-bubu .ecard-title {
  color: var(--rose-p);
}

.ecard-date {
  font-size: .72rem;
  color: var(--textm);
}

/* Mood Tags */
.mood-tag {
  padding: 4px 11px;
  border-radius: var(--rf);
  font-size: .73rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.mood-love {
  background: rgba(232, 88, 122, .14);
  color: var(--rose-p);
  border: 1px solid rgba(232, 88, 122, .3);
}

.mood-happy {
  background: rgba(196, 131, 42, .14);
  color: var(--caramel-d);
  border: 1px solid rgba(196, 131, 42, .3);
}

.mood-peace {
  background: rgba(52, 211, 153, .14);
  color: #059669;
  border: 1px solid rgba(52, 211, 153, .3);
}

[data-theme="night"] .mood-peace {
  color: #6ee7b7;
}

.mood-sulky {
  background: rgba(249, 115, 22, .15);
  color: #ea580c;
  border: 1px solid rgba(249, 115, 22, .32);
}

[data-theme="night"] .mood-sulky {
  color: #fdba74;
}

.mood-miss {
  background: rgba(167, 139, 250, .15);
  color: #7c3aed;
  border: 1px solid rgba(167, 139, 250, .3);
}

[data-theme="night"] .mood-miss {
  color: #c4b5fd;
}

.mood-default {
  background: rgba(160, 128, 112, .14);
  color: var(--textl);
  border: 1px solid rgba(160, 128, 112, .25);
}

.ecard-body {
  padding: 18px 20px 14px;
}

.ecard-text {
  font-size: .94rem;
  line-height: 1.88;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ========== POLAROID PHOTO & WASHI TAPE ========== */
.polaroid-wrap {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.polaroid-card {
  position: relative;
  background: #fffdf9;
  padding: 10px 10px 22px;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.06);
  max-width: 340px;
  width: 100%;
  transform: rotate(-1.2deg);
  transition: transform .3s ease, box-shadow .3s ease;
  cursor: zoom-in;
}

.ecard-bubu .polaroid-card {
  transform: rotate(1.2deg);
}

.polaroid-card:hover {
  transform: rotate(0deg) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.polaroid-card img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.polaroid-caption {
  font-family: 'Dancing Script', cursive;
  font-size: 1.05rem;
  color: #5c4038;
  text-align: center;
  margin-top: 8px;
}

.washi-tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 86px;
  height: 22px;
  background: repeating-linear-gradient(
    45deg,
    rgba(244, 114, 150, 0.55),
    rgba(244, 114, 150, 0.55) 6px,
    rgba(255, 228, 235, 0.65) 6px,
    rgba(255, 228, 235, 0.65) 12px
  );
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  pointer-events: none;
}

.polaroid-preview {
  max-width: 220px;
  margin: 0 auto;
  cursor: default;
}

.photo-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-upload-btn {
  cursor: pointer;
  margin-bottom: 0 !important;
}

/* Lightbox */
.lightbox-overlay {
  background: rgba(15, 10, 10, 0.86);
}

.lightbox-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.2rem;
}

/* ========== MUSIC EMBED ========== */
.music-embed {
  margin-top: 14px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.music-embed-label {
  padding: 8px 14px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--rose);
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--rose-f);
}

.music-embed iframe {
  display: block;
  width: 100%;
  border: none;
}

.music-link {
  background: var(--rose-f);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.music-link a {
  color: var(--rose);
  font-size: .86rem;
  font-weight: 600;
}

/* ========== COUPLE INTERACTION: REACTIONS & STICKY NOTE REPLIES ========== */
.ecard-interact {
  padding: 10px 20px 16px;
  border-top: 1px dashed var(--border-soft);
}

.reaction-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.reaction-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--rf);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--textl);
  font-size: .74rem;
  font-weight: 600;
  transition: var(--tr);
}

.react-btn:hover:not(:disabled) {
  border-color: var(--rose);
  transform: translateY(-1px);
}

.react-btn.active {
  background: var(--rose-f);
  border-color: var(--rose);
  color: var(--rose-p);
  font-weight: 700;
}

.react-who {
  font-size: .72rem;
}

.reply-toggle-btn {
  background: none;
  border: none;
  font-size: .78rem;
  font-weight: 700;
  color: var(--rose);
  padding: 4px 8px;
  border-radius: var(--rf);
  transition: var(--tr);
}

.reply-toggle-btn:hover {
  background: var(--rose-f);
}

/* Sticky Note Replies */
.replies-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.reply-note {
  position: relative;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-left: 3.5px solid var(--caramel);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: .84rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.reply-note.reply-bubu {
  border-left-color: var(--rose);
}

.reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: .73rem;
  color: var(--textl);
}

.reply-author {
  font-weight: 700;
  color: var(--text2);
}

.reply-del-btn {
  background: none;
  border: none;
  color: var(--textm);
  font-size: .72rem;
  padding: 0 4px;
}

.reply-del-btn:hover {
  color: #ef4444;
}

.reply-text {
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply-form {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.reply-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  font-size: .83rem;
  resize: none;
  min-height: 38px;
  outline: none;
}

.reply-input:focus {
  border-color: var(--rose);
}

.ecard-actions {
  padding: 0 20px 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ========== EMPTY ========== */
.empty {
  text-align: center;
  padding: 64px 24px;
}

.empty-icon {
  font-size: 3.6rem;
  display: block;
  margin-bottom: 14px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.85rem;
  color: var(--text2);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: .86rem;
  color: var(--textl);
}

/* ========== FAB ========== */
.fab {
  position: fixed;
  bottom: 24px;
  right: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--purple));
  color: #fff;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 26px rgba(232, 88, 122, .45);
  border: none;
  z-index: 90;
  transition: var(--tr);
}

.fab:hover {
  transform: scale(1.1) rotate(8deg);
}

/* ========== ADMIN / SETTINGS PANEL ========== */
.admin-wrap {
  padding: 22px 0 80px;
}

.section-card {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--rm);
  padding: 22px;
  margin-bottom: 18px;
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--sh);
}

.section-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.65rem;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-soft), transparent);
  margin: 24px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat {
  background: var(--surface);
  border-radius: var(--rm);
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--border-soft);
  box-shadow: var(--sh);
  transition: var(--tr);
}

.stat:hover {
  transform: translateY(-3px);
}

.stat-ico {
  font-size: 1.4rem;
  margin-bottom: 5px;
}

.stat-val {
  font-family: 'Dancing Script', cursive;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--rose);
  line-height: 1.05;
  display: block;
}

.stat-lbl {
  font-size: .72rem;
  color: var(--textl);
  font-weight: 600;
  margin-top: 4px;
}

.pwd-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--rose-f);
  border: 1.5px dashed rgba(232, 88, 122, .35);
  border-radius: var(--r);
  padding: 13px 18px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: var(--tr);
}

.pwd-val {
  font-family: 'Dancing Script', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rose);
  letter-spacing: 3px;
  flex: 1;
}

.pwd-hint {
  font-size: .73rem;
  color: var(--textm);
}

.expiry-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.preset {
  padding: 6px 14px;
  border-radius: var(--rf);
  border: 1.5px solid var(--border-soft);
  background: var(--surface);
  color: var(--text2);
  font-size: .78rem;
  font-weight: 600;
  transition: var(--tr);
}

.preset:hover,
.preset.on {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}

.post-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface);
  border-radius: var(--r);
  margin-bottom: 8px;
  border: 1px solid var(--border-soft);
}

.post-item-title {
  flex: 1;
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-item-date {
  font-size: .72rem;
  color: var(--textm);
}

.post-item-acts {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ========== MODALS (POST, STATUS, MEMORY JAR) ========== */
.modal-card {
  background: var(--modal-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--rm);
  padding: 26px;
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shm);
  border: 1.5px solid var(--border-soft);
  animation: popIn .28s ease;
}

.modal-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.65rem;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mood-group-label {
  width: 100%;
  font-size: .72rem;
  font-weight: 700;
  color: var(--textm);
  margin: 6px 0 2px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.mood-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mopt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px;
  border-radius: var(--r);
  border: 1.5px solid var(--border-soft);
  background: var(--surface);
  cursor: pointer;
  transition: var(--tr);
  font-size: .71rem;
  font-weight: 600;
  color: var(--textl);
  min-width: 68px;
  text-align: center;
}

.mopt .memi {
  font-size: 1.35rem;
}

.mopt:hover {
  border-color: var(--rose-l);
  transform: translateY(-2px);
}

.mopt.on {
  border-color: var(--rose);
  background: var(--rose-f);
  color: var(--rose-p);
  transform: translateY(-2px);
}

textarea.input {
  resize: vertical;
  min-height: 140px;
  line-height: 1.75;
}

.spellcheck-box {
  margin-top: 10px;
  font-size: 0.84rem;
  background: var(--surface);
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--border-soft);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* Status Presets */
.status-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.status-preset-chip {
  padding: 6px 12px;
  border-radius: var(--rf);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text2);
  font-size: .78rem;
  transition: var(--tr);
}

.status-preset-chip:hover {
  background: var(--rose-f);
  border-color: var(--rose);
}

/* Memory Jar Modal */
.jar-modal-card {
  max-width: 540px;
}

.jar-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Dancing Script', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--caramel-d);
  margin-bottom: 14px;
}

/* Author Picker */
.author-picker {
  display: flex;
  gap: 12px;
}

.author-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px 8px;
  border-radius: var(--rm);
  border: 2px solid var(--border-soft);
  background: var(--surface);
  cursor: pointer;
  transition: var(--tr);
  position: relative;
}

.author-opt.on {
  border-color: var(--rose);
  background: var(--rose-f);
}

#authorDudu.on {
  border-color: var(--caramel);
  background: var(--caramel-f);
}

.author-opt.on::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: .72rem;
  font-weight: 800;
  color: var(--rose);
}

.author-opt video {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 50%;
}

.author-opt-name {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text2);
}

/* ========== CONFIRM & EXPIRED ========== */
.confirm-card,
.expired-card {
  background: var(--modal-bg);
  border-radius: var(--rm);
  padding: 32px 26px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shm);
  border: 1.5px solid var(--border-soft);
}

.confirm-card p {
  font-size: .92rem;
  line-height: 1.65;
  margin-bottom: 20px;
  color: var(--text2);
}

.confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.expired-ico {
  font-size: 3.6rem;
  display: block;
  margin-bottom: 14px;
}

.expired-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2rem;
  color: var(--rose);
  margin-bottom: 8px;
}

.expired-desc {
  font-size: .86rem;
  color: var(--textl);
  line-height: 1.7;
  margin-bottom: 22px;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(45, 26, 22, 0.94);
  color: #fff;
  padding: 11px 22px;
  border-radius: var(--rf);
  font-size: .85rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: all .3s ease;
  pointer-events: none;
  max-width: 92vw;
  text-align: center;
  box-shadow: var(--shm);
}

.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.ok {
  background: rgba(22, 163, 74, 0.94);
}

.toast.er {
  background: rgba(220, 38, 38, 0.94);
}

/* ========== PAGINATION ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 18px 0 90px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r);
  border: 1.5px solid var(--border-soft);
  background: var(--card);
  color: var(--textl);
  font-size: .82rem;
  font-weight: 600;
  transition: var(--tr);
}

.page-btn.on,
.page-btn:hover:not(:disabled) {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-info {
  font-size: .78rem;
  color: var(--textm);
  padding: 0 6px;
}

/* ========== FALLING HEARTS ========== */
.hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.heart {
  position: absolute;
  top: -10%;
  font-size: 20px;
  animation: fall linear forwards;
  opacity: 0;
}

@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.85; }
  90% { opacity: 0.85; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  .nav-inner {
    flex-direction: column;
    gap: 10px;
  }

  .nav-actions {
    width: 100%;
    justify-content: center;
  }

  .couple-hero {
    padding: 16px 14px;
  }

  .love-days-num {
    font-size: 2.15rem;
  }

  .love-avatar-badge {
    min-width: 62px;
  }

  .love-avatar-badge video {
    width: 48px;
    height: 48px;
  }

  .couple-status-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .scrapbook-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .author-filter-group {
    justify-content: center;
  }

  .toolbar-right {
    justify-content: space-between;
  }

  .entries.timeline-list {
    padding-left: 16px;
  }

  .entries.timeline-list::before {
    left: 4px;
  }

  .ecard::before {
    left: -17px;
    width: 9px;
    height: 9px;
  }

  .ecard-head {
    flex-direction: column;
    padding: 13px 15px 10px;
  }

  .ecard-body {
    padding: 14px 15px 12px;
  }

  .ecard-interact {
    padding: 10px 15px 14px;
  }

  .ecard-text {
    font-size: .97rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-card {
    padding: 20px 16px;
  }
}


/* ========== DEDICATED WRITE PAGE (#pageWrite) ========== */
.write-page-wrap {
  padding: 20px 18px 80px;
}

.write-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.draft-status {
  font-size: .75rem;
  color: var(--textm);
  font-weight: 600;
}

.write-paper-card {
  background: var(--card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--rm);
  padding: 28px;
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shm);
  animation: fadeIn .28s ease;
}

.write-paper-card.paper-dudu {
  border-top: 5px solid var(--caramel);
}

.write-paper-card.paper-bubu {
  border-top: 5px solid var(--rose);
}

.write-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px dashed var(--border-soft);
  flex-wrap: wrap;
}

.write-page-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2.05rem;
  color: var(--text);
  line-height: 1.2;
}

.write-page-sub {
  font-size: .82rem;
  color: var(--textl);
  margin-top: 4px;
}

.writer-identity-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 10px;
  border-radius: var(--rf);
  background: var(--caramel-f);
  border: 1.5px solid var(--caramel-l);
}

.writer-identity-badge.is-bubu {
  background: var(--rose-f);
  border-color: rgba(232, 88, 122, 0.35);
}

.writer-identity-badge video {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--surface);
}

.writer-badge-lbl {
  font-size: .68rem;
  color: var(--textm);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .04em;
}

.writer-badge-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
}

.write-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 24px;
  align-items: start;
}

.write-title-input {
  font-size: 1.04rem;
  font-weight: 600;
  padding: 13px 16px;
}

.write-content-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.write-textarea {
  min-height: 330px;
  font-size: .96rem;
  line-height: 1.88;
  padding: 15px 16px;
}

.write-meta-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: .74rem;
  color: var(--textm);
}

.clear-draft-link {
  background: none;
  border: none;
  color: var(--textm);
  font-size: .74rem;
  text-decoration: underline;
}

.clear-draft-link:hover {
  color: #ef4444;
}

.write-side-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.write-side-box {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  padding: 14px 15px;
}

.write-side-box label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 8px;
}

.mood-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.more-moods-link {
  background: var(--rose-f);
  border: 1px solid rgba(232, 88, 122, 0.3);
  color: var(--rose-p);
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--rf);
  transition: var(--tr);
}

.more-moods-link:hover {
  background: var(--rose);
  color: #fff;
  transform: translateX(2px);
}

.selected-mood-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--rose-f);
  font-size: .8rem;
  color: var(--textl);
  margin-bottom: 10px;
}

.selected-mood-banner strong {
  color: var(--rose-p);
  font-size: .88rem;
}

.compact-mood-grid .mopt {
  min-width: 62px;
  padding: 7px 8px;
}

.upload-status-note {
  margin-top: 8px;
  font-size: .76rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--rose-f);
  color: var(--text2);
}

.write-footer-actions {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.write-submit-btn {
  min-width: 240px;
  padding: 13px 28px;
  font-size: .95rem;
}

/* ========== MOOD GALLERY PAGE (#pageMoods) ========== */
.moods-page-wrap {
  padding: 20px 18px 80px;
}

.current-mood-pill-top {
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  padding: 6px 14px;
  border-radius: var(--rf);
  font-size: .8rem;
  color: var(--textl);
}

.current-mood-pill-top strong {
  color: var(--rose-p);
}

.moods-gallery-card {
  padding: 26px;
}

.moods-gallery-search-row {
  margin-top: 14px;
  margin-bottom: 18px;
}

.custom-mood-creator {
  background: var(--surface);
  border: 1.5px dashed rgba(232, 88, 122, 0.35);
  border-radius: var(--r);
  padding: 15px 16px;
  margin-bottom: 22px;
}

.custom-creator-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 10px;
}

.quick-emoji-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.emoji-pick-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: var(--card);
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--tr);
}

.emoji-pick-btn:hover,
.emoji-pick-btn.on {
  border-color: var(--rose);
  background: var(--rose-f);
  transform: scale(1.12);
}

.custom-creator-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mood-cat-block {
  margin-bottom: 22px;
}

.mood-cat-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-soft);
}

.mood-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 9px;
}

.gallery-mood-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1.5px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
  text-align: left;
  transition: var(--tr);
}

.gallery-mood-item .g-emo {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.gallery-mood-item:hover {
  border-color: var(--rose);
  background: var(--rose-f);
  transform: translateY(-2px);
}

.gallery-mood-item.on {
  border-color: var(--rose);
  background: linear-gradient(135deg, #f07090, #e8587a);
  color: #fff;
  box-shadow: 0 4px 12px rgba(232, 88, 122, 0.3);
}

@media (max-width: 820px) {
  .write-grid {
    grid-template-columns: 1fr;
  }

  .write-paper-card {
    padding: 20px 16px;
  }

  .write-textarea {
    min-height: 240px;
  }

  .write-submit-btn {
    width: 100%;
  }

  .mood-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ========== SMART MOOD POPOVER & MOBILE BOTTOM SHEET (#diary) ========== */
.scrapbook-toolbar {
  margin: 6px 0 10px;
}

.mood-pop-anchor {
  position: relative;
  display: inline-flex;
}

.mood-trigger-group {
  display: inline-flex;
  align-items: center;
  border-radius: var(--rf);
  border: 1.5px solid var(--border-soft);
  background: var(--card);
  transition: var(--tr);
}

.mood-trigger-group:hover {
  border-color: var(--rose);
}

.mood-trigger-group.active {
  background: linear-gradient(135deg, #f07090, #e8587a);
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(232, 88, 122, 0.3);
}

.mood-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: .78rem;
  font-weight: 700;
  border-radius: var(--rf);
  max-width: 190px;
}

.mood-trigger-btn #moodTriggerLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mood-trigger-group.active .mood-trigger-btn {
  color: #fff;
  padding-right: 6px;
}

.mood-caret {
  font-size: .72rem;
  opacity: 0.75;
  transition: transform .22s ease;
}

.mood-pop-anchor.open .mood-caret {
  transform: rotate(180deg);
}

.mood-clear-chip {
  border: none;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: .68rem;
  font-weight: 800;
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--tr);
}

.mood-clear-chip:hover {
  background: rgba(255, 255, 255, 0.42);
  transform: scale(1.1);
}

.mood-sheet-backdrop {
  display: none;
}

.mood-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 330px;
  background: var(--modal-bg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1.5px solid var(--border-soft);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shm);
  z-index: 160;
  display: none;
  animation: fadeIn .2s ease;
}

.mood-pop-anchor.open .mood-popover {
  display: block;
}

.sheet-handle {
  display: none;
}

.mood-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mood-pop-title {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text2);
}

.mood-pop-reset {
  border: none;
  background: var(--rose-f);
  color: var(--rose-p);
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--rf);
}

.mood-popover .mood-search-wrap {
  max-width: 100%;
  margin-bottom: 10px;
}

.mood-popover .mood-search {
  padding: 7px 30px 7px 12px;
  font-size: .8rem;
  background: var(--surface);
}

.mood-pop-list {
  max-height: 270px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 2px;
}

.mood-pop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
  text-align: left;
  transition: var(--tr);
}

.mood-pop-item:hover {
  border-color: var(--rose-l);
  background: var(--rose-f);
}

.mood-pop-item.on {
  background: linear-gradient(135deg, #f07090, #e8587a);
  color: #fff;
}

.mood-pop-count {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--rf);
  background: rgba(160, 128, 112, 0.14);
  color: var(--textl);
  flex-shrink: 0;
}

.mood-pop-item.on .mood-pop-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.mood-pop-empty {
  text-align: center;
  padding: 18px 10px;
  font-size: .78rem;
  color: var(--textm);
}

/* Mobile: biến Popover thành Bottom Sheet mượt mà */
@media (max-width: 640px) {
  .toolbar-right {
    justify-content: center;
    gap: 6px;
  }

  .mood-pop-anchor.open .mood-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(25, 14, 16, 0.42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 240;
  }

  .mood-popover {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 10px 18px 26px;
    z-index: 250;
    animation: sheetUp .24s cubic-bezier(.2, .8, .2, 1);
  }

  .sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(160, 128, 112, 0.35);
    margin: 2px auto 12px;
  }

  .mood-pop-list {
    max-height: 52vh;
  }
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}


/* ========== STRUCTURED ADMIN DASHBOARD (#pageAdmin) ========== */
.admin-hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--rm);
  padding: 16px 22px;
  margin-bottom: 14px;
  box-shadow: var(--sh);
  flex-wrap: wrap;
}

.admin-hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-hero-vid {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: contain;
  background: var(--surface);
  padding: 3px;
  flex-shrink: 0;
}

.admin-page-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.85rem;
  color: var(--text);
  line-height: 1.15;
}

.admin-page-sub {
  font-size: .78rem;
  color: var(--textl);
  margin-top: 2px;
}

.admin-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-wrap .stats-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.admin-wrap .stat {
  padding: 12px 10px;
}

.admin-wrap .stat-ico {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.admin-wrap .stat-val {
  font-size: 1.85rem;
}

/* Admin Sub-Navigation */
.admin-subnav {
  display: flex;
  gap: 6px;
  background: var(--card);
  padding: 5px;
  border-radius: var(--rf);
  border: 1.5px solid var(--border-soft);
  margin-bottom: 18px;
  box-shadow: var(--sh);
  overflow-x: auto;
}

.admin-subtab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--rf);
  border: none;
  background: transparent;
  color: var(--textl);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: var(--tr);
}

.admin-subtab:hover {
  color: var(--rose);
}

.admin-subtab.on {
  background: linear-gradient(135deg, #f07090, #e8587a);
  color: #fff;
  box-shadow: 0 3px 12px rgba(232, 88, 122, 0.28);
}

.adm-tab-badge {
  font-size: .7rem;
  padding: 1px 7px;
  border-radius: var(--rf);
  background: rgba(232, 88, 122, 0.14);
  color: var(--rose-p);
}

.admin-subtab.on .adm-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.admin-panel {
  display: none;
}

.admin-panel.on {
  display: block;
  animation: fadeIn .22s ease;
}

.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.admin-col-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-col-stack .section-card {
  margin-bottom: 0;
}

.accent-bubu-card {
  border-top: 4px solid var(--rose);
}

.accent-dudu-card {
  border-top: 4px solid var(--caramel);
}

.card-head-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.card-head-compact .section-title {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.mini-pill {
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--rf);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--textl);
}

.mini-pill.rose {
  background: var(--rose-f);
  color: var(--rose-p);
}

.mini-pill.caramel {
  background: var(--caramel-f);
  color: var(--caramel-d);
}

.card-desc-sm {
  font-size: .8rem;
  color: var(--textl);
  line-height: 1.55;
  margin-bottom: 12px;
}

.inline-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form-row > .input {
  flex: 1;
  min-width: 150px;
  padding: 9px 13px;
  font-size: .86rem;
}

.toggle-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toggle-setting-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

/* Secret Masking Box */
.secret-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1.5px dashed var(--border-soft);
  border-radius: 13px;
  padding: 9px 12px;
  margin-bottom: 12px;
}

.secret-val-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.secret-lbl {
  font-size: .68rem;
  color: var(--textm);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .04em;
}

.secret-code {
  font-family: 'Be Vietnam Pro', monospace;
  font-size: .95rem;
  font-weight: 700;
  color: var(--rose-p);
  letter-spacing: 1px;
  word-break: break-all;
}

.secret-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-mini-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: var(--card);
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--tr);
}

.icon-mini-btn:hover {
  border-color: var(--rose);
}

.compact-cd {
  padding: 8px 14px;
  margin: 0 0 12px;
}

/* Admin Posts Manager Toolbar */
.adm-posts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.adm-posts-search {
  flex: 1;
  min-width: 220px;
}

.adm-posts-search .input {
  padding: 9px 14px;
  font-size: .85rem;
}

.adm-posts-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.adm-author-select {
  width: auto;
  padding: 8px 12px;
  font-size: .82rem;
  font-weight: 600;
}

@media (max-width: 760px) {
  .admin-two-col {
    grid-template-columns: 1fr;
  }

  .admin-wrap .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ========== ECARD HEAD V2 & MOBILE APP-LIKE OPTIMIZATION ========== */
.mobile-bottom-nav {
  display: none;
}

.date-mobile {
  display: none;
}

.ecard-head.ecard-head-v2 {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 14px 20px 12px;
}

.ecard-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ecard-author-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ecard-title-full {
  width: 100%;
  font-size: 1.48rem;
  line-height: 1.32;
}

@media (max-width: 640px) {
  /* Chừa khoảng trống cho Bottom Navigation Bar */
  body.logged-in {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .wrap {
    padding: 0 12px;
  }

  /* 1. Top Bar mỏng 1 dòng duy nhất (~50px) */
  .navbar {
    padding: 7px 0;
  }

  .nav-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    gap: 6px;
  }

  .brand {
    font-size: 1.42rem;
    white-space: nowrap;
  }

  .brand-prefix {
    display: none;
  }

  .nav-tab-bar {
    display: none !important;
  }

  .nav-actions {
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 5px;
  }

  .icon-pill-btn {
    width: 32px;
    height: 32px;
    font-size: .9rem;
  }

  .role-pill {
    font-size: .68rem;
    padding: 3px 8px;
  }

  .nav-logout-btn {
    padding: 4px 8px;
    font-size: .72rem;
  }

  /* Ẩn FAB trôi nổi trên mobile vì đã có nút Viết bài nổi bật giữa Bottom Bar */
  .fab {
    display: none !important;
  }

  .toast {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  /* Bottom Navigation Bar chuẩn Mobile App */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding: 4px 10px env(safe-area-inset-bottom, 0px);
    background: var(--nav-bg);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border-top: 1.5px solid var(--border-soft);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 180;
  }

  .mnav-item {
    flex: 1;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--textm);
    padding: 4px 0;
    transition: var(--tr);
  }

  .mnav-ico {
    font-size: 1.2rem;
    line-height: 1.1;
  }

  .mnav-lbl {
    font-size: .66rem;
    font-weight: 700;
  }

  .mnav-item.on {
    color: var(--rose);
  }

  .mnav-item.mnav-write-cta {
    color: var(--rose-p);
  }

  .mnav-write-circle {
    width: 36px;
    height: 36px;
    margin-top: -14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f07090, #e8587a, #c93d62);
    color: #fff;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(232, 88, 122, 0.42);
    border: 2.5px solid var(--cream);
  }

  /* 2. Couple Hero thu gọn chiều cao một nửa, 2 cột trạng thái ngang */
  .couple-hero {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 11px 12px 10px;
    border-radius: 18px;
  }

  .love-counter-row {
    gap: 8px;
    padding-bottom: 9px;
  }

  .love-avatar-badge {
    min-width: 42px;
  }

  .love-avatar-badge video {
    width: 38px;
    height: 38px;
    padding: 2px;
  }

  .love-avatar-badge span {
    display: none;
  }

  .love-days-label {
    font-size: .65rem;
  }

  .love-days-num {
    font-size: 1.75rem;
    margin: 0;
  }

  .love-days-num small {
    font-size: 1rem;
  }

  .love-days-since {
    font-size: .67rem;
  }

  .couple-status-grid {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 9px;
  }

  .status-bubble {
    padding: 7px 9px;
    border-radius: 12px;
  }

  .status-who {
    font-size: .65rem;
    margin-bottom: 2px;
  }

  .status-edit-hint {
    font-size: .6rem;
    padding: 0 5px;
  }

  .status-text {
    font-size: .75rem;
    line-height: 1.32;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* 3. Thanh Lọc ép gọn đúng 1 hàng ngang */
  .scrapbook-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 4px 0 8px;
    flex-wrap: nowrap;
  }

  .author-filter-group {
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
  }

  .af-btn {
    padding: 5px 8px;
    font-size: .72rem;
  }

  .toolbar-right {
    gap: 5px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 0;
  }

  /* Hũ kỷ niệm đã có trên Bottom Bar nên ẩn nút trên toolbar mobile */
  .scrapbook-toolbar .jar-btn {
    display: none;
  }

  .mood-trigger-btn {
    padding: 5px 9px;
    font-size: .72rem;
    max-width: 132px;
  }

  .sort-toggle {
    padding: 5px 9px;
    font-size: .74rem;
    flex-shrink: 0;
  }

  .sort-toggle #sortLabel {
    display: none;
  }

  /* 4. Content Card rộng tối đa, bỏ lề Timeline trái, Reaction 1 dòng gọn */
  .entries.timeline-list {
    padding: 4px 0 12px 0;
  }

  .entries.timeline-list::before,
  .ecard::before {
    display: none;
  }

  .ecard {
    border-radius: 18px;
    margin-bottom: 14px;
  }

  .ecard-head.ecard-head-v2 {
    padding: 11px 13px 9px;
    gap: 6px;
  }

  .author-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .date-desktop {
    display: none;
  }

  .date-mobile {
    display: inline;
    font-size: .69rem;
  }

  .mood-tag {
    font-size: .68rem;
    padding: 3px 9px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ecard-title-full {
    font-size: 1.32rem;
  }

  .ecard-body {
    padding: 12px 13px 11px;
  }

  .ecard-text {
    font-size: .94rem;
    line-height: 1.78;
  }

  .polaroid-card {
    max-width: 280px;
    padding: 8px 8px 16px;
  }

  .ecard-interact {
    padding: 8px 13px 11px;
  }

  .reaction-bar {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .reaction-btns {
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .reaction-btns::-webkit-scrollbar {
    display: none;
  }

  .react-btn {
    padding: 4px 7px;
    font-size: .78rem;
    flex-shrink: 0;
  }

  .react-lbl,
  .reply-lbl-extra {
    display: none;
  }

  .reply-toggle-btn {
    font-size: .74rem;
    padding: 4px 6px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .ecard-actions {
    padding: 0 13px 11px;
  }

  .pagination {
    padding-bottom: 24px;
  }
}


/* ========== MOBILE-OPTIMIZED LOGIN EXPERIENCE ========== */
#loginOverlay.login-screen {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-items: safe center;
  padding: max(16px, env(safe-area-inset-top, 16px)) 14px max(20px, env(safe-area-inset-bottom, 20px));
}

#loginOverlay .login-wrap {
  margin: auto;
  max-width: 410px;
}

.sr-only-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.login-card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.login-mini-tag {
  font-size: .72rem;
  font-weight: 700;
  color: var(--rose-p);
  background: var(--rose-f);
  padding: 4px 11px;
  border-radius: var(--rf);
  border: 1px solid var(--border-soft);
}

.login-brand-hero {
  text-align: center;
  margin-bottom: 18px;
}

.login-mascot-ring {
  width: 76px;
  height: 76px;
  margin: 0 auto 8px;
  border-radius: 50%;
  padding: 4px;
  background: var(--caramel-f);
  border: 2.5px solid var(--caramel);
  box-shadow: 0 6px 18px rgba(196, 131, 42, 0.22);
  transition: var(--tr);
}

.login-mascot-ring.mode-bubu {
  background: var(--rose-f);
  border-color: var(--rose);
  box-shadow: 0 6px 18px rgba(232, 88, 122, 0.25);
}

.login-mascot-ring.mode-reader {
  background: rgba(167, 139, 250, 0.14);
  border-color: var(--purple);
  box-shadow: 0 6px 18px rgba(167, 139, 250, 0.22);
}

.login-mascot-ring video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  background: var(--surface);
  display: block;
}

.login-brand-hero .login-site-title {
  font-size: 2.35rem;
  line-height: 1.15;
  margin-bottom: 2px;
}

.login-brand-hero .login-cursive-sub {
  font-size: 1.18rem;
  margin-bottom: 0;
  color: var(--textl);
}

/* 3 Role Selector Cards */
.login-role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.role-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px 9px;
  border-radius: 16px;
  border: 1.5px solid var(--border-soft);
  background: var(--surface);
  color: var(--textl);
  transition: var(--tr);
  -webkit-tap-highlight-color: transparent;
}

.role-card-btn .rc-emo {
  font-size: 1.35rem;
  line-height: 1.15;
}

.role-card-btn .rc-name {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}

.role-card-btn .rc-sub {
  font-size: .66rem;
  color: var(--textm);
  font-weight: 600;
}

.role-card-btn.on {
  transform: translateY(-2px);
}

#tabDudu.role-card-btn.on {
  background: var(--caramel-f);
  border-color: var(--caramel);
  box-shadow: 0 5px 14px rgba(196, 131, 42, 0.22);
}

#tabDudu.role-card-btn.on .rc-name {
  color: var(--caramel-d);
}

#tabBubu.role-card-btn.on {
  background: var(--rose-f);
  border-color: var(--rose);
  box-shadow: 0 5px 14px rgba(232, 88, 122, 0.24);
}

#tabBubu.role-card-btn.on .rc-name {
  color: var(--rose-p);
}

#tabReader.role-card-btn.on {
  background: rgba(167, 139, 250, 0.14);
  border-color: var(--purple);
  box-shadow: 0 5px 14px rgba(167, 139, 250, 0.22);
}

/* Input >= 16px (1rem) prevents iOS Safari auto-zoom on focus! */
.login-pwd-input {
  font-size: 1rem !important;
  padding: 13px 46px 13px 15px;
  border-radius: 14px;
}

.eye-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--textm);
  -webkit-tap-highlight-color: transparent;
}

.eye-btn:active {
  background: var(--rose-f);
}

.login-submit-btn {
  padding: 13px 22px;
  font-size: .95rem;
  border-radius: 14px;
}

.login-card.shake-err {
  animation: cardShake .38s ease;
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@media (max-width: 640px) {
  #loginOverlay.login-screen {
    align-items: flex-start;
  }

  #loginOverlay .login-wrap {
    margin-top: auto;
    margin-bottom: auto;
  }

  #loginOverlay .login-card {
    padding: 20px 18px 20px;
    border-radius: 24px;
  }

  .login-mascot-ring {
    width: 68px;
    height: 68px;
  }

  .login-brand-hero .login-site-title {
    font-size: 2.1rem;
  }

  .login-brand-hero .login-cursive-sub {
    font-size: 1.08rem;
  }

  .login-footer-note {
    font-size: .72rem;
    padding: 6px 12px;
    max-width: 94%;
    border-radius: 14px;
    margin-top: 10px;
  }
}
