/* LUMINA interface colors and shared components */

:root {
  /* LUMINA Win11 Blue Glass */
  --blue: #0078D4;
  --blue-hover: #1A88E0;
  --blue-active: #005A9E;
  --blue-glow: rgba(0,120,212,0.24);
  --blue-light: #E6F2FC;
  --blue-subtle: rgba(0,120,212,0.06);

  --green: #3FB950;
  --red: #F85149;
  --orange: #D29922;
  --yellow: #E3B341;
  --purple: #39C5CF;
  --teal: #39C5CF;
  --pink: #DB61A2;

  --bg-page: #0D1117;
  --bg-surface: #161B22;
  --bg-elevated: #21262D;
  --bg-tertiary: #30363D;
  --bg-glass: rgba(22,27,34,0.78);
  --bg-glass-hover: rgba(33,38,45,0.88);
  --bg-glass-active: rgba(48,54,61,0.92);
  --bg-glass-card: rgba(22,27,34,0.84);
  --bg-modal-overlay: rgba(1,4,9,0.72);
  --bg-input: rgba(13,17,23,0.76);
  --bg-input-focus: rgba(22,27,34,0.94);
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-tertiary: #6E7681;
  --border-subtle: rgba(240,246,252,0.06);
  --border-glass: rgba(240,246,252,0.10);
  --border-input: rgba(240,246,252,0.16);
  --separator: rgba(240,246,252,0.10);
  --glass-highlight: rgba(240,246,252,0.04);
  --glass-highlight-strong: rgba(240,246,252,0.08);
  --glass-edge-glow: rgba(240,246,252,0.05);
  --fill-tertiary: rgba(139,148,158,0.12);

  --shadow-01: 0 2px 4px rgba(0,0,0,0.20);
  --shadow-02: 0 4px 8px rgba(0,0,0,0.24);
  --shadow-03: 0 4px 12px rgba(0,0,0,0.28), 0 2px 4px rgba(0,0,0,0.16);
  --shadow-04: 0 6px 16px rgba(0,0,0,0.32), 0 2px 6px rgba(0,0,0,0.18);
  --shadow-05: 0 8px 24px rgba(0,0,0,0.36), 0 4px 8px rgba(0,0,0,0.20);
  --shadow-06: 0 12px 32px rgba(0,0,0,0.40), 0 4px 12px rgba(0,0,0,0.22);
  --shadow-07: 0 16px 40px rgba(0,0,0,0.44), 0 6px 16px rgba(0,0,0,0.24);
  --shadow-08: 0 20px 48px rgba(0,0,0,0.48), 0 8px 20px rgba(0,0,0,0.26);
  --shadow-09: 0 24px 56px rgba(0,0,0,0.52), 0 10px 24px rgba(0,0,0,0.28);
  --shadow-10: 0 28px 64px rgba(0,0,0,0.56), 0 12px 28px rgba(0,0,0,0.30);
  --shadow-14: 0 32px 80px rgba(0,0,0,0.60);
  --button-shadow: 0 1px 1px rgba(1,4,9,0.22), 0 2px 2px rgba(1,4,9,0.18), 0 3px 3px rgba(1,4,9,0.16), 0 4px 4px rgba(1,4,9,0.14), 0 5px 5px rgba(1,4,9,0.12), 0 6px 6px rgba(1,4,9,0.10), 0 7px 7px rgba(1,4,9,0.08), 0 8px 8px rgba(1,4,9,0.07), 0 9px 9px rgba(1,4,9,0.06), 0 10px 10px rgba(1,4,9,0.05), 0 11px 11px rgba(1,4,9,0.04), 0 12px 12px rgba(1,4,9,0.03), 0 13px 13px rgba(1,4,9,0.02), 0 14px 14px rgba(1,4,9,0.015);

  /* Motion */
  --apple-spring: cubic-bezier(0.25,0.46,0.45,0.94);
  --apple-spring-heavy: cubic-bezier(0.34,1.56,0.64,1);
  --apple-spring-bounce: cubic-bezier(0.18,0.89,0.32,1.28);
  --apple-ease-in: cubic-bezier(0.42,0,1,1);
  --apple-ease-out: cubic-bezier(0,0,0.58,1);
  --apple-ease-in-out: cubic-bezier(0.42,0,0.58,1);
  --apple-snap: cubic-bezier(0.22,1,0.36,1);

  --duration-instant: 50ms;
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-medium: 280ms;
  --duration-slow: 420ms;
  --duration-slower: 600ms;
  --duration-glacial: 800ms;

  --corner-radius-base: 12px;
  --radius-xs: calc(var(--corner-radius-base) * 0.5);
  --radius-sm: calc(var(--corner-radius-base) * 0.6667);
  --radius-md: var(--corner-radius-base);
  --radius-lg: calc(var(--corner-radius-base) * 1.3333);
  --radius-xl: calc(var(--corner-radius-base) * 1.6667);
  --radius-2xl: calc(var(--corner-radius-base) * 2);
  --radius-3xl: calc(var(--corner-radius-base) * 2.3333);
  --radius-4xl: calc(var(--corner-radius-base) * 3.3333);
  --nav-height: 64px;
  --glass-blur: 20px;
  --glass-saturate: 160%;
}
/* Shared light appearance, including native dropdown menus. */
:root { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --bg-page: #F5F7FA;
  --bg-surface: #FFFFFF;
  --bg-elevated: #EDF1F5;
  --bg-tertiary: #E3E8EF;
  --bg-glass: rgba(255,255,255,0.78);
  --bg-glass-hover: rgba(245,247,250,0.94);
  --bg-glass-active: rgba(237,241,245,0.96);
  --bg-glass-card: rgba(255,255,255,0.84);
  --bg-modal-overlay: rgba(26,28,35,0.28);
  --bg-input: rgba(255,255,255,0.9);
  --bg-input-focus: #FFFFFF;
  --text-primary: #1A1C23;
  --text-secondary: #5A6170;
  --text-tertiary: #646D7B;
  --border-subtle: rgba(26,28,35,0.10);
  --border-glass: rgba(26,28,35,0.14);
  --border-input: rgba(26,28,35,0.24);
  --separator: rgba(26,28,35,0.12);
  --shadow-04: 0 4px 8px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-06: 0 8px 20px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
  --shadow-14: 0 12px 32px rgba(0,0,0,0.14);
}
/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

