/* ==========================================================================
   Patok — Theme layer  (Day / Night)
   --------------------------------------------------------------------------
   This file is loaded AFTER newStyle.css and only *re-declares design tokens*
   plus adds the light ("Day") palette. Because every component in the codebase
   consumes the `--pk-*` / `--chui-*` / `--lobby-*` custom properties, flipping
   the token values is enough to re-skin the whole client — no component
   duplication, no specificity wars.

   Contract:
     html[data-theme="dark"]   → "Patok Night"  (default, gold + aqua on ink)
     html[data-theme="light"]  → "Patok Day"    (gold + teal on parchment)
     html[data-theme-mode]     → user preference ('auto' | 'light' | 'dark')

   Scheduled by js/theme.js; first paint resolved by the inline bootstrap in
   index.php to prevent FOUC.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DARK — "Patok Night"  (refined: deeper inks, crisper gold, softer glow)
   -------------------------------------------------------------------------- */
html[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces */
  --pk-bg: #04080f;
  --pk-panel: #0a1b29;
  --pk-panel-2: #0f2635;
  --pk-panel-3: #133546;
  --pk-elev: rgba(10, 27, 41, 0.92);
  --pk-lobby-bg: #061725;
  --pk-page-deep: #020810;

  /* Semantic surfaces (consumed by components in newStyle.css) */
  --pk-surface-1: rgba(10, 27, 41, 0.96);
  --pk-surface-2: rgba(6, 20, 33, 0.96);
  --pk-surface-3: rgba(15, 38, 53, 0.85);
  --pk-surface-hover-1: #133546;
  --pk-surface-hover-2: #0a1b29;
  --pk-glass-bar-1: rgba(3, 9, 16, 0.94);
  --pk-glass-bar-2: rgba(3, 9, 16, 0.74);
  --pk-glass-tint: rgba(3, 9, 16, 0.55);
  --pk-glass-tint-strong: rgba(3, 9, 16, 0.74);
  --pk-overlay: rgba(3, 9, 16, 0.78);
  --pk-overlay-soft: rgba(0, 0, 0, 0.5);
  --pk-overlay-faint: rgba(0, 0, 0, 0.25);
  --pk-profile-scrim: rgba(0, 0, 0, 0.65);
  --pk-crop-mask: rgba(3, 9, 16, 0.62);
  --pk-input-bg: rgba(3, 9, 16, 0.66);
  --pk-canvas-tint: rgba(0, 0, 0, 0.189);
  --pk-modal-backdrop: #04080f;
  --pk-media-scrim-1: rgba(3, 9, 16, 0.92);
  --pk-media-scrim-2: rgba(3, 9, 16, 0.35);
  --pk-media-scrim-3: rgba(3, 9, 16, 0.08);
  --pk-media-chip: rgba(3, 9, 16, 0.62);

  /* Chat reply quote */
  --pk-reply-bg: rgba(19, 53, 70, 0.72);
  --pk-reply-bg-hover: rgba(19, 53, 70, 0.95);
  --pk-reply-border: rgba(200, 170, 110, 0.22);
  --pk-reply-bar-bg: rgba(3, 9, 16, 0.94);
  --pk-reply-text: #d3c49a;
  --pk-reply-rail: #0ac8b9;
  --pk-reply-rail-mine: #c8aa6e;

  --pk-shadow-color: #000;
  --pk-logo-invert: 1;
  --pk-text-halo: rgba(0, 0, 0, 0.85);
  --pk-text-halo-soft: rgba(0, 0, 0, 0.5);

  /* Hairlines */
  --pk-line: rgba(200, 170, 110, 0.2);
  --pk-line-2: rgba(200, 170, 110, 0.44);
  --pk-line-3: rgba(200, 170, 110, 0.1);

  /* Brand metals */
  --pk-gold-1: #f0e6d2;
  --pk-gold-2: #c8aa6e;
  --pk-gold-3: #7a5c29;
  --pk-gold-deep: #a8863f;
  --pk-aqua: #0ac8b9;
  --pk-aqua-2: #0397ab;
  --pk-aqua-3: #005a82;
  --pk-aqua-soft: rgba(10, 200, 185, 0.13);

  /* Type */
  --pk-text: #a8a294;
  --pk-text-2: #d3c49a;
  --pk-text-muted: #8b8677;
  --pk-text-strong: #f4efe2;
  --pk-danger: #e08080;

  /* Status */
  --pk-ok: #0b9b5e;
  --pk-ok-2: #22c55e;

  /* Glass / chrome */
  --pk-glass: rgba(6, 20, 32, 0.72);
  --pk-glass-2: rgba(4, 12, 22, 0.86);
  --pk-scrim: rgba(2, 7, 14, 0.72);

  /* Gradients */
  --pk-grad-gold: linear-gradient(135deg, #dcc08a, #a8863f);
  --pk-grad-gold-hover: linear-gradient(135deg, #e8d3a4, #c8aa6e);
  --pk-grad-aqua: linear-gradient(135deg, #0ac8b9, #0397ab);
  --pk-grad-aqua-3stop: linear-gradient(135deg, #0ac8b9, #0397ab 55%, #005a82);
  --pk-grad-aqua-hover: linear-gradient(135deg, #3bdccf, #0ac8b9);
  --pk-aqua-hairline: rgba(205, 250, 250, 0.35);

  --pk-grad-panel: linear-gradient(160deg, var(--pk-surface-3), var(--pk-surface-2));
  --pk-grad-panel-lit: linear-gradient(160deg, rgba(200, 170, 110, 0.16), var(--pk-surface-2));
  --pk-grad-panel-hover: linear-gradient(160deg, var(--pk-surface-hover-1), var(--pk-surface-hover-2));
  --pk-grad-chrome: linear-gradient(180deg, var(--pk-surface-1), var(--pk-glass-bar-2));
  --pk-grad-chrome-soft: linear-gradient(180deg, var(--pk-glass-bar-1), var(--pk-glass-bar-2));
  --pk-grad-page:
    radial-gradient(ellipse 60% 42% at 88% -6%, rgba(10, 200, 185, 0.14), transparent 62%),
    radial-gradient(ellipse 55% 38% at 6% 14%, rgba(200, 170, 110, 0.11), transparent 62%),
    linear-gradient(180deg, #04080f 0%, #061725 46%, #020810 100%);

  /* Shadows */
  --pk-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --pk-shadow-md: 0 6px 14px -6px rgba(0, 0, 0, 0.62);
  --pk-shadow-lg: 0 14px 30px -10px rgba(0, 0, 0, 0.72);
  --pk-shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.82);
  --pk-shadow-card: 0 12px 26px -20px rgba(0, 0, 0, 1);
  --pk-glow-aqua: 0 0 20px -10px rgba(10, 200, 185, 0.45);
  --pk-focus: 0 0 0 3px rgba(10, 200, 185, 0.42);

  /* Brand actions */
  --pk-on-gold: #1a1408;
  --pk-on-aqua: #03151b;

  /* Legacy aliases consumed across the codebase */
  --primary: var(--pk-aqua-2);
  --primary-dark: var(--pk-aqua-3);
  --secondary: var(--pk-text-2);
  --secondary-dark: var(--pk-text);
  --success: var(--pk-ok);
  --success-dark: #0a7f4e;
  --danger: #b91c1c;
  --danger-dark: #991b1b;
  --warning: #b45309;
  --warning-dark: #92400e;
  --info: var(--pk-aqua-2);
  --info-dark: var(--pk-aqua-3);
  --light: #f8fafc;
  --dark: var(--pk-gold-1);
  --border-color: var(--pk-line);
  --border-light: var(--pk-line-3);
  --text-muted: var(--pk-text);

  /* Lobby */
  --lobby-bg: #061725;
  --lobby-surface: var(--pk-panel);
  --lobby-surface-2: var(--pk-panel-2);
  --lobby-accent: var(--pk-aqua);
  --lobby-accent-light: var(--pk-aqua-soft);

  /* Chats UI */
  --chui-bg: #061725;
  --chui-surface: var(--pk-panel);
  --chui-surface-alt: var(--pk-panel-2);
  --chui-border: var(--pk-line);
  --chui-border-light: var(--pk-line-3);
  --chui-text: var(--pk-gold-1);
  --chui-text-secondary: var(--pk-text-2);

  --chui-text-muted: var(--pk-text-muted);
  --chui-accent: var(--pk-aqua-2);
  --chui-accent-light: var(--pk-aqua-soft);
  --chui-accent-soft: rgba(10, 200, 185, 0.28);
  --chui-danger: var(--pk-danger);
  --chui-danger-light: rgba(224, 128, 128, 0.14);
  --chui-danger-border: rgba(224, 128, 128, 0.5);
  --chui-success: var(--pk-ok-2);
  --chui-success-light: rgba(34, 197, 94, 0.14);
  --chui-warning: #f59e0b;
  --chui-warning-light: rgba(245, 158, 11, 0.14);
  --chui-warning-border: rgba(245, 158, 11, 0.4);
  --chui-shadow-sm: var(--pk-shadow-sm);
  --chui-shadow: var(--pk-shadow-sm);
  --chui-shadow-md: var(--pk-shadow-md);
  --chui-shadow-lg: var(--pk-shadow-lg);
  --chui-shadow-xl: var(--pk-shadow-xl);
}
/* --------------------------------------------------------------------------
   2. LIGHT — "Patok Day"
   A warm parchment surface (not a stark white) keeps the brand's board-game /
   tavern feel while meeting WCAG AA contrast for body copy and controls.
   -------------------------------------------------------------------------- */
html[data-theme="light"] {
  color-scheme: light;

  /* Surfaces — warm paper */
  --pk-bg: #f4f1ea;
  --pk-panel: #fffdf8;
  --pk-panel-2: #f7f3ea;
  --pk-panel-3: #efe9dc;
  --pk-elev: rgba(255, 253, 248, 0.94);
  --pk-lobby-bg: #f1ece1;
  --pk-page-deep: #ece5d7;

  /* Semantic surfaces — paper panels with a warm ink veil instead of ink with
     a gold veil, so every component flips without a separate rule set. */
  --pk-surface-1: rgba(255, 253, 248, 0.96);
  --pk-surface-2: rgba(247, 243, 234, 0.96);
  --pk-surface-3: rgba(239, 233, 220, 0.92);
  --pk-surface-hover-1: #efe9dc;
  --pk-surface-hover-2: #f7f3ea;
  --pk-glass-bar-1: rgba(250, 247, 240, 0.94);
  --pk-glass-bar-2: rgba(244, 239, 229, 0.78);
  --pk-glass-tint: rgba(255, 253, 248, 0.72);
  --pk-glass-tint-strong: rgba(255, 253, 248, 0.88);
  --pk-overlay: rgba(58, 47, 27, 0.34);
  --pk-overlay-soft: rgba(58, 47, 27, 0.22);
  --pk-overlay-faint: rgba(58, 47, 27, 0.12);
  --pk-profile-scrim: rgba(58, 47, 27, 0.34);
  --pk-crop-mask: rgba(58, 47, 27, 0.42);
  --pk-input-bg: #fffdf8;
  --pk-canvas-tint: rgba(58, 47, 27, 0.06);
  --pk-modal-backdrop: #f4f1ea;
  --pk-media-scrim-1: rgba(30, 24, 12, 0.9);
  --pk-media-scrim-2: rgba(30, 24, 12, 0.34);
  --pk-media-scrim-3: rgba(30, 24, 12, 0.08);
  --pk-media-chip: rgba(30, 24, 12, 0.62);

  /* Chat reply quote — on paper the plate needs a clearly darker warm tint
     plus a real border; a thin veil disappears and the reply becomes invisible
     in "Patok Day". --pk-reply-text is a deep ink for AA contrast on that plate. */
  --pk-reply-bg: rgba(58, 47, 27, 0.16);
  --pk-reply-bg-hover: rgba(58, 47, 27, 0.24);
  --pk-reply-border: rgba(120, 90, 40, 0.34);
  --pk-reply-bar-bg: #ece5d7;
  --pk-reply-text: #3a3125;
  --pk-reply-rail: #0e8f86;
  --pk-reply-rail-mine: #8a6a2f;

  --pk-shadow-color: #5a4828;
  --pk-logo-invert: 1;
  --pk-text-halo: rgba(30, 24, 12, 0.7);
  --pk-text-halo-soft: rgba(30, 24, 12, 0.35);

  /* Hairlines — warm ink veils (darker than the dark theme so they read on paper) */
  --pk-line: rgba(120, 90, 40, 0.22);
  --pk-line-2: rgba(120, 90, 40, 0.42);
  --pk-line-3: rgba(120, 90, 40, 0.12);

  /* Brand metals — deepened for contrast on light surfaces */
  --pk-gold-1: #3a2f1b;   /* headings / high-emphasis on paper */
  --pk-gold-2: #8a6a2f;   /* mid gold */
  --pk-gold-3: #b08c48;
  --pk-gold-deep: #6f5320;
  --pk-aqua: #0e8f86;
  --pk-aqua-2: #0b7d84;
  --pk-aqua-3: #0a5f6b;
  --pk-aqua-soft: rgba(11, 125, 132, 0.12);

  /* Type — slate ink */
  --pk-text: #4f4a3f;
  --pk-text-2: #6a5c3c;
  --pk-text-muted: #7d7669;
  --pk-text-strong: #2a2418;
  --pk-danger: #b23b3b;

  /* Status */
  --pk-ok: #0f7a4c;
  --pk-ok-2: #128a56;

  /* Glass / chrome */
  --pk-glass: rgba(255, 253, 248, 0.78);
  --pk-glass-2: rgba(247, 243, 234, 0.9);
  --pk-scrim: rgba(58, 47, 27, 0.42);

  /* Gradients */
  --pk-grad-gold: linear-gradient(135deg, #c8a45c, #8a6a2f);
  --pk-grad-gold-hover: linear-gradient(135deg, #d9b876, #a07d3a);
  --pk-grad-aqua: linear-gradient(135deg, #13a79b, #0a5f6b);
  --pk-grad-aqua-3stop: linear-gradient(135deg, #13a79b, #0b7d84 55%, #0a5f6b);
  --pk-grad-aqua-hover: linear-gradient(135deg, #2abfae, #0b7d84);
  --pk-aqua-hairline: rgba(11, 125, 132, 0.28);

  --pk-grad-panel: linear-gradient(160deg, var(--pk-surface-3), var(--pk-surface-2));
  --pk-grad-panel-lit: linear-gradient(160deg, rgba(176, 140, 72, 0.18), var(--pk-surface-2));
  --pk-grad-panel-hover: linear-gradient(160deg, var(--pk-surface-hover-1), var(--pk-surface-hover-2));
  --pk-grad-chrome: linear-gradient(180deg, var(--pk-surface-1), var(--pk-glass-bar-2));
  --pk-grad-chrome-soft: linear-gradient(180deg, var(--pk-glass-bar-1), var(--pk-glass-bar-2));
  --pk-grad-page:
    radial-gradient(ellipse 60% 42% at 88% -6%, rgba(11, 125, 132, 0.1), transparent 62%),
    radial-gradient(ellipse 55% 38% at 6% 14%, rgba(176, 140, 72, 0.13), transparent 62%),
    linear-gradient(180deg, #f7f4ed 0%, #f1ece1 48%, #ece5d7 100%);

  /* Shadows — soft, warm, low-contrast (paper shouldn't look printed on) */
  --pk-shadow-sm: 0 1px 2px rgba(90, 72, 40, 0.1);
  --pk-shadow-md: 0 6px 14px -6px rgba(90, 72, 40, 0.18);
  --pk-shadow-lg: 0 14px 28px -12px rgba(90, 72, 40, 0.22);
  --pk-shadow-xl: 0 20px 44px -14px rgba(90, 72, 40, 0.26);
  --pk-shadow-card: 0 10px 22px -18px rgba(90, 72, 40, 0.5);
  --pk-glow-aqua: 0 0 18px -8px rgba(11, 125, 132, 0.35);
  --pk-focus: 0 0 0 3px rgba(11, 125, 132, 0.3);

  /* Brand actions — text laid over gold/aqua fills. The light palette uses a
     deeper ink rather than white: the gold gradient's light stop is #c8a45c, so
     white would only reach ~3.6:1 while ink clears AA comfortably (~7:1). */
  --pk-on-gold: #2b2110;
  --pk-on-aqua: #062b2c;

  /* Legacy aliases */
  --primary: var(--pk-aqua-2);
  --primary-dark: var(--pk-aqua-3);
  --secondary: var(--pk-gold-2);
  --secondary-dark: var(--pk-gold-deep);
  --success: var(--pk-ok);
  --success-dark: #0b5f3b;
  --danger: #b23b3b;
  --danger-dark: #8f2f2f;
  --warning: #a3681a;
  --warning-dark: #855314;
  --info: var(--pk-aqua-2);
  --info-dark: var(--pk-aqua-3);
  --light: #fffdf8;
  --dark: var(--pk-text-strong);
  --border-color: var(--pk-line);
  --border-light: var(--pk-line-3);
  --text-muted: var(--pk-text-muted);

  /* Lobby */
  --lobby-bg: #f1ece1;
  --lobby-surface: var(--pk-panel);
  --lobby-surface-2: var(--pk-panel-2);
  --lobby-accent: var(--pk-aqua-2);
  --lobby-accent-light: var(--pk-aqua-soft);

  /* Chats UI */
  --chui-bg: #f7f3ea;
  --chui-surface: var(--pk-panel);
  --chui-surface-alt: var(--pk-panel-2);
  --chui-border: var(--pk-line);
  --chui-border-light: var(--pk-line-3);
  --chui-text: var(--pk-text-strong);
  --chui-text-secondary: var(--pk-text-2);
  --chui-text-muted: var(--pk-text-muted);
  --chui-accent: var(--pk-aqua-2);
  --chui-accent-light: var(--pk-aqua-soft);
  --chui-accent-soft: rgba(11, 125, 132, 0.24);
  --chui-danger: var(--pk-danger);
  --chui-danger-light: rgba(178, 59, 59, 0.1);
  --chui-danger-border: rgba(178, 59, 59, 0.4);
  --chui-success: #128a56;
  --chui-success-light: rgba(18, 138, 86, 0.12);
  --chui-warning: #b45309;
  --chui-warning-light: rgba(180, 83, 9, 0.12);
  --chui-warning-border: rgba(180, 83, 9, 0.35);
  --chui-shadow-sm: var(--pk-shadow-sm);
  --chui-shadow: var(--pk-shadow-sm);
  --chui-shadow-md: var(--pk-shadow-md);
  --chui-shadow-lg: var(--pk-shadow-lg);
  --chui-shadow-xl: var(--pk-shadow-xl);
}

/* ==========================================================================
   3. GLOBAL BEHAVIOUR (applies to both themes)
   ========================================================================== */

html {
  background-color: var(--pk-bg);
}

/* Body paints from the shared token so there is no white flash behind the
   (transparent) app surfaces during view transitions. */
body {
  background: var(--pk-bg);
  color: var(--pk-text);
  transition: background-color 0.28s ease, color 0.28s ease;
}

/* Theme changes animate gently instead of snapping. */
.ui_holder,
.lobby-container,
.mainSection,
.modal-content,
.ui_bottomNav,
.ui_topMenu,
.ui_MainMenus_ChatsUI__container {
  transition:
    background-color 0.28s ease,
    color 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

/* --------------------------------------------------------------------------
   Focus visibility — keyboard users get a clear ring, pointer users don't.
   -------------------------------------------------------------------------- */
:where(button, [role="button"], a, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--pk-focus);
}

/* --------------------------------------------------------------------------
   Scrollbars — themed thumb legible on both palettes.
   -------------------------------------------------------------------------- */
*::-webkit-scrollbar-thumb {
  background-color: rgba(200, 170, 110, 0.45);
}
html[data-theme="light"] *::-webkit-scrollbar-thumb {
  background-color: rgba(120, 90, 40, 0.32);
}
*::-webkit-scrollbar-thumb:hover {
  background-color: var(--pk-gold-2);
}

/* --------------------------------------------------------------------------
   Selection text
   -------------------------------------------------------------------------- */
::selection {
  background: rgba(10, 200, 185, 0.28);
  color: var(--pk-gold-1);
}
html[data-theme="light"] ::selection {
  background: rgba(11, 125, 132, 0.22);
  color: var(--pk-text-strong);
}

/* --------------------------------------------------------------------------
   Reduced motion — honour the OS toggle (WCAG 2.3.3).
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   4. THEME SWITCHER  (#pkThemeSwitch, injected into .ui_topMenu)
   Segmented control: auto | light | dark. Sits inline in the top chrome.
   ========================================================================== */
.ui_topMenu {
  /* top bar hosts coin pill (start) + theme switch (end);
     layout, padding and gap are owned by newStyle.css so there is a
     single source of truth. Only the switch position needs a nudge. */
}

.pk-themeSwitch {
  /* No margin-right hack: the bar is a space-between flex row, so the
     switch already sits at the inline-end edge. A hardcoded margin here
     used to fight with an inline style written by toggleFullScreen(). */
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--pk-line);
  border-radius: 999px;
  background: var(--pk-glass-2);
  box-shadow: var(--pk-shadow-sm);
  direction: ltr;
  flex-shrink: 0;
}

.pk-themeSwitch__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--pk-text-muted);
  width: 30px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.pk-themeSwitch__btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pk-themeSwitch__btn:hover {
  color: var(--pk-gold-1);
  background: var(--pk-aqua-soft);
}

.pk-themeSwitch__btn:active {
  transform: scale(0.92);
}

.pk-themeSwitch__btn.is-active {
  color: var(--pk-on-gold);
  background: var(--pk-grad-gold);
  box-shadow: 0 4px 12px -6px rgba(200, 170, 110, 0.9);
}

.pk-themeSwitch__btn.is-active:hover {
  background: var(--pk-grad-gold-hover);
  color: var(--pk-on-gold);
}

/* Keyboard ring inside the compact control */
.pk-themeSwitch__btn:focus-visible {
  box-shadow: var(--pk-focus);
}

/* ==========================================================================
   5. COMPONENT SKIN — light ("Day") corrections
   --------------------------------------------------------------------------
   As of the token refactor, newStyle.css no longer hardcodes dark surfaces:
   every panel, glass layer, scrim and input derives from a --pk-* token, and
   the palette above re-declares those tokens for "Patok Day". The rules below
   are the residual exceptions that genuinely need a light-only tweak — i.e.
   artwork scrims that must stay dark, and specific regions where the paper
   tint has to be denser than the shared token. Layout is never touched.
   ========================================================================== */

/* --- App shell surfaces -------------------------------------------------- */
html[data-theme="light"] .ui_holder {
  background: var(--pk-grad-page);
  color: var(--pk-text);
}

html[data-theme="light"] #ui_mainMenu {
  background: var(--pk-grad-page);
}

html[data-theme="light"] #gamedisplay {
  background: var(--pk-canvas-tint);
}

html[data-theme="light"] .mainMenu-content::before {
  background: radial-gradient(
    ellipse 45% 26% at 50% 0%,
    rgba(11, 125, 132, 0.09),
    transparent 70%
  );
}

/* --- Login / OTP / name & bio screens ------------------------------------ */
html[data-theme="light"] .ui_login > * {
  color: var(--pk-text);
}
/* The mark is authored white; on paper we keep the invert (via the shared
   --pk-logo-invert token) and swap the aqua glow for a warm neutral halo. */
html[data-theme="light"] .ui_login #logo,
html[data-theme="light"] .ui_holder #logo,
html[data-theme="light"] .ui_holder #logo_verify {
  filter: invert(var(--pk-logo-invert, 1))
    drop-shadow(0 6px 20px rgba(120, 90, 40, 0.22)) !important;
}

/* --- System modals ------------------------------------------------------- */
html[data-theme="light"] body .modal {
  background: var(--pk-scrim);
}

/* --- News / Shop / Chats chrome ----------------------------------------- */
/* .shop-header / .ui_MainMenus_ChatsUI__header now derive from --pk-surface-*,
   so they need no light-specific rule. Only the search field and the tab strip
   still need a slightly denser paper tint for comfortable field affordance. */
html[data-theme="light"] #ui_topbar_twoTimerPlayer > div {
  background: var(--pk-glass-tint-strong);
}
html[data-theme="light"] #ui_MainMenus_UserUI_UserName_Edit,
html[data-theme="light"] #ui_MainMenus_UserUI_BioEdit,
html[data-theme="light"] #ui_avatar_frame_modal_closeBTN {
  background-color: var(--pk-surface-3) !important;
  color: var(--pk-text-2);
}
html[data-theme="light"] #ui_MainMenus_UserUI_UserName {
  color: var(--pk-text-strong);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}
html[data-theme="light"] .member-bubble__voice,
html[data-theme="light"] .player-slot__voice {
  background: var(--pk-surface-1);
}
html[data-theme="light"] .msg-edit-input {
  background: var(--pk-surface-1);
  color: var(--pk-text-strong);
}

/* --- Product cards keep their image scrim (readability over photos) ------
   The card art is a photo in both palettes, so the caption keeps a dark chip
   with a light label rather than following the paper theme. */
html[data-theme="light"] .shop-product-card__name {
  color: #fffdf8;
  background-color: var(--pk-media-chip);
}
html[data-theme="light"] .shop-product-card__desc {
  color: #efe9da;
}

/* --- On-load splash -------------------------------------------------------
   #onloadcontentscreen already paints from --pk-bg; only the accent glow needs
   a softer, warmer value on paper. */
html[data-theme="light"] #onloadcontentscreen {
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(11, 125, 132, 0.1), transparent 62%),
    var(--pk-bg);
}

/* --- Full-screen toggle & loaders ----------------------------------------
   #fullScreenBTN and .ball-grid-beat now consume --pk-grad-chrome / --pk-aqua,
   which the light palette re-declares — no light-specific rule required. */


/* ==========================================================================
   6. UX POLISH — shared micro-interactions (both themes)
   ========================================================================== */

/* Bottom navigation: the active item gets a soft pill so the current tab is
   unmistakable even on low-contrast screens. */
.ui_bottomNav .nav-item {
  isolation: isolate;
}
.ui_bottomNav .nav-item.active::before {
  content: "";
  position: absolute;
  inset: 6px 18%;
  border-radius: 14px;
  background: var(--pk-aqua-soft);
  z-index: -1;
}

/* Cards advertise their lift on pointer devices (hint the compositor). */
@media (hover: hover) and (pointer: fine) {
  .lobby-card:hover,
  .news-card:hover,
  .shop-product-card:hover {
    will-change: transform;
  }
}

/* Touch targets: guarantee a comfortable tap area on coarse pointers
   (WCAG 2.5.5 target size / Material 48dp guidance) for icon-only controls.
   NOTE: lobby header buttons are intentionally excluded — the header is a
   single-row grid whose width is fixed, and .lobby-header owns its own
   --lobby-hit sizing (36-40px) so the title keeps enough room on narrow
   phones. Forcing 44px here overflowed the header on <=320px screens. */
@media (pointer: coarse) {
  .pk-themeSwitch__btn {
    width: 34px;
    height: 30px;
  }
}

/* Safe-area for the top chrome (notched / rounded-corner devices).
   NOTE: --topbar-height is owned by newStyle.css (:root) and already
   includes env(safe-area-inset-top). Do not redefine it here — an older
   copy of this rule lived here and silently reset the value to 36px,
   which made the bar hug its own buttons. `.mainMenu-content` consumes
   the same token, so both stay aligned automatically. */

/* High-contrast / forced-colors mode: keep structural borders visible. */
@media (forced-colors: active) {
  .ui_holder,
  .lobby-container,
  .modal-content,
  .ui_bottomNav {
    border: 1px solid CanvasText;
  }
}

/* ==========================================================================
   7. UTILITIES — theme-aware helpers exposed to JS / markup
   ========================================================================== */

/* Hide an element only in the given palette — useful for swapping a heavy
   raster logo for a light-optimised one without touching the component CSS. */
html[data-theme="light"] .pk-hide-light {
  display: none !important;
}
html[data-theme="dark"] .pk-hide-dark {
  display: none !important;
}

/* Small caption used next to swatches in settings surfaces. */
.pk-themeSwatch-label {
  font: 600 11px/1 inherit;
  letter-spacing: 0.2px;
}

/* ==========================================================================
   8. RTL gate for self-contained widgets
   --------------------------------------------------------------------------
   The markup of injected widgets (js/wheel.js → #ui_wheel) is authored in
   RTL, but it is mounted into a host that does not guarantee a direction
   (#UI / body — see minirtl.css). style/wheel.css already declares it for
   itself; this rule keeps the guarantee even if that sheet fails to load,
   while :where() keeps zero specificity so style/wheel.css stays in charge.
   ========================================================================== */
:where(#ui_wheel) {
  direction: rtl;
}







