/**
 * Nano Banana WebApp - Settings Panel
 * Панель настроек с 3 параметрами в строку
 */

/* ===== OVERLAY ===== */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  touch-action: none;
  user-select: none;
}

.settings-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== PANEL ===== */
.settings-panel {
  background: linear-gradient(135deg, rgba(30, 30, 50, 0.95), rgba(20, 20, 35, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.settings-overlay.active .settings-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ===== HEADER ===== */
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.settings-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.settings-close:hover {
  background: rgba(239, 68, 68, 0.8);
  transform: scale(1.1);
}

/* ===== SECTION ===== */
.settings-section {
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(15px);
}

/* Анимации запускаются только когда overlay активен */
.settings-overlay.active .settings-section {
  animation: sectionAppear 0.4s ease forwards;
}

/* Staggered animation delays for sections */
.settings-overlay.active .settings-section:nth-child(2) { animation-delay: 0.05s; }
.settings-overlay.active .settings-section:nth-child(3) { animation-delay: 0.1s; }
.settings-overlay.active .settings-section:nth-child(4) { animation-delay: 0.15s; }
.settings-overlay.active .settings-section:nth-child(5) { animation-delay: 0.2s; }
.settings-overlay.active .settings-section:nth-child(6) { animation-delay: 0.25s; }
.settings-overlay.active .settings-section:nth-child(7) { animation-delay: 0.3s; }

@keyframes sectionAppear {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== OPTIONS CONTAINER ===== */
.settings-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== OPTION BUTTON ===== */
.settings-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 60px;
  position: relative;
  overflow: hidden;
  /* Initial state - hidden until overlay active */
  opacity: 0;
  transform: translateY(10px) scale(0.95);
}

/* Анимации запускаются только когда overlay активен */
.settings-overlay.active .settings-option {
  animation: optionAppear 0.3s ease forwards;
}

/* Staggered delays for options within a container */
.settings-overlay.active .settings-option:nth-child(1) { animation-delay: 0.02s; }
.settings-overlay.active .settings-option:nth-child(2) { animation-delay: 0.04s; }
.settings-overlay.active .settings-option:nth-child(3) { animation-delay: 0.06s; }
.settings-overlay.active .settings-option:nth-child(4) { animation-delay: 0.08s; }
.settings-overlay.active .settings-option:nth-child(5) { animation-delay: 0.1s; }
.settings-overlay.active .settings-option:nth-child(6) { animation-delay: 0.12s; }
.settings-overlay.active .settings-option:nth-child(7) { animation-delay: 0.14s; }
.settings-overlay.active .settings-option:nth-child(8) { animation-delay: 0.16s; }
.settings-overlay.active .settings-option:nth-child(9) { animation-delay: 0.18s; }
.settings-overlay.active .settings-option:nth-child(10) { animation-delay: 0.2s; }
.settings-overlay.active .settings-option:nth-child(11) { animation-delay: 0.22s; }

@keyframes optionAppear {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Ripple effect container */
.settings-option::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.5) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

/* Ripple animation on click */
.settings-option:active::before {
  animation: optionRipple 0.5s ease-out;
}

@keyframes optionRipple {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 200%;
    height: 200%;
    opacity: 0;
  }
}

.settings-option:hover {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.5);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
}

/* Press effect */
.settings-option:active {
  transform: scale(0.96);
  transition: transform 0.1s ease;
}

.settings-option.selected,
.settings-overlay.active .settings-option.selected {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 140, 0, 0.3)) !important;
  border-color: rgba(255, 215, 0, 0.9) !important;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4) !important;
  /* CRITICAL: Keep element visible when animation changes */
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  /* Glow pulse animation for selected state */
  animation: selectedGlow 2s ease-in-out infinite !important;
}

@keyframes selectedGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 50px rgba(255, 140, 0, 0.3);
  }
}

.settings-option.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ===== OPTION CONTENT ===== */
.option-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.option-label {
  font-size: 12px;
  font-weight: 700;
}

