/* ============================================================
   Mahjmuddle - App Stylesheet
   Warm, welcoming palette with sculptural typography moments
   and smooth motion effects inspired by Obsidian Assembly.
   ============================================================ */

:root {
  --color-primary: #008E2C;
  --color-primary-dark: #1B5E20;
  --color-accent: #FFC107;
  --color-accent-dark: #F57C00;

  /* Mahj Muddle platform brand colors. NOT overridden per-franchise — used
     on platform-admin pages and the public landing where there's no
     franchise context. Per-franchise pages should prefer var(--color-accent)
     which the franchise can customize via Site Settings. */
  --color-brand-pink: #FF2E99;
  --color-brand-pink-dark: #C71F73;
  --color-brand-pink-soft: #FFE5F1;

  --color-bg: #FAF8F3;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F4F1EA;
  --color-border: #E8E3D6;

  --color-text: #1A1F1A;
  --color-text-muted: #6B6D63;
  --color-text-inverse: #FAF8F3;

  --color-error: #C0392B;
  --color-error-bg: #FADBD8;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Georgia', 'Times New Roman', serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 24px;

  --shadow-sm: 0 1px 2px rgba(26, 31, 26, 0.06);
  --shadow-md: 0 4px 16px rgba(26, 31, 26, 0.08);
  --shadow-lg: 0 20px 60px rgba(26, 31, 26, 0.12);

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

/* ============================================================
   NAV
   ============================================================ */
.platform-nav,
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FAF5EB;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 4px solid #6F8265;
}

.platform-nav__inner,
.app-nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Variant of platform-nav__inner used only on the platform landing page.
   Establishes a positioning context for the decorative SVG that sits
   between the logo and the CTA. */
.platform-nav__inner--with-decoration {
  position: relative;
}

/* Decorative intertwined-loops SVG. Absolutely positioned so it doesn't
   take up flex space (logo and CTA stay where they are). Hidden below
   ~700px viewport width to avoid cramping the mobile header. */
.platform-nav__decoration {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 70px;
  pointer-events: none;
  z-index: 0;
}

.platform-nav__inner--with-decoration .platform-nav__brand,
.platform-nav__inner--with-decoration .platform-nav__links {
  position: relative;
  z-index: 1; /* keep logo/CTA above the decoration */
}

@media (max-width: 700px) {
  .platform-nav__decoration { display: none; }
}

.platform-nav__brand,
.app-nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--color-text);
  font-size: 18px;
}

.platform-nav__logo,
.app-nav__logo {
  color: var(--color-primary);
  font-size: 20px;
}

