

:root {
  /* Theme tokens (default = Blue) */
  --bg-1: #0077ea;
  --bg-2: #1f4f96;
  --bg-3: #1b2949;
  --bg-4: #020817;

  --stroke-strong: dodgerblue;
  --stroke-fill: #0077ea;

  --shadow-a: #00366b;
  --shadow-b: #002951;

  --footer-bg: rgba(0, 0, 0, 0.28);
  --footer-border: rgba(255, 255, 255, 0.22);

  --ui-bg: rgba(0, 0, 0, 0.30);
  --ui-border: rgba(255, 255, 255, 0.22);
  --ui-text: rgba(255, 255, 255, 0.92);
}

/* Purple theme overrides */
[data-theme="purple"] {
  --bg-1: #8a2be2;   /* blueviolet */
  --bg-2: #4b1d7a;
  --bg-3: #1f0a3a;
  --bg-4: #0b0616;

  --stroke-strong: #a855f7; /* vivid purple */
  --stroke-fill: #7c3aed;   /* deep purple */

  --shadow-a: #2b0a4f;
  --shadow-b: #1f063b;

  --footer-bg: rgba(16, 2, 32, 0.30);
  --footer-border: rgba(215, 190, 255, 0.22);

  --ui-bg: rgba(16, 2, 32, 0.34);
  --ui-border: rgba(215, 190, 255, 0.24);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Hot Pink theme overrides */
[data-theme="hotpink"] {
  --bg-1: #ff69b4;
  --bg-2: #b12c6d;
  --bg-3: #3a0a22;
  --bg-4: #1a0010;

  --stroke-strong: #ff85c5;
  --stroke-fill: #ff69b4;

  --shadow-a: #5b0e32;
  --shadow-b: #3a0820;

  --footer-bg: rgba(36, 0, 18, 0.30);
  --footer-border: rgba(255, 210, 235, 0.22);

  --ui-bg: rgba(36, 0, 18, 0.34);
  --ui-border: rgba(255, 210, 235, 0.24);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Deep Pink theme overrides */
[data-theme="deeppink"] {
  /* keep it vivid but smoother + less muddy */
  --bg-1: #ff1493;
  --bg-2: #b10a67;
  --bg-3: #3a001c;
  --bg-4: #14000a;

  --stroke-strong: #ff5fbc;
  --stroke-fill: #ff1493;

  --shadow-a: #5a002a;
  --shadow-b: #320016;

  --footer-bg: rgba(28, 0, 14, 0.30);
  --footer-border: rgba(255, 200, 230, 0.22);

  --ui-bg: rgba(28, 0, 14, 0.34);
  --ui-border: rgba(255, 200, 230, 0.24);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Teal theme overrides */
[data-theme="teal"] {
  --bg-1: #328E6E;
  --bg-2: #005461;
  --bg-3: #062b2f;
  --bg-4: #031616;

  --stroke-strong: #39d9b0;
  --stroke-fill: #328E6E;

  --shadow-a: #003a34;
  --shadow-b: #002429;

  --footer-bg: rgba(0, 22, 24, 0.30);
  --footer-border: rgba(185, 255, 242, 0.20);

  --ui-bg: rgba(0, 22, 24, 0.34);
  --ui-border: rgba(185, 255, 242, 0.22);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Rose theme overrides */
[data-theme="rose"] {
  --bg-1: #BE5985;
  --bg-2: #7b2e52;
  --bg-3: #360719;
  --bg-4: #14040b;

  --stroke-strong: #d77aa4;
  --stroke-fill: #BE5985;

  --shadow-a: #3c0a21;
  --shadow-b: #240514;

  --footer-bg: rgba(28, 0, 12, 0.30);
  --footer-border: rgba(255, 205, 225, 0.22);

  --ui-bg: rgba(28, 0, 12, 0.34);
  --ui-border: rgba(255, 205, 225, 0.24);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Wine theme overrides */
[data-theme="wine"] {
  --bg-1: #AC1754;
  --bg-2: #3A0519; /* red wine */
  --bg-3: #120008;
  --bg-4: #0d0005;

  --stroke-strong: #AC1754;
  --stroke-fill: #AC1754;

  --shadow-a: #1f000c;
  --shadow-b: #120007;

  --footer-bg: rgba(20, 0, 8, 0.30);
  --footer-border: rgba(255, 195, 210, 0.20);

  --ui-bg: rgba(20, 0, 8, 0.34);
  --ui-border: rgba(255, 195, 210, 0.22);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Rose Gold theme overrides */
[data-theme="rosegold"] {
  --bg-1: #B76E79;
  --bg-2: #7A3B45;
  --bg-3: #2A0B11;
  --bg-4: #120507;

  --stroke-strong: #FFB3C1;
  --stroke-fill: #B76E79;

  --shadow-a: #3A0A14;
  --shadow-b: #24060C;

  --footer-bg: rgba(30, 6, 12, 0.30);
  --footer-border: rgba(255, 220, 230, 0.22);

  --ui-bg: rgba(30, 6, 12, 0.34);
  --ui-border: rgba(255, 220, 230, 0.24);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Green theme overrides */
[data-theme="green"] {
  --bg-1: #22C55E;
  --bg-2: #15803D;
  --bg-3: #052E1A;
  --bg-4: #02130a;

  --stroke-strong: #34D399;
  --stroke-fill: #22C55E;

  --shadow-a: #06301B;
  --shadow-b: #041F12;

  --footer-bg: rgba(0, 24, 10, 0.30);
  --footer-border: rgba(190, 255, 220, 0.20);

  --ui-bg: rgba(0, 24, 10, 0.34);
  --ui-border: rgba(190, 255, 220, 0.22);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Brown theme overrides */
[data-theme="brown"] {
  --bg-1: #8B5E34;
  --bg-2: #4E2A16;
  --bg-3: #1F1008;
  --bg-4: #120a05;

  --stroke-strong: #D4A373;
  --stroke-fill: #8B5E34;

  --shadow-a: #2B1408;
  --shadow-b: #1C0C05;

  --footer-bg: rgba(18, 10, 6, 0.30);
  --footer-border: rgba(255, 225, 200, 0.18);

  --ui-bg: rgba(18, 10, 6, 0.34);
  --ui-border: rgba(255, 225, 200, 0.20);
  --ui-text: rgba(255, 255, 255, 0.94);
}

/* Orange theme overrides */
[data-theme="orange"] {
  --bg-1: #FF7A00;
  --bg-2: #C2410C;
  --bg-3: #591c07;
  --bg-4: #140700;

  --stroke-strong: #FFB703;
  --stroke-fill: #FF7A00;

  --shadow-a: #4A1400;
  --shadow-b: #2B0B00;

  --footer-bg: rgba(28, 10, 0, 0.30);
  --footer-border: rgba(255, 220, 190, 0.18);

  --ui-bg: rgba(28, 10, 0, 0.34);
  --ui-border: rgba(255, 220, 190, 0.20);
  --ui-text: rgba(255, 255, 255, 0.94);
}


/* Auto-harmony (when supported): UI/footer tints follow the active theme accent */
@supports (color: color-mix(in srgb, red, blue)) {
  :root,
  [data-theme] {
    /* Use the theme's fill/stroke as the accent anchor */
    --accent: var(--stroke-fill);

    /* Softer, more coherent glass */
    --ui-bg: color-mix(in srgb, var(--accent) 10%, rgba(0, 0, 0, 0.34));
    --ui-border: color-mix(in srgb, var(--accent) 26%, rgba(255, 255, 255, 0.18));
    --footer-bg: color-mix(in srgb, var(--accent) 8%, rgba(0, 0, 0, 0.30));
    --footer-border: color-mix(in srgb, var(--accent) 22%, rgba(255, 255, 255, 0.18));
  }
}

body {
  min-height: 450px;
  height: 100vh;
  margin: 0;
  background: radial-gradient(circle, var(--bg-1), var(--bg-2), var(--bg-3), var(--bg-4));
}

.stage {
  height: 300px;
  width: 500px;
  margin: auto;
  position: absolute;
  z-index: 6; /* keep text above theme reveal */
  top: 0;
  right: 0;
  bottom: 0;
  left: -120px;
  perspective: 9999px;
  transform-style: preserve-3d;
}

.layer {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  animation: ಠ_ಠ 5s infinite alternate ease-in-out -7.5s;
  animation-fill-mode: forwards;
  transform: rotateY(40deg) rotateX(33deg) translateZ(0);
}

.layer:after {
  font: 150px/0.65 "Pacifico", "Kaushan Script", Futura, "Roboto", "Trebuchet MS", Helvetica, sans-serif;
  content: "I Love You \a\a Aida";
  white-space: pre;
  text-align: center;
  height: 100%;
  width: 100%;
  position: absolute;
  top: 50px;
  color: whitesmoke;
  letter-spacing: -2px;
  text-shadow: 4px 0 10px rgba(0, 0, 0, 0.13);
}

.layer:nth-child(1):after { transform: translateZ(0px); }
.layer:nth-child(2):after { transform: translateZ(-1.5px); }
.layer:nth-child(3):after { transform: translateZ(-3px); }
.layer:nth-child(4):after { transform: translateZ(-4.5px); }
.layer:nth-child(5):after { transform: translateZ(-6px); }
.layer:nth-child(6):after { transform: translateZ(-7.5px); }
.layer:nth-child(7):after { transform: translateZ(-9px); }
.layer:nth-child(8):after { transform: translateZ(-10.5px); }
.layer:nth-child(9):after { transform: translateZ(-12px); }
.layer:nth-child(10):after { transform: translateZ(-13.5px); }
.layer:nth-child(11):after { transform: translateZ(-15px); }
.layer:nth-child(12):after { transform: translateZ(-16.5px); }
.layer:nth-child(13):after { transform: translateZ(-18px); }
.layer:nth-child(14):after { transform: translateZ(-19.5px); }
.layer:nth-child(15):after { transform: translateZ(-21px); }
.layer:nth-child(16):after { transform: translateZ(-22.5px); }
.layer:nth-child(17):after { transform: translateZ(-24px); }
.layer:nth-child(18):after { transform: translateZ(-25.5px); }
.layer:nth-child(19):after { transform: translateZ(-27px); }
.layer:nth-child(20):after { transform: translateZ(-28.5px); }

.layer:nth-child(n+10):after {
  -webkit-text-stroke: 3px rgba(0, 0, 0, 0.25);
}

.layer:nth-child(n+11):after {
  -webkit-text-stroke-width: 15px;
  -webkit-text-stroke-color: var(--stroke-strong);
  text-shadow: 6px 0 6px var(--shadow-a), 5px 5px 5px var(--shadow-b), 0 6px 6px var(--shadow-a);
}

.layer:nth-child(n+12):after {
  -webkit-text-stroke-color: var(--stroke-fill);
}

.layer:last-child:after {
  -webkit-text-stroke: 17px rgba(0, 0, 0, 0.1);
}

.layer:first-child:after {
  color: #fff;
  text-shadow: none;
}

@keyframes ಠ_ಠ {
  100% { transform: rotateY(-40deg) rotateX(-43deg); }
}

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 10;

  display: flex;
  justify-content: center;

  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.footer > span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;

  padding: 10px 16px;
  border-radius: 999px;

  background: var(--footer-bg);
  border: 1px solid var(--footer-border);

  transition: background 320ms ease, border-color 320ms ease, color 320ms ease;

  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);

  font: 600 15px/1.2 "Roboto", system-ui, -apple-system, "Segoe UI", "Trebuchet MS", Helvetica, Arial, sans-serif;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.90);
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);

  transform: translateZ(0);
}

.footer > span::before {
  content: "✦";
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
}

@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .footer > span { background: rgba(0, 0, 0, 0.45); }
}

@media (max-width: 600px) {
  .footer { bottom: 12px; padding: 0 12px; }
  .footer > span { font-size: 13px; padding: 9px 12px; text-align: center; }
}

/* Theme switch UI */
.theme-switch {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 20;

  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  max-width: calc(100vw - 36px);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;

  border-radius: 16px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);

  transition: background 320ms ease, border-color 320ms ease;

  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

/* Hide scrollbar (still scrollable) */
.theme-switch::-webkit-scrollbar { height: 0; }
.theme-switch { scrollbar-width: none; }

.theme-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--ui-text);

  display: inline-flex;
  align-items: center;

  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;

  font: 700 12px/1 "Roboto", system-ui, -apple-system, "Segoe UI", "Trebuchet MS", Helvetica, Arial, sans-serif;
  letter-spacing: 0.6px;

  transition: transform 820ms cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.32);
}

