/* ============================================================
   TATTVAVIDYĀS — Shell styles
   ============================================================ */
/* `hidden` must always win over any element's display rule below
   (a class like .tv-topbar{display:flex} otherwise beats [hidden]). */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

/* Global text-size preference (shell-owned). The Aa control in the top bar
   and the account menu set data-font on <html>; every rem-sized element in
   the shell AND in the mounted mini-apps (all rem-based) scales from this
   single root font-size. One preference for the whole sanctuary. */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html[data-font="large"] { font-size: 19px; }
html[data-font="xl"]    { font-size: 22px; }
body {
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, #421E33 0%, transparent 55%),
    radial-gradient(ellipse 100% 60% at 50% 110%, #36192A 0%, transparent 50%),
    var(--tv-bg);
  color: var(--tv-text);
  font-family: var(--tv-font-ui);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------------- Top bar ---------------- */
.tv-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--tv-safe-top)) 14px 10px;
  background: rgba(30, 14, 20, 0.86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--tv-line);
}
.tv-iconbtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--tv-line);
  color: var(--tv-text); border-radius: 999px;
  padding: 8px 16px; font-size: 0.92rem; font-weight: 500;
}
.tv-iconbtn:active { background: var(--tv-bg-soft); }
.tv-app-title {
  font-family: var(--tv-font-serif); font-size: 1.2rem; font-weight: 600;
  color: var(--app-accent); flex: 1; text-align: center;
}
.tv-topbar-spacer { width: 92px; }

/* Small round icon button variant (Back · Home · text-size). */
.tv-iconbtn.small {
  padding: 0; width: 38px; height: 38px; border-radius: 50%;
  justify-content: center; gap: 0;
}
.tv-navbtn svg { display: block; }

/* Left nav cluster: Back (conditional) + Home (always, while an app is open). */
.tv-topbar-nav { display: flex; align-items: center; gap: 8px; min-width: 84px; }
.tv-fontbtn .tv-font-glyph { font-weight: 700; font-size: 1.02rem; line-height: 1; }
.tv-fontbtn .tv-font-glyph-sm { font-size: 0.7em; }

/* Right-side cluster: text-size button + account control. Kept ~spacer-width
   so the centered app title stays roughly centered against the Back button. */
.tv-topbar-tools { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.tv-topbar-account { position: relative; display: flex; justify-content: flex-end; }
.tv-topacct-btn {
  width: 38px; height: 38px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tv-bg-elev); border: 1px solid var(--tv-line); color: var(--tv-text-soft);
}
.tv-topacct-btn:active { background: var(--tv-bg-soft); }
.tv-topacct-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tv-grad-gold); color: #2A1620;
  font-weight: 700; font-size: 0.9rem; text-transform: uppercase;
}
/* signed-out: show the outline icon, not the gold disc */
.tv-topacct-btn.anon .tv-topacct-avatar { background: transparent; color: var(--tv-text-soft); }
.tv-topacct-avatar.lg { width: 40px; height: 40px; font-size: 1.1rem; }

.tv-topacct-menu {
  position: absolute; top: 46px; right: 0; z-index: 60; min-width: 210px;
  background: var(--tv-bg-warm); border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius-sm); box-shadow: var(--tv-shadow-lg); overflow: hidden;
}
.tv-topacct-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--tv-line); }
.tv-topacct-meta { display: flex; flex-direction: column; min-width: 0; }
.tv-topacct-name { font-size: 0.96rem; font-weight: 700; color: var(--tv-text); word-break: break-word; }
.tv-topacct-email { font-size: 0.76rem; color: var(--tv-text-muted); word-break: break-all; }
.tv-topacct-email:empty { display: none; }
.tv-topacct-logout {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  color: var(--tv-primary-light); padding: 13px 16px; font-family: var(--tv-font-ui);
  font-size: 0.92rem; font-weight: 600;
}
.tv-topacct-logout:active { background: var(--tv-bg-soft); }

/* Signed-out: a sign-in row at the top of the menu (replaces the account head). */
.tv-menu-signin {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  border-bottom: 1px solid var(--tv-line); color: var(--tv-gold-bright);
  padding: 14px 16px; font-family: var(--tv-font-ui); font-size: 0.96rem; font-weight: 700;
}
.tv-menu-signin:active { background: var(--tv-bg-soft); }