a { color: var(--blue); text-decoration: none; transition: color var(--duration-fast) var(--apple-ease-out); }
a:hover { color: var(--blue-hover); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.20); }

/* ===== Page Background — clean LUMINA black ===== */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2;
  background: var(--bg-page);
}

body.has-wallpaper::before {
  background-image: var(--wallpaper);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* Shared panel */
.glass {
  position: relative;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-radius: var(--radius-xl);
  border: 0.5px solid var(--border-glass);
  box-shadow: var(--shadow-04);
  transition:
    transform var(--duration-medium) var(--apple-spring-heavy),
    box-shadow var(--duration-medium) var(--apple-spring),
    background var(--duration-normal) var(--apple-ease-out);
}

/* Subtle top highlight — LUMINA-like light refraction */
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.04) 0%,
    transparent 40%);
}

.glass::after { display: none; }

.glass:hover {
  background: var(--bg-glass-hover);
  box-shadow: var(--shadow-06);
  transform: translateY(-2px);
}

.glass:active {
  background: var(--bg-glass-active);
  box-shadow: var(--shadow-02);
  transform: translateY(0) scale(0.98);
  transition: all var(--duration-instant) var(--apple-spring-heavy);
}

/* ===== LUMINA Frosted Card ===== */
.card-glass {
  position: relative;
  background: var(--bg-surface);
  border-radius: calc(var(--corner-radius-base) * 1.8333);
  border: 1px solid var(--border-glass);
  padding: 28px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.14);
  transition:
    background var(--duration-normal) var(--apple-ease-out),
    border-color var(--duration-normal) var(--apple-ease-out);
  overflow: hidden;
}

/* LUMINA-style card inner glow */
.card-glass::before {
  content: none;
}

.card-glass:hover {
  background: var(--bg-elevated);
  border-color: var(--border-input);
}

.card-glass > * { position: relative; z-index: 2; }

/* ============================================================
   SURFACE TENSION — Clean spacing (LUMINA-style)
   ============================================================ */
.glass-stack {
  display: flex; flex-direction: column;
}
.glass-stack > * + * { margin-top: 16px; }

/* ============================================================
   BUTTONS — LUMINA frosted glass spring-press
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px; font-size: 0.9375rem; font-weight: 500; font-family: inherit;
  border: none; border-radius: calc(var(--corner-radius-base) * 0.8333); cursor: pointer; user-select: none;
  white-space: nowrap; position: relative; overflow: hidden; outline: none;
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, color var(--duration-fast) ease;
  letter-spacing: -0.01em;
}

.btn:focus-visible {
  box-shadow: 0 0 0 4px var(--blue-glow);
}

/* Primary action */
.btn-primary {
  background: var(--blue);
  color: #ffffff;
  border: 1px solid var(--blue);
}
.btn-primary:hover {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
}
.btn-primary:active {
  background: var(--blue-active);
}