.app-nav__name {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.app-nav__logo-img {
  height: 100px;
  width: auto;
  object-fit: contain;
}

.platform-nav__links,
.app-nav__links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.platform-nav__links a,
.app-nav__links a {
  color: var(--color-text);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s;
}

.platform-nav__links a:hover,
.app-nav__links a:hover {
  color: var(--color-primary);
}

/* Active state on platform-nav links — pink underline marks the current
   section. JS in platform-nav.ejs adds the class based on URL path.
   Pink is hardcoded because platform pages don't have franchise context
   to pull --color-accent from. */
.platform-nav__link--active {
  color: var(--color-brand-pink-dark) !important;
  border-bottom: 2px solid var(--color-brand-pink);
  padding-bottom: 4px;
  margin-bottom: -2px; /* compensate so layout doesn't shift */
}

.app-nav__logout {
  color: var(--color-text-muted) !important;
}

.app-nav__install {
  font-size: 16px;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.app-nav__install:hover {
  opacity: 1;
}

/* Hide install link when running as installed PWA */
@media (display-mode: standalone) {
  .app-nav__install {
    display: none !important;
  }
}

/* ============================================================
   MOBILE NAV — hamburger toggle
   ============================================================ */
.app-nav__toggle {
  display: none; /* hidden on desktop */
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.app-nav__toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 720px) {
  .app-nav__inner,
  .platform-nav__inner {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
  }

  .app-nav__logo-img {
    height: 56px; /* smaller logo on mobile */
  }

  .app-nav__toggle {
    display: flex; /* visible on mobile */
    margin-left: auto;
  }

  /* Collapse menu by default on mobile */
  .app-nav__links,
  .platform-nav__links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
    order: 3; /* drop below brand + toggle */
    padding-top: 0;
    margin-top: 8px;
    border-top: 1px solid var(--color-border);
  }

  .app-nav.is-nav-open .app-nav__links,
  .platform-nav.is-nav-open .platform-nav__links {
    display: flex;
  }

  .app-nav__links a,
  .platform-nav__links a {
    display: block;
    padding: 14px 4px;
    font-size: 16px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
  }

  /* Normalize the Join button to look like a regular nav link on mobile */
  .app-nav__links .btn,
  .app-nav__links .btn--small,
  .platform-nav__links .btn {
    display: block;
    background: transparent;
    color: var(--color-text);
    border: 0;
    padding: 14px 4px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 0;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid var(--color-border);
  }

  /* Style the install icon and inline text spans (admin name, version) */
  .app-nav__install,
  .platform-nav__links span,
  .app-nav__links span {
    display: block;
    padding: 12px 4px;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
  }

  /* Last visible item — no border */
  .app-nav__links > *:last-child,
  .platform-nav__links > *:last-child {
    border-bottom: 0;
  }

  /* Animate hamburger to "X" when open */
  .app-nav.is-nav-open .app-nav__toggle-bar:nth-child(1),
  .platform-nav.is-nav-open .app-nav__toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .app-nav.is-nav-open .app-nav__toggle-bar:nth-child(2),
  .platform-nav.is-nav-open .app-nav__toggle-bar:nth-child(2) {
    opacity: 0;
  }
  .app-nav.is-nav-open .app-nav__toggle-bar:nth-child(3),
  .platform-nav.is-nav-open .app-nav__toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 80px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle repeating mahjong-tile pattern in the background. Inline SVG via
   data URI so there's no asset to host. 4% opacity = present but never
   competing with content. The pattern's stroke uses the brand green;
   franchise-specific accent via var() inside SVG isn't possible (data URIs
   can't reference page CSS vars), so the green is hardcoded — acceptable
   because every franchise inherits this base color anyway. */
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='160' viewBox='0 0 120 160'><rect x='10' y='10' width='80' height='120' rx='6' fill='none' stroke='%23008E2C' stroke-width='2'/><rect x='14' y='14' width='72' height='112' rx='4' fill='none' stroke='%23008E2C' stroke-width='0.5'/><circle cx='50' cy='70' r='6' fill='%23FF2E99'/><circle cx='40' cy='55' r='3' fill='%23008E2C'/><circle cx='60' cy='55' r='3' fill='%23008E2C'/><circle cx='40' cy='85' r='3' fill='%23008E2C'/><circle cx='60' cy='85' r='3' fill='%23008E2C'/></svg>");
  background-repeat: repeat;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.hero--platform {
  padding-top: 120px;
}

.hero__tag {
  display: inline-block;
  padding: 6px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.hero__sub {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero__cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   STATS
   ============================================================ */
.stats {
  padding: 0 24px 80px;
}

.my-matches {
  padding: 0 24px 40px;
}

.my-matches__inner {
  max-width: 720px;
  margin: 0 auto;
}

.my-matches__card:hover {
  background: var(--color-surface-alt) !important;
  transform: translateY(-1px);
  transition: all 0.15s ease;
}

.stats__inner {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.4s var(--ease-out-expo),
              box-shadow 0.4s var(--ease-out-expo);
}

.stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat__value {
  display: block;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 400;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 8px;
}

.stat__label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Platform brand accent for the "headline" stat on a page (your earnings,
   your cut, your share). Pink because these are platform-level pages
   without franchise branding context. Used sparingly — at most one per
   stat group, on the metric that matters most. */
.stat--brand-accent {
  border: 2px solid var(--color-brand-pink);
}

.stat--brand-accent .stat__value {
  color: var(--color-brand-pink-dark);
}

.stat--brand-accent .stat__label {
  color: var(--color-brand-pink-dark);
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section-tag {
  display: inline-block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.section-sub {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--color-text-muted);
  max-width: 600px;
}

/* ============================================================
   HOW IT WORKS
   ============================================================ */
.how {
  padding: 48px 16px;
  background: var(--color-surface-alt);
}

@media (min-width: 768px) {
  .how { padding: 80px 24px; }
}

.how__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.how__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 32px;
}

.how__step {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  transition: transform 0.4s var(--ease-out-expo);
}

@media (min-width: 768px) {
  .how__grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    margin-top: 48px;
  }
  .how__step { padding: 40px 32px; }
}

.how__step:hover {
  transform: translateY(-4px);
}

.how__num {
  font-family: var(--font-display);
  font-size: 40px;
  color: var(--color-accent-dark);
  font-weight: 400;
  display: block;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.how__step h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  margin: 0 0 12px;
}

.how__step p {
  color: var(--color-text-muted);
  margin: 0;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-main {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
}

.auth-card--wide {
  max-width: 560px;
}

.auth-card__header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card__tag {
  display: inline-block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.auth-card__title {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.auth-card__sub {
  color: var(--color-text-muted);
  margin: 0;
}

.auth-card__footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ============================================================
   FORMS
   ============================================================ */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .form__row { grid-template-columns: 1fr; }
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: none;
  padding: 0;
  margin: 0;
}

.form__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.form__hint {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 400;
}

.form__field input[type="email"],
.form__field input[type="password"],
.form__field input[type="text"],
.form__field input[type="tel"],
.form__field input[type="date"],
.form__field input[type="datetime-local"],
.form__field textarea,
.form__field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form__field input:focus,
.form__field textarea:focus,
.form__field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 142, 44, 0.12);
}

.form__radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.form__radio {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.form__radio:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-alt);
}

.form__radio input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--color-primary);
}