/* Menu sections (text size, language). */
.tv-menu-section {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--tv-line);
}
.tv-menu-label { font-size: 0.86rem; color: var(--tv-text-soft); font-weight: 500; }

/* Segmented text-size control: three A's of growing size. */
.tv-fontseg { display: inline-flex; border: 1px solid var(--tv-line); border-radius: 999px; overflow: hidden; }
.tv-fontseg-btn {
  background: transparent; border: 0; color: var(--tv-text-soft);
  width: 34px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--tv-font-serif); font-weight: 700; line-height: 1;
}
.tv-fontseg-btn + .tv-fontseg-btn { border-left: 1px solid var(--tv-line); }
.tv-fontseg-btn[data-size="regular"] { font-size: 0.82rem; }
.tv-fontseg-btn[data-size="large"]   { font-size: 1.0rem; }
.tv-fontseg-btn[data-size="xl"]      { font-size: 1.22rem; }
.tv-fontseg-btn.active { background: var(--tv-grad-gold); color: #2A1620; }

/* Language pill in the menu. */
.tv-menu-langbtn {
  background: transparent; border: 1px solid var(--tv-line); color: var(--tv-text-soft);
  border-radius: 999px; padding: 6px 16px; font-size: 0.86rem; letter-spacing: 0.04em;
}
.tv-menu-langbtn:active { background: var(--tv-bg-soft); }

/* App-injected menu items (e.g. Śrī Nāma's "How it works" / "Reset progress"). */
.tv-menu-appitems:empty { display: none; }
.tv-menu-item {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  color: var(--tv-text); padding: 13px 16px; font-family: var(--tv-font-ui);
  font-size: 0.92rem; font-weight: 600; border-bottom: 1px solid var(--tv-line);
}
.tv-menu-item:active { background: var(--tv-bg-soft); }
.tv-menu-item.danger { color: var(--tv-primary-light); }

/* ---------------- Launcher ---------------- */
.tv-launcher {
  max-width: 720px; margin: 0 auto;
  padding: calc(28px + var(--tv-safe-top)) 20px calc(40px + var(--tv-safe-bot));
}
.tv-hero { text-align: center; margin: 18px 0 34px; }
.tv-hero-mark {
  width: 96px; height: 96px; margin: 0 auto 16px;
  background: url('icons/icon-192.png?v=20') center/contain no-repeat;
  border-radius: 24px;
  box-shadow: var(--tv-shadow-gold);
}
.tv-hero-title {
  font-family: var(--tv-font-serif); font-weight: 700;
  font-size: 2.6rem; margin: 0 0 6px;
  background: var(--tv-grad-gold); -webkit-background-clip: text;
  background-clip: text; color: transparent;
  letter-spacing: 0.5px;
}
.tv-hero-tagline {
  font-family: var(--tv-font-serif); font-style: italic;
  font-size: 1.12rem; color: var(--tv-text-soft); margin: 0;
}
.tv-section-title {
  font-family: var(--tv-font-ui); font-size: 0.82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--tv-gold-deep); margin: 0 0 16px 4px;
}

/* ---------------- App grid + tiles ---------------- */
.tv-app-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
  gap: 16px;
  justify-content: center;
}
.tv-tile {
  --tile-accent: var(--tv-primary);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 22px 16px 20px;
  background: linear-gradient(160deg, var(--tv-bg-elev), var(--tv-bg-soft));
  border: 1px solid var(--tv-line); border-radius: var(--tv-radius-lg);
  color: var(--tv-text); box-shadow: var(--tv-shadow);
  transition: transform var(--tv-dur) var(--tv-ease), box-shadow var(--tv-dur) var(--tv-ease), border-color var(--tv-dur);
}
.tv-tile:active { transform: scale(0.97); }
.tv-tile:hover { border-color: color-mix(in srgb, var(--tile-accent) 50%, var(--tv-line)); box-shadow: var(--tv-shadow-lg); }
.tv-tile-icon {
  width: 84px; height: 84px; border-radius: 22px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35), 0 0 0 1px var(--tv-line);
  background: var(--tv-bg);
}
.tv-tile-icon img { width: 100%; height: 100%; object-fit: cover; }
.tv-tile-name {
  font-family: var(--tv-font-serif); font-weight: 600; font-size: 1.18rem;
  color: var(--tv-gold-bright);
}
.tv-tile-tag { font-size: 0.82rem; line-height: 1.35; color: var(--tv-text-muted); }

