/**
 * MASTER CODEX FINANCIAL - CSS Layer
 * Marlowe Partners / MK Time Travel
 * 140 Micro-Interactions for High-End Financial UX
 * 
 * Mobile-First (iPhone/Safari Focus)
 * All classes namespaced with .cdx-
 */

/* ==========================================================================
   PART 0: BASE RESETS & MOBILE CONSTRAINTS
   ========================================================================== */

/* iOS Safari tap highlight removal */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Force pointer cursor on all interactive elements (iOS requirement) */
button, 
a, 
[role="button"], 
.cdx-interactive,
input[type="submit"],
input[type="button"],
select {
  cursor: pointer;
}

/* Prevent double-tap zoom delay on iOS */
html {
  touch-action: manipulation;
}

/* Safe area handling for iPhone notch/home bar */
.cdx-safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.cdx-safe-top {
  padding-top: env(safe-area-inset-top, 0px);
}

/* ==========================================================================
   PART 1: EFFICIENCY LAYER - CSS Components (1-50)
   ========================================================================== */

/* #2 Quick Actions FAB */
.cdx-fab {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 20px rgba(255, 107, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483640;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cdx-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(255, 107, 0, 0.5);
}

.cdx-fab:active {
  transform: scale(0.95);
}

/* #3 Command Palette Modal */
.cdx-command-palette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 2147483647;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cdx-command-palette.cdx-active {
  opacity: 1;
  visibility: visible;
}

.cdx-command-palette-inner {
  width: 90%;
  max-width: 600px;
  background: var(--cdx-bg, #1a1a1a);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

.cdx-command-palette.cdx-active .cdx-command-palette-inner {
  transform: translateY(0);
}

.cdx-command-input {
  width: 100%;
  padding: 20px 24px;
  font-size: 18px;
  border: none;
  background: transparent;
  color: var(--cdx-text, #fff);
  outline: none;
}

.cdx-command-input::placeholder {
  color: var(--cdx-muted, #666);
}

.cdx-command-results {
  max-height: 400px;
  overflow-y: auto;
  border-top: 1px solid var(--cdx-border, #333);
}

.cdx-command-item {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cdx-command-item:hover,
.cdx-command-item.cdx-selected {
  background: var(--cdx-hover, #2a2a2a);
}

.cdx-command-item-icon {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.cdx-command-item-text {
  flex: 1;
  color: var(--cdx-text, #fff);
}

.cdx-command-item-shortcut {
  font-size: 12px;
  color: var(--cdx-muted, #666);
  background: var(--cdx-subtle, #222);
  padding: 4px 8px;
  border-radius: 4px;
}

/* #6 Theme Switcher */
.cdx-theme-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--cdx-subtle, #222);
  border-radius: 8px;
}

.cdx-theme-btn {
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--cdx-muted, #666);
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.2s ease;
}

.cdx-theme-btn.cdx-active {
  background: var(--cdx-accent, #ff6b00);
  color: white;
}

/* #10 Toast System */
.cdx-toast-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483646;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.cdx-toast {
  background: var(--cdx-bg, #1a1a1a);
  color: var(--cdx-text, #fff);
  padding: 14px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  animation: cdx-toast-in 0.3s ease forwards;
  pointer-events: auto;
  max-width: 90vw;
}

.cdx-toast.cdx-toast-success {
  border-left: 4px solid #00ff88;
}

.cdx-toast.cdx-toast-error {
  border-left: 4px solid #ff4444;
}

.cdx-toast.cdx-toast-info {
  border-left: 4px solid #ff6b00;
}

.cdx-toast.cdx-toast-out {
  animation: cdx-toast-out 0.3s ease forwards;
}

@keyframes cdx-toast-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cdx-toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* #12 Greeter */
.cdx-greeter {
  font-size: 14px;
  color: var(--cdx-muted, #888);
  margin-bottom: 8px;
}

/* #22 Zen Mode */
.cdx-zen-mode .cdx-hide-in-zen,
.cdx-zen-mode nav,
.cdx-zen-mode aside,
.cdx-zen-mode footer:not(.cdx-keep-in-zen),
.cdx-zen-mode header:not(.cdx-keep-in-zen) {
  display: none !important;
}

.cdx-zen-mode main,
.cdx-zen-mode article {
  max-width: 75ch;
  margin: 0 auto;
  padding: 40px 20px;
}

/* #23 Read Time */
.cdx-read-time {
  font-size: 13px;
  color: var(--cdx-muted, #888);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cdx-read-time::before {
  content: "⏱";
}

/* #24 Copy Code Button */
.cdx-code-wrapper {
  position: relative;
}

.cdx-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 12px;
  font-size: 12px;
  background: var(--cdx-subtle, #333);
  color: var(--cdx-text, #fff);
  border: none;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cdx-code-wrapper:hover .cdx-copy-btn {
  opacity: 1;
}

.cdx-copy-btn:hover {
  background: var(--cdx-accent, #ff6b00);
}

/* #31 Night Shift */
.cdx-night-shift {
  filter: sepia(20%) brightness(95%);
}

/* #32 Pulse Loader */
.cdx-pulse {
  animation: cdx-pulse 1.5s ease-in-out infinite;
}

@keyframes cdx-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* #33 Skeleton UI */
.cdx-skeleton {
  background: linear-gradient(
    90deg,
    var(--cdx-subtle, #222) 25%,
    var(--cdx-hover, #333) 50%,
    var(--cdx-subtle, #222) 75%
  );
  background-size: 200% 100%;
  animation: cdx-skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes cdx-skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* #42 Print Styles */
@media print {
  .cdx-no-print,
  nav,
  .cdx-fab,
  .cdx-toast-container,
  .cdx-command-palette,
  footer {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
  
  a {
    text-decoration: underline;
    color: #000;
  }
}

/* #45 Confetti Canvas */
.cdx-confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2147483645;
}

/* ==========================================================================
   PART 2: POLISH LAYER - UI/UX Detail (51-100)
   ========================================================================== */

/* #51 Hover Lift */
.cdx-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cdx-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* #52 Active Press */
.cdx-press:active {
  transform: scale(0.98);
}

/* #53 Focus Glow */
.cdx-focus-glow:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.25);
}

/* #54 Skeleton Animation - Already defined above */

/* #55 Menu Slide */
.cdx-menu-slide {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.cdx-menu-slide.cdx-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* #57 Link Fade */
.cdx-link-fade {
  transition: color 0.2s ease, opacity 0.2s ease;
}

.cdx-link-fade:hover {
  opacity: 0.8;
}

/* #58 Sticky Header */
.cdx-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: inherit;
}

/* #59 Toast Pop - Already defined above */

/* #60 Progress Bar */
.cdx-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff6b00, #ff8c00);
  z-index: 2147483644;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
}

/* #61-63 Typography */
.cdx-typography {
  line-height: 1.6;
}

.cdx-max-width {
  max-width: 75ch;
}

.cdx-h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; }
.cdx-h2 { font-size: 2rem; font-weight: 600; line-height: 1.3; }
.cdx-h3 { font-size: 1.75rem; font-weight: 600; line-height: 1.4; }
.cdx-h4 { font-size: 1.5rem; font-weight: 500; line-height: 1.4; }

/* #64 Contrast */
.cdx-high-contrast {
  color: #222;
  background: #fff;
}

/* #65 System Fonts */
.cdx-system-font {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}

/* #68 Link Style */
.cdx-link {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}

.cdx-link:hover {
  text-decoration-color: var(--cdx-accent, #ff6b00);
}

/* #69 Whitespace Utilities */
.cdx-mb-1 { margin-bottom: 0.25rem; }
.cdx-mb-2 { margin-bottom: 0.5rem; }
.cdx-mb-3 { margin-bottom: 1rem; }
.cdx-mb-4 { margin-bottom: 1.5rem; }
.cdx-mb-5 { margin-bottom: 2rem; }

.cdx-mt-1 { margin-top: 0.25rem; }
.cdx-mt-2 { margin-top: 0.5rem; }
.cdx-mt-3 { margin-top: 1rem; }
.cdx-mt-4 { margin-top: 1.5rem; }
.cdx-mt-5 { margin-top: 2rem; }

/* #76 Error Text */
.cdx-error-text {
  color: #ff4444;
  font-size: 12px;
  margin-top: 4px;
}

/* #77 Button Primary */
.cdx-btn-primary {
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.cdx-btn-primary:hover {
  background: linear-gradient(135deg, #333 0%, #444 100%);
  transform: translateY(-1px);
}

/* #78 Touch Target */
.cdx-touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* #79 Label Float */
.cdx-float-label {
  position: relative;
}

.cdx-float-label input,
.cdx-float-label textarea {
  padding-top: 20px;
}

.cdx-float-label label {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--cdx-muted, #888);
  transition: all 0.2s ease;
  pointer-events: none;
}

.cdx-float-label input:focus + label,
.cdx-float-label input:not(:placeholder-shown) + label,
.cdx-float-label textarea:focus + label,
.cdx-float-label textarea:not(:placeholder-shown) + label {
  top: 8px;
  font-size: 11px;
  color: var(--cdx-accent, #ff6b00);
}

/* #80 Breadcrumbs */
.cdx-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--cdx-muted, #888);
}

.cdx-breadcrumbs a {
  color: var(--cdx-muted, #888);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cdx-breadcrumbs a:hover {
  color: var(--cdx-accent, #ff6b00);
}

.cdx-breadcrumbs span {
  opacity: 0.5;
}

/* #82 Visited Links */
.cdx-visited:visited {
  opacity: 0.7;
}

/* #83 Empty State */
.cdx-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--cdx-muted, #888);
}

.cdx-empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  opacity: 0.3;
}

.cdx-empty-state-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--cdx-text, #fff);
}

.cdx-empty-state-text {
  font-size: 14px;
  max-width: 300px;
  margin: 0 auto;
}

/* #86 Back to Top */
.cdx-back-top {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cdx-subtle, #222);
  color: var(--cdx-text, #fff);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 2147483640;
}

.cdx-back-top.cdx-visible {
  opacity: 1;
  visibility: visible;
}

.cdx-back-top:hover {
  background: var(--cdx-accent, #ff6b00);
  transform: translateY(-2px);
}

/* #89 Modal Close on Backdrop */
.cdx-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2147483646;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.cdx-modal-backdrop.cdx-active {
  opacity: 1;
  visibility: visible;
}

.cdx-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--cdx-bg, #1a1a1a);
  border-radius: 16px;
  padding: 24px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 2147483647;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.cdx-modal.cdx-active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* #91 Lazy Load Blur-up */
.cdx-lazy {
  filter: blur(10px);
  transition: filter 0.3s ease;
}

.cdx-lazy.cdx-loaded {
  filter: blur(0);
}

/* #92 Image Aspect Ratio */
.cdx-aspect-16-9 {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.cdx-aspect-4-3 {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.cdx-aspect-1-1 {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* #93 Alt Warning (Dev Mode) */
.cdx-dev-mode img:not([alt]),
.cdx-dev-mode img[alt=""] {
  outline: 3px solid #ff4444 !important;
}

/* #94 Tablet Media Queries */
@media (min-width: 768px) {
  .cdx-hide-tablet { display: none; }
  .cdx-show-tablet { display: block; }
}

@media (max-width: 767px) {
  .cdx-hide-mobile { display: none; }
  .cdx-show-mobile { display: block; }
}

/* #97 External Link Icon */
.cdx-external-link::after {
  content: " ↗";
  font-size: 0.8em;
  opacity: 0.6;
}

/* #100 Selection Color */
::selection {
  background: rgba(255, 107, 0, 0.3);
  color: inherit;
}

::-moz-selection {
  background: rgba(255, 107, 0, 0.3);
  color: inherit;
}

/* ==========================================================================
   PART 3: ANTICIPATORY LAYER (101-120)
   ========================================================================== */

/* #102 Trajectory Glow */
.cdx-trajectory-glow {
  transition: box-shadow 0.1s ease;
}

.cdx-trajectory-glow.cdx-approaching {
  box-shadow: 0 0 20px rgba(255, 107, 0, 0.4);
}

/* #103 Magnet Cursor */
.cdx-magnet {
  transition: transform 0.1s ease;
}

/* #107 Focus Tunnel */
.cdx-focus-tunnel *:not(:focus):not(:focus-within) {
  opacity: 0.3;
}

.cdx-focus-tunnel *:focus,
.cdx-focus-tunnel *:focus-within {
  opacity: 1;
}

/* #108 Rage Click */
.cdx-rage-detected {
  animation: cdx-rage-shake 0.3s ease;
}

@keyframes cdx-rage-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* #110 Density Mode */
.cdx-density-compact {
  --cdx-spacer: 0.5rem;
}

.cdx-density-compact .cdx-card {
  padding: var(--cdx-spacer);
}

/* #111 Patina Effect */
.cdx-patina-1 { filter: brightness(0.98); }
.cdx-patina-2 { filter: brightness(0.96); }
.cdx-patina-3 { filter: brightness(0.94); }
.cdx-patina-4 { filter: brightness(0.92); }
.cdx-patina-5 { filter: brightness(0.90); }

/* #113 Wait Cursor */
.cdx-waiting {
  cursor: progress !important;
}

.cdx-waiting * {
  cursor: progress !important;
}

/* #116 Link Peek */
.cdx-link-peek {
  position: absolute;
  width: 300px;
  height: 200px;
  border: 1px solid var(--cdx-border, #333);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 2147483643;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
}

.cdx-link-peek.cdx-visible {
  opacity: 1;
  visibility: visible;
}

/* #117 Changelog Badge */
.cdx-new-badge {
  position: relative;
}

.cdx-new-badge::after {
  content: "NEW";
  position: absolute;
  top: -8px;
  right: -8px;
  background: #00ff88;
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   PART 4: PSYCHOLOGICAL CODEX - The Marlowe Features (121-140)
   ========================================================================== */

/* #121 Reverse Download */
.cdx-download-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2147483647;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cdx-download-overlay.cdx-active {
  opacity: 1;
  visibility: visible;
}

.cdx-download-progress {
  width: 200px;
  height: 4px;
  background: var(--cdx-subtle, #333);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}

.cdx-download-progress-bar {
  height: 100%;
  background: var(--cdx-accent, #ff6b00);
  width: 0;
  transition: width 0.1s linear;
}

/* #122 Welcome Prime Modal */
.cdx-welcome-modal {
  text-align: center;
  max-width: 400px;
}

.cdx-welcome-modal-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cdx-welcome-modal-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.cdx-welcome-modal-text {
  color: var(--cdx-muted, #888);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* #123 Exit Value Overlay */
.cdx-exit-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 2147483647;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cdx-exit-overlay.cdx-active {
  opacity: 1;
  visibility: visible;
}

/* #124 Identity Toggle */
.cdx-identity-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--cdx-subtle, #222);
  border-radius: 8px;
}

.cdx-identity-toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--cdx-border, #333);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cdx-identity-toggle-switch.cdx-active {
  background: var(--cdx-accent, #ff6b00);
}

.cdx-identity-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.cdx-identity-toggle-switch.cdx-active::after {
  transform: translateX(20px);
}

/* Blur noise elements when identity toggle is active */
.cdx-long-duration-view .cdx-noise {
  filter: blur(4px);
  opacity: 0.5;
}

/* #125 Manifesto Gate */
.cdx-manifesto-gate {
  padding: 24px;
  background: var(--cdx-subtle, #222);
  border-radius: 12px;
  text-align: center;
}

.cdx-manifesto-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.cdx-manifesto-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--cdx-accent, #ff6b00);
}

.cdx-gated-content {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.3s ease;
}

.cdx-gated-content.cdx-unlocked {
  filter: blur(0);
  pointer-events: auto;
  user-select: auto;
}

/* #128 Silent Badge */
.cdx-silent-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 107, 0, 0.1);
  border: 1px solid rgba(255, 107, 0, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--cdx-accent, #ff6b00);
}

.cdx-silent-badge::before {
  content: "★";
}

/* #129 Peer Notes */
.cdx-peer-notes {
  font-family: "Caveat", cursive, -apple-system, sans-serif;
  color: #ff6b00;
  font-size: 14px;
  transform: rotate(-2deg);
  margin-left: 20px;
  opacity: 0.8;
}

/* #131 Quiet Room */
.cdx-quiet-room {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f5f0e8;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 2147483647;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
}

.cdx-quiet-room.cdx-active {
  opacity: 1;
  visibility: visible;
}

.cdx-quiet-room-content {
  max-width: 600px;
  text-align: center;
  font-size: 18px;
  line-height: 1.8;
}

.cdx-quiet-room-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
}

/* Quiet Mode - Hide distracting elements */
body.cdx-quiet-mode .cdx-activity-ticker,
body.cdx-quiet-mode .cdx-featured-window,
body.cdx-quiet-mode .cdx-social-proof,
body.cdx-quiet-mode .cdx-fab,
body.cdx-quiet-mode .cdx-back-top,
body.cdx-quiet-mode .cdx-progress-bar,
body.cdx-quiet-mode .cdx-privacy-banner,
body.cdx-quiet-mode [data-quiet-hide],
body.cdx-quiet-mode .live-activity-ticker,
body.cdx-quiet-mode .featured-window-banner,
body.cdx-quiet-mode .social-share-buttons,
body.cdx-quiet-mode .archetype-suggestions {
  display: none !important;
}

body.cdx-quiet-mode {
  --cdx-bg: #f5f0e8;
  --cdx-text: #333;
}

.cdx-theme-dark body.cdx-quiet-mode {
  --cdx-bg: #1a1a1a;
  --cdx-text: #e0e0e0;
}

/* #132 Disqualify Warning */
.cdx-disqualify {
  padding: 20px;
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.3);
  border-radius: 8px;
  margin-bottom: 20px;
}

.cdx-disqualify-title {
  font-weight: 600;
  color: #ff4444;
  margin-bottom: 8px;
}

.cdx-disqualify-text {
  font-size: 14px;
  color: var(--cdx-muted, #888);
}

/* #133 Dated Window */
.cdx-dated-window {
  padding: 40px;
  text-align: center;
  background: var(--cdx-subtle, #222);
  border-radius: 12px;
}

.cdx-dated-window-closed {
  font-size: 24px;
  font-weight: 700;
  color: var(--cdx-muted, #666);
  margin-bottom: 12px;
}

/* #134 Underwriting Mode */
.cdx-underwriting-mode table,
.cdx-underwriting-mode .highcharts-container,
.cdx-underwriting-mode .recharts-wrapper,
.cdx-underwriting-mode svg:not(.cdx-icon) {
  filter: grayscale(100%);
  font-family: "IBM Plex Mono", "Courier New", monospace;
}

/* #135 Legacy Font */
.cdx-legacy-font {
  font-family: "Crimson Text", "Times New Roman", serif;
}

/* #137 Privacy Banner */
.cdx-privacy-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cdx-subtle, #222);
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 13px;
  color: var(--cdx-muted, #888);
  z-index: 2147483640;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.cdx-privacy-banner.cdx-visible {
  transform: translateY(0);
}

.cdx-privacy-banner strong {
  color: var(--cdx-text, #fff);
}

/* #138 Pacing Tooltip */
.cdx-pacing-tooltip {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cdx-bg, #1a1a1a);
  color: var(--cdx-text, #fff);
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 2147483645;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cdx-pacing-tooltip.cdx-visible {
  opacity: 1;
  visibility: visible;
}

/* #139 Smart 404 */
.cdx-smart-404 {
  text-align: center;
  padding: 80px 20px;
}

.cdx-smart-404-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
}

.cdx-smart-404-text {
  font-size: 18px;
  color: var(--cdx-muted, #888);
  margin-bottom: 8px;
}

.cdx-smart-404-apology {
  font-style: italic;
  color: var(--cdx-accent, #ff6b00);
}

/* #140 Patient Tag */
.cdx-patient-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: #00ff88;
}

/* ==========================================================================
   CSS VARIABLES - Theme Support
   ========================================================================== */

:root {
  --cdx-bg: #0a0a0a;
  --cdx-text: #ffffff;
  --cdx-muted: #888888;
  --cdx-subtle: #1a1a1a;
  --cdx-hover: #2a2a2a;
  --cdx-border: #333333;
  --cdx-accent: #ff6b00;
  --cdx-success: #00ff88;
  --cdx-error: #ff4444;
  --cdx-spacer: 1rem;
}

.cdx-theme-light {
  --cdx-bg: #ffffff;
  --cdx-text: #1a1a1a;
  --cdx-muted: #666666;
  --cdx-subtle: #f5f5f5;
  --cdx-hover: #eeeeee;
  --cdx-border: #dddddd;
}

/* ==========================================================================
   NEON GREEN HOVER STATE (User Preference)
   ========================================================================== */

.cdx-neon-hover:hover {
  background: #00ff00 !important;
  color: #000 !important;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

/* ==========================================================================
   CIRCADIAN BACKGROUND WARMTH
   ========================================================================== */

.cdx-circadian-morning {
  filter: brightness(1.02) saturate(1.05);
}

.cdx-circadian-afternoon {
  filter: brightness(1) saturate(1);
}

.cdx-circadian-evening {
  filter: brightness(0.98) sepia(0.05);
}

.cdx-circadian-night {
  filter: brightness(0.95) sepia(0.1);
}
