/* styles.css — Harmonic Breath PWA
 * 19 July 2026 · Harmonia · Codex Universalis
 * Dark theme: background #0a0a0f
 * Layout: CymaScope + 24-Gon centered, frequency display, breath phase,
 * progress bar, play button, volume slider, band selector
 */

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #1a1a26;
  --text: #e8e8f0;
  --text-dim: #a0a0b8;
  --text-faint: #9a9ab2;
  --accent: #ffc857;
  --accent-blue: #7cb7ff;
  --accent-teal: #5cd1c0;
  --accent-purple: #b76cff;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overscroll-behavior: none;
}

/* ── App Container ───────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: var(--safe-top) 0 var(--safe-bottom);
  position: relative;
  overflow: hidden;
}

/* ── Top Bar ─────────────────────────────────── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.icon-button.active {
  background: var(--accent-blue);
  color: var(--bg);
}

/* ── Visual Area ──────────────────────────────── */
.visual-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

.canvas-stack {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 500px;
  max-height: 500px;
  margin: 0 auto;
}

.canvas-stack canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
}

#bg-pattern-canvas {
  z-index: 0;
}

#cymascope-canvas {
  z-index: 1;
}

#gon-canvas {
  z-index: 2;
}

/* ── Frequency Display ───────────────────────── */
.frequency-display {
  text-align: center;
  padding: 4px 0;
  flex-shrink: 0;
}

.frequency-value {
  font-size: 36px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.frequency-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  letter-spacing: 0.5px;
}

/* ── Breath Phase Display ─────────────────────── */
.breath-phase-display {
  text-align: center;
  padding: 4px 0 2px;
  flex-shrink: 0;
  transition: opacity 0.3s;
}

.breath-phase-display.inhale { color: rgba(255, 255, 255, 0.95); }
.breath-phase-display.holdIn { color: rgba(255, 255, 255, 0.5); }
.breath-phase-display.exhale { color: rgba(255, 255, 255, 0.7); }
.breath-phase-display.holdOut { color: rgba(255, 255, 255, 0.55); }

.breath-phase-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.breath-phase-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.breath-phase-text {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.breath-sequence-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.breath-intention {
  font-style: italic;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  max-width: 320px;
  margin: 4px auto 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.breath-intensity {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 2px;
}

.cycle-counter {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 2px;
  display: none;
}

/* ── Progress Bar ────────────────────────────── */
.progress-bar-container {
  width: calc(100% - 48px);
  max-width: 400px;
  margin: 6px auto;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-blue);
  border-radius: 2px;
  transition: background-color 0.5s;
}

/* ── Controls ────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 0;
  flex-shrink: 0;
}

.play-button {
  width: 140px;
  height: 48px;
  border: 2px solid var(--accent-blue);
  background: rgba(124, 183, 255, 0.1);
  color: var(--accent-blue);
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
  font-family: inherit;
  letter-spacing: 1px;
}

.play-button:hover {
  background: rgba(124, 183, 255, 0.2);
  transform: scale(1.05);
}

.play-button:active {
  transform: scale(0.95);
}

.play-button.playing {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
  background: rgba(92, 209, 192, 0.1);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-icon {
  font-size: 16px;
  color: var(--text-dim);
}

.volume-slider {
  width: 100px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-blue);
  border-radius: 50%;
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-blue);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* ── Band Selector ────────────────────────────── */
.band-selector {
  display: flex;
  gap: 8px;
  padding: 8px 16px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  scrollbar-color: transparent transparent;
}

.band-selector::-webkit-scrollbar {
  display: none;
}

.band-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s;
  flex-shrink: 0;
  color: var(--text);
  font-family: inherit;
}

.band-chip:hover {
  background: var(--bg-elevated);
}

.band-chip.selected {
  background: var(--bg-elevated);
  transform: translateY(-2px);
}

.band-chip.locked {
  opacity: 0.5;
  cursor: pointer;
}

.band-chip.locked .band-chip-freq,
.band-chip.locked .band-chip-role {
  display: none;
}

.band-chip.locked .band-chip-color {
  opacity: 0.4;
}

.band-chip.locked::after {
  content: '🔒';
  font-size: 10px;
  margin-top: 2px;
}

.band-chip.locked:active {
  transform: scale(0.95);
  opacity: 0.7;
}

.band-chip-color {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  margin-bottom: 4px;
}

.band-chip-short {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 1px;
}

.band-chip-freq {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.band-chip-role {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 1px;
}

/* ── Modals ───────────────────────────────────── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  padding: 16px;
}

.modal.modal-visible {
  opacity: 1;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

/* ── Paywall ──────────────────────────────────── */
.paywall-content {
  max-width: 440px;
}

.paywall-header {
  text-align: center;
  margin-bottom: 20px;
}

.paywall-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.paywall-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.paywall-codex {
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
}

.paywall-tiers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.tier-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  position: relative;
}

.tier-card[data-tier="duplex"] {
  border-color: var(--accent-blue);
}

.tier-card[data-tier="emTransmutation"] {
  border-color: var(--accent-purple);
}