/* ---------------- Diamond launcher (four apps at the points) ----------------
   A 3×3 grid: tiles at N / W / E / S, centre cell empty. The two-class
   selector (.tv-app-grid.tv-diamond) wins over the plain grid rules above. */
.tv-app-grid.tv-diamond {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 1 / 1;
  width: 100%; max-width: 500px;
  margin: 6px auto 0;
  gap: 0;
  place-items: center;
  position: relative;
}
.tv-diamond .tv-tile {
  position: relative; z-index: 1;
  width: 100%; max-width: 158px;
  padding: 16px 10px 14px; gap: 8px;
}
.tv-diamond .tv-tile-icon { width: 62px; height: 62px; border-radius: 18px; }
.tv-diamond .tv-tile-name { font-size: 1.04rem; }
.tv-diamond .tv-tile-tag { display: none; }   /* kept as a hover tooltip instead */
.tv-diamond .pos-top    { grid-area: 1 / 2 / 2 / 3; }
.tv-diamond .pos-left   { grid-area: 2 / 1 / 3 / 2; }
.tv-diamond .pos-right  { grid-area: 2 / 3 / 3 / 4; }
.tv-diamond .pos-bottom { grid-area: 3 / 2 / 4 / 3; }

/* The animated diamond of light, behind the tiles. */
.tv-diamond-svg {
  grid-area: 1 / 1 / 4 / 4;          /* span the whole grid */
  width: 100%; height: 100%;
  align-self: stretch; justify-self: stretch;
  pointer-events: none; z-index: 0; overflow: visible;
}
.tv-diamond-edge {
  fill: none; stroke: var(--tv-gold); stroke-width: 1.4; stroke-opacity: 0.16;
  animation: tv-dia-breathe 5.5s var(--tv-ease) infinite;
}
.tv-diamond-spark { fill: none; stroke-linecap: round; stroke-dasharray: 15 85; }
.tv-diamond-spark-1 {
  stroke: var(--tv-gold-bright); stroke-width: 2;
  filter: drop-shadow(0 0 3px rgba(240, 226, 188, 0.85));
  animation: tv-dia-orbit 7s linear infinite;
}
.tv-diamond-spark-2 {
  stroke: var(--tv-gold-deep); stroke-width: 1.6; stroke-dasharray: 8 92; stroke-opacity: 0.7;
  animation: tv-dia-orbit 7s linear infinite;
  animation-delay: -3.5s;            /* trailing comet on the opposite arc */
}
/* One lit segment travels the 100-unit perimeter, looping seamlessly. */
@keyframes tv-dia-orbit { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -100; } }
@keyframes tv-dia-breathe { 0%, 100% { stroke-opacity: 0.12; } 50% { stroke-opacity: 0.30; } }

@media (prefers-reduced-motion: reduce) {
  .tv-diamond-edge { animation: none; stroke-opacity: 0.24; }
  .tv-diamond-spark { animation: none; stroke-opacity: 0; }   /* still, quiet diamond */
}

.tv-launcher-foot {
  margin-top: 38px; display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.tv-langbtn {
  background: transparent; border: 1px solid var(--tv-line);
  color: var(--tv-text-soft); border-radius: 999px; padding: 9px 22px;
  font-size: 0.9rem; letter-spacing: 0.04em;
}
.tv-langbtn:active { background: var(--tv-bg-soft); }
.tv-foot-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.tv-account-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--tv-line);
  color: var(--tv-text-soft); border-radius: 999px; padding: 8px 16px 8px 10px;
  font-family: var(--tv-font-ui); font-size: 0.9rem; max-width: 220px;
}
.tv-account-btn:active { background: var(--tv-bg-soft); }
.tv-account-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; flex: 0 0 auto;
  background: var(--tv-bg-soft); color: var(--tv-gold);
  font-family: var(--tv-font-serif); font-weight: 700; font-size: 0.85rem; text-transform: uppercase;
}
.tv-account-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-blessing {
  font-family: var(--tv-font-deva); color: var(--tv-gold-deep);
  font-size: 1rem; margin: 0; opacity: 0.85;
}

