/* App shell: header, popovers, footer, phone tab bar. */
bz-app { display: block; min-height: 100vh; }
bz-app > .bz-shell { display: flex; flex-direction: column; min-height: 100vh; }
#main { flex: 1; outline: none; }

/* Chrome modes: 'bare' pages draw their own top and bottom */
html[data-chrome="bare"] bz-header,
html[data-chrome="bare"] bz-footer,
html[data-chrome="bare"] bz-tabbar { display: none; }

/* ---- Header ---- */
.bz-header { background: var(--surface); border-bottom: 2px solid var(--line); position: relative; z-index: 20; }
.bz-header__in { display: flex; align-items: center; gap: 20px; padding-block: 14px; }
.bz-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.bz-brand__name { font-family: var(--font-head); font-weight: 800; font-size: 30px; letter-spacing: -0.5px; color: var(--ink); line-height: 1; }
.bz-brand:hover .bz-brand__name { color: var(--ink); }
.bz-logo { width: 44px; height: 44px; display: block; flex: none; }
.bz-nav { display: flex; gap: 6px; }
.bz-nav a { padding: 10px 14px; border-radius: 12px; font-weight: 600; text-decoration: none; }
.bz-nav a:hover { background: var(--soft); color: var(--ink); }
.bz-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.bz-hsearch { flex: 1 1 120px; min-width: 0; position: relative; }
.bz-hsearch .bz-input { padding: 12px 16px 12px 44px; border-radius: 14px; }
.bz-hsearch .bz-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.bz-header__spacer { flex: 1; }
.bz-hsearch-btn { display: none; }

/* Popover shared by the bell and the account menu */
.bz-pop { position: relative; }
.bz-pop__panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 30;
  background: var(--surface); border-radius: 22px; padding: 20px;
  box-shadow: 0 12px 32px var(--shadow), 0 3px 0 var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.bz-pop__panel[hidden] { display: none; }
