/* ==========================================================================
   Unified Visual & Shape Consistency System
   ==========================================================================
   Aligns component radii, borders, surfaces, headers, buttons, and UPPERCASE
   UI chrome onto the app's primary dark warm-neutral language (#222222 /
   #2a2a2a / #292826 / #afa38c / #eceae5 + per-mode accents).
   ========================================================================== */

:root {
  --app-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --radius-sm: 6px;
  --radius-input: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --surface-border: rgba(175, 163, 140, 0.25);
  --surface-border-subtle: rgba(175, 163, 140, 0.18);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 12px 40px rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------------------
   1. Modals, Popups, Dialogs & Sheets — unified radius, elevation & chrome
   -------------------------------------------------------------------------- */
.message-center-popup,
.achievement-gallery-popup,
.online-users-popup,
.avatar-selection-popup,
.rank-progression-modal,
.confirmation-dialog,
.challenge-modal,
.admin-passcode-modal,
.shop-content,
.quiz-websites-modal,
.cheat-sheets-modal,
.cheat-sheet-viewer-modal,
.pdf-cheat-sheet-modal,
.point-click-map-modal,
.central-files-modal,
.pdf-viewer-modal,
.news-brief-modal,
.week-picker-modal-content,
.flash-cards-modal,
.study-materials-modal,
.spelling-category-modal,
.blitz-category-modal,
.endless-mode-modal,
.custom-words-modal,
.flash-cards-subcategory-modal,
.daily-challenge-gate-card,
.login-progress-modal-content,
.login-modal,
.weekly-checklist-sheet,
.duel-pick-card,
.live-gate-card,
.raw-data-modal {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}

.confirmation-dialog {
  background: var(--modal-bg);
  border: 1px solid var(--surface-border);
}

.admin-passcode-modal {
  border: 1px solid var(--surface-border);
}

.login-modal {
  border: 1px solid var(--surface-border);
}

/* Unified modal/popup header geometry and close button hit targets */
.message-center-header,
.online-users-header,
.avatar-selection-header,
.achievement-gallery-header,
.rank-progression-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  min-height: 48px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--surface-border-subtle);
}

.message-center-header h3,
.online-users-header h3,
.avatar-selection-header h3,
.achievement-gallery-header h3,
.rank-progression-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.message-center-close,
.online-users-close,
.avatar-selection-close,
.achievement-gallery-close,
.rank-progression-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.message-center-close:hover,
.online-users-close:hover,
.avatar-selection-close:hover,
.achievement-gallery-close:hover,
.rank-progression-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.study-materials-modal .modal-header,
.spelling-category-modal .modal-header,
.blitz-category-modal .modal-header,
.endless-mode-modal .modal-header,
.custom-words-modal .modal-header,
.flash-cards-subcategory-modal .modal-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 14px 18px;
}

/* --------------------------------------------------------------------------
   2. Status Bars — uniform height, spacing, and divider border
   -------------------------------------------------------------------------- */
.status-bar {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border-bottom: 1px solid var(--surface-border-subtle);
}

.study-materials-status-bar,
.endless-mode-status-bar {
  min-height: calc(44px + var(--pwa-safe-top, env(safe-area-inset-top, 0px)));
  height: auto;
  border-bottom: 1px solid var(--surface-border-subtle);
}

.study-materials-status-bar .status-bar,
.endless-mode-status-bar .status-bar {
  border-radius: 0;
  border-bottom: none;
}

.study-materials-status-bar:not([style*="display: none"]) ~ .container,
body.study-materials-active .container,
.endless-mode-status-bar:not([style*="display: none"]) ~ .container,
body.endless-mode-active .container {
  padding-top: calc(44px + var(--pwa-safe-top, env(safe-area-inset-top, 0px)));
}

.news-brief-round .status-bar,
.encampment-round .status-bar,
.daily-quests-round .status-bar {
  border-bottom: 1px solid var(--surface-border-subtle);
}

/* --------------------------------------------------------------------------
   3. Cards, Panels & Welcome Containers — unified dark surfaces & radii
   -------------------------------------------------------------------------- */
.welcome-box,
.trivia-deck-welcome-box {
  border-radius: var(--radius-lg);
  border: 1px solid var(--surface-border-subtle);
  box-shadow: var(--shadow-card);
}

.cf-card,
.daily-challenge-header,
.second-chance-header,
.boss-battle-header {
  border-radius: var(--radius-md);
}

.acrostic-calendar {
  border-radius: var(--radius-md);
}

/* Point & Click UI panel: align bright white panel to dark app language */
.point-click-ui-panel {
  background: var(--modal-bg);
  border: 1px solid rgba(107, 155, 209, 0.35);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-light);
}

.point-click-question-box h2 {
  color: var(--text-light);
}

