/* ============================================================
   ChampStudios — SPA shell additions
   Boot splash, view container transitions, sheets, route
   transitions (restrained, reduced-motion aware).
   ============================================================ */

/* ---------- boot splash ---------- */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
}
.boot-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.boot-splash[hidden] { display: none; }
.boot-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(244, 176, 33, 0.22);
  border-top-color: var(--gold);
  animation: spin 0.7s linear infinite;
}

/* ---------- view container ---------- */
#view { outline: none; }
#view.is-leaving .view-fade { animation: view-out 0.12s ease both; }
#view.is-entering .view-fade { animation: view-in 0.16s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes view-out { to { opacity: 0; transform: translateY(-4px); } }

/* feed / watch manage their own full-bleed layout */
.page-bleed { padding-left: 0 !important; padding-right: 0 !important; max-width: none !important; }
/* mobile: the video stage extends under the iOS status bar (viewport-
   fit=cover + black-translucent) — the page container must not add a
   top inset, or a body-colored strip sits above the feed. Desktop
   keeps the topbar clearance (the desktop stage is NOT full-bleed). */
.page-bleed-top { padding-top: 0 !important; }
@media (min-width: 1024px) {
  .page-bleed-top { padding-top: calc(var(--topbar-h) + 24px) !important; }
}
.page-bleed-bottom { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 0px) !important; }
@media (min-width: 1024px) {
  .page-bleed-bottom { padding-bottom: 0 !important; }
}

/* ---------- bottom sheets ---------- */
.sheet-open { overflow: hidden; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 4, 3, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: sheet-backdrop-in 0.2s ease both;
}
@keyframes sheet-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
/* iOS keyboard lift: while an input inside the sheet is focused,
   ui.js measures the keyboard overlap and raises the whole sheet */
.sheet-backdrop.sheet-kb-raise { padding-bottom: var(--kb-h, 0px); }
.sheet {
  width: min(560px, 100%);
  max-height: 82dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(244, 176, 33, 0.28);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(244, 176, 33, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheet-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }
.sheet-bar {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  margin: 10px auto 4px;
  flex: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-head .h3 { font-size: 16px; }
.sheet-head .icon-btn { width: 36px; height: 36px; }
.sheet-body { padding: 16px 18px 22px; overflow-y: auto; }

/* ---------- toast tones ---------- */
.toast-error { border-color: rgba(248, 113, 113, 0.45); }
.toast-error svg { color: var(--danger); }
.toast-info { border-color: rgba(255, 255, 255, 0.22); }

/* ---------- error / offline banners ---------- */
.view-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.view-error .empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--gold-faint); border: 1px solid rgba(244, 176, 33, 0.3); display: flex; align-items: center; justify-content: center; color: var(--gold); }
.view-error .empty-icon svg { width: 24px; height: 24px; }
.view-error p { font-size: 13.5px; max-width: 320px; }

/* ---------- load-more sentinel ---------- */
.load-sentinel {
  height: 1px;
  width: 100%;
}
.load-more-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.load-more-state .spinner { border-color: rgba(183, 176, 164, 0.25); border-top-color: var(--muted); }

/* ---------- own-entry banner on the feed ---------- */
.own-entry-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 12px 16px 2px;
  border-radius: var(--r-md);
  background: rgba(244, 176, 33, 0.07);
  border: 1px solid rgba(244, 176, 33, 0.35);
  color: var(--txt);
  transition: border-color 0.2s, background 0.2s;
}
.own-entry-banner:hover { border-color: rgba(244, 176, 33, 0.6); background: rgba(244, 176, 33, 0.12); }
.own-entry-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold-faint);
  border: 1px solid rgba(244, 176, 33, 0.4);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.own-entry-banner-icon svg { width: 18px; height: 18px; }
.own-entry-banner b { display: block; font-size: 13.5px; font-weight: 700; }
.own-entry-banner .grow span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.own-entry-banner > svg { width: 16px; height: 16px; color: var(--muted); flex: none; }

/* ---------- real-data additions (#016) ---------- */

