/* ProDobro Games — shared in-game components.
   Companion to tokens.css + base.css.
   Classes used inside the 7 game pages; all values derived from tokens so
   light/dark theme switching is automatic — no per-theme overrides needed. */

/* Floating back link — top-left corner of a game page */
.pdg-back-btn {
  position: absolute;
  top: 14px;
  left: 24px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--pdg-surface);
  border: 1px solid var(--pdg-border);
  color: var(--pdg-fg);
  text-decoration: none;
  font-family: var(--pdg-font);
  font-weight: 700;
  font-size: 12px;
  transition: background var(--pdg-transition), color var(--pdg-transition), box-shadow var(--pdg-transition);
}
.pdg-back-btn:hover {
  background: var(--pdg-surface-hover);
  box-shadow: var(--pdg-shadow-sm);
}

/* Round theme-toggle button — top-right corner */
.pdg-theme-btn {
  position: absolute;
  top: 14px;
  right: 24px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--pdg-surface);
  border: 1px solid var(--pdg-border);
  color: var(--pdg-fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background var(--pdg-transition), transform 0.2s ease, box-shadow var(--pdg-transition);
}
.pdg-theme-btn:hover {
  background: var(--pdg-surface-hover);
  transform: scale(1.05);
  box-shadow: var(--pdg-shadow-sm);
}

/* Theme-toggle icons. Filled duotone (opacity-layered) to match catalog
   card-icon style; coloured per icon with a glow via drop-shadow. Visibility
   is driven by [data-theme] on <html>, set synchronously by settings.js
   _applyTheme() — no flash, no JS swap. */
.pdg-theme-icon {
  display: none;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 2px 8px currentColor);
  opacity: 0.95;
  transition: filter 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pdg-theme-icon--sun { color: #fb923c; }
.pdg-theme-icon--moon { color: #facc15; }
:root[data-theme="dark"] .pdg-theme-icon--sun { display: block; }
:root[data-theme="light"] .pdg-theme-icon--moon { display: block; }
.pdg-theme-btn:hover .pdg-theme-icon,
.pdg-header__theme:hover .pdg-theme-icon {
  filter: drop-shadow(0 2px 14px currentColor);
  transform: rotate(12deg);
}

/* Circular avatar used in the header, profile picker and stats panel.
   Lives in components.css so it works on every page, including those that
   don't load header.css (profile.html). */
.pdg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--pdg-accent-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}
.pdg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pdg-avatar--lg { width: 64px; height: 64px; font-size: 28px; }

/* In-game action buttons (used as .btn and .btn.primary inside game pages) */
.btn {
  flex: 1;
  padding: 14px 16px;
  border-radius: 100px;
  border: 1px solid var(--pdg-border);
  background: var(--pdg-surface-solid);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pdg-fg);
  cursor: pointer;
  transition: border-color var(--pdg-transition), filter var(--pdg-transition), transform 0.15s ease, box-shadow var(--pdg-transition);
}
.btn:hover { border-color: var(--pdg-accent-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, #34d399 0%, #22c55e 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.primary:active:not(:disabled) { transform: scale(0.97); }

/* Full-screen overlay for pause / result modals */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at top, rgba(255, 117, 140, 0.18), transparent 55%),
    radial-gradient(ellipse at bottom, rgba(139, 92, 246, 0.18), transparent 55%),
    var(--pdg-surface-solid);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--pdg-transition);
}
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay.hidden { display: none; }
.overlay .modal {
  text-align: center;
  max-width: 340px;
  width: 100%;
  transform: translateY(20px);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.1);
}
.overlay.show .modal { transform: translateY(0); }

/* Result screen typography */
.result-title {
  font-weight: 900;
  font-size: clamp(28px, 7vw, 40px);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--pdg-accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 117, 140, 0.4));
  margin-bottom: 4px;
}
.result-detail {
  color: var(--pdg-fg-muted);
  font-size: 13px;
  margin-bottom: 22px;
  line-height: 1.5;
}

/* Confirm / prompt modal panel variant — narrower and centred. */
.pdg-modal__panel--narrow {
  max-width: 400px;
  text-align: center;
}

/* Row of action buttons at the bottom of a modal. */
.pdg-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}

/* Wrapper around the prompt's toolbar + textarea — small gap to lift it
   away from the description above. */
.pdg-modal__input-group {
  margin-top: 10px;
}

/* Danger-styled OK button (e.g. "Delete profile"). Replaces inline
   style assignments in PDG.confirm so style-src can drop 'unsafe-inline'. */