.form__radio:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-surface-alt);
}

.form__radio-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.form__radio-body strong {
  font-weight: 600;
}

.form__radio-body span {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out-expo),
              background 0.2s,
              color 0.2s,
              border-color 0.2s,
              box-shadow 0.2s;
  white-space: nowrap;
}

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

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn--primary:hover {
  background: var(--color-primary-dark);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-md);
}

.btn--ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn--ghost:hover {
  border-color: var(--color-text);
  background: var(--color-surface);
}

/* Accent-outlined button. Uses the franchise's accent color (or pink on
   platform pages). For "secondary positive" CTAs that are equal-weight
   alternatives to the primary action — like "Sign In" next to "Register". */
.btn--accent-outline {
  background: transparent;
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
  border-width: 1.5px;
}

.btn--accent-outline:hover {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
}

.btn--full { width: 100%; }

.btn--small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn--large {
  padding: 16px 32px;
  font-size: 17px;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
}

.alert--error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(192, 57, 43, 0.2);
}

/* ============================================================
   CONTAINER / MAIN
   ============================================================ */
.app-main {
  padding: 48px 24px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
}

/* ============================================================
   REVEAL ANIMATIONS
   Elements with .reveal fade+slide in when scrolled into view
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-out-expo),
              transform 0.8s var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children of a reveal group */
.reveal:nth-child(1) { --reveal-delay: 0s; }
.reveal:nth-child(2) { --reveal-delay: 0.08s; }
.reveal:nth-child(3) { --reveal-delay: 0.16s; }
.reveal:nth-child(4) { --reveal-delay: 0.24s; }
.reveal:nth-child(5) { --reveal-delay: 0.32s; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   FORM EXTRAS (for application form + admin forms)
   ============================================================ */
.form-section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin: 16px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.form-section-title:first-child {
  margin-top: 0;
}

.form__field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form__hint--success {
  color: #1b7a3a;
}

.form__hint--error {
  color: var(--color-error);
}

.form__footer-note {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 16px 0 0;
}

/* Slug input with prefix */
.slug-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.slug-input:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 142, 44, 0.12);
}

.slug-input__prefix {
  padding: 12px 14px;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 15px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
}

.slug-input input {
  flex: 1;
  border: none !important;
  box-shadow: none !important;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  min-width: 0;
}

.slug-input input:focus {
  outline: none;
  box-shadow: none !important;
}

/* ============================================================
   ALERTS - additional variants
   ============================================================ */