.tier-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 8px;
}

.tier-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.tier-price {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.tier-tagline {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
}

.tier-features {
  list-style: none;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.tier-features li {
  padding: 2px 0;
  padding-left: 16px;
  position: relative;
}

.tier-features li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--tier-accent, var(--accent-blue));
  font-size: 10px;
}

.tier-codex {
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
  margin-bottom: 12px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

.tier-button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bg);
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: inherit;
}

.tier-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.tier-button:not(:disabled):hover {
  opacity: 0.85;
}

.paywall-restore-row {
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.paywall-restore {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  font-family: inherit;
}

.paywall-restore:hover {
  color: var(--text);
}

/* ── Credits ─────────────────────────────────── */
.credits-content {
  max-width: 480px;
}

.credits-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  text-align: center;
}

.credits-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 20px;
}

.credits-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.credit-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.credit-card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.credit-card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.credit-card-role {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.credit-card-contrib {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 4px;
}

.credit-card-link {
  font-size: 11px;
  color: var(--text-faint);
}

.credits-framework {
  margin-bottom: 16px;
}

.credits-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dim);
}

.credits-framework-list {
  list-style: none;
  font-size: 12px;
  color: var(--text-dim);
}

.credits-framework-list li {
  padding: 3px 0;
  padding-left: 16px;
  position: relative;
}

.credits-framework-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent-blue);
}

.credits-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.codex-formula {
  font-size: 11px;
  color: var(--text-faint);
  font-family: 'SF Mono', 'Menlo', monospace;
  line-height: 1.6;
}

.codex-formula em {
  color: var(--accent);
  font-style: italic;
}

/* ── Compact Mode (height < 700px) ───────────── */
@media (max-height: 699px) {
  .top-bar { padding: 6px 12px; }
  .app-title { font-size: 13px; }
  .auth-container { padding: 2px 8px; }
  .auth-input { width: 110px; font-size: 11px; }
  .auth-submit { padding: 5px 10px; font-size: 11px; }
  .auth-avatar { width: 24px; height: 24px; font-size: 10px; }
  .auth-email { font-size: 10px; }
  .auth-logout { font-size: 10px; padding: 3px 8px; }
  .frequency-value { font-size: 28px; }
  .frequency-display { padding: 2px 0; }
  .breath-phase-display { padding: 2px 0 1px; }
  .breath-phase-text { font-size: 14px; }
  .breath-sequence-label { font-size: 10px; }
  .play-button { width: 120px; height: 42px; font-size: 13px; }
  .breath-intention { display: none; }
  .breath-intensity { font-size: 9px; margin-top: 1px; }
  .cycle-counter { font-size: 10px; margin-top: 1px; }
  .band-chip { min-width: 64px; padding: 5px 8px; }
  .band-chip-short { font-size: 12px; }
  .band-chip-freq { font-size: 9px; }
  .band-chip-role { font-size: 8px; margin-top: 0; }
  .progress-bar-container { margin: 3px auto; }
  .controls { padding: 4px 0; gap: 12px; }
  .visual-area { min-height: 120px; }
}

/* ── Tiny screens ─────────────────────────────── */
@media (max-width: 374px) {
  .frequency-value { font-size: 26px; }
  .band-chip { min-width: 60px; padding: 6px; }
  .band-chip-role { display: none; }
  .volume-slider { width: 80px; }
  .modal-content { padding: 16px; }
  .auth-input { width: 100px; }
  .app-title { font-size: 12px; }
}

/* ── Landscape adjustments ───────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  #app { flex-direction: row; }
  .visual-area { flex: 1; min-height: 0; }
  .frequency-display, .breath-phase-display, .breath-intention, .breath-intensity, .cycle-counter, .progress-bar-container, .controls, .band-selector {
    width: 280px;
    margin-left: auto;
    margin-right: auto;
  }
  .top-bar { width: 280px; margin: 0 auto; }
}

/* ── Animations ───────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.breath-phase-display.active .breath-phase-text {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tier-card, .credit-card {
  animation: fadeIn 0.4s ease-out;
}

/* ── Reduced Motion ─────────────────────────── */
@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;
  }
  
  .breath-phase-display.active .breath-phase-text {
    animation: none;
  }
  
  .tier-card, .credit-card {
    animation: none;
  }
}

/* ── Paddle Toast ─────────────────────────────── */
.paddle-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--accent-blue);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.paddle-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Auth UI ────────────────────────────────── */
.auth-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-info {
  display: flex;
  flex-direction: column;
}

.auth-email {
  font-size: 11px;
  color: var(--text-dim);
}

.auth-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.auth-logout:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.auth-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.auth-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  width: 140px;
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent-blue);
}

.auth-submit {
  background: var(--accent-blue);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Legal Footer ─────────────────────────────── */
.legal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 4px 16px 8px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-faint);
}

.legal-footer a {
  color: var(--text-faint);
  text-decoration: none;
}

.legal-footer a:hover {
  color: var(--text-dim);
  text-decoration: underline;
}

