/* ─────────────────────────────────────────────────────────
   AIMIRU UX ENHANCEMENT STYLES — v2.0
   ─────────────────────────────────────────────────────────
   - Screen transition animations
   - Accessibility features (keyboard, screen readers)
   - Color system with theme support (gold)
   - Spacing, border radius, transition tokens
   - Z-index layers for modals and dropdowns
   - Streak badges, loading states
   ───────────────────────────────────────────────────────── */

/* ─── BASE RESET (Box Model + Defaults) ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; } /* Prevent horizontal scroll on mobile */

/* ─── SCREEN TRANSITION ANIMATIONS ─── */
/**
 * Shared fade+slide for all divination page screen transitions
 * Patterns:
 *   1. .screen.active (runes, seimei, iching, etc.)
 *   2. .screen:not(.hidden) (omikuji, tarot, etc.)
 */
@keyframes uxScreenIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.screen.active,
.screen:not(.hidden) {
  animation: uxScreenIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
/* Selection screens have slightly shorter duration */
.screen-selection.active,
.screen-selection:not(.hidden) {
  animation: uxScreenIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ─── SKIP-TO-CONTENT LINK (keyboard accessibility) ─── */
/**
 * Skip-to-content link: visible on keyboard focus
 * Allows keyboard users to jump to main content
 * WCAG Success Criterion 2.4.1 (Bypass Blocks)
 */
.ux-skip-to-content {
  position: fixed;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--ux-z-popover);
  padding: 12px 24px;
  background: #2d3436;
  color: var(--ux-primary-gold);  /* WCAG AA contrast on dark background */
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  transition: top var(--ux-transition-fast);
  letter-spacing: 0.5px;
  border: 2px solid var(--ux-primary-gold);
}
.ux-skip-to-content:focus {
  top: 0;
  outline: none;
}
html[data-theme="light"] .ux-skip-to-content {
  background: var(--ux-accent, #8b6914);
  color: #fff;
}

/* ─── FOCUS-VISIBLE RING (keyboard accessibility) ─── */
/**
 * Visible focus indicator for keyboard users
 * WCAG Success Criterion 2.4.7 (Focus Visible)
 * Uses gold depending on theme
 */
:focus-visible {
  outline: 3px solid var(--ux-primary-gold);
  outline-offset: 2px;
  border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(232, 184, 74, 0.2);
}
:focus:not(:focus-visible) {
  outline: none;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ux-primary-gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(232, 184, 74, 0.2);
}
html[data-theme="light"] :focus-visible {
  outline-color: var(--ux-accent, #8b6914);
}

/* ─── KEYBOARD NAVIGATION IMPROVEMENTS ─── */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
  transition: outline 0.1s ease, box-shadow 0.1s ease;
}

/* Ensure modal dialogs are keyboard accessible */
[role="dialog"]:focus-visible,
[role="alertdialog"]:focus-visible {
  outline: 3px solid var(--ux-primary-gold);
  outline-offset: -3px;
}

/* Ensure buttons have visible hover and focus states */
button:not(:disabled):hover,
a:not([aria-disabled="true"]):hover {
  cursor: pointer;
}

/* Prevent focus loss on interactive elements */
.ux-modal-overlay:focus-visible,
.ux-popup:focus-visible {
  outline: none;
}

/* ─── COLOR SYSTEM WITH THEME SUPPORT ─── */
/* All colors meet WCAG AA or AAA contrast standards against their backgrounds */
:root {
  --ux-primary-gold: #e8b84a;  /* 4.5:1 contrast on dark background (WCAG AA) */
  --ux-primary-gold-dark: #c8932a;  /* 5.2:1 contrast (WCAG AA) */
  --ux-primary-gold-muted: #9a8e72;  /* 3.5:1 contrast (WCAG A) */

  /* Active theme (gold by default) */
  --ux-accent: var(--ux-primary-gold);
  --ux-accent-dark: var(--ux-primary-gold-dark);
  --ux-accent-muted: var(--ux-primary-gold-muted);

  /* Color system */
  --ux-text-secondary: #d4c9b0;
  --ux-text-subtle: #8a7a5a;
  --ux-text-subtle-dark: #6a6050;
  --ux-text-muted: #b5a696;
  --ux-text-light: #c4b89a;
  --ux-text-pale: #e0d8c0;

  /* Spacing system */
  --ux-spacing-xs: 4px;
  --ux-spacing-sm: 8px;
  --ux-spacing-md: 12px;
  --ux-spacing-lg: 16px;
  --ux-spacing-xl: 20px;
  --ux-spacing-2xl: 24px;
  --ux-spacing-3xl: 32px;

  /* Border radius system */
  --ux-radius-sm: 8px;
  --ux-radius-md: 10px;
  --ux-radius-lg: 12px;
  --ux-radius-xl: 14px;
  --ux-radius-2xl: 16px;
  --ux-radius-circle: 50%;

  /* Transition system */
  --ux-transition-fast: 0.2s ease;
  --ux-transition-base: 0.3s ease;
  --ux-transition-slow: 0.5s ease;

  /* Z-index system */
  --ux-z-tooltip: 100;
  --ux-z-dropdown: 500;
  --ux-z-sticky: 1000;
  --ux-z-fixed: 1000;
  --ux-z-modal: 5000;
  --ux-z-popover: 10000;
}

/* ─── ARIA LIVE REGIONS ─── */
[role="status"], [role="alert"], [aria-live] {
  position: relative;
  display: block;
}

/* ─── SCREEN READER ONLY TEXT ─── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* CONFETTI CANVAS */
.ux-confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9000;
  contain: strict;
}

/* STREAK BADGE — Enhanced */
.ux-streak-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  background: linear-gradient(135deg, rgba(200,147,42,0.25), rgba(140,80,0,0.15));
  border: 1px solid rgba(200,147,42,0.4);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ux-accent);
  text-align: center;
  margin: 8px auto;
  animation: streakFadeIn 0.6s ease;
  contain: content;
}
/* Enhanced prominent display */
.ux-streak-enhanced {
  padding: 10px 20px;
  font-size: 13px;
  border-radius: 24px;
  gap: 8px;
}
.ux-streak-fire {
  font-size: 18px;
  line-height: 1;
}
.ux-streak-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--ux-accent);
  line-height: 1;
  letter-spacing: 0;
}
.ux-streak-label {
  font-size: 11px;
  opacity: 0.85;
  letter-spacing: 0.5px;
}
.ux-streak-new {
  animation: streakPop 0.6s cubic-bezier(0.34,1.56,0.64,1);
  contain: content;
}

/* Milestone tiers */
.ux-streak-7 {
  background: linear-gradient(135deg, rgba(200,147,42,0.35), rgba(180,120,20,0.2));
  border-color: rgba(200,147,42,0.6);
  box-shadow: 0 0 12px rgba(200,147,42,0.15);
}
.ux-streak-30 {
  background: linear-gradient(135deg, rgba(218,165,32,0.3), rgba(200,147,42,0.2));
  border-color: rgba(218,165,32,0.6);
  box-shadow: 0 0 16px rgba(218,165,32,0.2);
}
.ux-streak-100 {
  background: linear-gradient(135deg, rgba(255,200,50,0.25), rgba(218,165,32,0.2));
  border-color: rgba(255,200,50,0.6);
  box-shadow: 0 0 20px rgba(255,200,50,0.2);
}
.ux-streak-365 {
  background: linear-gradient(135deg, rgba(255,215,0,0.3), rgba(255,180,50,0.2));
  border-color: rgba(255,215,0,0.7);
  box-shadow: 0 0 24px rgba(255,215,0,0.25), 0 0 48px rgba(255,215,0,0.1);
}

/* Milestone celebration banner */
.ux-streak-milestone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px auto;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,180,50,0.1));
  border: 1px solid rgba(255,215,0,0.4);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ux-accent);
  letter-spacing: 1px;
  animation: milestoneCelebrate 0.8s cubic-bezier(0.34,1.56,0.64,1);
}
.ux-streak-milestone-emoji {
  font-size: 20px;
}
@keyframes milestoneCelebrate {
  0% { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  50% { transform: scale(1.15) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Freeze used notification */
.ux-streak-freeze-used {
  margin: 4px auto;
  padding: 6px 14px;
  background: rgba(100,180,255,0.12);
  border: 1px solid rgba(100,180,255,0.3);
  border-radius: 12px;
  font-size: 11px;
  color: #7cb8f0;
  letter-spacing: 0.5px;
  text-align: center;
  animation: streakFadeIn 0.6s ease;
}

/* Freeze available indicator */
.ux-streak-freeze-avail {
  margin: 2px auto;
  font-size: 10px;
  color: rgba(100,180,255,0.7);
  letter-spacing: 0.5px;
  text-align: center;
}

@keyframes streakFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes streakPop {
  0% { opacity: 0; transform: scale(0.5); }
  70% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

/* HISTORY BADGE */
.ux-history-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--ux-accent-muted);
  letter-spacing: 1px;
  margin: 4px auto;
  text-align: center;
}

/* TODAY'S KEYWORD ANCHOR */
.ux-keyword-anchor {
  text-align: center;
  padding: 14px 20px;
  margin: 12px 0;
  border: 1px solid rgba(200,147,42,0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(200,147,42,0.08), rgba(140,80,0,0.05));
}
.ux-keyword-label {
  display: block;
  font-size: 10px;
  color: var(--ux-accent-muted);
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.ux-keyword-word {
  display: block;
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--ux-accent);
  font-family: 'Noto Serif JP', serif;
}

/* PROGRESS LOADING */
.ux-progress-container {
  text-align: center;
  padding: 20px;
}
.ux-progress-bar {
  max-width: 200px;
  width: 90%;
  height: 3px;
  background: rgba(200,147,42,0.15);
  border-radius: 2px;
  margin: 0 auto 12px;
  overflow: hidden;
}
.ux-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ux-accent-dark), var(--ux-accent));
  border-radius: 2px;
  transition: width 0.6s ease;
}
.ux-progress-step {
  font-size: 10px;
  color: var(--ux-accent-muted);
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.ux-progress-text {
  font-size: 13px;
  color: #e0d8c0;
  letter-spacing: 2px;
  transition: opacity 0.3s;
}

/* STEP INDICATOR — 3-step journey bar (input → loading → result) */
.ux-step-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  pointer-events: none;
}
.ux-step-bar {
  height: 2px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.ux-step-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #9b7de8), var(--accent2, #c4a8ff));
  border-radius: 0 2px 2px 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}