.bz-acct-btn { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); }
.bz-acct-btn:hover { border-color: var(--ink); }
.bz-acct-btn__name { font-weight: 600; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-acct { width: 320px; }
.bz-acct__who { display: flex; gap: 14px; align-items: center; }
.bz-acct__name { font-family: var(--font-head); font-weight: 800; font-size: 22px; line-height: 1.1; }
.bz-acct__next { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--level-soft); color: var(--level-ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.bz-acct__next:hover { color: var(--level-ink); filter: brightness(0.97); }
.bz-acct__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bz-acct__stat { background: var(--bg); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.bz-acct__stat span:first-child { font-size: 12px; color: var(--muted); }
.bz-acct__stat span:last-child { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.bz-acct__stat .bz-icon { width: 14px; height: 14px; }
.bz-acct__gems .bz-icon { color: #19A3C7; }
.bz-acct__stat--link { text-decoration: none; color: inherit; }
.bz-acct__stat--link:hover { filter: brightness(0.97); }
.bz-acct__links { display: flex; flex-direction: column; gap: 2px; border-top: 2px solid var(--soft); padding-top: 10px; }
.bz-acct__links a, .bz-acct__links button { display: flex; align-items: center; gap: 8px; padding: 9px 4px; border: 0; background: transparent; text-decoration: none; text-align: left; font-weight: 600; border-radius: 8px; }
.bz-acct__links .plain { font-weight: 400; }
.bz-count { padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; }
.bz-notes { width: 360px; gap: 6px; padding: 14px; }
.bz-notes__head { display: flex; align-items: center; padding: 2px 6px 6px; }
.bz-notes__head strong { flex: 1; font-size: 17px; }
.bz-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 14px; text-decoration: none; }
.bz-note[data-unread="true"] { background: var(--bg); font-weight: 600; }
.bz-note:hover { background: var(--soft); color: var(--ink); }
.bz-note__dot { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.bz-note__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.bz-note__when { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---- Avatar tile ---- */
.bz-avatar { display: inline-block; flex: none; border-radius: 12px; overflow: hidden; position: relative; }
.bz-avatar svg { display: block; width: 100%; height: 100%; }

/* ---- Footer ---- */
.bz-footer { border-top: 2px solid var(--line); background: var(--surface); }
.bz-footer__in { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; padding-block: 24px; font-size: 14px; }
.bz-footer__in a { text-decoration: none; font-weight: 500; }
.bz-footer__in a:hover { text-decoration: underline; }
.bz-theme { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bz-theme .bz-seg button { padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.bz-copy { flex-basis: 100%; color: var(--muted); font-size: 13px; }

/* ---- Phone tab bar ---- */
bz-tabbar { display: none; }
.bz-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); border-top: 2px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-bottom: env(safe-area-inset-bottom);
}
.bz-tabs a { padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; text-decoration: none; color: var(--muted); min-height: 56px; justify-content: center; }
.bz-tabs a[aria-current="page"] { color: var(--accent-text); }
.bz-tabs .bz-icon { width: 24px; height: 24px; }
.bz-tabs .bz-avatar { width: 26px; height: 26px; border-radius: 9px; }
.bz-tabs a[aria-current="page"] .bz-avatar { outline: 3px solid var(--accent-text); outline-offset: 1px; }

@media (max-width: 860px) {
  .bz-hsearch { flex-basis: 180px; }
}
/* Tablets (721-899 px): the header's items must fit in one row (a 768 px page scrolled sideways by about 90 px). */
@media (min-width: 721px) and (max-width: 899px) {
  .bz-header__in { gap: 10px; }
  .bz-acct-btn__name { max-width: 8ch; }
}

@media (max-width: 720px) {
  bz-tabbar { display: block; }
  .bz-header__in { padding-block: 10px; gap: 10px; flex-wrap: nowrap; }
  .bz-nav, .bz-hsearch { display: none; }
  .bz-brand__name { font-size: 24px; flex: 0 1 auto; }
  .bz-logo { width: 36px; height: 36px; }
  .bz-header__spacer { display: block; }
  .bz-hsearch-btn { display: inline-flex; }
  .bz-acct-btn { display: none; }
  .bz-notes { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; max-height: calc(100vh - 160px); overflow: auto; }
  .bz-footer__in { padding-bottom: 96px; }
  .bz-theme { margin-left: 0; flex-basis: 100%; }
}

/* Pages framed by the web editor (/embed/*): no site chrome, the wizard's own top bar goes (the editor's dialog has its own). */
html[data-embed="1"] .pb-top { display: none; }
html[data-embed="1"] .pb-main { padding-top: 12px; }
html[data-embed="1"] body { min-height: 0; }

/* The card <-> game page flight (lib/morph.js): one fixed copy of the whole card moves between the card and the top of the game page. */
.bz-fly { position: fixed; z-index: 90; margin: 0; overflow: hidden; pointer-events: none; will-change: left, top, width, height; }
.bz-fly__art { width: 100%; overflow: hidden; position: relative; }
.bz-fly__title { white-space: nowrap; font-family: var(--font-text); }
.bz-fly__meta { display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.bz-fly__meta span:last-child { font-weight: 600; }
main[data-flying] .g-card, bz-game-card[data-flying] .bz-card { visibility: hidden; }

/* Loading placeholders: gray blocks in the page's own layout with a soft shimmer; still gray with reduced motion. */
.bz-skel { background: linear-gradient(90deg, var(--line) 30%, var(--soft, var(--surface)) 50%, var(--line) 70%) 0 0 / 300% 100%; border-radius: 12px; animation: bz-shimmer 1.6s ease-in-out infinite; min-height: 14px; }
@keyframes bz-shimmer { to { background-position: -150% 0; } }
.bz-skel--line { height: 14px; border-radius: 8px; }
.bz-skel--card { aspect-ratio: 1; border-radius: 20px; }
.bz-skel--hero { aspect-ratio: 16 / 9; border-radius: 24px; }
.bz-skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.bz-skel-stack { display: flex; flex-direction: column; gap: 14px; }
.bz-reduce-motion .bz-skel { animation: none; background: var(--line); }
@media (prefers-reduced-motion: reduce) { .bz-skel { animation: none; background: var(--line); } }
