/* ==========================================================
   Dear Letters — app shell for phones
   Bottom tab bar + compact header, shared by every public page.
   Loaded at the end of <body> so it wins over page styles.
   ========================================================== */

.app-tabbar,
.app-fab {
  display: none;
}

/* ── "Keep your voices alive" banner (all screen sizes) ─────── */
.support-banner {
  position: relative;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 7px 44px 7px 16px;
  background: linear-gradient(90deg, rgba(87, 136, 254, 0.18), rgba(181, 23, 162, 0.3));
  border-bottom: 1px solid rgba(229, 168, 255, 0.25);
  color: #eadcff;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.35;
}

.support-banner-text {
  text-align: right;
}

.support-banner-btn {
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #b517a2, #5788fe);
  box-shadow: 0 0 14px rgba(181, 23, 162, 0.4);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.support-banner-btn:hover {
  transform: translateY(-1px);
}

.support-banner-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(234, 220, 255, 0.7);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.support-banner-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ── Always-visible side button ────────────────────────────── */
.support-side {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 9px;
  border: 1px solid rgba(240, 196, 255, 0.45);
  border-right: none;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, #b517a2, #5788fe);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
  box-shadow: 0 0 18px rgba(181, 23, 162, 0.45);
  cursor: pointer;
  transition: padding 0.2s ease, box-shadow 0.2s ease;
}

.support-side:hover {
  padding-left: 13px;
  box-shadow: 0 0 26px rgba(181, 23, 162, 0.7);
}

.support-side-heart {
  writing-mode: horizontal-tb;
  font-size: 16px;
  animation: supportBeat 2.4s ease-in-out infinite;
}

@keyframes supportBeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.25); }
  24% { transform: scale(1); }
}

/* ── Support modal ─────────────────────────────────────────── */
.support-modal[hidden] {
  display: none;
}

.support-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: 'Inter', sans-serif;
}

.support-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 2, 15, 0.75);
  backdrop-filter: blur(4px);
}

.support-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
  padding: 30px 26px 24px;
  border-radius: 22px;
  text-align: center;
  color: #d9d2f0;
  background: linear-gradient(160deg, #1b1640, #120f2c);
  border: 1px solid rgba(229, 168, 255, 0.3);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(181, 23, 162, 0.2);
  animation: supportIn 0.25s ease;
}

@keyframes supportIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.support-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #9d93bd;
  font-size: 26px;
  cursor: pointer;
}

.support-icon {
  font-size: 40px;
  margin-bottom: 6px;
}

.support-card h2 {
  font-family: 'Dancing Script', 'Caveat', cursive;
  font-size: 32px;
  font-weight: 700;
  color: #f3e3ff;
  margin-bottom: 12px;
}

.support-card p {
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.support-quiet {
  color: #b8acd9;
  font-style: italic;
}

.support-goal {
  margin: 18px 0;
  text-align: left;
}

.support-goal-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #b8acd9;
  margin-bottom: 8px;
}

.support-goal-row strong {
  color: #fff;
  white-space: nowrap;
}

.support-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.support-bar-fill {
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: linear-gradient(90deg, #5788fe, #b517a2, #f0abfc);
}

.support-donate {
  display: block;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #b517a2, #5788fe);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(181, 23, 162, 0.35);
}

.support-donate--soon {
  background: rgba(255, 255, 255, 0.08);
  color: #b8acd9;
  box-shadow: none;
  font-weight: 500;
}

.support-upi {
  margin-top: 12px;
  font-size: 13.5px !important;
}

.support-thanks {
  margin: 14px 0 0 !important;
  font-size: 13px !important;
  color: #9d93bd;
}

@media (max-width: 768px) {
  .support-banner {
    justify-content: space-between;
    padding: 6px 40px 6px 12px;
    font-size: 12px;
    gap: 8px;
  }

  .support-banner-text {
    text-align: left;
  }

  .support-banner-extra {
    display: none;
  }

  .support-banner-btn {
    font-size: 12px;
    padding: 5px 11px;
  }

  /* Phones: a round heart above the tab bar, opposite the write button */
  .support-side {
    top: auto;
    right: auto;
    left: 14px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: 46px;
    height: 46px;
    padding: 0;
    justify-content: center;
    border: 1px solid rgba(240, 196, 255, 0.45);
    border-radius: 50%;
    writing-mode: horizontal-tb;
    transform: none;
    background: linear-gradient(135deg, #b517a2, #5788fe);
  }

  .support-side:hover {
    padding: 0;
  }

  .support-side-text {
    display: none;
  }

  .support-side-heart {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  /* ── Compact sticky header ─────────────────────────────── */
  .header {
    padding: 8px 0 !important;
  }

  .header .header-content {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 0 12px !important;
  }

  .header .main-title {
    font-size: 1.45rem !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    gap: 0 !important;
    min-width: 0;
    line-height: 1.15;
  }

  .header .title-main {
    gap: 6px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .header .subtitle {
    display: none !important;
  }

  .header .nav {
    flex-wrap: nowrap !important;
    gap: 6px !important;
    flex-shrink: 0;
  }

  /* Home lives in the tab bar now */
  .header .nav-btn[onclick*="index.html"] {
    display: none !important;
  }

  /* Wall pages: the floating button replaces the header's write button */
  .has-app-fab .header .nav {
    display: none !important;
  }

  .has-app-fab .header .main-title {
    align-items: center !important;
    width: 100%;
  }

  .header .nav-btn {
    font-size: 15px !important;
    padding: 6px 12px !important;
    white-space: nowrap;
    border-radius: 999px !important;
  }

  .header .nav-btn .btn-icon {
    font-size: 1em !important;
  }

  /* ── Bottom tab bar ────────────────────────────────────── */
  .app-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 4px env(safe-area-inset-bottom);
    background: rgba(12, 10, 32, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(200, 170, 255, 0.18);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  }

  .app-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: rgba(210, 200, 240, 0.65);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    border-radius: 14px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
  }

  .app-tab-icon {
    font-size: 20px;
    line-height: 1;
    padding: 4px 16px;
    border-radius: 999px;
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .app-tab.active {
    color: #fff;
    font-weight: 600;
  }

  .app-tab.active .app-tab-icon {
    background: linear-gradient(135deg, rgba(181, 23, 162, 0.55), rgba(87, 136, 254, 0.5));
    box-shadow: 0 0 14px rgba(181, 23, 162, 0.35);
  }

  .app-tab:active .app-tab-icon {
    transform: scale(0.9);
  }

  /* ── Floating "write" button on the wall pages ─────────── */
  .app-fab {
    display: flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    right: 16px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 901;
    padding: 12px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #b517a2, #5788fe);
    color: #fff;
    font-family: 'Caveat', 'Dancing Script', cursive;
    font-size: 21px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(181, 23, 162, 0.45);
    -webkit-tap-highlight-color: transparent;
  }

  .app-fab:active {
    transform: scale(0.95);
  }
}
