/* Extracted from views/layout.php.
 * These rules were rendered inline into every page. Page HTML is sent with
 * no-store, so ~9 KB of unchanging CSS was re-downloaded on every single
 * navigation; as a file it gets the same 10-year cache as the other stylesheets.
 * Part 1: main layout/nav. Part 2: tutorial popup. */
    /* Scope Tailwind resets away from design-system components */
    .topnav, .topnav *, .sheet, .sheet *, .ds-toast, .ds-toast * {
      box-sizing: border-box;
    }

    /* ── Global Tailwind → design-token bridge ──────────────────────────────
       Overrides Tailwind utility classes so every existing page inherits
       the new palette without requiring per-file rewrites.
    ── */
    /* Surfaces */
    .bg-white      { background-color: var(--bg-surface) !important; color: var(--fg-primary) !important; }
    .bg-gray-50    { background-color: var(--bg-inset) !important; }
    .bg-gray-100   { background-color: var(--bg-inset) !important; }
    .bg-gray-200   { background-color: var(--bg-inset) !important; }
    /* Foreground */
    .text-gray-900, .text-gray-800 { color: var(--fg-primary) !important; }
    .text-gray-700, .text-gray-600 { color: var(--fg-secondary) !important; }
    .text-gray-500, .text-gray-400 { color: var(--fg-tertiary) !important; }
    .text-gray-300, .text-gray-200 { color: var(--fg-muted) !important; }
    /* Borders */
    .border         { border-color: var(--line-default) !important; }
    .border-gray-200, .border-gray-300 { border-color: var(--line-subtle) !important; }
    .border-b       { border-bottom-color: var(--line-subtle) !important; }
    .border-t       { border-top-color: var(--line-subtle) !important; }
    .divide-y > * + * { border-top-color: var(--line-subtle) !important; }
    /* Shadows */
    .shadow, .shadow-md { box-shadow: var(--shadow-md) !important; }
    .shadow-sm          { box-shadow: var(--shadow-sm) !important; }
    /* Radius */
    .rounded-xl, .rounded-2xl { border-radius: var(--r-md) !important; }
    .rounded-lg               { border-radius: var(--r-md) !important; }
    .rounded                  { border-radius: var(--r-sm) !important; }
    .rounded-full             { border-radius: var(--r-pill) !important; }
    /* Buttons – green primary */
    .bg-green-700 { background-color: var(--c-lime) !important; color: var(--c-lime-ink) !important; border-color: var(--c-lime) !important; }
    .hover\:bg-green-600:hover { filter: brightness(0.95) !important; }
    .text-green-700 { color: var(--c-confirmed-fg) !important; }
    /* Buttons – secondary/ghost */
    .bg-gray-700, .bg-gray-800 { background-color: var(--fg-primary) !important; color: var(--bg-base) !important; }
    .bg-gray-600               { background-color: var(--fg-secondary) !important; color: var(--bg-base) !important; }
    /* Status – pending (yellow) */
    .bg-yellow-50, .bg-yellow-100 { background-color: var(--c-pending-bg) !important; }
    .text-yellow-600, .text-yellow-700, .text-yellow-800 { color: var(--c-pending-fg) !important; }
    .border-yellow-300 { border-color: var(--c-status-pending) !important; }
    /* Status – claimed (blue) */
    .bg-blue-50, .bg-blue-100   { background-color: var(--c-claimed-bg) !important; }
    .text-blue-600, .text-blue-700, .text-blue-800 { color: var(--c-claimed-fg) !important; }
    .border-blue-200            { border-color: rgba(143,180,255,0.3) !important; }
    .bg-blue-600                { background-color: var(--c-claimed-fg) !important; color: var(--bg-base) !important; }
    /* Status – confirmed (lime) */
    .bg-green-50, .bg-green-100 { background-color: var(--c-confirmed-bg) !important; }
    .text-green-700, .text-green-800 { color: var(--c-confirmed-fg) !important; }
    .border-green-200, .border-green-300 { border-color: rgba(199,255,91,0.4) !important; }
    /* Status – waived (lavender/purple) */
    .bg-purple-100              { background-color: var(--c-waived-bg) !important; }
    .text-purple-600, .text-purple-700 { color: var(--c-waived-fg) !important; }
    .bg-purple-600              { background-color: var(--c-lavender) !important; color: var(--c-lavender-ink) !important; }
    /* Danger/error */
    .bg-red-50                  { background-color: var(--c-danger-bg) !important; }
    .text-red-700, .text-red-800 { color: var(--c-danger-fg) !important; }
    .border-red-300, .border-red-400 { border-color: var(--c-danger-fg) !important; }
    /* Form focus rings */
    .focus\:ring-green-500:focus, .focus\:ring-2:focus {
      box-shadow: 0 0 0 3px rgba(199,255,91,0.18) !important;
    }
    .focus\:border-green-500:focus, .focus\:ring-2:focus {
      border-color: var(--c-lime) !important;
    }
    /* Link colours */
    .text-green-700 a, a.text-green-700 { color: var(--c-lime) !important; }
    .text-blue-600  a, a.text-blue-600  { color: var(--c-claimed-fg) !important; }
    /* Page content max-width container */
    .page-content {
      max-width: 1024px;
      margin: 0 auto;
      padding: var(--s-8) var(--s-9);
    }
    @media (max-width: 720px) {
      .page-content { padding: var(--s-7) 20px; }
    }
    /* Player bottom tabbar */
    .player-tabbar {
      display: none;
    }
    @media (max-width: 639px) {
      .player-tabbar {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--bg-elevated);
        border-top: 1px solid var(--line-subtle);
        z-index: 30;
      }
      .has-tabbar .page-content { padding-bottom: 5rem; }
    }
    .player-tab {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      padding: 10px 0 8px;
      text-decoration: none;
      font-family: var(--font-mono);
      font-size: var(--t-mono);
      letter-spacing: var(--ls-mono);
      text-transform: uppercase;
      color: var(--fg-muted);
      transition: color var(--d-fast) var(--ease-out);
    }
    .player-tab[aria-current='page'] { color: var(--c-accent); }
    .player-tab:hover { color: var(--fg-secondary); }
    .player-tab-icon { font-size: 20px; line-height: 1; }
    /* Flash/toast bar */
    .flash-bar {
      margin: var(--s-5) 0;
    }
    @media (max-width: 720px) {
      #logout-desktop { display: none !important; }
    }
    /* Fix: inline display:flex on mobile-only divs overrides Tailwind sm:hidden class.
       !important ensures the media-query rule wins over inline styles. */
    @media (min-width: 640px) {
      .sm\:hidden { display: none !important; }
    }