.pdg-btn--danger {
  background: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

/* Generic utility classes used by game pages and PDG.* modals.
   Replace ad-hoc inline `style="display:none"` / `style="width:100%"`. */
.is-hidden { display: none !important; }
.btn--full { width: 100%; }

/* Semantic recolours for .stat .value. Replace inline `style="color: ..."`
   on per-game error / success counters. */
.stat .value.value--danger  { color: #f87171; }
.stat .value.value--success { color: #34d399; }
:root[data-theme="light"] .stat .value.value--danger  { color: #ef4444; }
:root[data-theme="light"] .stat .value.value--success { color: #059669; }

/* ============================================================
 * Game-page chrome
 *
 * Classes consumed by every /games/<name>/index.html. Game style.css
 * files previously each shipped a near-identical copy of this block
 * (~80 lines × 10 games + matching light-theme overrides ≈ 1500 lines
 * of dead-weight CSS). All values here derive from tokens.css so
 * light/dark theme switching is automatic — no per-page overrides.
 * ============================================================ */

/* Game body opt-in tweaks. <body class="pdg-game-body"> picks up the
   bottom padding and disables text selection that the previous inline
   blocks set on `body` directly. Background + colour come from base.css. */
.pdg-game-body {
  -webkit-user-select: none;
  user-select: none;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

/* Decorative noise overlay, injected by game-shell.js. */
.noise {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
:root[data-theme="light"] .noise {
  opacity: 0.02;
  mix-blend-mode: multiply;
}

/* Page-width wrapper used by every standard game */
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding-top: 52px;
  position: relative;
}

.wrap header {
  text-align: center;
  margin-bottom: 18px;
  padding-top: 10px;
}

.eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: 0.4em;
  text-transform: uppercase; color: var(--pdg-fg-muted);
  margin-bottom: 8px;
}

.wrap h1 {
  font-family: var(--pdg-font); font-weight: 900;
  font-size: clamp(32px, 8vw, 48px); line-height: 0.95;
  letter-spacing: -0.02em; text-transform: uppercase;
  background: var(--pdg-accent-gradient);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 117, 140, 0.45));
}

/* Mode picker grid + cards. .modes--2 / .modes--3 switch column count;
   default = 3 (the most common). */
.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.modes.modes--2 { grid-template-columns: repeat(2, 1fr); }

.mode-card {
  background: var(--pdg-surface);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--pdg-border);
  border-radius: 18px;
  padding: 12px 10px;
  cursor: pointer;
  transition: border-color var(--pdg-transition), color var(--pdg-transition), background var(--pdg-transition), box-shadow var(--pdg-transition);
  text-align: center;
  color: var(--pdg-fg-muted);
  font-family: inherit;
}
.mode-card:hover {
  border-color: var(--pdg-accent-2);
  color: var(--pdg-fg);
}
.mode-card.active {
  background: linear-gradient(135deg, rgba(255, 126, 179, 0.22), rgba(255, 117, 140, 0.22));
  border-color: var(--pdg-accent);
  color: var(--pdg-fg);
  box-shadow: 0 6px 24px rgba(255, 117, 140, 0.2);
}
.mode-card .mode-num {
  font-family: var(--pdg-font);
  font-weight: 900;
  font-size: 22px;
  color: var(--pdg-accent);
  display: block;
  margin-bottom: 4px;
  line-height: 1;
}
.mode-card.active .mode-num { color: var(--pdg-fg); }
.mode-card .mode-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

/* Stats strip (round / score / attempts / timer / best …) */
.stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.stat {
  background: var(--pdg-surface);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--pdg-border);
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat .label {
  opacity: 0.55;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.stat .value {
  font-weight: 900;
  color: var(--pdg-accent);
  font-size: 18px;
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Instruction line under the stats — short prompt per round */
.instruction {
  text-align: center;
  color: var(--pdg-fg-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
  padding: 0 8px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

/* Pills + segmented row used by Shulte / Corrector / Fly */
.pill-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.pill-row.segmented {
  background: var(--pdg-surface);
  border: 1px solid var(--pdg-border);
  border-radius: 100px;
  padding: 5px;
  gap: 4px;
}
.pill-row.segmented .pill {
  flex: 1;
  border-radius: 100px;
  padding: 10px 6px;
  background: transparent;
  border: none;
  color: var(--pdg-fg-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--pdg-transition), background var(--pdg-transition);
  text-align: center;
  line-height: 1.2;
}
.pill-row.segmented .pill:hover { color: var(--pdg-fg); }
.pill-row.segmented .pill.active {
  color: #fff;
  background: var(--pdg-accent-gradient);
  box-shadow: 0 4px 20px rgba(255, 117, 140, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Bottom controls row */
.controls {
  display: flex;
  gap: 10px;
}

/* Result-screen typography */
.big-number {
  font-family: var(--pdg-font);
  font-weight: 900;
  font-size: clamp(56px, 15vw, 84px);
  color: var(--pdg-accent);
  filter: drop-shadow(0 6px 24px rgba(255, 117, 140, 0.5));
  line-height: 1;
  margin: 10px 0;
  font-variant-numeric: tabular-nums;
}
.small-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--pdg-fg-muted);
}
.record-badge {
  display: inline-block;
  background: var(--pdg-accent-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(255, 117, 140, 0.4);
}

/* ----- Offline-mode UI (profile page section + first-run prompt) ----- */

.offline-zone {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--pdg-radius);
  background: var(--pdg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--pdg-border);
  margin-bottom: 24px;
}
.offline-zone__desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--pdg-fg-muted);
  line-height: 1.45;
  margin: 0;
}

/* iOS-style switch button. Encapsulates the track, thumb, and a text label
   that reflects the on/off state. Composable into any section. */
.pdg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--pdg-fg);
  align-self: flex-start;
}
.pdg-toggle__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--pdg-border);
  transition: background var(--pdg-transition);
  flex-shrink: 0;
}
.pdg-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform var(--pdg-transition);
}
.pdg-toggle.is-on .pdg-toggle__track {
  background: linear-gradient(135deg, #34d399 0%, #22c55e 100%);
}
.pdg-toggle.is-on .pdg-toggle__thumb {
  transform: translateX(20px);
}
.pdg-toggle__label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* First-run "Enable offline mode?" modal — narrower stacked actions and
   a soft hint line under the main description. */
.pdg-offline-prompt__icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.pdg-offline-prompt__hint {
  font-size: 12px;
  opacity: 0.75;
  margin-top: -8px;
}
.pdg-offline-prompt__actions {
  flex-wrap: wrap;
}

/* Win/loss feedback animations referenced by per-game cells/answers */
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ============================================================
 * Fullscreen, scrollable legal/info document modal
 * (privacy policy, about). The close button is pinned to the panel
 * (which never scrolls) so it stays visible while .legal-doc__scroll
 * scrolls underneath it. Used on the catalogue (home) page.
 * ============================================================ */
/* Compound selectors (two classes) so these beat base.css's .pdg-modal /
   .pdg-modal__panel rules regardless of stylesheet load order. */
.pdg-modal.pdg-modal--fullscreen { padding: 0; }
.pdg-modal__panel.pdg-modal__panel--fullscreen {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.legal-doc__close {
  position: absolute;
  top: 16px;
  /* Offset = scrollbar width (8px) + ~16px gap, so the button keeps a
     consistent gap whether or not the document scrolls. */
  right: 24px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pdg-surface-solid);
  border: 1px solid var(--pdg-border);
  color: var(--pdg-fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--pdg-shadow-sm);
  transition: background var(--pdg-transition), transform 0.2s ease;
}
.legal-doc__close:hover { background: var(--pdg-surface-hover); transform: scale(1.05); }
.legal-doc__scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Fixed thin scrollbar so the close-button offset is predictable. */
  scrollbar-width: thin;
  scrollbar-color: var(--pdg-border) transparent;
}
.legal-doc__scroll::-webkit-scrollbar { width: 8px; }
.legal-doc__scroll::-webkit-scrollbar-track { background: transparent; }
.legal-doc__scroll::-webkit-scrollbar-thumb {
  background: var(--pdg-border);
  border-radius: 999px;
}
.legal-doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px 56px;
}
.legal-doc h1 {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  padding-right: 52px;
}
.legal-doc h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 28px 0 10px;
  color: var(--pdg-fg);
}
.legal-doc p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--pdg-fg-muted);
  margin-bottom: 12px;
}
.legal-doc ul {
  margin: 0 0 12px;
  padding-left: 22px;
  color: var(--pdg-fg-muted);
}
.legal-doc li {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 6px;
}
.legal-doc strong { color: var(--pdg-fg); font-weight: 700; }
.legal-doc a {
  color: var(--pdg-accent);
  text-decoration: none;
  word-break: break-word;
}
.legal-doc a:hover { text-decoration: underline; }
.legal-doc__updated {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--pdg-border);
  font-size: 14px;
}