.ux-step-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 4px 0 2px;
}
.ux-step-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: background 0.4s ease, transform 0.3s ease;
}
.ux-step-dot.active {
  background: var(--accent, #9b7de8);
  transform: scale(1.4);
}
.ux-step-dot.done {
  background: var(--accent, #9b7de8);
  opacity: 0.4;
}
.ux-step-label {
  display: flex;
  justify-content: center;
  gap: 0;
  max-width: 300px;
  margin: 0 auto;
}
.ux-step-label-item {
  flex: 1;
  text-align: center;
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.2);
  padding: 0 2px 3px;
  transition: color 0.4s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ux-step-label-item.active {
  color: var(--accent, #9b7de8);
}
.ux-step-label-item.done {
  color: rgba(255,255,255,0.35);
}
@media (prefers-reduced-motion: reduce) {
  .ux-step-bar-fill { transition: none; }
  .ux-step-dot { transition: none; }
  .ux-step-label-item { transition: none; }
}

/* TOMORROW TEASER (Zeigarnik) */
.ux-tomorrow-teaser {
  text-align: center;
  padding: 18px 16px;
  margin: 16px 0;
  border: 1px dashed rgba(200,147,42,0.3);
  border-radius: 14px;
  background: rgba(200,147,42,0.05);
  animation: teaserFade 1s ease 0.5s both;
}
@keyframes teaserFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.ux-teaser-line1 {
  font-size: 13px;
  color: var(--ux-accent);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.ux-teaser-line2 {
  font-size: 11px;
  color: var(--ux-accent-muted);
  letter-spacing: 2px;
}

/* POSITIVE ENDING (Peak-End Rule) */
.ux-positive-ending {
  text-align: center;
  padding: 20px;
  margin: 20px 0;
  min-height: 60px;
  font-size: 13px;
  color: var(--ux-accent);
  letter-spacing: 3px;
  font-style: italic;
  animation: endingGlow 2s ease-in-out infinite alternate;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes endingGlow {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* LUCKY COLOR RGB */
.ux-color-chip {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  vertical-align: middle;
  margin-right: 6px;
}
.ux-color-hex {
  font-size: 11px;
  color: var(--ux-text-subtle);
  font-family: monospace;
  letter-spacing: 1px;
  vertical-align: middle;
}

/* ─── LUCKY COLOR HEX ─── */
.ux-lucky-color {
  padding: 14px 16px;
  margin: 12px 0;
  background: rgba(200,147,42,0.04);
  border: 1px solid rgba(200,147,42,0.15);
  border-radius: 12px;
  text-align: center;
}
.ux-lucky-color-label {
  font-size: 10px;
  color: var(--ux-text-subtle);
  letter-spacing: 2px;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.ux-lucky-color-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.ux-lucky-color-chip {
  min-width: 48px;
  min-height: 48px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.ux-lucky-color-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ux-accent);
}
.ux-lucky-color-hex {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--ux-text-subtle);
  letter-spacing: 1px;
}

/* ─── FADE-IN ANIMATION FOR RESULT SECTIONS ─── */
.ux-fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: uxFadeIn 0.5s ease forwards;
}

@keyframes uxFadeIn {
  to {
    opacity: 1;
    transform: none;
  }
}

.ux-fade-in:nth-child(2) { animation-delay: 0.12s; }
.ux-fade-in:nth-child(3) { animation-delay: 0.24s; }
.ux-fade-in:nth-child(4) { animation-delay: 0.36s; }
.ux-fade-in:nth-child(5) { animation-delay: 0.48s; }
.ux-fade-in:nth-child(6) { animation-delay: 0.60s; }
.ux-fade-in:nth-child(7) { animation-delay: 0.72s; }
.ux-fade-in:nth-child(8) { animation-delay: 0.84s; }
.ux-fade-in:nth-child(9) { animation-delay: 0.96s; }
.ux-fade-in:nth-child(10) { animation-delay: 1.08s; }

/* ─── RESULT 3-TIER STRUCTURE STYLES ─── */
.ux-result-summary {
  text-align: center;
  padding: 20px 16px;
  margin: 16px 0;
  min-height: 80px;
  background: linear-gradient(135deg, rgba(200,147,42,0.12), rgba(140,80,0,0.08));
  border: 1px solid rgba(200,147,42,0.25);
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ux-accent);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ux-result-reason {
  padding: 16px;
  margin: 12px 0;
  background: rgba(200,147,42,0.04);
  border-left: 3px solid var(--ux-accent);
  border-radius: 4px;
  font-size: 13px;
  color: var(--ux-text-secondary);
  line-height: 1.6;
  letter-spacing: 0.5px;
}

.ux-result-action {
  padding: 14px 16px;
  margin: 12px 0;
  background: linear-gradient(135deg, rgba(232,184,74,0.08), rgba(184,163,232,0.04));
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  color: var(--ux-accent);
  letter-spacing: 1px;
  border: 1px solid rgba(200,147,42,0.15);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ux-transition-base);
}
.ux-result-action:hover {
  background: linear-gradient(135deg, rgba(232,184,74,0.12), rgba(184,163,232,0.08));
  border-color: rgba(200,147,42,0.3);
}

/* ─── CONTINUATION DESIGN (DIG DEEPER) ─── */
.ux-continue-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

@media (max-width: 600px) {
  .ux-continue-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.ux-continue-card {
  min-height: 100px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(232,184,74,0.08), rgba(140,80,0,0.05));
  border: 1px solid rgba(200,147,42,0.2);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ux-continue-card:hover {
  background: linear-gradient(135deg, rgba(232,184,74,0.15), rgba(140,80,0,0.1));
  border-color: rgba(200,147,42,0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.ux-continue-card:focus-visible {
  outline: 2px solid var(--ux-accent);
  outline-offset: 2px;
}

.ux-continue-card:active {
  transform: scale(0.97);
}

.ux-continue-card-emoji {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}

.ux-continue-card-label {
  display: block;
  font-size: 12px;
  color: var(--ux-accent);
  letter-spacing: 1px;
  font-weight: 400;
}

/* ─── TRUST BADGE ─── */
.ux-trust-badge {
  text-align: center;
  padding: 12px 12px;
  margin: 12px 0;
  font-size: 11px;
  color: var(--ux-accent-muted);
  letter-spacing: 0.5px;
  line-height: 1.6;
  border-top: 1px solid rgba(200,147,42,0.1);
  border-bottom: 1px solid rgba(200,147,42,0.1);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ux-trust-item {
  display: inline-block;
  margin: 0 8px;
}

.ux-trust-item::before {
  content: '✓ ';
  color: var(--ux-accent);
}

/* ─── ATMOSPHERIC LOADING ─── */
.ux-loading-atmosphere {
  text-align: center;
  padding: 30px 20px;
}

.ux-loading-spinner {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  border: 2px solid rgba(200,147,42,0.2);
  border-top: 2px solid var(--ux-accent);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
  will-change: transform;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ux-loading-message {
  font-size: 13px;
  color: var(--ux-text-secondary);
  letter-spacing: 1px;
  opacity: 0;
  animation: messageFadeInOut 2s ease-in-out;
}

@keyframes messageFadeInOut {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.ux-loading-message:nth-child(2) { animation-delay: 0s; }
.ux-loading-message:nth-child(3) { animation-delay: 2s; }
.ux-loading-message:nth-child(4) { animation-delay: 4s; }
.ux-loading-message:nth-child(5) { animation-delay: 6s; }

/* ─── TODAY-ONLY BADGE ─── */
.ux-today-badge {
  display: inline-block;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(232,184,74,0.2), rgba(184,163,232,0.12));
  border: 1px solid rgba(200,147,42,0.3);
  border-radius: 8px;
  font-size: 11px;
  color: var(--ux-accent);
  letter-spacing: 1px;
  font-weight: 400;
  text-align: center;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ux-today-date {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
  line-height: 1.4;
}

/* ─── SHARE CARD STYLING ─── */
.ux-share-card {
  padding: 20px;
  margin: 20px 0;
  background: linear-gradient(135deg, rgba(232,184,74,0.1), rgba(140,80,0,0.06));
  border: 1px solid rgba(200,147,42,0.2);
  border-radius: 14px;
  text-align: center;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ux-share-image {
  max-width: 100%;
  max-height: 400px;
  height: auto;
  border-radius: 10px;
  margin-bottom: 12px;
}

.ux-share-button {
  display: inline-block;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 24px;
  background: var(--ux-accent);
  color: #0e0c08;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.ux-share-button:hover {
  background: var(--ux-accent-dark);
  transform: scale(1.02);
}

.ux-share-button:focus-visible {
  outline: 2px solid var(--ux-accent-dark);
  outline-offset: 2px;
}

.ux-share-button:active {
  transform: scale(0.98);
}

/* ENTERTAINMENT DISCLAIMER */
.ux-disclaimer {
  text-align: center;
  padding: 12px 16px;
  margin-top: 20px;
  font-size: 10px;
  color: var(--ux-text-subtle-dark);
  letter-spacing: 0.5px;
  line-height: 1.6;
  border-top: 1px solid rgba(200,147,42,0.1);
}

/* SOCIAL PROOF */
.ux-social-proof {
  text-align: center;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 12px;
  color: var(--ux-accent-muted);
  letter-spacing: 0.5px;
  animation: proofFade 1s ease 0.3s both;
}
@keyframes proofFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── TYPE CLASSIFICATION CARD ─── */
.ux-type-card {
  padding: 20px 16px;
  margin: 20px 0;
  min-height: 160px;
  background: linear-gradient(135deg, rgba(200,147,42,0.08), rgba(160,100,20,0.04));
  border: 1px solid rgba(200,147,42,0.2);
  border-radius: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ux-type-emoji { font-size: clamp(32px, 10vw, 40px); margin-bottom: 8px; animation: typeFloat 3s ease-in-out infinite; }
@keyframes typeFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.ux-type-label { font-size: 11px; color: #8a7a5a; letter-spacing: 2px; margin-bottom: 4px; }
.ux-type-name { font-size: 20px; font-weight: 700; color: var(--ux-accent); margin-bottom: 4px; letter-spacing: 1px; }
.ux-type-suffix { font-size: 11px; color: #8a7a5a; letter-spacing: 2px; margin-bottom: 8px; }
.ux-type-desc { font-size: 12px; color: var(--ux-accent-muted); line-height: 1.5; }

/* ─── MAP PIN TOOLTIPS ─── */
.marker {
  position: relative;
}
.marker .tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: rgba(15,13,26,0.95);
  border: 1px solid rgba(200,147,42,0.3);
  border-radius: 8px;
  white-space: nowrap;
  font-size: 11px;
  color: var(--ux-text-light);
  z-index: var(--ux-z-tooltip);
  pointer-events: none;
}
.marker:hover .tooltip {
  display: block;
}
.marker:focus-within .tooltip {
  display: block;
}

/* ─── DAILY FORTUNE ─── */
.ux-daily-fortune {
  padding: 20px 16px;
  margin: 20px 0;
  min-height: 120px;
  background: linear-gradient(135deg, rgba(139,126,200,0.08), rgba(200,147,42,0.04));
  border: 1px solid rgba(139,126,200,0.2);
  border-radius: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ux-daily-fortune-header { margin-bottom: 8px; }
.ux-daily-fortune-emoji { font-size: 28px; margin-right: 8px; vertical-align: middle; }
.ux-daily-fortune-date { font-size: 16px; color: var(--ux-text-subtle); vertical-align: middle; letter-spacing: 2px; font-weight: 700; }
.ux-daily-fortune-title { font-size: 10px; color: var(--ux-text-subtle); letter-spacing: 2px; margin-bottom: 10px; text-transform: uppercase; }
.ux-daily-fortune-message { font-size: 16px; font-weight: 700; color: var(--ux-accent); line-height: 1.6; letter-spacing: 0.5px; }

/* ─── FRIENDS COMPATIBILITY ─── */
.ux-compat-card {
  padding: 20px 16px;
  margin: 20px 0;
  background: linear-gradient(135deg, rgba(200,147,42,0.06), rgba(180,120,30,0.03));
  border: 1px solid rgba(200,147,42,0.2);
  border-radius: 14px;
  text-align: center;
  contain: content;
}
.ux-compat-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ux-accent);
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.ux-compat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.ux-compat-label {
  font-size: 11px;
  color: var(--ux-text-subtle);
  letter-spacing: 1px;
}
.ux-compat-input {
  width: 100%;
  max-width: 240px;
  min-height: 44px;
  padding: 10px 12px;
  background: rgba(30,25,15,0.6);
  border: 1px solid rgba(200,147,42,0.3);
  border-radius: 8px;
  color: var(--ux-text-light);
  font-size: 14px;
  text-align: center;
  transition: border-color var(--ux-transition-fast), box-shadow var(--ux-transition-fast);
}
.ux-compat-input:focus {
  outline: none;
  border-color: var(--ux-accent);
  box-shadow: 0 0 8px rgba(200,147,42,0.2);
}
.ux-compat-input:focus-visible {
  outline: 2px solid var(--ux-accent);
  outline-offset: 2px;
}
.ux-compat-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(200,147,42,0.2), rgba(200,147,42,0.1));
  border: 1px solid rgba(200,147,42,0.4);
  border-radius: 10px;
  color: var(--ux-accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 1px;
}
.ux-compat-btn:hover {
  background: linear-gradient(135deg, rgba(200,147,42,0.3), rgba(200,147,42,0.15));
  transform: translateY(-1px);
}
.ux-compat-btn:focus-visible {
  outline: 2px solid var(--ux-accent);
  outline-offset: 2px;
}
.ux-compat-btn:active {
  transform: scale(0.97);
}
.ux-compat-score-wrap {
  margin-top: 20px;
  padding: 20px;
  background: rgba(200,147,42,0.04);
  border-radius: var(--ux-radius-lg);
}
.ux-compat-emoji {
  font-size: 36px;
  margin-bottom: 8px;
}
.ux-compat-score {
  font-size: 48px;
  font-weight: 700;
  color: var(--ux-accent);
  line-height: 1;
}
.ux-compat-percent {
  font-size: 20px;
  font-weight: 400;
}
.ux-compat-comment {
  font-size: 13px;
  color: var(--ux-accent-muted);
  margin-top: 8px;
  letter-spacing: 0.5px;
}
.ux-compat-share-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}
.ux-compat-share-btn {
  min-height: 44px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: var(--text, #fff);
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--ux-transition-fast);
}
.ux-compat-share-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--accent, #8b7ec8);
}
.ux-compat-share-btn:focus-visible {
  outline: 2px solid var(--accent, #8b7ec8);
  outline-offset: 2px;
}
.ux-compat-share-btn:active {
  transform: scale(0.97);
}
.ux-compat-form .ux-bday-wrap {
  justify-content: center;
}
.ux-compat-form .ux-bday-wrap input {
  min-height: 44px;
  background: rgba(30,25,15,0.6);
  border-color: rgba(200,147,42,0.3);
  color: var(--ux-text-light);
  font-size: 14px;
  transition: border-color var(--ux-transition-fast), box-shadow var(--ux-transition-fast);
}
.ux-compat-form .ux-bday-wrap input:focus {
  border-color: var(--ux-accent, #c8932a);
  box-shadow: 0 0 8px rgba(200,147,42,0.2);
}
.ux-compat-form .ux-bday-wrap input:focus-visible {
  outline: 2px solid var(--ux-accent);
  outline-offset: 2px;
}

/* ─── DAILY LIMIT MESSAGE ─── */
.ux-daily-limit {
  padding: 24px 16px;
  margin: 20px 0;
  min-height: 140px;
  background: linear-gradient(135deg, rgba(88,86,214,0.08), rgba(88,86,214,0.03));
  border: 1px solid rgba(88,86,214,0.2);
  border-radius: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ux-limit-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: typeFloat 3s ease-in-out infinite;
}
.ux-limit-done {
  font-size: 15px;
  font-weight: 700;
  color: var(--ux-accent);
  margin-bottom: 4px;
}
.ux-limit-next {
  font-size: 12px;
  color: var(--ux-accent-muted);
  margin-bottom: 12px;
}
.ux-limit-timer {
  font-size: 20px;
  font-weight: 700;
  color: #8b7ec8;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.ux-limit-encourage {
  font-size: 11px;
  color: var(--ux-text-subtle);
  letter-spacing: 1px;
}

/* ─── SAVE IMAGE BUTTON ─── */
.ux-save-image-btn {
  display: inline-block;
  min-height: 44px;
  min-width: 44px;
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(139,126,200,0.2), rgba(139,126,200,0.1));
  border: 1px solid rgba(139,126,200,0.4);
  border-radius: 12px;
  color: #8b7ec8;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--ux-transition-fast);
  letter-spacing: 1px;
  margin: 8px 4px;
}
.ux-save-image-btn:hover {
  background: linear-gradient(135deg, rgba(139,126,200,0.3), rgba(139,126,200,0.15));
  transform: translateY(-1px);
}
.ux-save-image-btn:focus-visible {
  outline: 2px solid #8b7ec8;
  outline-offset: 2px;
}
.ux-save-image-btn:active {
  transform: scale(0.97);
}

/* ─── RANK-BASED VISUAL EFFECTS ─── */
.ux-rank-effect {
  position: relative;
  width: 100%;
  min-height: 80px;
  height: 80px;
  overflow: hidden;
  border-radius: 12px;
  margin: 8px 0;
  contain: layout style;
}

/* BEST - Gold explosion */
.ux-rank-best { background: radial-gradient(ellipse at center, rgba(232,184,74,0.15) 0%, transparent 70%); }
.ux-rank-particles { position: absolute; inset: 0; contain: strict; }
.ux-rank-particle {
  position: absolute;
  background: #e8b84a;
  border-radius: 50%;
  animation: rankParticle 3s ease-out infinite;
  will-change: transform, opacity;
}
@keyframes rankParticle {
  0% { opacity: 1; transform: scale(0) translateY(0); }
  50% { opacity: 0.8; transform: scale(1) translateY(-20px); }
  100% { opacity: 0; transform: scale(0.5) translateY(-40px); }
}
.ux-rank-glow-best {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(232,184,74,0.2) 0%, transparent 60%);
  animation: rankGlow 2s ease-in-out infinite;
}
@keyframes rankGlow {
  0%, 100% { opacity: 0.5; } 50% { opacity: 1; }
}

/* GOOD - Golden glow */
.ux-rank-good { background: radial-gradient(ellipse at center, rgba(232,184,74,0.08) 0%, transparent 70%); }
.ux-rank-glow-good {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(232,184,74,0.12) 0%, transparent 50%);
  animation: rankGlow 3s ease-in-out infinite;
}

/* BAD - Starry sky */
.ux-rank-bad { background: linear-gradient(180deg, #0a0820 0%, #1a1040 100%); }
.ux-rank-stars { position: absolute; inset: 0; contain: strict; }
.ux-rank-star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: rankTwinkle 2s ease-in-out infinite;
  will-change: opacity;
}
@keyframes rankTwinkle {
  0%, 100% { opacity: 0.3; } 50% { opacity: 1; }
}
.ux-rank-hope {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(200,180,220,0.8);
  letter-spacing: 1px;
}

/* NORMAL - Shimmer */
.ux-rank-normal { background: rgba(200,147,42,0.03); }
.ux-rank-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(200,147,42,0.08), transparent);
  animation: rankShimmer 3s ease-in-out infinite;
}
@keyframes rankShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ─── RESULT PAGE VISUAL ENHANCEMENT (v=3) ─── */

/* Decorative section dividers */
.ux-section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 20px;
  opacity: 0;
  animation: uxFadeIn 0.5s ease 0.3s forwards;
}
.ux-section-divider::before,
.ux-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ux-accent, #e8b84a), transparent);
}
.ux-section-divider-symbol {
  font-size: 10px;
  color: var(--ux-accent, #e8b84a);
  letter-spacing: 4px;
}

/* Enhanced result header glow */
.ux-result-glow {
  position: relative;
}
.ux-result-glow::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent, #9b7de8) 0%, transparent 70%);
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
  border-radius: var(--ux-radius-circle);
}

/* Score visualization ring */
.ux-score-ring {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px auto 8px;
}
.ux-score-ring svg {
  max-width: 100px;
  height: auto;
  width: 80px;
  min-height: 80px;
  transform: rotate(-90deg);
}
.ux-score-ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 6;
}
.ux-score-ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4,0,0.2,1);
}
.ux-score-ring-text {
  position: absolute;
  text-align: center;
}
.ux-score-ring-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  display: block;
}
.ux-score-ring-label {
  font-size: 9px;
  letter-spacing: 2px;
  opacity: 0.6;
  display: block;
  margin-top: 2px;
}

/* Enhanced lucky items with color swatch */
.ux-lucky-color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 8px rgba(var(--swatch-r, 200), var(--swatch-g, 147), var(--swatch-b, 42), 0.4);
}