.alert--info {
  background: #E8F4FD;
  color: #1A5490;
  border: 1px solid #B8DAEE;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

/* ============================================================
   PLATFORM ADMIN
   ============================================================ */
.pa-tabs {
  display: flex;
  gap: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 32px;
  /* Allow horizontal scrolling on narrow screens so the rightmost tabs
     don't get clipped off the edge on mobile. fit-content keeps the
     container compact on desktop where all tabs fit; max-width caps
     the visual width so the scroll behavior kicks in if needed. */
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.pa-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background 0.2s, color 0.2s;
  /* Prevent each tab from shrinking when the container scrolls — they
     should keep their natural size and overflow horizontally. */
  flex-shrink: 0;
  white-space: nowrap;
}

.pa-tab:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.pa-tab.is-active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.pa-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pa-tab.is-active .pa-tab__count {
  background: rgba(255, 255, 255, 0.25);
  color: var(--color-text-inverse);
}

/* Application list */
.pa-app-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pa-app-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  color: var(--color-text);
  transition: transform 0.3s var(--ease-out-expo),
              border-color 0.2s,
              box-shadow 0.3s var(--ease-out-expo);
}

.pa-app-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
}

.pa-app-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.pa-app-card__head h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  margin: 0;
}

.pa-app-card__city {
  font-size: 13px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pa-app-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.pa-app-card__sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--color-text);
}

/* Application detail view */
.pa-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 32px 0;
}

.pa-detail__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 16px;
}

.pa-detail__label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.pa-detail__value {
  font-size: 15px;
  color: var(--color-text);
  font-weight: 500;
}

.pa-detail__section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.pa-detail__section p {
  margin: 8px 0 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Review sections (approve/reject forms) */
.pa-review {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
}

.pa-review h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  margin: 0 0 20px;
}

.pa-review--danger {
  border-color: rgba(192, 57, 43, 0.25);
}

.pa-review--danger h2 {
  color: var(--color-error);
}

/* Approved confirmation card */
.pa-approved-card {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.pa-approved-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.pa-approved-row:last-child {
  border-bottom: none;
}

/* Franchise list */
.pa-franchise-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.pa-franchise-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  color: var(--color-text);
  transition: transform 0.3s var(--ease-out-expo),
              border-color 0.2s,
              box-shadow 0.3s var(--ease-out-expo);
  text-decoration: none;
}

.pa-franchise-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
}

.pa-franchise-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 4px;
}

.pa-franchise-card__url {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 13px;
  margin: 4px 0;
}

.pa-franchise-card__meta {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0;
}

/* ============================================================
   MATCHES
   ============================================================ */
.matches-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Match card (used in list) */
.match-card {
  display: flex;
  gap: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  color: var(--color-text);
  transition: transform 0.3s var(--ease-out-expo),
              border-color 0.2s,
              box-shadow 0.3s var(--ease-out-expo);
}

.match-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
}

.match-card__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  padding: 8px 12px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  text-align: center;
  flex-shrink: 0;
}

.match-card__day {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 500;
}

.match-card__num {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.match-card__month {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.match-card__body {
  flex: 1;
  min-width: 0;
}

.match-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.match-card__time {
  font-size: 14px;
  font-weight: 500;
}

.match-card__status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.match-card__status--open {
  background: #FFF8E1;
  color: #F57C00;
}

.match-card__status--confirmed {
  background: #E8F5E9;
  color: #008E2C;
}

.match-card__status--completed {
  background: #E3F2FD;
  color: #1565C0;
}

.match-card__status--cancelled {
  background: #FAFAFA;
  color: #999;
}

.match-card__location {
  font-size: 15px;
  margin-bottom: 10px;
}

.match-card__players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.match-card__player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text);
}

.match-card__player--empty {
  color: var(--color-text-muted);
}

.match-card__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.match-card__avatar--empty {
  background: var(--color-border);
  color: var(--color-text-muted);
}

.match-card__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ============================================================
   MATCH DETAIL
   ============================================================ */
.back-link {
  display: inline-block;
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.back-link:hover {
  color: var(--color-primary);
}

.match-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.match-detail__status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 16px;
}

