:root {
  --bg-1: #0b0f19;
  --bg-2: #1a1a2e;
  --bg-3: #16213e;
  --bg-color: var(--bg-1);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --card-bg: rgba(30, 41, 59, 0.4);
  --card-border: rgba(255, 255, 255, 0.1);
  --accent-1: #6366f1;
  --accent-2: #ec4899;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(var(--grad-angle, 45deg), var(--bg-1), var(--bg-2), var(--bg-1), var(--bg-3));
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Animated Background Blobs */
.background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  filter: blur(100px);
  border-radius: 50%;
  animation: float 15s infinite ease-in-out alternate;
  opacity: 0.6;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-1);
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-2);
  bottom: -200px;
  right: -100px;
  animation-delay: -7s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  100% { transform: translate(150px, 100px) scale(1.3) rotate(45deg); }
}

.container {
  max-width: 1200px;
  width: 100%;
  padding: 40px 24px 60px;
  z-index: 1;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: clamp(30px, 6vw, 60px);
}

.title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
}

.sub-title {
  font-size: clamp(2.5rem, 9vw, 5rem);
  font-weight: 900;
  letter-spacing: clamp(2px, 1vw, 5px);
  text-transform: uppercase;
  background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: rainbowFlow 4s linear infinite;
  margin: 0;
  text-shadow: 0 0 20px rgba(255,255,255,0.1);
  line-height: 1.1;
  text-align: center;
  word-break: break-word;
}

@keyframes rainbowFlow {
  to { background-position: 200% center; }
}

.main-title {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
  text-align: center;
}

.main-title span {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}

.card {
  text-decoration: none;
  color: inherit;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 30px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  display: block;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transition: all 0.5s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card:active {
  transform: scale(0.98);
}

.card:hover::before {
  left: 100%;
}

.card-content {
  position: relative;
  z-index: 2;
}

.icon {
  width: 60px;
  height: 60px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.05);
}

.neon-icon { color: #22d3ee; }
.star-icon { color: #fbbf24; }
.chem-icon { color: #10b981; }
.chill-icon { color: #ec4899; }
.shape-icon { color: #facc15; }
.sonic-icon { color: #39ff14; }
.add-icon { color: var(--text-muted); }

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  font-weight: 500;
}

.card p {
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 300;
}

.add-new {
  border: 1px dashed var(--card-border);
  background: transparent;
  cursor: pointer;
}

.add-new:hover {
  background: rgba(255,255,255,0.02);
}

@media (max-width: 768px) {
  .container {
    padding: 24px 16px 40px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
  }
  .card {
    padding: 22px;
    border-radius: 16px;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 20px;
  }
  .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 14px;
  }
  .card h2 {
    font-size: 1.3rem;
  }
  .card p {
    font-size: 0.95rem;
  }
}

/* --- RGB Gradient Theme Bar & Studio --- */
.top-nav-bar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 15px;
}

.theme-palette-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.theme-palette-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--accent-1);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.theme-palette-btn:active {
  transform: scale(0.96);
}

/* Modal */
.theme-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.theme-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.theme-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.theme-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.theme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.modal-title-group h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.theme-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.modal-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.gradient-preview {
  width: 100%;
  height: 28px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease;
}

.color-pickers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.picker-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.picker-card label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.picker-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.picker-inner input[type="color"] {
  -webkit-appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.2);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  padding: 0;
  outline: none;
}

.picker-inner input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.picker-inner input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.color-hex-tag {
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-main);
}

.presets-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.presets-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-1);
}

.preset-chip.active {
  background: rgba(99, 102, 241, 0.35);
  border-color: var(--accent-1);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
  color: #fff;
}

/* Main Page Theme Strip */
.main-theme-strip {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.theme-strip-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.theme-strip-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.main-preset {
  font-size: 0.85rem;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
}

.studio-pill {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(236, 72, 153, 0.25));
  border-color: rgba(99, 102, 241, 0.5);
  color: #fff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.studio-pill:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(236, 72, 153, 0.45));
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

/* Angle Control Slider */
.angle-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.angle-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.angle-tag {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
}

.angle-slider {
  width: 100%;
  accent-color: var(--accent-1);
  cursor: pointer;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.theme-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.reset-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.apply-btn {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  color: #fff;
  padding: 8px 24px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.apply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