/* Enhanced card hover effects */
.ux-card-enhanced {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ux-card-enhanced:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Decorative corner ornaments for result cards */
.ux-corner-ornament {
  position: relative;
  overflow: hidden;
}
.ux-corner-ornament::before,
.ux-corner-ornament::after {
  content: '✦';
  position: absolute;
  font-size: 10px;
  opacity: 0.2;
  color: var(--accent, var(--ux-accent, #e8b84a));
}
.ux-corner-ornament::before {
  top: 8px;
  left: 10px;
}
.ux-corner-ornament::after {
  bottom: 8px;
  right: 10px;
}

/* Background decorative particles for result screen */
.ux-result-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: strict;
}
.ux-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent, var(--ux-accent, #e8b84a));
  border-radius: 50%;
  opacity: 0;
  animation: uxParticleFloat 8s ease-in-out infinite;
  will-change: transform, opacity;
}
@keyframes uxParticleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.4; }
  90% { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(-20px) scale(1); }
}

/* Enhanced accordion with gradient indicator */
.ux-accordion-enhanced .accordion-header {
  position: relative;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: background-color var(--ux-transition-base);
}
.ux-accordion-enhanced .accordion-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, var(--ux-accent, #e8b84a));
  opacity: 0;
  transition: opacity var(--ux-transition-fast);
}
.ux-accordion-enhanced .accordion-header:hover::before,
.ux-accordion-enhanced .accordion-header.open::before {
  opacity: 1;
}
.ux-accordion-enhanced .accordion-header:focus-visible {
  outline: 2px solid var(--ux-accent);
  outline-offset: -2px;
}

/* Enhanced overall message card with gradient border */
.ux-message-highlight {
  position: relative;
  border: none !important;
  background-clip: padding-box;
}
.ux-message-highlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent, #9b7de8), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Animated entrance for result sections */
@keyframes uxSlideReveal {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
.ux-reveal {
  animation: uxSlideReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Enhanced share button */
.ux-btn-share-enhanced {
  position: relative;
  overflow: hidden;
}
.ux-btn-share-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transition: left 0.5s;
}
.ux-btn-share-enhanced:hover::before {
  left: 100%;
}

/* Lucky item enhanced with icon glow */
.ux-lucky-enhanced {
  position: relative;
  overflow: hidden;
}
.ux-lucky-enhanced::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--accent, var(--ux-accent, #e8b84a)) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.ux-lucky-enhanced:hover::after {
  opacity: 0.04;
}

/* Result page floating ornament dots */
.ux-floating-dots {
  position: absolute;
  pointer-events: none;
}
.ux-floating-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent, var(--ux-accent, #e8b84a));
  opacity: 0.15;
  animation: uxDotPulse 4s ease-in-out infinite;
}
@keyframes uxDotPulse {
  0%, 100% { opacity: 0.1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.5); }
}