.option-desc {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

/* ===== ASPECT OPTIONS ===== */
.settings-aspects {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.aspect-option {
  padding: 8px 6px;
  min-width: unset;
}

.aspect-option .option-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.aspect-option .option-label {
  font-size: 10px;
}

/* ===== VERSION OPTIONS ===== */
.settings-versions {
  display: flex;
  gap: 12px;
}

.version-option {
  flex: 1;
  padding: 12px 8px;
  flex-direction: column;
  gap: 4px;
}

.version-option .option-icon {
  font-size: 20px;
  margin-bottom: 0;
}

.version-option .option-label {
  font-size: 13px;
}

.version-option .option-cost {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
}

/* Version buttons share the same yellow highlight as aspect/quality —
   generic .settings-option.selected rule (above) does the paint. */

/* ===== QUALITY SECTION (Pro only) ===== */
.settings-quality-section {
  max-height: 200px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

.settings-quality-section.hidden {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

/* ===== QUALITY OPTIONS ===== */
.settings-qualities {
  display: flex;
  gap: 10px;
}

.quality-option {
  flex: 1;
  padding: 12px;
  position: relative;
}

.quality-option .option-label {
  font-size: 16px;
  font-weight: 800;
}

.quality-option .option-desc {
  font-size: 11px;
}

.quality-option .pro-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 9px;
  padding: 2px 6px;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
  border-radius: 6px;
  font-weight: 700;
}

/* ===== CONFIRM BUTTON ===== */
.settings-confirm {
  width: 100%;
  padding: 14px;
  margin-top: 10px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
  position: relative;
  overflow: hidden;
  /* Initial state - hidden until overlay active */
  opacity: 0;
  transform: translateY(15px);
}

/* Анимация запускается только когда overlay активен */
.settings-overlay.active .settings-confirm {
  animation: confirmAppear 0.4s ease forwards 0.35s;
}

@keyframes confirmAppear {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shine effect - only when overlay active */
.settings-confirm::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.settings-overlay.active .settings-confirm::after {
  animation: confirmShine 3s ease-in-out infinite;
}

@keyframes confirmShine {
  0%, 100% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
}

.settings-confirm:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
}

.settings-confirm:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

.settings-confirm span {
  font-size: 18px;
  position: relative;
  z-index: 1;
}

/* ===== MOBILE ===== */
@media (max-width: 380px) {
  .settings-panel {
    padding: 16px;
    border-radius: 16px;
  }

  .settings-aspects {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .aspect-option {
    padding: 6px 4px;
  }

  .aspect-option .option-icon {
    font-size: 16px;
  }

  .aspect-option .option-label {
    font-size: 9px;
  }

  .version-option {
    padding: 10px 6px;
  }

  .version-option .option-icon {
    font-size: 18px;
  }

  .version-option .option-label {
    font-size: 11px;
  }

  .version-option .option-cost {
    font-size: 9px;
  }

  .quality-option {
    padding: 10px;
  }

  .quality-option .option-label {
    font-size: 14px;
  }

  .settings-confirm {
    padding: 12px;
    font-size: 14px;
  }
}

/* ===== TRIGGER BUTTON (legacy support) ===== */
.radial-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 14px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.radial-trigger:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
  border-color: rgba(102, 126, 234, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* ===== INSTAGRAM MODE TOGGLE ===== */
.settings-insta-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  margin-top: 16px;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
  max-height: 200px;
  overflow: hidden;
}

.settings-insta-section.hidden {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  border: none;
  pointer-events: none;
}

.settings-retouch-section {
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
  max-height: 500px;
  overflow: hidden;
}

.settings-retouch-section.hidden {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.settings-toggle-row {
  display: flex;
  gap: 10px;
}

.settings-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

/* Ripple effect for toggle buttons */
.settings-toggle-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 30, 99, 0.4) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}

.settings-toggle-btn:active::before {
  animation: toggleRipple 0.5s ease-out;
}

@keyframes toggleRipple {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 250%;
    height: 250%;
    opacity: 0;
  }
}

.settings-toggle-btn:hover {
  background: rgba(233, 30, 99, 0.15);
  border-color: rgba(233, 30, 99, 0.4);
  transform: translateY(-2px) scale(1.01);
}

.settings-toggle-btn:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

.settings-toggle-btn.active {
  background: linear-gradient(135deg, rgba(233, 30, 99, 0.4), rgba(156, 39, 176, 0.4));
  border-color: rgba(233, 30, 99, 0.9);
  box-shadow: 0 0 20px rgba(233, 30, 99, 0.4);
  animation: toggleActiveGlow 2s ease-in-out infinite;
}

@keyframes toggleActiveGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(233, 30, 99, 0.6), 0 0 50px rgba(156, 39, 176, 0.3);
  }
}