/* Register pill — sits beside the account button for signed-out users.
   Matches the Sign in chip's look (transparent, bordered). */
.tv-register-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--tv-line); color: var(--tv-text-soft);
  border-radius: 999px; padding: 9px 20px;
  font-family: var(--tv-font-ui); font-size: 0.9rem; letter-spacing: 0.02em;
}
.tv-register-btn:active { background: var(--tv-bg-soft); }

/* ---------------- Shared account modal ---------------- */
.tv-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(8,4,7,0.62);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity var(--tv-dur) var(--tv-ease);
}
.tv-modal.show { opacity: 1; }
.tv-modal-card {
  position: relative; width: 100%; max-width: 380px;
  background: var(--tv-bg-elev); border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius-lg); padding: 26px 22px 22px;
  box-shadow: var(--tv-shadow-lg);
  transform: translateY(10px) scale(0.98); transition: transform var(--tv-dur) var(--tv-ease);
}
.tv-modal.show .tv-modal-card { transform: none; }
.tv-modal-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; border: 0; color: var(--tv-text-muted);
  font-size: 1.1rem; line-height: 1; padding: 6px; cursor: pointer;
}
.tv-auth-title {
  font-family: var(--tv-font-serif); font-weight: 700; font-size: 1.4rem;
  color: var(--tv-gold-bright); margin: 0 0 4px;
}
.tv-auth-sub { font-size: 0.86rem; color: var(--tv-text-muted); margin: 0 0 18px; }
.tv-auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.tv-auth-field span { font-size: 0.78rem; color: var(--tv-text-soft); letter-spacing: 0.03em; }
.tv-auth-field input {
  background: var(--tv-bg); border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius); color: var(--tv-text);
  padding: 11px 13px; font-size: 1rem; font-family: var(--tv-font-ui);
}
.tv-auth-field input:focus { outline: none; border-color: var(--tv-gold); }
.tv-auth-consent {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 0.8rem; color: var(--tv-text-muted); line-height: 1.4; margin-bottom: 13px;
}
.tv-auth-consent input { margin-top: 2px; flex: 0 0 auto; }
.tv-auth-error {
  background: rgba(139,26,26,0.16); border: 1px solid rgba(139,26,26,0.4);
  color: var(--tv-primary-light); border-radius: var(--tv-radius);
  padding: 9px 12px; font-size: 0.84rem; margin-bottom: 13px;
}
.tv-auth-submit { width: 100%; justify-content: center; }
.tv-auth-switch { text-align: center; margin-top: 14px; font-size: 0.85rem; color: var(--tv-text-muted); }
.tv-linkbtn {
  background: none; border: 0; color: var(--tv-gold); cursor: pointer;
  font-size: 0.85rem; font-family: var(--tv-font-ui); padding: 2px 4px; text-decoration: underline;
}
.tv-account-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.tv-account-summary-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 999px; flex: 0 0 auto;
  background: var(--tv-bg-soft); color: var(--tv-gold);
  font-family: var(--tv-font-serif); font-weight: 700; font-size: 1.1rem; text-transform: uppercase;
}
.tv-account-summary-label { display: block; font-size: 0.74rem; color: var(--tv-text-muted); }
.tv-account-summary strong { color: var(--tv-text); font-size: 0.98rem; }
.tv-auth-logout { width: 100%; justify-content: center; }

/* ---------------- App host ---------------- */
.tv-app-host { position: relative; width: 100%; min-height: calc(100vh - 56px); }
.tv-frame {
  width: 100%; height: calc(100vh - 56px); border: 0; display: block;
  background: var(--tv-bg);
}
.tv-module-root { width: 100%; min-height: calc(100vh - 56px); }
.tv-app-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--tv-bg);
}
.tv-spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--tv-line); border-top-color: var(--tv-gold);
  animation: tv-spin 0.9s linear infinite;
}
@keyframes tv-spin { to { transform: rotate(360deg); } }
.tv-app-error { padding: 40px 24px; text-align: center; color: var(--tv-primary-light); }

