.theme-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 99999;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.theme-modal {
  background: var(--panel, #181432);
  color: var(--text, #f5f3ff);
  border: 1px solid var(--line, #3b336a);
  border-radius: 16px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 25px var(--glow, rgba(139, 92, 246, 0.2));
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.theme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line, #3b336a);
  padding-bottom: 14px;
}

.theme-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-modal-close {
  background: transparent;
  border: none;
  color: var(--muted, #a78bfa);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
}

.theme-modal-close:hover {
  background: var(--panel-strong, #241e48);
  color: var(--text, #ffffff);
}

.theme-section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted, #a78bfa);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 8px;
}

.theme-brand-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-brand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 520px) {
  .theme-brand-grid {
    grid-template-columns: 1fr;
  }
}

.theme-brand-card {
  background: var(--panel-strong, #241e48);
  border: 2px solid var(--line, #3b336a);
  color: var(--text, #f5f3ff);
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              background 0.2s ease;
  will-change: transform;
}

.theme-brand-card:hover {
  border-color: var(--accent, #8b5cf6);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25), 0 0 14px var(--glow, rgba(139, 92, 246, 0.25));
}

.theme-brand-card.active {
  border-color: var(--accent, #8b5cf6);
  background: var(--panel, #181432);
  box-shadow: 0 0 14px var(--glow, rgba(139, 92, 246, 0.35));
}

.theme-brand-badge {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  font-family: Georgia, serif;
  border: 1px solid var(--accent, #8b5cf6);
  background: var(--accent, #8b5cf6);
  color: var(--accent-text, #ffffff);
}

.theme-brand-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-brand-info strong {
  font-size: 13.5px;
  color: var(--text, #f5f3ff);
}

.theme-brand-info span {
  font-size: 11px;
  color: var(--muted, #a78bfa);
}

.theme-brand-check {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent, #8b5cf6);
  background: var(--glow, rgba(139, 92, 246, 0.2));
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.theme-brand-action {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted, #a78bfa);
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.theme-brand-card:hover .theme-brand-action {
  color: var(--accent, #8b5cf6);
}

.theme-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.theme-preset-btn {
  background: var(--panel-strong, #241e48);
  border: 2px solid transparent;
  color: var(--text, #f5f3ff);
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              background 0.2s ease;
  text-align: left;
  will-change: transform;
}

.theme-preset-btn:hover {
  border-color: var(--accent, #8b5cf6);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25), 0 0 14px var(--glow, rgba(139, 92, 246, 0.25));
}

.theme-preset-btn.active {
  border-color: var(--accent, #8b5cf6);
  background: var(--glow, rgba(139, 92, 246, 0.2));
  box-shadow: 0 0 12px var(--glow, rgba(139, 92, 246, 0.3));
}

.theme-preset-btn.active:hover {
  transform: translateY(-2px) scale(1.02);
}

.theme-preset-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.theme-sliders-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel-strong, #241e48);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line, #3b336a);
}

.theme-slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted, #a78bfa);
  font-weight: 600;
}

.theme-slider-input {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--line, #3b336a);
  outline: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.theme-slider-input:hover {
  filter: brightness(1.1);
}

.theme-preview-box {
  padding: 14px;
  border-radius: 10px;
  background: var(--bg, #0f0c20);
  border: 1px solid var(--line, #3b336a);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.theme-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
  will-change: transform;
}

.theme-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 16px var(--glow, rgba(139, 92, 246, 0.3));
}

.theme-btn:active {
  transform: translateY(0) scale(0.99);
}

.theme-btn-primary {
  background: var(--accent, #8b5cf6);
  color: var(--accent-text, #ffffff);
}

.theme-btn-primary:hover {
  background: var(--accent-hover, #7c3aed);
}

.theme-btn-secondary {
  background: var(--panel-strong, #241e48);
  color: var(--text, #f5f3ff);
  border-color: var(--line, #3b336a);
}

.theme-btn-secondary:hover {
  border-color: var(--muted, #a78bfa);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
