/* Shared building blocks: top bar, logo, type, buttons, data note, bottom nav, toast, loader. */
/* ---------- top bars ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 800; text-align: center; flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-pill); border: 0;
  background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-spacer { width: 44px; flex: none; }
[dir="rtl"] .flip { transform: scaleX(-1); }

.logo { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.logo svg.mascot { width: 46px; height: 38px; }
.wordmark { font-family: var(--font-brand); font-weight: 800; font-size: 24px; letter-spacing: -.02em; line-height: 1; direction: ltr; position: relative; }
.wordmark b { color: var(--purple); font-weight: 800; }
.wordmark::after {
  content: ""; position: absolute; inset-inline: 52% -2px; bottom: -6px; height: 5px;
  border-radius: 6px; background: var(--yellow); transform: rotate(-2deg);
}

/* ---------- type ---------- */
.h-hero { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; text-wrap: balance; }
.sub { margin: 0; color: var(--ink-2); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.link { background: none; border: 0; color: var(--purple); font-weight: 700; padding: 6px 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--ink-3); text-transform: uppercase; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: var(--r-pill); min-height: 54px; padding: 0 var(--s6);
  font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  transition: transform .12s ease, box-shadow .2s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--purple); color: #fff; box-shadow: 0 10px 22px rgba(101, 37, 245, .32); }
.btn-primary:hover { background: var(--purple-600); }
.btn-ghost { background: var(--surface); color: var(--purple); box-shadow: inset 0 0 0 2px var(--lilac); }
.btn-block { width: 100%; }
.btn svg { width: 20px; height: 20px; }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 var(--s4); }

/* ---------- data note ---------- */
.data-note {
  display: flex; align-items: center; gap: var(--s2); font-size: 12.5px; color: var(--ink-2);
  background: var(--surface); border-radius: var(--r-pill); padding: 6px 12px 6px 10px; align-self: flex-start;
  box-shadow: inset 0 0 0 1px var(--line);
}
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--mint-700); box-shadow: 0 0 0 3px var(--mint-50); flex: none; }


/* ---------- bottom nav ---------- */
.nav {
  position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 440px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px max(10px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 700; padding: 6px 0; border-radius: 14px; min-height: 52px; justify-content: center; }
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--purple); }
.nav a[aria-current="page"] .ni { background: var(--lilac-50); }
.nav .ni { width: 52px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .2s; }

/* ---------- toast & loader ---------- */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  bottom: calc(var(--nav-h) + 160px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: #fff; border-radius: var(--r-pill); padding: 10px 18px 10px 10px;
  display: flex; align-items: center; gap: 8px; font-weight: 700; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .25s; max-width: calc(100% - 32px);
}
[dir="rtl"] .toast { padding: 10px 10px 10px 18px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg.mascot { width: 34px; height: 28px; }
.loader { min-height: 100vh; display: grid; place-items: center; text-align: center; gap: var(--s3); align-content: center; padding: 24px; }
.loader svg.mascot { width: 140px; height: 116px; animation: roll 1.1s ease-in-out infinite alternate; }
.loader p { margin: 0; font-weight: 700; color: var(--ink-2); }
@keyframes roll { from { transform: translateX(-14px) rotate(-3deg); } to { transform: translateX(14px) rotate(3deg); } }
.err { color: var(--danger); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
