/* Padhopper's site-wide look: the theme tokens every page reads (--ph-*) and the site bar (sitebar.js). Each game maps
   its own chrome colours (menus, panels, buttons, text) onto the tokens and keeps its own boards and art.
   Copied into the games without a bundler and the landing page (scripts/sync-platform.mjs); edit it here only. */
:root { --ph-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --ph-radius: 12px; --ph-gap: 8px; }
/* Theme tokens (client/themes.js lists the themes). theme-boot.js puts data-ph-theme on <html>; a picker swatch carries
   data-ph-swatch so it shows its own colours. Without either (no script), light or dark follows the device. */
:root, :root[data-ph-theme='light'], [data-ph-swatch='light'] {
  --ph-bg: #f4f6f1; --ph-surface: #ffffff; --ph-surface-2: #eaeeea; --ph-ink: #1d2a1f;
  --ph-muted: #56655a; --ph-line: #d3dbd5; --ph-accent: #2f7d4f; --ph-accent-ink: #ffffff;
  --ph-accent-strong: #246640; --ph-accent-soft: #d7efe1; --ph-focus: #1a5fd1; --ph-online: #2f9d5c;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-ph-theme]) {
    --ph-bg: #121814; --ph-surface: #1c251f; --ph-surface-2: #252f28; --ph-ink: #e8efe9;
    --ph-muted: #a3b3a6; --ph-line: #34403a; --ph-accent: #6fcf97; --ph-accent-ink: #0d1a12;
    --ph-accent-strong: #8fdcae; --ph-accent-soft: #1d3a2b; --ph-focus: #7fb0ff; --ph-online: #6fcf97;
    --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
  }
}
:root[data-ph-theme='dark'], [data-ph-swatch='dark'] {
  --ph-bg: #121814; --ph-surface: #1c251f; --ph-surface-2: #252f28; --ph-ink: #e8efe9;
  --ph-muted: #a3b3a6; --ph-line: #34403a; --ph-accent: #6fcf97; --ph-accent-ink: #0d1a12;
  --ph-accent-strong: #8fdcae; --ph-accent-soft: #1d3a2b; --ph-focus: #7fb0ff; --ph-online: #6fcf97;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}
:root[data-ph-theme='contrast'], [data-ph-swatch='contrast'] {
  --ph-bg: #000000; --ph-surface: #000000; --ph-surface-2: #1a1a1a; --ph-ink: #ffffff;
  --ph-muted: #e0e0e0; --ph-line: #ffffff; --ph-accent: #ffd400; --ph-accent-ink: #000000;
  --ph-accent-strong: #ffe766; --ph-accent-soft: #333000; --ph-focus: #00e5ff; --ph-online: #4cff8f;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}
:root[data-ph-theme='mono'], [data-ph-swatch='mono'] {
  --ph-bg: #f2f2f2; --ph-surface: #ffffff; --ph-surface-2: #e6e6e6; --ph-ink: #111111;
  --ph-muted: #555555; --ph-line: #cfcfcf; --ph-accent: #111111; --ph-accent-ink: #ffffff;
  --ph-accent-strong: #333333; --ph-accent-soft: #e0e0e0; --ph-focus: #1a5fd1; --ph-online: #2f9d5c;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.18);
}
:root[data-ph-theme='sakura'], [data-ph-swatch='sakura'] {
  --ph-bg: #fdf1f4; --ph-surface: #ffffff; --ph-surface-2: #fae3ea; --ph-ink: #3b1f2b;
  --ph-muted: #75525f; --ph-line: #efc8d5; --ph-accent: #b8396a; --ph-accent-ink: #ffffff;
  --ph-accent-strong: #9a2d57; --ph-accent-soft: #fbd9e5; --ph-focus: #3a5fd1; --ph-online: #2f9d5c;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.18);
}
:root[data-ph-theme='lavender'], [data-ph-swatch='lavender'] {
  --ph-bg: #f5f0fb; --ph-surface: #ffffff; --ph-surface-2: #ece3f7; --ph-ink: #2c2140;
  --ph-muted: #665a7a; --ph-line: #d9cbec; --ph-accent: #7247bd; --ph-accent-ink: #ffffff;
  --ph-accent-strong: #5e37a3; --ph-accent-soft: #e6dbf7; --ph-focus: #c2560f; --ph-online: #2f9d5c;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.18);
}
:root[data-ph-theme='midnight'], [data-ph-swatch='midnight'] {
  --ph-bg: #0f1527; --ph-surface: #18213a; --ph-surface-2: #222e4f; --ph-ink: #e9edf7;
  --ph-muted: #a2acc6; --ph-line: #3a4770; --ph-accent: #f2b53a; --ph-accent-ink: #1a1a1a;
  --ph-accent-strong: #f7c866; --ph-accent-soft: #3a3220; --ph-focus: #7fd6ff; --ph-online: #6fcf97;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}
:root[data-ph-theme='ocean'], [data-ph-swatch='ocean'] {
  --ph-bg: #062a30; --ph-surface: #0b3a42; --ph-surface-2: #114a54; --ph-ink: #e3f7f7;
  --ph-muted: #9cc9cc; --ph-line: #1f6470; --ph-accent: #ff7f66; --ph-accent-ink: #2a0a04;
  --ph-accent-strong: #ff9a85; --ph-accent-soft: #4a2a26; --ph-focus: #4fe3e0; --ph-online: #6fcf97;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}
:root[data-ph-theme='forest'], [data-ph-swatch='forest'] {
  --ph-bg: #12261a; --ph-surface: #1a3324; --ph-surface-2: #23402e; --ph-ink: #e6f2e4;
  --ph-muted: #a7c2a5; --ph-line: #33573f; --ph-accent: #e0b84c; --ph-accent-ink: #1f1a05;
  --ph-accent-strong: #ecc96b; --ph-accent-soft: #3d3820; --ph-focus: #9fd8ff; --ph-online: #6fcf97;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}
:root[data-ph-theme='sunset'], [data-ph-swatch='sunset'] {
  --ph-bg: #2a1433; --ph-surface: #3a1d45; --ph-surface-2: #4a2756; --ph-ink: #ffeadf;
  --ph-muted: #d9b3b0; --ph-line: #6b3c74; --ph-accent: #ffb36b; --ph-accent-ink: #2a1206;
  --ph-accent-strong: #ffc78f; --ph-accent-soft: #5a3448; --ph-focus: #ffd166; --ph-online: #6fcf97;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}
:root[data-ph-theme='arcade'], [data-ph-swatch='arcade'] {
  --ph-bg: #0a0e2a; --ph-surface: #141a3d; --ph-surface-2: #1d2552; --ph-ink: #eaf6ff;
  --ph-muted: #9fb0d9; --ph-line: #2e3a7a; --ph-accent: #39e5ff; --ph-accent-ink: #04121a;
  --ph-accent-strong: #7aefff; --ph-accent-soft: #12305a; --ph-focus: #ff4fd8; --ph-online: #6fcf97;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}
:root[data-ph-theme='chalk'], [data-ph-swatch='chalk'] {
  --ph-bg: #263238; --ph-surface: #2f3d44; --ph-surface-2: #384850; --ph-ink: #f2f2ea;
  --ph-muted: #b7c2c0; --ph-line: #4e6068; --ph-accent: #ffe066; --ph-accent-ink: #262000;
  --ph-accent-strong: #ffeb99; --ph-accent-soft: #4a4a30; --ph-focus: #9fd8ff; --ph-online: #6fcf97;
  --ph-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}

/* The site bar: one row on each game's start screen. Its own colours, whatever the game's theme. */
.ph-bar {
  position: relative; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--ph-gap);
  width: min(560px, 100%); margin: 0 auto 8px; padding: 4px 6px 4px 8px;
  font: 14px/1.3 var(--ph-font); color: var(--ph-ink);
  background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 999px; box-shadow: var(--ph-shadow);
  text-align: left; letter-spacing: normal; text-transform: none;
}
.ph-bar * { box-sizing: border-box; }
.ph-home { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; font-weight: 700; padding: 2px 4px; border-radius: 999px; }
.ph-home img { width: 22px; height: 22px; display: block; }
.ph-home:hover, .ph-home:focus-visible { background: var(--ph-line); outline: none; }
.ph-friends { position: relative; }
.ph-friends > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ph-line); white-space: nowrap;
}
.ph-friends > summary::-webkit-details-marker { display: none; }
.ph-friends > summary:hover, .ph-friends > summary:focus-visible { border-color: var(--ph-accent); outline: none; }
.ph-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ph-line); flex: none; }
.ph-dot.on { background: var(--ph-online); }
.ph-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d9482b; color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.ph-panel {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(300px, calc(100vw - 24px));
  padding: 10px 12px; background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: var(--ph-radius);
  box-shadow: var(--ph-shadow); display: grid; gap: 8px;
}
.ph-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ph-panel li { display: flex; align-items: center; gap: 8px; }
.ph-panel .ph-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-panel .ph-where, .ph-panel .ph-note { color: var(--ph-muted); font-size: 13px; }
.ph-panel .ph-note { margin: 0; }
.ph-invite { padding: 8px; border-radius: 8px; background: var(--ph-line); display: grid; gap: 6px; }
.ph-button {
  font: inherit; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ph-accent); background: var(--ph-accent); color: var(--ph-accent-ink); text-decoration: none; justify-self: start;
}
.ph-button.ph-quiet { background: none; color: inherit; border-color: var(--ph-line); }

/* Text for screen readers only (client/announce.js). */
.ph-sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* The Theme pill and its picker (sitebar.js). Each swatch carries data-ph-swatch, so it shows its own colours;
   Automatic shows light and dark side by side. */
.ph-pills { display: flex; align-items: center; gap: 6px; }
.ph-themes { position: relative; }
.ph-themes > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ph-line); white-space: nowrap;
}
.ph-themes > summary::-webkit-details-marker { display: none; }
.ph-themes > summary:hover, .ph-themes > summary:focus-visible { border-color: var(--ph-accent); outline: none; }
.ph-chip {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--ph-surface) 50%, var(--ph-accent) 50%); border: 1px solid var(--ph-ink);
}
.ph-swatches { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.ph-swatch {
  font: inherit; font-size: 13px; display: flex; align-items: center; gap: 6px; padding: 6px 8px; cursor: pointer;
  text-align: left; color: var(--ph-ink); background: var(--ph-surface); border: 1px solid var(--ph-line); border-radius: 8px;
}
.ph-swatch:not([data-ph-swatch]) .ph-chip { background: linear-gradient(135deg, #ffffff 50%, #1c251f 50%); }
.ph-swatch[aria-pressed='true'] { outline: 2px solid var(--ph-focus); outline-offset: 1px; font-weight: 700; }
.ph-swatch:focus-visible { outline: 2px solid var(--ph-focus); outline-offset: 1px; }