.toggle-icon {
  font-size: 22px;
}

.toggle-label {
  font-size: 14px;
  font-weight: 700;
}

.toggle-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.settings-toggle-btn.active .toggle-status {
  background: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.settings-hint {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
}

/* ===== BEAUTY RETOUCH SLIDERS ===== */
.retouch-sliders {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.retouch-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.retouch-slider-row:last-child {
  border-bottom: none;
}

.slider-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.slider-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  width: 50px;
}

.slider-value {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  width: 28px;
  text-align: right;
}

/* Custom Range Slider */
.retouch-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.retouch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.retouch-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(236, 72, 153, 0.7);
}

.retouch-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

.retouch-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.5);
}

/* Slider track fill effect */
.retouch-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg,
    rgba(236, 72, 153, 0.6) 0%,
    rgba(168, 85, 247, 0.6) 100%
  );
}

/* Mobile adjustments */
@media (max-width: 380px) {
  .retouch-sliders {
    padding: 10px;
    margin-top: 10px;
  }

  .retouch-slider-row {
    padding: 6px 0;
  }

  .slider-icon {
    font-size: 16px;
    width: 20px;
  }

  .slider-label {
    font-size: 11px;
    width: 45px;
  }

  .slider-value {
    font-size: 11px;
    width: 24px;
  }

  .retouch-slider::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
  }

  .retouch-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
  }
}