.theme-btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.45);
}

.theme-btn .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: -1px;
}

.theme-btn[data-theme="blue"] .dot {
  background: #2aa2ff;
  box-shadow: 0 0 0 2px rgba(42, 162, 255, 0.25), 0 0 18px rgba(42, 162, 255, 0.55);
}

.theme-btn[data-theme="purple"] .dot {
  background: #a855f7;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25), 0 0 18px rgba(168, 85, 247, 0.55);
}

.theme-btn[data-theme="hotpink"] .dot {
  background: #ff69b4;
  box-shadow: 0 0 0 2px rgba(255, 105, 180, 0.25), 0 0 18px rgba(255, 105, 180, 0.55);
}

.theme-btn[data-theme="deeppink"] .dot {
  background: #ff1493;
  box-shadow: 0 0 0 2px rgba(255, 20, 147, 0.25), 0 0 18px rgba(255, 20, 147, 0.55);
}

.theme-btn[data-theme="teal"] .dot {
  background: #328E6E;
  box-shadow: 0 0 0 2px rgba(50, 142, 110, 0.25), 0 0 18px rgba(50, 142, 110, 0.55);
}

.theme-btn[data-theme="rose"] .dot {
  background: #BE5985;
  box-shadow: 0 0 0 2px rgba(190, 89, 133, 0.25), 0 0 18px rgba(190, 89, 133, 0.55);
}