/* ---------------- Sign-in gate (requiresAuth apps) ---------------- */
.tv-authgate {
  width: 100%; min-height: calc(100vh - 56px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 22px calc(40px + var(--tv-safe-bot));
}
.tv-authgate-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--tv-bg-elev); border: 1px solid var(--tv-line);
  border-radius: var(--tv-radius); padding: 34px 26px; box-shadow: var(--tv-shadow-lg);
}
.tv-authgate-icon {
  width: 60px; height: 60px; margin: 0 auto 16px; display: grid; place-items: center;
  border-radius: 50%; color: var(--tv-gold);
  background: var(--tv-bg-soft); border: 1px solid var(--tv-line);
}
.tv-authgate-title {
  font-family: var(--tv-font-serif); font-size: 1.6rem; font-weight: 700;
  color: var(--tv-gold-bright); margin: 0 0 10px;
}
.tv-authgate-sub { font-size: 0.92rem; color: var(--tv-text-muted); line-height: 1.55; margin: 0 0 22px; }
.tv-authgate-actions { display: flex; flex-direction: column; gap: 10px; }
.tv-authgate-actions .tv-btn { flex: 1 1 auto; width: 100%; }

/* ---------------- Install banner ---------------- */
.tv-install {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  display: flex; justify-content: center;
  padding: 0 14px calc(14px + var(--tv-safe-bot));
  pointer-events: none;
}
.tv-install-card {
  pointer-events: auto; width: 100%; max-width: 480px;
  background: var(--tv-bg-elev); border: 1px solid rgba(197,165,90,0.4);
  border-radius: var(--tv-radius-lg); padding: 18px;
  box-shadow: var(--tv-shadow-lg), var(--tv-shadow-gold);
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center;
  transform: translateY(140%); opacity: 0;
  transition: transform 0.45s var(--tv-ease), opacity 0.4s var(--tv-ease);
}
.tv-install.show .tv-install-card { transform: translateY(0); opacity: 1; }
.tv-install-icon { width: 52px; height: 52px; border-radius: 13px; grid-row: span 2; }
.tv-install-text { display: flex; flex-direction: column; gap: 3px; }
.tv-install-text strong { font-family: var(--tv-font-serif); font-size: 1.15rem; color: var(--tv-gold-bright); }
.tv-install-text span { font-size: 0.82rem; color: var(--tv-text-soft); }
.tv-install-actions { grid-column: 1 / -1; display: flex; gap: 10px; }
.tv-btn {
  border: 1px solid var(--tv-line); background: var(--tv-bg-soft);
  color: var(--tv-text); border-radius: 999px; padding: 11px 18px;
  font-weight: 600; font-size: 0.92rem; flex: 1;
}
.tv-btn.primary { background: var(--tv-grad-brand); border-color: transparent; color: #FFF6F0; }
.tv-btn.ghost { flex: 0 0 auto; background: transparent; color: var(--tv-text-muted); }

/* ---------------- Notification banners ---------------- */
/* A shell-owned stack of gentle notices (scheduled reminders + ad-hoc
   notifications). Flows above the launcher hero / app content, centered. */
.tv-banners {
  max-width: 640px; margin: 0 auto;
  padding: 0 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.tv-banners:not(:empty) {
  padding-top: calc(12px + var(--tv-safe-top));
  padding-bottom: 2px;
}
/* Inside an open app the sticky topbar already owns the safe-area inset,
   so the banner doesn't need to pad for it. (Fallback without :has() just
   keeps the launcher padding — a harmless few px when in-app.) */
body:has(#tvAppHost:not([hidden])) .tv-banners:not(:empty) {
  padding-top: 12px;
}
.tv-banner {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  background: linear-gradient(160deg, var(--tv-bg-elev), var(--tv-bg-soft));
  border: 1px solid rgba(197,165,90,0.34); border-radius: var(--tv-radius);
  padding: 13px 14px; box-shadow: var(--tv-shadow);
  animation: tv-banner-in 0.32s var(--tv-ease);
}
@keyframes tv-banner-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tv-banner-icon {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 1.2rem;
  background: var(--tv-bg); border: 1px solid var(--tv-line); color: var(--tv-gold);
}
.tv-banner-body { min-width: 0; }
.tv-banner-text {
  font-size: 0.9rem; line-height: 1.4; color: var(--tv-text-soft); margin: 0;
}
.tv-banner-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tv-banner-open {
  background: var(--tv-grad-gold); color: #2A1620; border: 0;
  border-radius: 999px; padding: 8px 16px; font-family: var(--tv-font-ui);
  font-size: 0.84rem; font-weight: 700; box-shadow: var(--tv-shadow-gold);
}
.tv-banner-open:active { transform: scale(0.97); }
.tv-banner-dismiss {
  background: transparent; border: 0; color: var(--tv-text-muted);
  font-size: 1rem; line-height: 1; padding: 6px 8px; border-radius: 50%;
}
.tv-banner-dismiss:active { background: var(--tv-bg-soft); color: var(--tv-text-soft); }

/* ---------------- Toast ---------------- */
.tv-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 20px);
  background: #110810; color: var(--tv-cream);
  padding: 12px 22px; border-radius: 999px; font-size: 0.9rem;
  border: 1px solid var(--tv-line); box-shadow: var(--tv-shadow-lg);
  z-index: 300; opacity: 0; transition: opacity 0.28s, transform 0.28s; max-width: 90%; text-align: center;
}
.tv-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .tv-hero-title { font-size: 2.2rem; }
  .tv-app-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 180px)); gap: 13px; }
  .tv-app-grid.tv-diamond { max-width: 340px; }
  .tv-diamond .tv-tile { padding: 10px 4px; max-width: 116px; }
  .tv-diamond .tv-tile-icon { width: 52px; height: 52px; border-radius: 15px; }
  .tv-diamond .tv-tile-name { font-size: 0.9rem; }
}