/* ── tutorial popup ── */
  .tut-help-btn {
    display: inline;
    font-size: var(--t-caption);
    font-weight: 500;
    color: var(--c-accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5em;
    letter-spacing: 0;
    font-family: inherit;
    vertical-align: baseline;
    line-height: inherit;
    opacity: 0.8;
  }
  .tut-help-btn:hover { opacity: 1; text-decoration: underline; }

  /* Tutorial modal — uses design tokens so it adapts to light/dark themes */
  #tut-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--line-default);
    border-radius: 16px;
    padding: 28px 28px 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    font-family: var(--font-body, Inter, sans-serif);
    box-shadow: var(--shadow-md);
  }
  .tut-title {
    font-family: var(--font-display, Inter Tight, sans-serif);
    font-size: 18px;
    font-weight: 800;
    color: var(--fg-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
  }
  .tut-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--fg-muted);
    line-height: 1;
    padding: 2px 0 0 12px;
    flex-shrink: 0;
  }
  .tut-close-btn:hover { color: var(--fg-primary); }
  .tut-step-label {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin-bottom: 20px;
  }
  .tut-body {
    font-size: 14px;
    color: var(--fg-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
  }
  .tut-dot-inactive { background: var(--line-default); }
  .tut-img {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line-subtle);
    display: block;
    margin-bottom: 20px;
  }
  .tut-btn-prev {
    background: transparent;
    color: var(--fg-secondary);
    border: 1px solid var(--line-default);
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 140ms;
  }
  .tut-btn-prev:hover { border-color: var(--line-strong); color: var(--fg-primary); }
  .tut-status-text {
    text-align: center;
    padding: 32px 0;
    color: var(--fg-muted);
    font-size: 13px;
    font-family: inherit;
  }
  .tut-btn-close-empty {
    background: transparent;
    color: var(--fg-secondary);
    border: 1px solid var(--line-default);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
  }
