/* ── Shared Preferences modal ─────────────────────────────────────────────
   Used identically by home.html and game.html — see static/js/profileModal.js.
   Follows the same var(--x, fallback) convention as badges.css: on game.html
   these track the live theme (see the CSS custom properties set in
   game.html's inline theme-apply script); on home.html, which themes via
   React props rather than CSS variables, they fall back to the Ghost Wire
   defaults — the same behaviour badge-notif already has there. */

#profile-modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
#profile-modal-overlay.visible { display: flex; }

.pm-box {
  background: var(--bg, #030608);
  border: 1px solid var(--accent-border, rgba(0,255,184,0.30));
  border-radius: 8px;
  width: 400px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--card-glow, 0 0 0 1px rgba(0,255,184,0.25), 0 4px 32px rgba(0,0,0,0.6));
  font-family: 'IBM Plex Mono', monospace;
}
.pm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--accent-border, rgba(0,255,184,0.30));
}
.pm-title {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px;
  color: var(--text, #D0EEE6); letter-spacing: -0.01em;
}
.pm-close {
  background: none; border: none; color: var(--muted, #3A8899);
  cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px;
}
.pm-tabs {
  display: flex; border-bottom: 1px solid var(--accent-border, rgba(0,255,184,0.30));
  padding: 0 12px; overflow-x: auto;
}
.pm-tab {
  background: none; border: none; padding: 10px 10px; cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted, #3A8899);
  font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 600;
  letter-spacing: 0.08em; transition: all 120ms; white-space: nowrap;
}
.pm-tab.active { color: var(--accent, #00FFB8); border-bottom-color: var(--accent, #00FFB8); }
.pm-content { padding: 20px; overflow-y: auto; flex: 1; }
.pm-loading { text-align: center; color: var(--muted, #3A8899); font-size: 11px; padding: 28px 0; }

.pm-label { font-size: 10px; color: var(--muted, #3A8899); margin-bottom: 6px; letter-spacing: 0.06em; }
.pm-section-label { font-size: 10px; color: var(--muted, #3A8899); letter-spacing: 0.06em; margin-bottom: 10px; }
.pm-hr { border-top: 1px solid var(--accent-border, rgba(0,255,184,0.30)); margin: 16px 0; }
.pm-msg { margin-top: 10px; font-size: 10px; }
.pm-msg.ok  { color: var(--accent, #00FFB8); }
.pm-msg.err { color: #FF5555; }

.pm-input {
  width: 100%; padding: 9px 12px; border-radius: 4px; box-sizing: border-box;
  background: var(--surface, #060F18); border: 1px solid var(--accent-border, rgba(0,255,184,0.30));
  color: var(--text, #D0EEE6); font-family: 'IBM Plex Mono', monospace; font-size: 11px; outline: none;
}

.pm-btn-primary {
  padding: 7px 16px; border-radius: 4px; cursor: pointer; border: none;
  background: var(--btn, #00FFB8); color: var(--btn-text, #020507);
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
}
.pm-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.pm-btn-danger {
  padding: 7px 16px; border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid #FF5555; color: #FF5555;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
}
.pm-btn-danger.filled { background: #FF5555; border: none; color: #150505; }
.pm-btn-ghost {
  padding: 7px 16px; border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid var(--accent-border, rgba(0,255,184,0.30));
  color: var(--muted, #3A8899);
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
}

/* Avatar tab */
.pm-avatar-preview { display: flex; justify-content: center; margin-bottom: 18px; }
.pm-mode-row { display: flex; gap: 6px; margin-bottom: 16px; }
.pm-mode-btn {
  flex: 1; padding: 6px 4px; border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid var(--accent-border, rgba(0,255,184,0.30));
  color: var(--muted, #3A8899);
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
}
.pm-mode-btn.active { background: rgba(0,255,184,0.10); border-color: var(--accent, #00FFB8); color: var(--accent, #00FFB8); }
.pm-wire-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 10px; }
.pm-wire-tile {
  padding: 8px; border-radius: 6px; cursor: pointer; transition: all 120ms;
  background: var(--surface, #060F18); border: 1.5px solid var(--accent-border, rgba(0,255,184,0.30));
  display: flex; align-items: center; justify-content: center;
}
.pm-wire-tile.picked { background: rgba(0,255,184,0.10); border-color: var(--accent, #00FFB8); }
.pm-upload-drop {
  display: block; padding: 20px; border-radius: 6px; cursor: pointer; text-align: center;
  border: 1.5px dashed var(--accent-border, rgba(0,255,184,0.30)); background: var(--surface, #060F18);
}
.pm-upload-hint { color: var(--muted, #3A8899); font-size: 10px; }

/* Theme tab */
.pm-theme-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 5px; cursor: pointer; transition: all 120ms; text-align: left;
  background: transparent; border: 1px solid var(--accent-border, rgba(0,255,184,0.30));
  width: 100%; box-sizing: border-box; margin-bottom: 5px;
}
.pm-theme-row.active { border-color: var(--accent, #00FFB8); }
.pm-theme-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pm-theme-name { font-size: 11px; color: var(--muted, #3A8899); }
.pm-theme-name.active { color: var(--accent, #00FFB8); }
.pm-theme-default { margin-left: auto; font-size: 9px; color: var(--accent, #00FFB8); opacity: 0.7; }

/* Deck / card back preview + pickers (mirrors the old React ThemeTab) */
.pm-preview-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
.pm-preview-row img { width: 56px; height: auto; border-radius: 4px; border: 1px solid var(--accent-border, rgba(0,255,184,0.30)); background: #fff; }
.pm-option-row { display: flex; gap: 6px; }
.pm-option-btn {
  flex: 1; padding: 8px 4px; border-radius: 4px;
  background: transparent; border: 1px solid var(--accent-border, rgba(0,255,184,0.30));
  color: var(--muted, #3A8899);
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
  cursor: pointer;
}
.pm-option-btn.active { background: rgba(0,255,184,0.10); border-color: var(--accent, #00FFB8); color: var(--accent, #00FFB8); }
.pm-option-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.pm-option-hint { font-size: 9px; color: var(--muted, #3A8899); margin-top: 6px; line-height: 1.5; }
.pm-lock-hint { font-size: 9px; color: var(--muted, #3A8899); margin-top: 4px; line-height: 1.5; }
.pm-lock-hint em { color: var(--accent, #00FFB8); font-style: normal; }

/* Gameplay tab toggles */
.pm-toggle-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; margin-bottom: 20px; }
.pm-toggle-row:last-child { margin-bottom: 0; }
.pm-toggle {
  width: 36px; height: 20px; border-radius: 10px; flex-shrink: 0; position: relative;
  cursor: pointer; transition: background 180ms;
  background: rgba(255,255,255,0.12);
}
.pm-toggle.on { background: var(--btn, #00FFB8); }
.pm-toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,0.4); transition: left 180ms;
}
.pm-toggle.on .pm-toggle-knob { left: 18px; background: var(--btn-text, #020507); }
.pm-toggle-title { font-size: 11px; color: var(--text, #D0EEE6); }
.pm-toggle-sub { font-size: 9px; color: var(--muted, #3A8899); margin-top: 2px; line-height: 1.5; }
.pm-slider-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.pm-slider-row span { font-size: 10px; color: var(--accent, #00FFB8); }