/* Secondary */
.btn-secondary {
  background: rgba(0,120,212,0.10);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  color: var(--blue);
  border: 0.5px solid rgba(0,120,212,0.20);
  box-shadow: var(--button-shadow), inset 0 1px 0 rgba(255,255,255,0.04);
}
.btn-secondary:hover {
  background: rgba(0,120,212,0.16);
  border-color: rgba(0,120,212,0.30);
  transform: translateY(-1px);
}
.btn-secondary:active {
  background: rgba(0,120,212,0.24);
  transform: scale(0.96);
  transition: all var(--duration-instant) var(--apple-spring-heavy);
}

/* Glass button — Deep frosted glass */
.btn-glass {
  background: var(--bg-elevated);
  border: 1px solid var(--border-input);
  color: var(--text-primary);
  border-radius: calc(var(--corner-radius-base) * 0.8333);
}
.btn-glass:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-tertiary);
}
.btn-glass:active {
  background: var(--bg-surface);
}

/* Danger — Frosted red */
.btn-danger {
  background: rgba(255,59,48,0.12);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  color: var(--red);
  border: 0.5px solid rgba(255,59,48,0.20);
  box-shadow: var(--button-shadow), inset 0 1px 0 rgba(255,255,255,0.04);
}
.btn-danger:hover {
  background: rgba(255,59,48,0.20);
  border-color: rgba(255,59,48,0.30);
  transform: translateY(-1px);
}
.btn-danger:active {
  background: rgba(255,59,48,0.30);
  transform: scale(0.96);
  transition: all var(--duration-instant) var(--apple-spring-heavy);
}

.btn-sm { padding: 6px 16px; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 36px; font-size: 1.0625rem; border-radius: var(--radius-md); }
.btn.btn-icon { width: 38px; height: 38px; padding: 0; flex-shrink: 0; border-radius: 50%; }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-icon.btn-lg { width: 46px; height: 46px; }

/* ===== Input Fields — LUMINA frosted glass rounded rectangles ===== */
.input {
  width: 100%; padding: 12px 16px; font-size: 0.9375rem; font-family: inherit;
  color: var(--text-primary);
  background: rgba(139,148,158,0.12);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 0.5px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md); outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 1px 3px rgba(0,0,0,0.08);
  transition: all var(--duration-normal) var(--apple-spring);
  letter-spacing: -0.01em;
}
.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-glow), inset 0 1px 0 rgba(255,255,255,0.06);
  background: rgba(139,148,158,0.18);
}
.input::placeholder { color: var(--text-tertiary); }

.input-glass {
  background: rgba(139,148,158,0.10);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid rgba(255,255,255,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 1px 4px rgba(0,0,0,0.10);
}
.input-glass:focus {
  background: rgba(139,148,158,0.16);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-glow), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Remove jelly animation on inputs, use LUMINA spring */
@keyframes inputJellyIn {
  0% { transform: scale(1); }
  50% { transform: scale(1.008); }
  100% { transform: scale(1); }
}

.textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* ============================================================
   APPLE SPRING ANIMATIONS
   ============================================================ */
@keyframes appleBounceIn {
  0% { opacity: 0; transform: scale(0.92); }
  60% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes appleSpringUp {
  0% { opacity: 0; transform: translateY(24px); }
  70% { opacity: 1; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes appleScalePress {
  0% { transform: scale(1); }
  50% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

@keyframes appleFadeScale {
  0% { opacity: 0; transform: translateY(20px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes jellyBounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.04); }
  50% { transform: scale(0.98); }
  75% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes jellyPress {
  0% { transform: scale(1); }
  40% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes jellyPop {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-page);
}

/* ============================================================
   ENTRY ANIMATION — LUMINA-style logo reveal
   ============================================================ */
.entry-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  background: #0D1117;
  pointer-events: none;
}

.entry-name {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  color: #ffffff;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  animation: appleEntryReveal 1.8s var(--apple-snap) forwards;
}

.entry-glow {
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,120,212,0.12) 0%, transparent 70%);
  animation: appleEntryGlow 1.8s var(--apple-ease-out) forwards;
}

@keyframes appleEntryReveal {
  0% { opacity: 0; transform: translateY(30px) scale(0.90); filter: blur(10px); }
  35% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  75% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-15px) scale(1.02); filter: blur(6px); }
}

@keyframes appleEntryGlow {
  0% { transform: scale(0.2); opacity: 0; }
  30% { transform: scale(1); opacity: 0.6; }
  60% { transform: scale(0.8); opacity: 0.3; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ============================================================
   MODAL SYSTEM — LUMINA sheet style
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 11000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-modal-overlay);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-medium) var(--apple-ease-out);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid var(--border-glass);
  border-radius: var(--radius-2xl); padding: 32px;
  width: 90%; max-width: 480px; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-14);
  transform: translateY(30px) scale(0.94);
  transition: transform var(--duration-medium) var(--apple-spring-heavy);
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
  animation: appleBounceIn 0.5s var(--apple-spring-heavy);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; }