.match-detail__date {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.match-detail__time {
  font-size: 20px;
  color: var(--color-text-muted);
  margin: 0 0 28px;
}

.match-detail__info {
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
  margin-bottom: 28px;
}

.match-detail__row {
  margin-bottom: 16px;
}

.match-detail__row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.match-detail__players {
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
  margin-bottom: 28px;
}

.match-detail__player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 480px) {
  .match-detail__player-grid { grid-template-columns: 1fr; }
}

.match-detail__player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.match-detail__player--empty {
  border-style: dashed;
  color: var(--color-text-muted);
}

.match-detail__badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 4px;
  color: var(--color-text-muted);
}

.match-detail__actions {
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Success alert */
.alert--success {
  background: #E8F5E9;
  color: #008E2C;
  border: 1px solid rgba(0, 142, 44, 0.2);
}

/* ============================================================
   SCORES
   ============================================================ */
.score-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

.score-row--confirmed {
  border-color: rgba(0, 142, 44, 0.2);
  background: #FAFFF9;
}

.score-row__player {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.score-row__score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-row__value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  min-width: 60px;
  text-align: right;
}

.score-row__badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.score-row__badge--confirmed {
  background: #E8F5E9;
  color: #008E2C;
}

.score-row__badge--pending {
  background: #FFF8E1;
  color: #F57C00;
}

.score-row__actions {
  display: flex;
  gap: 12px;
  padding: 8px 0 16px;
  align-items: flex-start;
}

.score-dispute {
  flex: 0;
}

.score-dispute summary {
  cursor: pointer;
  white-space: nowrap;
}

.score-dispute__form {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.score-dispute__form .form__field {
  flex: 1;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-note {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.leaderboard-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: transform 0.3s var(--ease-out-expo),
              box-shadow 0.3s var(--ease-out-expo);
}

.lb-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.lb-row--me {
  border-color: var(--color-primary);
  background: #FAFFF9;
}

/* Champion accent on the #1 row. Uses the franchise's accent color for the
   border so each muddle's first-place row reflects their brand. The
   background stays a neutral cream (works across all accent hues). */
.lb-row--first {
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface-alt);
}

.lb-row--first .lb-row__value {
  color: var(--color-accent-dark);
}

.lb-row__rank {
  min-width: 40px;
  text-align: center;
}

.lb-row__medal {
  font-size: 24px;
}

.lb-row__position {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--color-text-muted);
}

.lb-row__player {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.lb-row__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.lb-row__diversity {
  color: var(--color-primary);
  font-weight: 600;
  cursor: help;
}

.lb-row__ineligible {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #856404;
  background: rgba(255, 193, 7, 0.18);
  padding: 1px 6px;
  border-radius: 3px;
  cursor: help;
}

.lb-row__score {
  min-width: 80px;
  text-align: right;
}

.lb-row__value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

@media (max-width: 580px) {
  .lb-row { flex-wrap: wrap; }
  .lb-row__stats { flex-direction: row; gap: 12px; }
}

/* ============================================================
   FRANCHISE ADMIN
   ============================================================ */
.admin-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 0;
  border-bottom: 1px solid var(--color-border);
}

.admin-nav__link {
  padding: 10px 16px 14px;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; /* overlap the container's bottom border */
  transition: color 0.2s, border-color 0.2s;
}

.admin-nav__link:hover {
  background: transparent;
  color: var(--color-text);
}

.admin-nav__link--active {
  background: transparent;
  color: var(--color-accent-dark);
  border-bottom-color: var(--color-accent);
}

.admin-nav__link--active:hover {
  background: transparent;
  color: var(--color-accent-dark);
  border-bottom-color: var(--color-accent);
}

/* Player list */
.admin-player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-player-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.admin-player-card__info {
  margin-bottom: 4px;
}

.admin-player-card__name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-player-card__edit {
  margin-top: 8px;
}

.admin-player-card__edit summary {
  cursor: pointer;
}

.admin-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 12px;
  padding: 16px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
}

.admin-edit-form .form__field {
  min-width: 140px;
  flex: 1;
}

.admin-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
}

.admin-checkbox input { accent-color: var(--color-primary); }