/* initial-in-a-circle avatars (backend avatarUrl is null until uploaded) */
.av-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gold-faint);
  border: 1.5px solid rgba(244, 176, 33, 0.5);
  color: var(--gold);
  font-weight: 800;
  flex: none;
  overflow: hidden;
}
.slide-participant .av-initial { width: 40px; height: 40px; font-size: 15px; }
.act-profile .av-initial { width: 34px; height: 34px; font-size: 13px; }
.rail-item .av-initial { width: 34px; height: 34px; font-size: 13px; }
.watch-participant .av-initial { width: 40px; height: 40px; font-size: 15px; }
.pod-av.av-initial { width: 54px; height: 54px; font-size: 20px; }
.pod-1 .pod-av.av-initial { width: 66px; height: 66px; font-size: 24px; }
.lb-av.av-initial { width: 40px; height: 40px; font-size: 15px; }
.pp-avatar.av-initial { width: 104px; height: 104px; font-size: 34px; }
.profile-avatar.av-initial { width: 104px; height: 104px; font-size: 34px; }
.lb-preview-av.av-initial { width: 34px; height: 34px; font-size: 13px; }
.user-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold-faint);
  border: 1.5px solid rgba(244, 176, 33, 0.5);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.user-chip-avatar svg { width: 15px; height: 15px; }

/* placeholder when an entry has no ready thumbnail — intentional and
   branded (CS mark + wordmark), never mistaken for a broken image or
   a playable video */
.entry-card-ph {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #1a1209, #0c0906);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.entry-card-ph::before {
  content: "CS";
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(244, 176, 33, 0.07);
  border: 1px solid rgba(244, 176, 33, 0.24);
  color: rgba(244, 176, 33, 0.72);
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.entry-card-ph::after {
  content: "ChampStudios";
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(183, 176, 164, 0.42);
}

/* images fade in once decoded (class added by the shell load listener) */
.entry-card > img,
.pp-feature > img {
  opacity: 0;
  transition: opacity 0.35s ease;
}
.entry-card > img.media-ready,
.pp-feature > img.media-ready { opacity: 1; }

/* image that failed to load (expired/deleted media) — quiet stand-in */
.media-fallback {
  display: block;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--r-sm);
  background: linear-gradient(160deg, #171008, #0d0906);
  border: 1px solid var(--line);
}
.entry-card .media-fallback,
.pp-feature .media-fallback {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
}

/* error badge (rejected / disqualified / failed) */
.badge-err { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.35); color: var(--danger); }

/* indeterminate processing state (NO fake percentages) */
.processing-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-top: 18px;
}
.processing-bar {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  animation: processing-slide 1.4s ease-in-out infinite;
}
@keyframes processing-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}

/* rules document (backend markdown rendered safely) */
.rules-doc { max-width: 720px; margin: 0 auto; }
.rules-head { padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.md-body { line-height: 1.7; font-size: 15px; }
.md-body h2, .md-body h3, .md-body h4 { margin: 22px 0 8px; letter-spacing: -0.01em; }
.md-body h2 { font-size: 18px; }
.md-body h3 { font-size: 16px; }
.md-body p { margin: 0 0 12px; }
.md-body ul, .md-body ol { margin: 0 0 12px 20px; }
.md-body ul { list-style: disc; }
.md-body ol { list-style: decimal; }
.md-body li { margin: 4px 0; }
.md-body a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.md-body strong { color: var(--txt); }

/* profile entry cards */
.profile-entry-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.profile-entry-card .entry-card { width: 100%; }
.profile-entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 2px;
}

/* tickets list */
.tickets-list { display: flex; flex-direction: column; gap: 8px; }
.ticket-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.ticket-row-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold-faint);
  border: 1px solid rgba(244, 176, 33, 0.4);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.ticket-row-icon svg { width: 18px; height: 18px; }

/* media failure marker on feed slides */
.slide.media-failed .slide-media::after {
  content: "Video unavailable";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* partial podium (fewer than 3 ranked entries) is handled by
   .podium-one / .podium-two in leaderboard.css */

/* avatar images inside the topbar account chip (social features #025) */
img.user-chip-avatar { object-fit: cover; overflow: hidden; }