/* ============================================================
   TOAST — LUMINA notification banner
   ============================================================ */
.toast-container {
  position: fixed; top: 80px; right: 24px; z-index: 12000;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: rgba(22,27,34,0.70);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg); padding: 14px 20px;
  font-size: 0.875rem; color: var(--text-primary);
  box-shadow: var(--shadow-06);
  animation: appleToastIn 0.5s var(--apple-spring-heavy);
  max-width: 380px; display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.01em;
}
.toast.success { border-left: 3px solid var(--green); }
.friend-presence { display: block; color: var(--text-secondary); line-height: 1.5; font-weight: 400; }
.friend-presence.is-online { color: var(--green); }
[data-theme="light"] .friend-presence.is-online { color: #1A7F37; }
.friend-presence[hidden] { display: none; }
#nav-game-invites { position: relative; flex: 0 0 auto; min-width: 36px; min-height: 36px; }
#nav-game-invite-count { position: absolute; right: -4px; top: -4px; min-width: 17px; padding: 1px 4px; border-radius: var(--radius-full); background: var(--blue); color: white; font-size: 10px; line-height: 15px; }
.game-invite-overlay { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; padding: 20px; background: var(--bg-modal-overlay); }
.game-invite-panel { width: 100%; max-width: 480px; max-height: calc(100dvh - 40px); overflow-y: auto; padding: 24px; background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); box-shadow: var(--shadow-04); }
.game-invite-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.game-invite-heading h2 { font-size: 1.15rem; }
.game-invite-person { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.game-invite-avatar { width: 36px; height: 36px; flex: 0 0 auto; object-fit: cover; border-radius: var(--radius-full); }
.game-invite-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.game-invite-row + .game-invite-row { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.game-invite-error { color: var(--red); margin-top: 12px; font-size: .85rem; }
@media (max-width: 480px) { .game-invite-overlay { padding: 12px; } .game-invite-panel { padding: 20px; max-height: calc(100dvh - 24px); } .game-invite-actions .btn { min-height: 42px; } }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }

@keyframes appleToastIn {
  0% { opacity: 0; transform: translateX(50px) scale(0.9); }
  60% { opacity: 1; transform: translateX(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* ============================================================
   ANIMATIONS — LUMINA scroll-reveal style
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* LUMINA-style reveal on scroll */
.animate-in { animation: appleSpringUp 0.6s var(--apple-snap) forwards; opacity: 0; }

/* Staggered reveal */
.stagger > * { opacity: 0; }
.stagger > *:nth-child(1) { animation: appleSpringUp 0.5s var(--apple-snap) 0.05s forwards; }
.stagger > *:nth-child(2) { animation: appleSpringUp 0.5s var(--apple-snap) 0.10s forwards; }
.stagger > *:nth-child(3) { animation: appleSpringUp 0.5s var(--apple-snap) 0.15s forwards; }
.stagger > *:nth-child(4) { animation: appleSpringUp 0.5s var(--apple-snap) 0.20s forwards; }
.stagger > *:nth-child(5) { animation: appleSpringUp 0.5s var(--apple-snap) 0.25s forwards; }
.stagger > *:nth-child(6) { animation: appleSpringUp 0.5s var(--apple-snap) 0.30s forwards; }
.stagger > *:nth-child(n+7) { animation: appleSpringUp 0.5s var(--apple-snap) 0.35s forwards; }

/* LUMINA intersection-observer driven reveal class */
.apple-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--apple-snap), transform 0.6s var(--apple-snap);
}
.apple-reveal.apple-visible {
  opacity: 1;
  transform: translateY(0);
}

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm);
}

/* ===== Utility ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }

/* ===== Form Group (LUMINA style) ===== */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

/* ===== Announcement overlay ===== */
#ann-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center; justify-content: center;
}
#ann-overlay.active { display: flex; }
#ann-content {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  padding: 32px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-14);
}

/* Message badge */
#msg-badge { pointer-events: none; }

/* ===== Chat limit banner ===== */
.chat-limit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin: 0;
  background: rgba(255,149,0,0.08);
  border-bottom: 0.5px solid rgba(255,149,0,0.20);
  flex-wrap: wrap;
}
.chat-limit-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--orange);
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}
.chat-limit-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Avoid leaving content hidden if reveal behavior is not active. */
.apple-reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