/* Enhanced caution card with animated border */
.ux-caution-enhanced {
  position: relative;
}
.ux-caution-enhanced::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232,122,122,0.3), transparent);
}

/* Subtle text gradient for headings */
.ux-text-gradient {
  background: linear-gradient(135deg, var(--accent, #9b7de8), var(--accent2, #c4a8ff));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── DIVINE BUTTON (unified CTA for all divination pages) ─── */
.btn-divine {
  display: block;
  width: 100%;
  max-width: 320px;
  min-height: 48px;
  margin: 24px auto 16px;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 3px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent, #9b7de8) 0%, var(--accent2, #c4a8ff) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform var(--ux-transition-fast), box-shadow var(--ux-transition-fast), opacity var(--ux-transition-fast);
  box-shadow: 0 4px 16px rgba(155, 125, 232, 0.3);
  position: relative;
  overflow: hidden;
}
.btn-divine::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}
.btn-divine:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(155, 125, 232, 0.45);
}
.btn-divine:hover::before {
  left: 100%;
}
.btn-divine:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 2px;
}
.btn-divine:active {
  transform: scale(0.97);
  opacity: 0.9;
}
.btn-divine:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 2px 8px rgba(155, 125, 232, 0.15);
  filter: grayscale(0.5);
  pointer-events: none;
  border: 2px dashed rgba(255,255,255,0.3);
}
@media (max-width: 480px) {
  .btn-divine {
    max-width: 280px;
    font-size: 16px;
    padding: 14px 24px;
    min-height: 44px;
  }
}

/* ─── LIGHT THEME OVERRIDE ─── */
/* Overrides page-level :root dark vars with light equivalents.
   Accent colors are darkened slightly for contrast on white. */