/* ---------------- Ambient falling leaves (launcher) ----------------
   A faint drift of gold betel leaves beneath the sanctuary. Driven by
   platform/leaves.js; sits above the page but ignores pointer events. */
.tv-leaf-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
  contain: strict;
}
.tv-leaf-fall {
  position: absolute;
  top: -10vh;
  left: var(--leaf-x, 50%);
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  animation: tvLeafFall var(--leaf-fall-dur, 12s) linear forwards;
}
.tv-leaf-sway {
  display: block;
  will-change: transform;
  animation: tvLeafSway var(--leaf-sway-dur, 4s) cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
  animation-delay: var(--leaf-sway-delay, 0s);
}
.tv-leaf-spin {
  display: block;
  width: var(--leaf-size, 36px);
  height: calc(var(--leaf-size, 36px) * 1.1);
  color: var(--tv-gold);
  will-change: transform;
  animation: tvLeafSpin var(--leaf-spin-dur, 6s) cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
  animation-delay: var(--leaf-spin-delay, 0s);
}
@keyframes tvLeafFall {
  0%   { transform: translate3d(0, 0, 0);              opacity: 0; }
  8%   {                                                opacity: var(--leaf-opacity, 0.32); }
  92%  {                                                opacity: var(--leaf-opacity, 0.32); }
  100% { transform: translate3d(0, 118vh, 0);          opacity: 0; }
}
@keyframes tvLeafSway {
  from { transform: translate3d(calc(var(--leaf-sway-amp, 32px) * -1), 0, 0); }
  to   { transform: translate3d(var(--leaf-sway-amp, 32px), 0, 0); }
}
@keyframes tvLeafSpin {
  from { transform: rotate(calc(var(--leaf-rot-base, 0deg) - var(--leaf-spin-amp, 22deg))); }
  to   { transform: rotate(calc(var(--leaf-rot-base, 0deg) + var(--leaf-spin-amp, 22deg))); }
}
@media (prefers-reduced-motion: reduce) {
  .tv-leaf-layer { display: none !important; }
}