.theme-btn[data-theme="wine"] .dot {
  background: #AC1754;
  box-shadow: 0 0 0 2px rgba(172, 23, 84, 0.25), 0 0 18px rgba(172, 23, 84, 0.55);
}

.theme-btn[data-theme="rosegold"] .dot {
  background: #B76E79;
  box-shadow: 0 0 0 2px rgba(183, 110, 121, 0.25), 0 0 18px rgba(183, 110, 121, 0.55);
}

.theme-btn[data-theme="green"] .dot {
  background: #22C55E;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25), 0 0 18px rgba(34, 197, 94, 0.55);
}

.theme-btn[data-theme="brown"] .dot {
  background: #8B5E34;
  box-shadow: 0 0 0 2px rgba(139, 94, 52, 0.25), 0 0 18px rgba(139, 94, 52, 0.55);
}

.theme-btn[data-theme="orange"] .dot {
  background: #FF7A00;
  box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.25), 0 0 18px rgba(255, 122, 0, 0.55);
}

/* Dot glow pulse on hover (starts from the dot color) */
@supports (color: color-mix(in srgb, red, blue)) {
  .theme-btn[data-theme] { --dot-color: #ffffff; }

  .theme-btn[data-theme="blue"] { --dot-color: #2aa2ff; }
  .theme-btn[data-theme="purple"] { --dot-color: #a855f7; }
  .theme-btn[data-theme="hotpink"] { --dot-color: #ff69b4; }
  .theme-btn[data-theme="deeppink"] { --dot-color: #ff1493; }
  .theme-btn[data-theme="teal"] { --dot-color: #328E6E; }
  .theme-btn[data-theme="rose"] { --dot-color: #BE5985; }
  .theme-btn[data-theme="wine"] { --dot-color: #AC1754; }
  .theme-btn[data-theme="rosegold"] { --dot-color: #B76E79; }
  .theme-btn[data-theme="green"] { --dot-color: #22C55E; }
  .theme-btn[data-theme="brown"] { --dot-color: #8B5E34; }
  .theme-btn[data-theme="orange"] { --dot-color: #FF7A00; }

  .theme-btn .dot {
    background: var(--dot-color);
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--dot-color) 25%, transparent),
      0 0 18px color-mix(in srgb, var(--dot-color) 55%, transparent);
  }

  @keyframes dotPulse {
    0%, 100% {
      box-shadow:
        0 0 0 2px color-mix(in srgb, var(--dot-color) 25%, transparent),
        0 0 14px color-mix(in srgb, var(--dot-color) 50%, transparent);
      transform: scale(1);
    }
    50% {
      box-shadow:
        0 0 0 2px color-mix(in srgb, var(--dot-color) 30%, transparent),
        0 0 28px color-mix(in srgb, var(--dot-color) 65%, transparent);
      transform: scale(1.06);
    }
  }

  .theme-btn:hover .dot {
    animation: dotPulse 900ms ease-in-out infinite;
  }
}


.theme-btn .label {
  opacity: 0.85;
  margin-left: 6px;
  font-weight: 700;
}

@media (max-width: 600px) {
  .theme-switch {
    top: 12px;
    left: 12px;
    padding: 7px;
    gap: 6px;
    max-width: calc(100vw - 24px);
  }

  .theme-btn {
    padding: 7px 9px;
    font-size: 12px;
  }
}

/* Theme change reveal (smooth, behind text) */
.theme-reveal {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 200vmax;
  height: 200vmax;
  border-radius: 9999px;
  transform: translate3d(-50%, -50%, 0) scale(0);
  transform-origin: center;
  z-index: 1; /* below stage/footer/switcher */
  pointer-events: none;

  background: radial-gradient(circle, var(--reveal-1), var(--reveal-2), var(--reveal-3), var(--reveal-4));
  will-change: transform;
  transition: transform 820ms cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-reveal.is-on {
  transform: translate3d(-50%, -50%, 0) scale(1);
}