.admin-edit-actions {
  display: flex;
  gap: 8px;
}

/* Season cards */
.admin-season-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 12px;
}

.admin-season-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-season-card__header h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-season-card details {
  margin-top: 12px;
}

.admin-season-card summary {
  cursor: pointer;
}

/* Revenue rows */
.revenue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.revenue-row:last-child {
  border-bottom: none;
}

.revenue-row__player {
  display: flex;
  align-items: center;
  gap: 12px;
}

.revenue-row__status {
  flex-shrink: 0;
}

/* ============================================================
   PLATFORM BILLING TABLE
   ============================================================ */
.billing-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.billing-header {
  display: grid;
  grid-template-columns: 2fr 1.2fr 0.8fr 0.8fr 1fr 1fr;
  gap: 8px;
  padding: 12px 20px;
  background: var(--color-surface-alt);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.billing-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 0.8fr 0.8fr 1fr 1fr;
  gap: 8px;
  padding: 16px 20px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  align-items: center;
  color: var(--color-text);
  transition: background 0.2s;
}

a.billing-row:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.billing-row--total {
  background: var(--color-surface-alt);
  font-weight: 600;
  border-top: 2px solid var(--color-border);
}

.billing-row__franchise {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.billing-row__sub {
  font-size: 12px;
  color: var(--color-text-muted);
  display: block;
}

.billing-row__cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
}

.billing-row__cell--highlight {
  color: var(--color-primary);
  font-weight: 600;
}

@media (max-width: 768px) {
  .billing-header { display: none; }
  .billing-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
  }
  .billing-row__franchise {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   BBS PER-GAME SCORING
   ============================================================ */
.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.totals-cell {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.totals-name {
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.totals-score {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
}

.game-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.game-block__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.game-block__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  margin: 0;
}

.game-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-form__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
}

.radio-option:hover { border-color: var(--color-primary); }

.radio-option input { accent-color: var(--color-primary); }

.bonus-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
}

.game-block__details {
  padding: 12px 16px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.game-block__details p { margin: 0 0 4px; }
.game-block__details p:last-child { margin: 0; }

.game-block__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   Password visibility toggle (added by app.js)
   ============================================================ */
.pw-toggle-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.pw-toggle-wrap input[type="password"],
.pw-toggle-wrap input[type="text"] {
  width: 100%;
  padding-right: 44px; /* leave room for the eye button */
}
.pw-toggle-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 6px 8px;
  cursor: pointer;
  color: #888;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.pw-toggle-btn:hover,
.pw-toggle-btn:focus {
  color: var(--color-primary, #008E2C);
  background-color: rgba(0, 142, 44, 0.08);
  outline: none;
}
.pw-toggle-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 142, 44, 0.3);
}

/* ============================================================
   AD BANNER — operator-managed affiliate ads on franchise homepage.
   Sits between the header and the hero. 5:1 aspect ratio, rotates
   through enabled ads. Hidden entirely if no ads exist (the EJS
   wrapper doesn't render the container in that case).
   ============================================================ */
.ad-banner {
  position: relative;
  width: 100%;
  /* 5:1 aspect ratio. aspect-ratio is well-supported in modern browsers;
     padding-top fallback would be 20% if needed. */
  aspect-ratio: 5 / 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  /* Subtle so the banner is unobtrusive — players notice but it doesn't
     dominate the page. */
}

.ad-banner__slot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  /* All slots are stacked on top of each other. The active one is
     visible; others are hidden via opacity. Cross-fade animation when
     rotation swaps the active slot. */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-in-out;
}

.ad-banner__slot.is-active {
  opacity: 1;
  visibility: visible;
  /* z-index so the active slot is clickable; inactive slots can't
     intercept clicks even with visibility:hidden as a fallback. */
  z-index: 2;
}

.ad-banner__img {
  width: 100%;
  height: 100%;
  /* contain rather than cover so the operator's image isn't cropped —
     they expect what they uploaded to be visible in full. Excess space
     shows the .ad-banner background. */
  object-fit: contain;
  display: block;
}

.ad-banner__title {
  position: absolute;
  left: 12px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
}

.ad-banner__label {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.85);
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 3;
  pointer-events: none;
}