html[data-theme="light"] {
  --bg: #f5f3f0;
  --bg2: #edeae5;
  --card-bg: #ffffff;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #6b6b80;
  --muted2: #8080a0;
  --text-sub: #6b6b80;
  --border: #d8d5d0;
  --positive: #2a9d5c;
  --negative: #d03030;
  color-scheme: light;
}
html[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}
/* Adjust shared UX elements for light mode */
html[data-theme="light"] .ux-theme-toggle {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.12);
  backdrop-filter: blur(8px);
}
html[data-theme="light"] .ux-theme-toggle:hover {
  border-color: rgba(0,0,0,0.25);
}
html[data-theme="light"] .ux-streak-badge {
  background: linear-gradient(135deg, rgba(200,147,42,0.12), rgba(200,147,42,0.06));
  border-color: rgba(200,147,42,0.25);
}
html[data-theme="light"] .ux-streak-milestone {
  background: linear-gradient(135deg, rgba(218,165,32,0.12), rgba(200,147,42,0.06));
  border-color: rgba(218,165,32,0.3);
}
html[data-theme="light"] .ux-streak-freeze-used {
  background: rgba(60,130,220,0.08);
  border-color: rgba(60,130,220,0.2);
  color: #3c82dc;
}
html[data-theme="light"] .ux-streak-freeze-avail {
  color: rgba(60,130,220,0.6);
}
html[data-theme="light"] .ux-keyword-anchor {
  background: linear-gradient(135deg, rgba(200,147,42,0.06), rgba(200,147,42,0.03));
  border-color: rgba(200,147,42,0.15);
}
html[data-theme="light"] .ux-detail-blur-overlay {
  background: linear-gradient(transparent 20%, var(--bg) 90%);
}
html[data-theme="light"] .ux-history-card {
  background: var(--card-bg);
  border-color: var(--border);
}
html[data-theme="light"] .ux-section-divider::before {
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
html[data-theme="light"] .ux-result-card {
  background: var(--card-bg);
  border-color: var(--border);
}
html[data-theme="light"] .ux-toast {
  background: rgba(255,255,255,0.95);
  color: var(--text);
  border-color: var(--border);
}
/* Birthday input fields */
html[data-theme="light"] .ux-bday-wrap input {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}
/* Page-level common elements */
html[data-theme="light"] .container,
html[data-theme="light"] .wrapper {
  color: var(--text);
}
html[data-theme="light"] .input-group input,
html[data-theme="light"] .input-group select,
html[data-theme="light"] .input-group textarea {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .input-group select option {
  background: var(--card-bg);
  color: var(--text);
}
html[data-theme="light"] .gender-btn {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .gender-btn:hover {
  background: rgba(0,0,0,0.06);
}
html[data-theme="light"] .gender-btn.active {
  background: rgba(var(--accent), 0.1);
}
/* Result cards and sections */
html[data-theme="light"] .result-card,
html[data-theme="light"] .detail-card,
html[data-theme="light"] .fortune-card,
html[data-theme="light"] .category-card,
html[data-theme="light"] .advice-card,
html[data-theme="light"] .caution-card {
  background: var(--card-bg);
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
html[data-theme="light"] .lucky-item {
  background: var(--card-bg);
  border-color: var(--border);
}
/* Header areas - keep dark for visual interest */
html[data-theme="light"] .header,
html[data-theme="light"] header {
  color: var(--text);
}
/* Share panel */
html[data-theme="light"] .ux-share-btn {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .ux-share-btn:hover {
  background: var(--bg2);
}
/* Cross nav */
html[data-theme="light"] .ux-cross-nav-card {
  background: var(--card-bg);
  border-color: var(--border);
}
/* History panel */
html[data-theme="light"] .ux-history-panel {
  background: var(--card-bg);
  border-color: var(--border);
}
/* Compatibility section */
html[data-theme="light"] .ux-compat-section {
  background: var(--card-bg);
  border-color: var(--border);
}
html[data-theme="light"] .ux-compat-section input {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
/* Disclaimer */
html[data-theme="light"] .ux-disclaimer {
  color: var(--muted);
}
/* Loading screen adjustments */
html[data-theme="light"] .screen-loading,
html[data-theme="light"] [id*="loading"] {
  background: var(--bg);
  color: var(--text);
}
/* Welcome/home screen */
html[data-theme="light"] .screen-home,
html[data-theme="light"] [id*="home"] {
  color: var(--text);
}
/* Divination-specific decorative elements - soften in light mode */
html[data-theme="light"] .ux-result-particles,
html[data-theme="light"] .ux-rank-particles {
  opacity: 0.3;
}
/* Scrollbar for light mode */
html[data-theme="light"] ::-webkit-scrollbar-track {
  background: var(--bg);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: var(--border);
}
/* Background layer adjustments */
html[data-theme="light"] .bg-layer {
  opacity: 0.15;
}
/* Fallback error UI */
html[data-theme="light"] .ux-fallback-btn {
  background: var(--card-bg);
  color: var(--text);
  border-color: var(--border);
}

/* ─── THEME TOGGLE BUTTON ─── */
.ux-theme-toggle {
  position: fixed;
  bottom: 16px;
  right: 58px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(30,25,15,0.8);
  border: 1px solid rgba(200,147,42,0.3);
  color: var(--ux-accent);
  font-size: 16px;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ux-theme-toggle:hover {
  border-color: rgba(200,147,42,0.6);
  transform: scale(1.1);
}

/* ─── HIGH CONTRAST THEME ─── */
/* Maximum readability for vision-impaired users. Uses pure black/white with vivid accent colors and strong borders. */
html[data-theme="high-contrast"] {
  --bg: #000000;
  --bg2: #0a0a0a;
  --card-bg: #0a0a0a;
  --card: #0a0a0a;
  --text: #ffffff;
  --muted: #e0e0e0;
  --muted2: #cccccc;
  --text-sub: #e0e0e0;
  --border: #ffffff;
  --positive: #00ff88;
  --negative: #ff4444;
  color-scheme: dark;
}
html[data-theme="high-contrast"] body {
  background: #000;
  color: #fff;
}
/* Strong borders on all card elements */
html[data-theme="high-contrast"] .ux-result-card,
html[data-theme="high-contrast"] .ux-detail-card,
html[data-theme="high-contrast"] .ux-lucky-items,
html[data-theme="high-contrast"] .ux-advice-card,
html[data-theme="high-contrast"] .ux-caution-card,
html[data-theme="high-contrast"] .ux-message-card,
html[data-theme="high-contrast"] .ux-message-highlight,
html[data-theme="high-contrast"] .result-card,
html[data-theme="high-contrast"] .detail-card,
html[data-theme="high-contrast"] .fortune-card,
html[data-theme="high-contrast"] .category-card,
html[data-theme="high-contrast"] .lucky-card,
html[data-theme="high-contrast"] .advice-card,
html[data-theme="high-contrast"] .caution-card {
  background: #0a0a0a;
  border: 2px solid #ffffff;
  box-shadow: none;
  color: #ffffff;
}
/* Inputs with strong contrast */
html[data-theme="high-contrast"] .input-group input,
html[data-theme="high-contrast"] .input-group select,
html[data-theme="high-contrast"] .input-group textarea,
html[data-theme="high-contrast"] .ux-bday-wrap input {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
}
html[data-theme="high-contrast"] .input-group select option {
  background: #000;
  color: #fff;
}
/* Gender buttons */
html[data-theme="high-contrast"] .gender-btn {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
}
html[data-theme="high-contrast"] .gender-btn:hover {
  background: #222;
  border-color: #ffdd00;
}
html[data-theme="high-contrast"] .gender-btn.active {
  background: #ffdd00;
  color: #000;
  border-color: #ffdd00;
}
/* Containers */
html[data-theme="high-contrast"] .container,
html[data-theme="high-contrast"] .wrapper {
  background: #000;
}
/* Links always bright yellow for visibility */
html[data-theme="high-contrast"] a {
  color: #ffdd00;
}
html[data-theme="high-contrast"] a:visited {
  color: #ffbb00;
}
/* Toast */
html[data-theme="high-contrast"] .ux-toast {
  background: #ffdd00;
  color: #000;
  border: 2px solid #fff;
  font-weight: 700;
}
/* Streak badge */
html[data-theme="high-contrast"] .ux-streak-badge {
  background: #000;
  border: 2px solid #ffdd00;
  color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-streak-milestone {
  background: #000;
  border: 2px solid #ffdd00;
  color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-streak-freeze-used {
  background: #000;
  border: 2px solid #00aaff;
  color: #00aaff;
}
html[data-theme="high-contrast"] .ux-streak-freeze-avail {
  color: #00aaff;
}
/* History card */
html[data-theme="high-contrast"] .ux-history-card {
  background: #0a0a0a;
  border: 2px solid #fff;
}
/* Section divider */
html[data-theme="high-contrast"] .ux-section-divider::before {
  background: #fff;
}
/* Share panel */
html[data-theme="high-contrast"] .ux-share-panel,
html[data-theme="high-contrast"] .ux-share-panel a,
html[data-theme="high-contrast"] .ux-share-panel button {
  border: 2px solid #fff;
  color: #fff;
  background: #000;
}
/* Toggle buttons */
html[data-theme="high-contrast"] .ux-theme-toggle {
  background: #000;
  border: 2px solid #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-theme-toggle:hover {
  border-color: #ffdd00;
}
/* Remove gradient text effects — force flat white text */
html[data-theme="high-contrast"] [style*="background-clip"],
html[data-theme="high-contrast"] .gradient-text,
html[data-theme="high-contrast"] .logo-en,
html[data-theme="high-contrast"] .beta-badge,
html[data-theme="high-contrast"] .tagline {
  -webkit-text-fill-color: #ffdd00 !important;
  background: none !important;
  background-clip: initial !important;
  -webkit-background-clip: initial !important;
}
/* Disable decorative particles and background layers */
html[data-theme="high-contrast"] .bg-layer,
html[data-theme="high-contrast"] .ux-result-particles,
html[data-theme="high-contrast"] .ux-rank-particles,
html[data-theme="high-contrast"] .ux-rank-effect,
html[data-theme="high-contrast"] .ux-particle,
html[data-theme="high-contrast"] .ux-rank-particle {
  display: none !important;
}
/* Score ring: strong border */
html[data-theme="high-contrast"] .ux-score-ring,
html[data-theme="high-contrast"] .score-ring {
  border: 3px solid #ffdd00;
}
/* Cross navigation */
html[data-theme="high-contrast"] .ux-cross-nav a {
  color: #ffdd00;
  border: 2px solid #fff;
  background: #000;
}
/* Error fallback */
html[data-theme="high-contrast"] .ux-error-fallback {
  background: #000;
  border: 2px solid #ff4444;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-detail-blur-overlay {
  background: linear-gradient(transparent, #000);
}
/* Keyword anchor */
html[data-theme="high-contrast"] .ux-keyword-anchor {
  color: #ffdd00;
  text-decoration: underline;
}
/* Focus-visible override for high contrast */
html[data-theme="high-contrast"] :focus-visible {
  outline: 3px solid #ffdd00 !important;
  outline-offset: 2px;
}
/* Remove body vignette pseudo-elements */
html[data-theme="high-contrast"] body::before,
html[data-theme="high-contrast"] body::after {
  display: none !important;
}
/* Buttons: strong borders, flat colors */
html[data-theme="high-contrast"] .btn-divine,
html[data-theme="high-contrast"] .btn-draw,
html[data-theme="high-contrast"] button[type="submit"],
html[data-theme="high-contrast"] .ux-save-image-btn {
  background: #ffdd00;
  color: #000;
  border: 2px solid #fff;
  font-weight: 700;
  text-shadow: none;
  box-shadow: none;
}
html[data-theme="high-contrast"] .btn-divine:hover,
html[data-theme="high-contrast"] .btn-draw:hover,
html[data-theme="high-contrast"] button[type="submit"]:hover {
  background: #fff;
  color: #000;
}
/* Forced-colors support (Windows High Contrast) */
@media (forced-colors: active) {
  .ux-result-particles, .ux-rank-particles, .ux-rank-effect,
  .bg-layer, .ux-particle, .ux-rank-particle { display: none !important; }
  .ux-theme-toggle { border: 1px solid ButtonText; }
}

/* ─── SWIPE NAV DOT INDICATOR ─── */
.ux-swipe-dots {
  position: fixed;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.ux-swipe-dots.visible {
  opacity: 1;
}
.ux-swipe-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: all 0.3s ease;
}
.ux-swipe-dot.active {
  background: rgba(200,147,42,0.9);
  transform: scale(1.4);
  box-shadow: 0 0 6px rgba(200,147,42,0.5);
}
html[data-theme="light"] .ux-swipe-dot {
  background: rgba(0,0,0,0.15);
}
html[data-theme="light"] .ux-swipe-dot.active {
  background: rgba(120,80,20,0.8);
  box-shadow: 0 0 6px rgba(120,80,20,0.3);
}
html[data-theme="high-contrast"] .ux-swipe-dot {
  background: #666;
  border: 1px solid #fff;
}
html[data-theme="high-contrast"] .ux-swipe-dot.active {
  background: #ffdd00;
  border-color: #ffdd00;
  box-shadow: 0 0 4px #ffdd00;
}
/* Only show on mobile-ish widths */
@media (min-width: 769px) {
  .ux-swipe-dots { display: none; }
}

/* ─── SWIPE ONBOARDING TOOLTIP ─── */
.ux-swipe-onboard {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.85);
  color: #ffdd00;
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-line;
  text-align: center;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,221,0,0.25);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.ux-swipe-onboard.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
html[data-theme="light"] .ux-swipe-onboard {
  background: rgba(255,255,255,0.92);
  color: #7c5c00;
  border-color: rgba(200,150,0,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
html[data-theme="high-contrast"] .ux-swipe-onboard {
  background: #000;
  color: #ffdd00;
  border: 2px solid #ffdd00;
}
@media (min-width: 769px) {
  .ux-swipe-onboard { display: none; }
}

/* ─── WIDE SCREEN LAYOUT (task #53) ─── */
/* Constrain body content and add visual framing on very wide screens */
@media (min-width: 1200px) {
  body {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
  }
  body::before,
  body::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    width: calc((100vw - 960px) / 2);
    pointer-events: none;
    z-index: -1;
  }
  body::before {
    left: 0;
    background: linear-gradient(90deg, rgba(15,13,26,0.95), rgba(15,13,26,0.3));
  }
  body::after {
    right: 0;
    background: linear-gradient(-90deg, rgba(15,13,26,0.95), rgba(15,13,26,0.3));
  }
}
html[data-theme="light"] body::before {
  background: linear-gradient(90deg, rgba(245,243,248,0.95), rgba(245,243,248,0.3));
}
html[data-theme="light"] body::after {
  background: linear-gradient(-90deg, rgba(245,243,248,0.95), rgba(245,243,248,0.3));
}

/* ─── HIGH-CONTRAST THEME (accessibility) ─── */
html[data-theme="high-contrast"] {
  --bg: #000000;
  --bg2: #0a0a0a;
  --card-bg: #0a0a0a;
  --card: #0a0a0a;
  --text: #ffffff;
  --muted: #e0e0e0;
  --muted2: #cccccc;
  --text-sub: #e0e0e0;
  --border: #ffffff;
  --positive: #00ff66;
  --negative: #ff4444;
  --accent: #ffdd00;
  color-scheme: dark;
}
html[data-theme="high-contrast"] body {
  background: #000;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-theme-toggle {
  background: #000;
  border: 2px solid #fff;
}
html[data-theme="high-contrast"] .ux-theme-toggle:hover {
  border-color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-result-card,
html[data-theme="high-contrast"] .result-card,
html[data-theme="high-contrast"] .detail-card,
html[data-theme="high-contrast"] .fortune-card,
html[data-theme="high-contrast"] .category-card,
html[data-theme="high-contrast"] .advice-card,
html[data-theme="high-contrast"] .caution-card,
html[data-theme="high-contrast"] .ux-detail-card,
html[data-theme="high-contrast"] .ux-lucky-items,
html[data-theme="high-contrast"] .ux-advice-card,
html[data-theme="high-contrast"] .ux-caution-card,
html[data-theme="high-contrast"] .ux-message-card,
html[data-theme="high-contrast"] .ux-message-highlight,
html[data-theme="high-contrast"] .lucky-item {
  background: #0a0a0a;
  border: 2px solid #fff;
  color: #fff;
  box-shadow: none;
}
html[data-theme="high-contrast"] .ux-share-btn,
html[data-theme="high-contrast"] .ux-cross-nav-card,
html[data-theme="high-contrast"] .ux-history-panel,
html[data-theme="high-contrast"] .ux-history-card,
html[data-theme="high-contrast"] .ux-compat-section,
html[data-theme="high-contrast"] .ux-streak-badge,
html[data-theme="high-contrast"] .ux-streak-milestone,
html[data-theme="high-contrast"] .ux-streak-freeze-used,
html[data-theme="high-contrast"] .ux-keyword-anchor {
  background: #0a0a0a;
  border: 2px solid #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-share-btn:hover,
html[data-theme="high-contrast"] .ux-cross-nav-card:hover {
  border-color: #ffdd00;
  color: #ffdd00;
}
html[data-theme="high-contrast"] .input-group input,
html[data-theme="high-contrast"] .input-group select,
html[data-theme="high-contrast"] .input-group textarea,
html[data-theme="high-contrast"] .ux-compat-section input,
html[data-theme="high-contrast"] .ux-bday-wrap input {
  background: #000;
  border: 2px solid #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .input-group input:focus,
html[data-theme="high-contrast"] .input-group select:focus,
html[data-theme="high-contrast"] .input-group textarea:focus,
html[data-theme="high-contrast"] .ux-bday-wrap input:focus {
  border-color: #ffdd00;
  outline: 2px solid #ffdd00;
}
html[data-theme="high-contrast"] .gender-btn {
  background: #000;
  border: 2px solid #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .gender-btn:hover {
  border-color: #ffdd00;
}
html[data-theme="high-contrast"] .gender-btn.active {
  background: #ffdd00;
  color: #000;
  border-color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-toast {
  background: #000;
  color: #fff;
  border: 2px solid #ffdd00;
}
html[data-theme="high-contrast"] .ux-section-divider::before {
  background: linear-gradient(90deg, transparent, #fff, transparent);
}
html[data-theme="high-contrast"] .ux-detail-blur-overlay {
  background: linear-gradient(transparent 20%, #000 90%);
}
/* Remove decorative particles and gradients for clarity */
html[data-theme="high-contrast"] .ux-result-particles,
html[data-theme="high-contrast"] .ux-rank-particles,
html[data-theme="high-contrast"] .ux-rank-effect,
html[data-theme="high-contrast"] .bg-layer {
  display: none;
}
/* Remove gradient text effects for readability */
html[data-theme="high-contrast"] * {
  -webkit-text-fill-color: inherit !important;
  background-clip: initial !important;
}
/* Ensure links are clearly visible */
html[data-theme="high-contrast"] a {
  color: #ffdd00;
  text-decoration: underline;
}
html[data-theme="high-contrast"] a:hover {
  color: #fff;
}
html[data-theme="high-contrast"] a:visited {
  color: #e0a0ff;
}
/* Loading screen */
html[data-theme="high-contrast"] .screen-loading,
html[data-theme="high-contrast"] [id*="loading"] {
  background: #000;
  color: #fff;
}
/* Home/welcome screen */
html[data-theme="high-contrast"] .screen-home,
html[data-theme="high-contrast"] [id*="home"] {
  color: #fff;
}
/* Disclaimer */
html[data-theme="high-contrast"] .ux-disclaimer {
  color: #e0e0e0;
}
/* Scrollbar */
html[data-theme="high-contrast"] ::-webkit-scrollbar-track {
  background: #000;
}
html[data-theme="high-contrast"] ::-webkit-scrollbar-thumb {
  background: #fff;
}
/* Fallback error UI */
html[data-theme="high-contrast"] .ux-fallback-btn {
  background: #000;
  color: #ffdd00;
  border: 2px solid #ffdd00;
}
/* Focus visible - extra prominent in high contrast */
html[data-theme="high-contrast"] :focus-visible {
  outline: 3px solid #ffdd00;
  outline-offset: 3px;
}
/* Wide screen vignettes */
html[data-theme="high-contrast"] body::before,
html[data-theme="high-contrast"] body::after {
  display: none;
}
/* Score ring */
html[data-theme="high-contrast"] .ux-score-ring,
html[data-theme="high-contrast"] .score-ring {
  border-color: #ffdd00;
}
/* Skip-to-content */
html[data-theme="high-contrast"] .ux-skip-to-content {
  background: #ffdd00;
  color: #000;
}
/* btn-divine CTA */
html[data-theme="high-contrast"] .btn-divine {
  border: 2px solid #ffdd00;
  color: #ffdd00;
}

/* ─── PRINT STYLESHEET ─── */
@media print {
  /* Hide non-essential UI */
  .ux-theme-toggle, .ux-skip-to-content,
  .ux-share-panel, .ux-cross-nav, .ux-save-image-btn,
  .ux-error-fallback, .ux-loading-spinner, .ux-result-particles,
  .ux-rank-particles, .ux-rank-effect, .bg-layer,
  .btn-divine, .btn-draw, #screen-home, #screen-loading,
  #screen-welcome, .screen-selection, nav, footer,
  button[onclick*="reload"], .ux-history-panel,
  .ux-swipe-dots { display: none !important; }

  /* Show result screen */
  #screen-result, .screen-result { display: block !important; }
  .screen { min-height: auto !important; padding: 0 !important; }

  /* Clean print layout */
  body {
    background: #fff !important;
    color: #222 !important;
    font-size: 12pt !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 16px !important;
  }
  body::before, body::after { display: none !important; }

  /* Readable cards */
  .ux-result-card, .ux-detail-card, .ux-lucky-items,
  .ux-advice-card, .ux-caution-card, .ux-message-card,
  .ux-message-highlight, [class*="result-card"], [class*="detail-card"] {
    background: #fff !important;
    color: #222 !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Remove gradient text */
  * { -webkit-text-fill-color: initial !important; background-clip: initial !important; }

  /* Remove animations */
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  /* Score ring: ensure visibility */
  .ux-score-ring, .score-ring { border-color: #333 !important; }
}

/* ─── PAGE TRANSITION ANIMATIONS (Removed - already defined earlier) ─── */
/* Fade-in when screens become visible (hidden class removed) */
@keyframes uxScreenFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Loading screen gets a gentler fade (no translateY since it's centered) */
.screen-loading:not(.hidden),
[id*="loading"]:not(.hidden) {
  animation: uxScreenFadeIn 0.3s ease-out both;
}
/* Result screen gets a slightly slower entrance for dramatic effect */
.screen-result:not(.hidden),
[id="screen-result"]:not(.hidden) {
  animation: uxScreenFadeIn 0.5s ease-out both;
}

/* ─── SEASONAL THEMES ─── */
/* Spring (Mar-May): Cherry blossom petals */
@keyframes ux-sakura-fall {
  0% { transform: translate(0, -20px) rotate(0deg) scale(1); opacity: 0; }
  10% { opacity: 0.8; }
  50% { transform: translate(30px, 50vh) rotate(180deg) scale(0.9); opacity: 0.6; }
  100% { transform: translate(-20px, 105vh) rotate(360deg) scale(0.7); opacity: 0; }
}
@keyframes ux-sakura-sway {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(15px); }
}
.ux-seasonal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
  contain: strict;
}
.ux-sakura-petal {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 12px;
  background: radial-gradient(ellipse at 30% 30%, #ffb7c5, #ff8fa3);
  border-radius: 50% 0 50% 50%;
  opacity: 0;
  animation: ux-sakura-fall linear infinite, ux-sakura-sway ease-in-out infinite;
  will-change: transform, opacity;
}
.ux-sakura-petal:nth-child(odd) {
  background: radial-gradient(ellipse at 30% 30%, #ffc8d6, #ffaabb);
  width: 10px;
  height: 10px;
}
html[data-theme="high-contrast"] .ux-seasonal-container {
  display: none;
}
/* Summer (Jun-Aug): Fireflies */
@keyframes ux-firefly-float {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  20% { opacity: 0.9; }
  50% { transform: translate(40px, -30px) scale(1.2); opacity: 0.7; }
  80% { opacity: 0.9; }
  100% { transform: translate(-30px, -60px) scale(0.8); opacity: 0; }
}
.ux-firefly {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ffe066;
  border-radius: 50%;
  box-shadow: 0 0 6px 2px rgba(255,224,102,0.6), 0 0 12px 4px rgba(255,224,102,0.3);
  opacity: 0;
  animation: ux-firefly-float ease-in-out infinite;
  will-change: transform, opacity;
}
/* Autumn (Sep-Nov): Falling leaves */
@keyframes ux-leaf-fall {
  0% { transform: translate(0, -20px) rotate(0deg); opacity: 0; }
  10% { opacity: 0.7; }
  50% { transform: translate(-25px, 50vh) rotate(200deg); opacity: 0.5; }
  100% { transform: translate(20px, 105vh) rotate(400deg); opacity: 0; }
}
.ux-autumn-leaf {
  position: absolute;
  top: -20px;
  font-size: 14px;
  opacity: 0;
  animation: ux-leaf-fall linear infinite;
  will-change: transform, opacity;
}
/* Winter (Dec-Feb): Snowflakes */
@keyframes ux-snow-fall {
  0% { transform: translate(0, -10px) rotate(0deg); opacity: 0; }
  10% { opacity: 0.8; }
  100% { transform: translate(15px, 105vh) rotate(360deg); opacity: 0; }
}
.ux-snowflake {
  position: absolute;
  top: -10px;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: ux-snow-fall linear infinite;
  will-change: transform, opacity;
}
.ux-snowflake:nth-child(odd) {
  width: 4px;
  height: 4px;
  background: rgba(200,220,255,0.9);
}

/* ─── REDUCED MOTION (accessibility) ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ux-result-particles, .ux-rank-particles, .ux-rank-effect,
  .bg-layer, .ux-particle, .ux-rank-particle,
  .star, .ux-rank-star, .ux-rank-shimmer, .ux-confetti-canvas { display: none !important; }
  .ux-loading-spinner { animation: spin 1.2s linear infinite !important; }
}

/* ─── REGION PAGES: LIGHT THEME ─── */
html[data-theme="light"] .wrapper { color: #1a1a2e; }
html[data-theme="light"] .back-link { color: #666; }
html[data-theme="light"] .back-link:hover { color: #8b6914; }
html[data-theme="light"] .country-name { -webkit-text-fill-color: #7c5c00; color: #7c5c00; background: none; }
html[data-theme="light"] .country-name-ja { color: #888; }
html[data-theme="light"] .country-desc { color: #666; }
html[data-theme="light"] .divider::before,
html[data-theme="light"] .divider::after { background: linear-gradient(to right, transparent, #ddd, transparent); }
html[data-theme="light"] .divider-icon { color: #b8960f; }
html[data-theme="light"] .section-label { color: #999; }
html[data-theme="light"] .item-card {
  background: #fff;
  border-color: #e0dcd4;
  color: #1a1a2e;
}
html[data-theme="light"] .item-card.open:hover {
  border-color: rgba(200,147,42,0.5);
  background: rgba(200,147,42,0.05);
}
html[data-theme="light"] .item-icon-bg { background: linear-gradient(135deg, rgba(200,147,42,0.12), rgba(200,147,42,0.08)); }
html[data-theme="light"] .item-name-en { color: #999; }
html[data-theme="light"] .item-name-ja { color: #1a1a2e; }
html[data-theme="light"] .item-desc { color: #666; }
html[data-theme="light"] .badge-open { background: rgba(200,147,42,0.1); color: #8b6914; border-color: rgba(200,147,42,0.3); }
html[data-theme="light"] .badge-soon { background: rgba(100,100,100,0.08); color: #999; border-color: rgba(100,100,100,0.2); }
html[data-theme="light"] .item-arrow { color: #ccc; }
html[data-theme="light"] .soon-overlay { background: rgba(255,255,255,0.5); }
html[data-theme="light"] .soon-text { color: #8b6914; }
html[data-theme="light"] .bottom-label { color: #999; }
html[data-theme="light"] .bg-layer { opacity: 0; }

/* ─── REGION PAGES: HIGH-CONTRAST THEME ─── */
html[data-theme="high-contrast"] .wrapper { color: #fff; }
html[data-theme="high-contrast"] .back-link { color: #ffdd00; text-decoration: underline; }
html[data-theme="high-contrast"] .country-name { -webkit-text-fill-color: #ffdd00; color: #ffdd00; background: none; }
html[data-theme="high-contrast"] .country-name-ja { color: #ccc; }
html[data-theme="high-contrast"] .country-desc { color: #ccc; }
html[data-theme="high-contrast"] .divider::before,
html[data-theme="high-contrast"] .divider::after { background: linear-gradient(to right, transparent, #fff, transparent); }
html[data-theme="high-contrast"] .divider-icon { color: #ffdd00; opacity: 1; }
html[data-theme="high-contrast"] .section-label { color: #ccc; }
html[data-theme="high-contrast"] .item-card {
  background: #000;
  border: 2px solid #fff;
  color: #fff;
  box-shadow: none;
}
html[data-theme="high-contrast"] .item-card.open:hover {
  border-color: #ffdd00;
  background: #000;
}
html[data-theme="high-contrast"] .item-icon-bg { background: transparent; border: 1px solid #fff; }
html[data-theme="high-contrast"] .item-name-en { color: #ccc; }
html[data-theme="high-contrast"] .item-name-ja { color: #fff; }
html[data-theme="high-contrast"] .item-desc { color: #ccc; }
html[data-theme="high-contrast"] .badge-open { background: transparent; color: #ffdd00; border-color: #ffdd00; }
html[data-theme="high-contrast"] .badge-soon { background: transparent; color: #999; border-color: #999; }
html[data-theme="high-contrast"] .item-arrow { color: #ffdd00; }
html[data-theme="high-contrast"] .soon-overlay { background: rgba(0,0,0,0.6); }
html[data-theme="high-contrast"] .soon-text { color: #ffdd00; }
html[data-theme="high-contrast"] .bottom-label { color: #ccc; }
html[data-theme="high-contrast"] .bg-layer { display: none; }
html[data-theme="high-contrast"] .stars { display: none; }

/* ─── REFLECTION CARD (Post-result wellness prompts) ─── */
/**
 * Accordion-style reflection section shown after divination results.
 * - Collapsed by default; expands on click/tap.
 * - Fade-in animation on questions (respects prefers-reduced-motion).
 * - Glass-morphism card consistent with existing UX patterns.
 * - Light/high-contrast theme variants included.
 */
.ux-reflection {
  margin: 20px auto;
  max-width: 360px;
}

/* Toggle button (collapsed/expanded trigger) */
.ux-reflection-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ux-radius-xl, 14px);
  color: var(--text, #eee);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    background var(--ux-transition-fast, 0.2s ease),
    border-color var(--ux-transition-fast, 0.2s ease);
}
.ux-reflection-toggle:hover,
.ux-reflection-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.ux-reflection-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.ux-reflection-title {
  flex: 1;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--ux-accent, #e8b84a);
  text-transform: uppercase;
}
.ux-reflection-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--ux-transition-fast, 0.2s ease);
  color: var(--ux-accent, #e8b84a);
}
.ux-reflection-toggle[aria-expanded="true"] .ux-reflection-chevron {
  transform: rotate(180deg);
}
.ux-reflection-tap {
  font-size: 11px;
  color: var(--text-sub, #999);
  margin-inline-start: 4px;
}
.ux-reflection-toggle[aria-expanded="true"] .ux-reflection-tap {
  display: none;
}

/* Expandable panel */
.ux-reflection-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition:
    max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}
.ux-reflection-panel.open {
  max-height: 600px;
  opacity: 1;
}

/* Glass-morphism card */
.ux-reflection-card {
  margin-block-start: 8px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ux-radius-xl, 14px);
}

/* Question list */
.ux-reflection-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ux-reflection-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text, #e8e0d0);
  opacity: 0;
  transform: translateY(10px);
  animation: uxReflectionFadeIn 0.45s ease forwards;
}
.ux-reflection-item:nth-child(1) { animation-delay: 0.05s; }
.ux-reflection-item:nth-child(2) { animation-delay: 0.15s; }
.ux-reflection-item:nth-child(3) { animation-delay: 0.25s; }

/* Number badge */
.ux-reflection-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(232, 184, 74, 0.15);
  border: 1px solid rgba(232, 184, 74, 0.3);
  color: var(--ux-accent, #e8b84a);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block-start: 2px;
}

@keyframes uxReflectionFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* prefers-reduced-motion: disable all animations */
@media (prefers-reduced-motion: reduce) {
  .ux-reflection-panel {
    transition: none;
  }
  .ux-reflection-chevron {
    transition: none;
  }
  .ux-reflection-item {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Light theme */
html[data-theme="light"] .ux-reflection-toggle {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
  color: #222;
}
html[data-theme="light"] .ux-reflection-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .ux-reflection-item {
  color: #333;
}
html[data-theme="light"] .ux-reflection-num {
  background: rgba(139, 105, 20, 0.12);
  border-color: rgba(139, 105, 20, 0.25);
}

/* High-contrast theme */
html[data-theme="high-contrast"] .ux-reflection-toggle {
  background: #000;
  border-color: #ffdd00;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-reflection-card {
  background: #000;
  border-color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-reflection-title { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-reflection-chevron { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-reflection-item { color: #fff; }
html[data-theme="high-contrast"] .ux-reflection-num {
  background: transparent;
  border-color: #ffdd00;
  color: #ffdd00;
}

/* ─── PWA INSTALL BANNER ─── */
.ux-pwa-banner {
  position: fixed;
  bottom: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 420px);
  background: rgba(20, 10, 40, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(180, 140, 255, 0.3);
  border-radius: 16px;
  padding: 16px 20px;
  z-index: 9999;
  transition: bottom 0.3s ease;
  text-align: center;
}
.ux-pwa-banner.ux-pwa-show { bottom: 20px; }
.ux-pwa-banner p {
  margin: 0 0 12px;
  color: #e0d0ff;
  font-size: 14px;
  line-height: 1.5;
}
.ux-pwa-actions { display: flex; gap: 10px; justify-content: center; }
.ux-pwa-yes {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ux-pwa-no {
  background: transparent;
  color: #a89cc8;
  border: 1px solid rgba(180, 140, 255, 0.2);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
  .ux-pwa-banner { transition: none; }
}

/* ─── ABOUT DIVINATION SECTION ─── */
/**
 * SEO-focused "About this divination" accordion.
 * Text stays in DOM (max-height:0 + overflow:hidden) for crawler indexing.
 * Triggered by renderAboutDivination() in aimiru-ux.js.
 */

/* Outer wrapper */
.ux-about-divination {
  margin: 32px auto 0;
  max-width: 480px;
  padding: 0 4px;
}

/* Toggle button */
.ux-about-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ux-radius-xl, 14px);
  color: var(--text, #eee);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background var(--ux-transition-fast, 0.2s ease),
              border-color var(--ux-transition-fast, 0.2s ease);
}
.ux-about-toggle:hover,
.ux-about-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Toggle inner elements */
.ux-about-toggle-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.ux-about-toggle-titles {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.ux-about-toggle-main {
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--ux-accent, #e8b84a);
  text-transform: uppercase;
}
.ux-about-toggle-sub {
  font-size: 11px;
  color: var(--text-sub, #999);
}
.ux-about-toggle[aria-expanded="true"] .ux-about-toggle-sub {
  display: none;
}

/* Chevron */
.ux-about-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--ux-transition-fast, 0.2s ease);
  color: var(--ux-accent, #e8b84a);
}
.ux-about-toggle[aria-expanded="true"] .ux-about-chevron {
  transform: rotate(180deg);
}

/* Expandable panel — max-height keeps text in DOM for SEO crawlers */
.ux-about-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.35s ease;
  opacity: 0;
}
.ux-about-panel.open {
  max-height: 2000px;
  opacity: 1;
}

/* Glassmorphism card */
.ux-about-card {
  margin-block-start: 8px;
  padding: 20px 18px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ux-radius-xl, 14px);
}

/* Sub-sections */
.ux-about-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Section heading */
.ux-about-section-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-block-end: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ux-accent, #e8b84a);
}
.ux-about-section-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* Section text */
.ux-about-section-text {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text, #e8e0d0);
  opacity: 0;
  transform: translateY(8px);
  animation: uxAboutFadeIn 0.4s ease forwards;
}
.ux-about-sections .ux-about-section:nth-child(1) .ux-about-section-text { animation-delay: 0.06s; }
.ux-about-sections .ux-about-section:nth-child(2) .ux-about-section-text { animation-delay: 0.14s; }
.ux-about-sections .ux-about-section:nth-child(3) .ux-about-section-text { animation-delay: 0.22s; }

@keyframes uxAboutFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Divider between sections */
.ux-about-section + .ux-about-section {
  padding-block-start: 20px;
  border-block-start: 1px solid rgba(255, 255, 255, 0.08);
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .ux-about-panel { transition: none; }
  .ux-about-toggle .ux-about-chevron { transition: none; }
  .ux-about-section-text { animation: none; opacity: 1; transform: none; }
}

/* Light theme */
html[data-theme="light"] .ux-about-toggle {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
  color: #222;
}
html[data-theme="light"] .ux-about-card {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .ux-about-section-text { color: #333; }
html[data-theme="light"] .ux-about-section + .ux-about-section {
  border-block-start-color: rgba(0, 0, 0, 0.08);
}

/* High-contrast theme */
html[data-theme="high-contrast"] .ux-about-toggle {
  background: #000;
  border-color: #ffdd00;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-about-card {
  background: #000;
  border-color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-about-toggle-main { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-about-chevron { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-about-section-heading { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-about-section-text { color: #fff; }
html[data-theme="high-contrast"] .ux-about-section + .ux-about-section {
  border-block-start-color: #ffdd00;
}

/* ─── COLLECTION (Hub page — past results carousel) ─── */
.ux-collection {
  margin-block: 32px;
  padding-block-end: 4px;
}

.ux-collection-header {
  display: flex;
  align-items: center;
  margin-block-end: 14px;
  padding-inline: 4px;
}

.ux-collection-title {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted2, #8a82a8);
  text-transform: uppercase;
  font-weight: 700;
  margin: 0;
}

/* Horizontal scrollable track with snap */
.ux-collection-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-block-end: 8px;
  /* Hide scrollbar — decorative, content still accessible by scrolling */
  scrollbar-width: none;
}
.ux-collection-track::-webkit-scrollbar {
  display: none;
}

/* Individual result card */
.ux-collection-card {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 120px;
  padding: 16px 10px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text, #f0eef8);
  /* Glassmorphism */
  background: linear-gradient(
    135deg,
    rgba(139, 126, 200, 0.10),
    rgba(168, 155, 212, 0.06)
  );
  border: 1px solid rgba(168, 155, 212, 0.20);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.ux-collection-card:hover,
.ux-collection-card:focus-visible {
  border-color: rgba(139, 126, 200, 0.50);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(139, 126, 200, 0.18);
  outline: none;
}
.ux-collection-card:focus-visible {
  outline: 2px solid var(--accent, #8b7ec8);
  outline-offset: 2px;
}

.ux-collection-emoji {
  font-size: 28px;
  line-height: 1;
}

.ux-collection-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  text-align: center;
}

.ux-collection-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent2, #a89bd4);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ux-collection-result {
  font-size: 10px;
  color: var(--text, #f0eef8);
  line-height: 1.4;
  /* Allow up to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  word-break: break-word;
}

.ux-collection-date {
  font-size: 9px;
  color: var(--muted2, #8a82a8);
  letter-spacing: 0.3px;
}

/* "Show more" button row */
.ux-collection-more {
  text-align: center;
  margin-block-start: 10px;
}

.ux-collection-toggle {
  background: none;
  border: 1px solid rgba(168, 155, 212, 0.20);
  border-radius: 8px;
  color: var(--muted2, #8a82a8);
  font-size: 11px;
  padding: 6px 18px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  font-family: inherit;
}
.ux-collection-toggle:hover {
  border-color: var(--accent, #8b7ec8);
  color: var(--accent, #8b7ec8);
}
.ux-collection-toggle:focus-visible {
  outline: 2px solid var(--accent, #8b7ec8);
  outline-offset: 2px;
}

/* Light theme overrides */
html[data-theme="light"] .ux-collection-card {
  background: linear-gradient(135deg, rgba(139, 126, 200, 0.08), rgba(168, 155, 212, 0.04));
  border-color: rgba(139, 126, 200, 0.18);
  color: #222;
}
html[data-theme="light"] .ux-collection-name { color: #5a4e9a; }
html[data-theme="light"] .ux-collection-result { color: #333; }
html[data-theme="light"] .ux-collection-date { color: #888; }
html[data-theme="light"] .ux-collection-title { color: #666; }

/* High-contrast theme overrides */
html[data-theme="high-contrast"] .ux-collection-card {
  background: #000;
  border: 2px solid #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-collection-card:hover,
html[data-theme="high-contrast"] .ux-collection-card:focus-visible {
  border-color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-collection-name { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-collection-date { color: #ccc; }
html[data-theme="high-contrast"] .ux-collection-title { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-collection-toggle {
  border-color: #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-collection-toggle:hover {
  border-color: #ffdd00;
  color: #ffdd00;
}

/* ─── VIEW TRANSITIONS API (Chrome 111+ cross-document) ─── */
/**
 * CSS-only cross-document (MPA) transition via Navigation API.
 * Applied automatically on same-origin page navigations in supporting browsers.
 * Browsers that don't support @view-transition simply ignore this block.
 */
@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: ux-vt-fade-out 0.2s ease-out;
}
::view-transition-new(root) {
  animation: ux-vt-fade-in 0.3s ease-in;
}
@keyframes ux-vt-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes ux-vt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Respect user's motion preference */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* ─── SOCIAL PROOF COUNTER ─── */
/**
 * "N people divined today" badge displayed at the top of divination input screens.
 * Subtle and unobtrusive — reinforces that others are using the app without
 * dominating the page.
 */
.ux-social-proof {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(200, 147, 42, 0.08);
  border: 1px solid rgba(200, 147, 42, 0.2);
  border-radius: 20px;
  font-size: 12px;
  color: var(--ux-primary-gold, #c8932a);
  letter-spacing: 0.4px;
  line-height: 1.4;
  user-select: none;
  pointer-events: none;
}
.ux-social-proof-icon {
  font-size: 13px;
  line-height: 1;
}
.ux-social-proof-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Count-up animation target */
@keyframes ux-social-proof-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ux-social-proof {
  animation: ux-social-proof-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Light theme */
html[data-theme="light"] .ux-social-proof {
  background: rgba(139, 105, 20, 0.07);
  border-color: rgba(139, 105, 20, 0.18);
  color: var(--ux-accent, #8b6914);
}

/* High contrast theme */
html[data-theme="high-contrast"] .ux-social-proof {
  background: transparent;
  border: 2px solid #ffdd00;
  color: #ffdd00;
}

/* Wrapper for centering within a page section */
.ux-social-proof-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

/* Suppress animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ux-social-proof {
    animation: none;
  }
}

/* ─── NOTIFICATION PERMISSION DIALOG ─── */
/**
 * Two-step notification permission UI.
 * Appears 30s after a result screen — after user has seen value.
 * Dismisses gracefully with backdrop click or "Not now" button.
 */
.ux-notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: var(--ux-z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ux-transition-base);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.ux-notif-overlay.ux-notif-show {
  opacity: 1;
  pointer-events: auto;
}

.ux-notif-card {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(160deg, #1a1620 0%, #12101a 100%);
  border: 1px solid rgba(232, 184, 74, 0.25);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 32px;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.ux-notif-overlay.ux-notif-show .ux-notif-card {
  transform: translateY(0);
}

.ux-notif-icon {
  font-size: 36px;
  margin-bottom: 12px;
  line-height: 1;
}

.ux-notif-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ux-primary-gold);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.ux-notif-body {
  font-size: 13px;
  color: var(--ux-text-secondary, #d4c9b0);
  line-height: 1.6;
  margin-bottom: 22px;
}

.ux-notif-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ux-notif-accept,
.ux-notif-decline {
  flex: 1;
  max-width: 160px;
  padding: 12px 16px;
  border-radius: var(--ux-radius-xl);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--ux-transition-fast), transform var(--ux-transition-fast);
  font-family: inherit;
  letter-spacing: 0.3px;
}
.ux-notif-accept:hover,
.ux-notif-decline:hover {
  opacity: 0.85;
}
.ux-notif-accept:active,
.ux-notif-decline:active {
  transform: scale(0.97);
}

.ux-notif-accept {
  background: linear-gradient(135deg, rgba(232, 184, 74, 0.9), rgba(200, 147, 42, 0.9));
  border: 1px solid rgba(232, 184, 74, 0.5);
  color: #1a1620;
}

.ux-notif-decline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ux-text-subtle, #8a7a5a);
}

/* Focus states */
.ux-notif-accept:focus-visible {
  outline: 3px solid var(--ux-primary-gold);
  outline-offset: 2px;
}
.ux-notif-decline:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.4);
  outline-offset: 2px;
}

/* Light theme */
html[data-theme="light"] .ux-notif-card {
  background: linear-gradient(160deg, #faf7ef 0%, #f0ead8 100%);
  border-color: rgba(139, 105, 20, 0.3);
}
html[data-theme="light"] .ux-notif-title {
  color: var(--ux-primary-gold-dark, #c8932a);
}
html[data-theme="light"] .ux-notif-body {
  color: #555;
}
html[data-theme="light"] .ux-notif-accept {
  background: linear-gradient(135deg, #c8932a, #a07020);
  border-color: #a07020;
  color: #fff;
}
html[data-theme="light"] .ux-notif-decline {
  border-color: rgba(0, 0, 0, 0.15);
  color: #888;
}

/* High-contrast theme */
html[data-theme="high-contrast"] .ux-notif-card {
  background: #000;
  border: 2px solid #fff;
}
html[data-theme="high-contrast"] .ux-notif-title {
  color: #ffdd00;
}
html[data-theme="high-contrast"] .ux-notif-body {
  color: #fff;
}
html[data-theme="high-contrast"] .ux-notif-accept {
  background: #ffdd00;
  border-color: #ffdd00;
  color: #000;
}
html[data-theme="high-contrast"] .ux-notif-decline {
  border-color: #fff;
  color: #fff;
}

/* RTL languages (ar, he, fa) */
[dir="rtl"] .ux-notif-actions {
  flex-direction: row-reverse;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ux-notif-overlay,
  .ux-notif-card {
    transition: none;
  }
}

/* ─── DAILY FORTUNE CARD ────────────────────────────────────────── */

.ux-fortune-wrap {
  margin: 0 0 24px;
}

.ux-fortune-card {
  background: linear-gradient(135deg, rgba(139,126,200,.10), rgba(232,160,192,.06));
  border: 1px solid rgba(168,155,212,.25);
  border-radius: 16px;
  padding: 18px 20px 14px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.ux-fortune-card:hover,
.ux-fortune-card:focus-visible {
  border-color: rgba(168,155,212,.5);
  box-shadow: 0 4px 20px rgba(139,126,200,.12);
}
.ux-fortune-card:focus-visible {
  outline: 2px solid var(--accent, #8b7ec8);
  outline-offset: 2px;
}

/* Header row */
.ux-fortune-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.ux-fortune-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ux-fortune-emoji {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.ux-fortune-sign-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ux-fortune-title {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted2, #8a82a8);
  font-weight: 700;
  text-transform: uppercase;
}
.ux-fortune-sign {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent2, #a89bd4);
  letter-spacing: .04em;
}
.ux-fortune-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.ux-fortune-stars {
  display: flex;
  gap: 3px;
}
.ux-fortune-star {
  font-size: 16px;
  color: rgba(168,155,212,.25);
  transition: color .2s;
}
.ux-fortune-star.on {
  color: #e8b84a;
  text-shadow: 0 0 6px rgba(232,184,74,.4);
}
.ux-fortune-date {
  font-size: 10px;
  color: var(--muted2, #8a82a8);
  letter-spacing: .5px;
}

/* Keywords */
.ux-fortune-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.ux-fortune-kw {
  display: inline-block;
  background: rgba(139,126,200,.12);
  border: 1px solid rgba(168,155,212,.2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--accent3, #c4b8e8);
  letter-spacing: .04em;
  font-weight: 500;
}

/* Hint text */
.ux-fortune-hint {
  font-size: 11px;
  color: var(--muted2, #8a82a8);
  letter-spacing: .5px;
  text-align: right;
}

/* Detail panel */
.ux-fortune-detail {
  border: 1px solid rgba(168,155,212,.18);
  border-top: none;
  border-radius: 0 0 16px 16px;
  background: rgba(22,19,41,.7);
  overflow: hidden;
}
.ux-fortune-detail.hidden {
  display: none;
}
.ux-fortune-detail-inner {
  padding: 16px 20px 14px;
}
.ux-fortune-detail-row {
  margin-bottom: 14px;
}
.ux-fortune-detail-row--inline {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.ux-fortune-detail-label {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted2, #8a82a8);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ux-fortune-detail-advice {
  font-size: 13px;
  color: var(--text, #f0eef8);
  line-height: 1.7;
  margin: 0;
  font-style: italic;
}
.ux-fortune-detail-item {
  display: flex;
  flex-direction: column;
  min-width: 100px;
}
.ux-fortune-detail-color {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text, #f0eef8);
}
.ux-fortune-color-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  flex-shrink: 0;
}
.ux-fortune-detail-number {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent2, #a89bd4);
  letter-spacing: .04em;
}
.ux-fortune-close {
  display: block;
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px solid rgba(168,155,212,.15);
  border-radius: 8px;
  color: var(--muted2, #8a82a8);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  font-family: inherit;
  margin-top: 4px;
}
.ux-fortune-close:hover {
  border-color: rgba(168,155,212,.35);
  color: var(--accent2, #a89bd4);
}

/* High-contrast overrides */
html[data-theme="high-contrast"] .ux-fortune-card {
  background: #000;
  border: 2px solid #fff;
}
html[data-theme="high-contrast"] .ux-fortune-card:hover,
html[data-theme="high-contrast"] .ux-fortune-card:focus-visible {
  border-color: #ffdd00;
  box-shadow: none;
}
html[data-theme="high-contrast"] .ux-fortune-title { color: #ccc; }
html[data-theme="high-contrast"] .ux-fortune-sign { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-fortune-star { color: #555; }
html[data-theme="high-contrast"] .ux-fortune-star.on { color: #ffdd00; text-shadow: none; }
html[data-theme="high-contrast"] .ux-fortune-kw {
  background: #000;
  border: 1.5px solid #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-fortune-detail {
  background: #000;
  border: 2px solid #fff;
  border-top: none;
}
html[data-theme="high-contrast"] .ux-fortune-detail-advice { color: #fff; }
html[data-theme="high-contrast"] .ux-fortune-detail-number { color: #ffdd00; }
html[data-theme="high-contrast"] .ux-fortune-close {
  border-color: #fff;
  color: #fff;
}
html[data-theme="high-contrast"] .ux-fortune-close:hover {
  border-color: #ffdd00;
  color: #ffdd00;
}

/* Responsive */
@media (max-width: 480px) {
  .ux-fortune-header { flex-wrap: wrap; }
  .ux-fortune-right { flex-direction: row; align-items: center; gap: 10px; }
  .ux-fortune-detail-row--inline { flex-direction: column; gap: 12px; }
}

/* ─── MOBILE UX FIXES (QA Round 2) ─── */
/**
 * iOS auto-zoom prevention: inputs must be >= 16px
 * Without this, iOS Safari zooms in when user focuses an input field
 * with font-size < 16px, which breaks the layout and is disorienting.
 * Note: Each page's inline <style> overrides this, so pages with
 * font-size < 16px on inputs are also fixed individually.
 */
input, select, textarea {
  font-size: 16px;
}

/**
 * Touch target minimum: 44px (WCAG 2.5.5 / Apple HIG)
 * Ensures gender selection buttons and share buttons are easily tappable.
 */
.gender-btn {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-section button {
  min-height: 44px;
}

/* ─── VIEW TRANSITIONS (Cross-Page Navigation) ─── */
/**
 * CSS View Transitions Level 2 — smooth cross-fade between pages.
 * @view-transition enables MPA (multi-page) transitions in Chrome 111+.
 * For unsupported browsers these rules are silently ignored.
 */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: ux-vt-fade-out 0.2s ease-out forwards;
}

::view-transition-new(root) {
  animation: ux-vt-fade-in 0.3s ease-in forwards;
}

@keyframes ux-vt-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes ux-vt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Disable View Transition animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* ─── WEB SHARE BUTTON ─── */
.ux-share-section {
  text-align: center;
  padding: 24px 16px 32px;
  margin-top: 16px;
}

.ux-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  min-width: 180px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent, #8b7ec8) 0%, var(--ux-accent-dark, #6a5acd) 100%);
  border: none;
  border-radius: 28px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 4px 16px rgba(139, 126, 200, 0.3);
  position: relative;
  overflow: hidden;
}

.ux-share-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s;
}

.ux-share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 126, 200, 0.45);
}

.ux-share-btn:hover::before {
  left: 100%;
}

.ux-share-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px rgba(139, 126, 200, 0.3);
}

.ux-share-btn:focus-visible {
  outline: 2px solid var(--accent, #8b7ec8);
  outline-offset: 3px;
}

.ux-share-btn-label {
  white-space: nowrap;
}

/* Light theme */
html[data-theme="light"] .ux-share-btn {
  background: linear-gradient(135deg, var(--accent, #6a5acd) 0%, var(--ux-accent-dark, #5548b0) 100%);
  box-shadow: 0 4px 16px rgba(106, 90, 205, 0.25);
}

html[data-theme="light"] .ux-share-btn:hover {
  box-shadow: 0 6px 24px rgba(106, 90, 205, 0.4);
}

/* High contrast theme */
html[data-theme="high-contrast"] .ux-share-btn {
  background: #fff;
  color: #000;
  border: 2px solid #fff;
  box-shadow: none;
}

html[data-theme="high-contrast"] .ux-share-btn:hover {
  background: #ffdd00;
  border-color: #ffdd00;
  color: #000;
  box-shadow: none;
}

html[data-theme="high-contrast"] .ux-share-btn:focus-visible {
  outline: 3px solid #ffdd00;
}

/* Print: hide share button */
@media print {
  .ux-share-section, .ux-share-btn {
    display: none !important;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ux-share-btn,
  .ux-share-btn::before {
    transition: none;
    animation: none;
  }

  .ux-share-btn:hover {
    transform: none;
  }
}