/* ===== CREATE STEPS (Two-step wizard) ===== */
.create-step {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.create-step.hidden {
  display: none;
}

/* Step 1: Settings preview */
.create-step-settings {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.step-icon {
  font-size: 24px;
}

.step-title {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.step-settings-preview {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.step-settings-preview .settings-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.step-settings-preview .settings-row:last-child {
  border-bottom: none;
}

.step-settings-preview .settings-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0;
  text-transform: none;
}

.step-settings-preview .settings-value {
  font-size: 13px;
  font-weight: 700;
  color: white;
}

.step-settings-btn {
  width: 100%;
  font-size: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Step 2: Form appearance animation */
.create-step-form {
  animation: stepFormAppear 0.5s ease forwards;
}

@keyframes stepFormAppear {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== MATRIX DECODE EFFECT ===== */

/* Canvas для матричного эффекта */
.matrix-canvas {
  position: absolute;
  inset: 0;
  z-index: 100002;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.9s ease; /* increased 3x */
}

.matrix-canvas.fade-out {
  opacity: 0;
}

/* Панель в режиме декодирования - контент скрыт */
.settings-panel.matrix-decoding {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.settings-panel.matrix-decoding > * {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Панель после декодирования - контент появляется */
.settings-panel.matrix-decoded {
  background: linear-gradient(135deg, rgba(30, 30, 50, 0.95), rgba(20, 20, 35, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-panel.matrix-decoded > * {
  opacity: 1;
  visibility: visible;
}

/* Элементы с эффектом появления из матрицы (increased 3x) */
.matrix-element {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.matrix-element.matrix-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Глитч-эффект при закрытии (increased 3x) */
.settings-panel.matrix-glitching {
  animation: matrixGlitch 1.2s ease-out forwards;
}

.settings-panel.matrix-glitching > * {
  animation: contentGlitch 1.2s ease-out forwards;
}

@keyframes matrixGlitch {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  20% {
    transform: scale(1.02) translateY(-2px);
    filter: hue-rotate(90deg);
  }
  40% {
    transform: scale(0.98) translateY(2px) skewX(2deg);
    filter: hue-rotate(-45deg) saturate(2);
  }
  60% {
    transform: scale(1.01) translateY(-1px) skewX(-1deg);
    filter: hue-rotate(45deg);
  }
  80% {
    opacity: 0.6;
    transform: scale(0.95) translateY(5px);
    filter: hue-rotate(180deg) blur(2px);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    filter: blur(8px);
  }
}

@keyframes contentGlitch {
  0% {
    opacity: 1;
    text-shadow: none;
  }
  10% {
    text-shadow: 2px 0 #00ff41, -2px 0 #a855f7;
  }
  20% {
    text-shadow: -3px 0 #f472b6, 3px 0 #00ff41;
    opacity: 0.9;
  }
  30% {
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  }
  40% {
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    text-shadow: 4px 0 #00ff41, -4px 0 #f472b6;
  }
  50% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    opacity: 0.7;
  }
  60% {
    text-shadow: -2px 2px #a855f7, 2px -2px #00ff41;
  }
  70% {
    opacity: 0.4;
    transform: translateX(3px);
  }
  80% {
    transform: translateX(-3px);
    text-shadow: 5px 0 #00ff41;
  }
  90% {
    opacity: 0.2;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    text-shadow: none;
  }
}

/* Отключаем стандартные анимации когда активен matrix эффект */
.settings-panel.matrix-decoding .settings-section,
.settings-panel.matrix-decoding .settings-option,
.settings-panel.matrix-decoding .settings-confirm {
  animation: none !important;
  opacity: 0 !important;
  transform: none !important;
}

/* После декодирования - своя анимация появления */
.settings-panel.matrix-decoded .settings-section,
.settings-panel.matrix-decoded .settings-option,
.settings-panel.matrix-decoded .settings-confirm {
  animation: matrixReveal 0.4s ease forwards !important;
}

/* Staggered delays for matrix reveal */
.settings-panel.matrix-decoded .settings-section:nth-child(1) { animation-delay: 0s !important; }
.settings-panel.matrix-decoded .settings-section:nth-child(2) { animation-delay: 0.04s !important; }
.settings-panel.matrix-decoded .settings-section:nth-child(3) { animation-delay: 0.08s !important; }
.settings-panel.matrix-decoded .settings-section:nth-child(4) { animation-delay: 0.12s !important; }
.settings-panel.matrix-decoded .settings-section:nth-child(5) { animation-delay: 0.16s !important; }
.settings-panel.matrix-decoded .settings-section:nth-child(6) { animation-delay: 0.2s !important; }
.settings-panel.matrix-decoded .settings-section:nth-child(7) { animation-delay: 0.24s !important; }
.settings-panel.matrix-decoded .settings-confirm { animation-delay: 0.28s !important; }

@keyframes matrixReveal {
  0% {
    opacity: 0;
    transform: translateY(15px);
    filter: blur(4px);
    text-shadow: 0 0 10px #00ff41;
  }
  30% {
    opacity: 0.5;
    filter: blur(2px);
    text-shadow: 0 0 8px #a855f7, 0 0 15px #00ff41;
  }
  60% {
    opacity: 0.8;
    transform: translateY(5px);
    filter: blur(1px);
    text-shadow: 0 0 5px #f472b6;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    text-shadow: none;
  }
}

/* Options внутри sections тоже с задержкой */
.settings-panel.matrix-decoded .settings-option {
  animation-delay: inherit !important;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .matrix-canvas,
  .settings-panel.matrix-decoding,
  .settings-panel.matrix-decoded,
  .settings-panel.matrix-glitching,
  .matrix-element {
    animation: none !important;
    transition: opacity 0.1s ease !important;
  }

  .settings-panel.matrix-decoding > * {
    opacity: 1 !important;
    visibility: visible !important;
    animation: none !important;
  }
}