.point-click-question-box p {
  color: var(--text-muted);
}

.point-click-score-box {
  color: var(--point-click-color);
}

.point-click-zoom-controls {
  border: 1px solid var(--surface-border-subtle);
  border-radius: var(--radius-md);
}

.point-click-zoom-btn {
  background: rgba(42, 42, 42, 0.94);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-input);
  color: var(--text-light);
}

.point-click-zoom-btn:hover {
  background: rgba(58, 58, 58, 0.98);
  border-color: var(--point-click-color);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   4. Buttons & Inputs — unified radius scale and consistent styling
   -------------------------------------------------------------------------- */
.mode-button,
.start-button,
.primary-button,
.trivia-deck-button,
.blitz-start-button,
.start-spelling-button,
.acrostic-start-button,
.grab-bag-start-btn,
.dialog-button,
.defense-how-start {
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.primary-button {
  border: none;
  cursor: pointer;
}

.bug-report-form input[type="text"],
.bug-report-form textarea,
.cf-input,
.grab-bag-input,
.acrostic-input {
  border-radius: var(--radius-input);
}

.message-center-btn,
.online-users-indicator,
.weekly-minutes-chip,
.mode-toggle-btn {
  border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   5. UPPERCASE Enforcement on User-Visible UI Chrome
      (Preserves password inputs, math-lowercase keys, pi symbols, and
      admin data/question editors.)
   -------------------------------------------------------------------------- */
.status-bar span,
.user-bar .welcome-greeting,
.online-users-indicator,
.progress-bar-header,
.modal-header h2,
.modal-header h3,
.confirmation-dialog h3,
.confirmation-dialog p,
.dialog-button,
.primary-button,
.mode-button,
.start-button,
.trivia-deck-button,
.start-spelling-button,
.blitz-start-button,
.blitz-leaderboard-header h2,
.mode-toggle-btn,
.acrostic-start-button,
.acrostic-mini-btn,
.acrostic-streak,
.acrostic-title,
.grab-bag-start-btn,
.grab-bag-end-btn,
.defense-how-start,
.weekly-checklist-empty,
.bug-report-field label,
.achievement-badge-name,
.achievement-detail-tier-name,
.level-rank,
.xp-label,
.achievements-unlocked-label,
.point-click-question-box h2,
.point-click-question-box p,
.point-click-score-box {
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   6. Unified Bold Wide-Tracked Typography (matches Gauntlet count header)
      Eliminates thin/light regular-weight text across headers, empty states,
      modals, buttons, inputs, and status bars while keeping compact tracking
      on tight single-character cells and keyboard keys.
   -------------------------------------------------------------------------- */
html,
body {
  font-family: var(--app-font-family);
  font-weight: 700;
  letter-spacing: 0.04em;
}

button,
input,
textarea,
select,
option,
optgroup {
  font-family: var(--app-font-family);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.status-bar,
.status-bar span,
.dungeon-status-bar,
.editor-status-bar {
  font-weight: 700;
  letter-spacing: 0.08em;
}

.user-bar .welcome-greeting,
.online-users-indicator,
.progress-bar-header,
.level-display,
.xp-display,
.modal-header h2,
.modal-header h3,
.confirmation-dialog h3 {
  font-weight: 700;
  letter-spacing: 0.06em;
}

.live-empty,
.duel-history-screen-body .live-empty,
.empty-state p,
.blitz-empty-state p,
.weekly-checklist-empty,
.weekly-checklist-note.is-empty,
.daily-challenge-archive-empty,
.grab-bag-empty,
.grab-bag-loading {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-style: normal;
  text-transform: uppercase;
}

/* Keep tight single-character keys and grid cells centered without overflow */
#iosKeyboard .key,
.dc-cal-day,
.acrostic-cell,
.letter-blank,
.punctuation-spacer {
  letter-spacing: 0;
}


/* News Brief stories, section titles, and History Book entries follow the app-wide uppercase display. */
#newsBriefList .news-section-title,
#newsBriefList .news-item-text,
#historyBookList .history-book-text {
  text-transform: uppercase;
}

/* Admin-only digest pipeline status line at the top of News Brief. */
.news-brief-admin-status {
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.35;
  background: rgba(88, 140, 96, 0.18);
  border: 1px solid rgba(88, 140, 96, 0.5);
  color: #cfe3d2;
}

.news-brief-admin-status[data-level="working"] {
  background: rgba(196, 160, 72, 0.18);
  border-color: rgba(196, 160, 72, 0.55);
  color: #ecdcae;
}

.news-brief-admin-status[data-level="problem"] {
  background: rgba(176, 82, 82, 0.2);
  border-color: rgba(176, 82, 82, 0.6);
  color: #f0c9c9;
}