.legal-footer-sep {
  opacity: 0.5;
}

/* ── No scrollbars on iOS ─────────────────── */
::-webkit-scrollbar { width: 0; height: 0; }

/* ── Background Mode Overlay ──────────────────── */
.background-mode-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #050507;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  padding: var(--safe-top) 24px var(--safe-bottom);
}

.background-mode-overlay.visible {
  opacity: 1;
}

.bg-mode-info {
  text-align: center;
  opacity: 0.25;
  transition: opacity 0.3s;
  margin-bottom: 32px;
}

.bg-mode-freq {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 1px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.bg-mode-band {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.bg-mode-playing {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
  letter-spacing: 1px;
}

.bg-mode-sleep {
  display: flex;
  gap: 12px;
  opacity: 0.25;
  transition: opacity 0.3s;
  margin-bottom: 32px;
}

.bg-mode-sleep-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.bg-mode-sleep-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
}

.bg-mode-sleep-btn.active {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(124, 183, 255, 0.1);
}

.bg-mode-controls {
  display: flex;
  gap: 20px;
  align-items: center;
}

.bg-mode-play-btn, .bg-mode-eye-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.bg-mode-play-btn:hover, .bg-mode-eye-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ── EM Transmutation Mode Selector ────────────────── */
.em-mode-container {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 8px;
  margin: 0 auto;
  max-width: 480px;
}

.em-mode-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.em-mode-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.em-mode-btn-row {
  display: flex;
  gap: 6px;
  padding: 3px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.em-mode-btn {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.em-mode-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.em-mode-btn.active {
  color: #fff;
  background: rgba(183, 108, 255, 0.25);
  box-shadow: 0 0 8px rgba(183, 108, 255, 0.2);
}

.em-mode-btn:focus-visible {
  outline: 2px solid #b76cff;
  outline-offset: 1px;
}

/* Disruptor target dropdown */
.em-target-wrapper {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.em-target-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.em-target-select {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.em-target-select:hover {
  border-color: rgba(183, 108, 255, 0.4);
}

.em-target-select:focus-visible {
  border-color: #b76cff;
  outline: 2px solid rgba(183, 108, 255, 0.3);
  outline-offset: 1px;
}

.em-target-select option {
  background: var(--bg);
  color: var(--text);
}

/* Mode description text */
.em-mode-description {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-faint);
  text-align: center;
  max-width: 360px;
  margin-top: 4px;
  min-height: 16px;
}

/* Fine volume control for Disruptor mode */
.em-volume-wrapper {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 360px;
  margin-top: 4px;
}

.em-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.em-volume-voice-label {
  font-size: 10px;
  color: var(--text-faint);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.em-volume-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.em-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #b76cff;
  cursor: pointer;
  border: none;
}

.em-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #b76cff;
  cursor: pointer;
  border: none;
}

/* Compact mode */
@media (max-height: 600px) {
  .em-mode-description { display: none; }
  .em-mode-btn { padding: 5px 10px; font-size: 11px; }
}

@media (max-width: 360px) {
  .em-mode-btn { padding: 5px 8px; font-size: 10px; }
  .em-mode-label { display: none; }
}

/* ── EM Transmutation Upgrade Hint (Duplex users) ────── */
.em-upgrade-hint {
  display: none;
  width: 100%;
  max-width: 480px;
  padding: 10px 16px;
  margin: 4px auto;
  background: linear-gradient(135deg, rgba(183, 108, 255, 0.08), rgba(124, 183, 255, 0.04));
  border: 1px solid rgba(183, 108, 255, 0.15);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.em-upgrade-hint:hover {
  background: linear-gradient(135deg, rgba(183, 108, 255, 0.14), rgba(124, 183, 255, 0.08));
  border-color: rgba(183, 108, 255, 0.3);
  color: var(--text);
}

.em-upgrade-hint .em-upgrade-arrow {
  color: #b76cff;
  margin-left: 4px;
  transition: transform 0.2s;
}

.em-upgrade-hint:hover .em-upgrade-arrow {
  transform: translateX(3px);
}

/* ── Paywall tier highlight pulse ──────────────────── */
.tier-card.tier-highlight {
  animation: tierHighlightPulse 1.5s ease-out;
}

@keyframes tierHighlightPulse {
  0% { box-shadow: 0 0 0 2px var(--tier-accent, #b76cff), 0 0 20px var(--tier-accent, #b76cff); }
  50% { box-shadow: 0 0 0 2px var(--tier-accent, #b76cff), 0 0 40px var(--tier-accent, #b76cff); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
}

/* ── Collective Field Indicator ──────────────────── */
.field-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 12px;
  margin: 0 auto;
  max-width: 280px;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.field-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5cd1c0;
  box-shadow: 0 0 6px rgba(92, 209, 192, 0.6);
  animation: fieldPulse 7.83s ease-in-out infinite;
}

@keyframes fieldPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.field-text {
  font-weight: 500;
}

@media (max-width: 360px) {
  .field-indicator { font-size: 10px; padding: 2px 8px; }
}
