:root {
  --ink-main: #e0f7fa;
  --ink-sub: #b2ebf2;
  --panel-glass: rgba(204, 244, 255, 0.1);
  --panel-line: rgba(204, 244, 255, 0.28);
  --panel-shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--ink-main);
  font-family: "Nunito", sans-serif;
  background: #020811;
  transition: background 500ms ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
}

body::after {
  z-index: 1;
}

.layout {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 30px);
  position: relative;
  z-index: 2;
}

.dream-container {
  width: min(760px, 100%);
  text-align: center;
  padding: clamp(18px, 3.5vw, 34px);
  border-radius: 24px;
  border: 1px solid var(--panel-line);
  background: linear-gradient(170deg, rgba(7, 18, 30, 0.62) 0%, rgba(3, 10, 20, 0.62) 100%);
  box-shadow: 0 22px 56px var(--panel-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: cardFloat 8s ease-in-out infinite;
}

.profile-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(214, 249, 255, 0.42);
  background: linear-gradient(155deg, rgba(210, 252, 255, 0.24) 0%, rgba(118, 201, 214, 0.16) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  animation: squareDrift 7s ease-in-out infinite;
}

.profile-shell::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.04) 100%);
  pointer-events: none;
}

.profile-img {
  width: min(240px, 52vw);
  height: min(240px, 52vw);
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid rgba(18, 26, 40, 0.45);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.16), inset 0 0 12px rgba(0, 240, 255, 0.08);
  filter: brightness(0.9) contrast(1.06);
}

h1 {
  margin: 0 0 12px;
  font-family: "Comfortaa", sans-serif;
  font-size: clamp(2.2rem, 8.5vw, 3.7rem);
  font-weight: 500;
  color: #e0f7fa;
  letter-spacing: 1px;
  text-shadow: 0 0 14px rgba(178, 235, 242, 0.45), 0 0 30px rgba(0, 240, 255, 0.2);
}

.subtitle {
  margin: 0 auto 18px;
  max-width: 40ch;
  font-size: clamp(1.1rem, 2.3vw, 1.38rem);
  line-height: 1.45;
  color: var(--ink-sub);
}

.status-pill {
  display: inline-block;
  margin: 0 0 12px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(178, 235, 242, 0.25);
  background: rgba(0, 240, 255, 0.06);
  color: #b2ebf2;
  font-size: clamp(0.95rem, 1.9vw, 1.08rem);
}

.mode-note {
  margin: 0;
  font-size: clamp(0.78rem, 1.4vw, 0.9rem);
  color: rgba(226, 245, 252, 0.72);
}

/* Water mode: 23:00-03:00 */
body.theme-water {
  background:
    linear-gradient(180deg, rgba(1, 10, 22, 0.4) 0%, rgba(1, 8, 18, 0.66) 100%),
    url("jellyfish.png?v=20260304p") center center / cover no-repeat;
}

body.theme-water::before {
  background:
    radial-gradient(circle at 50% -10%, rgba(66, 149, 177, 0.34) 0%, rgba(5, 18, 35, 0.12) 45%, rgba(2, 6, 14, 0.64) 100%),
    linear-gradient(180deg, rgba(1, 10, 20, 0.2) 0%, rgba(1, 7, 15, 0.5) 100%);
  opacity: 0.76;
}

body.theme-water::after {
  opacity: 0.3;
  background:
    radial-gradient(60% 40% at 20% 22%, rgba(168, 239, 255, 0.22) 0%, rgba(168, 239, 255, 0) 70%),
    radial-gradient(48% 36% at 82% 68%, rgba(160, 232, 255, 0.2) 0%, rgba(160, 232, 255, 0) 72%),
    repeating-radial-gradient(
      ellipse at 50% 50%,
      rgba(175, 241, 255, 0.16) 0 2px,
      rgba(175, 241, 255, 0) 4px 26px
    );
  mix-blend-mode: screen;
  filter: blur(1.8px);
  animation: causticShift 90s ease-in-out infinite alternate;
}

/* Minecraft mode: 03:01-06:01 */
body.theme-minecraft {
  font-family: "VT323", monospace;
  background:
    linear-gradient(rgba(2, 8, 16, 0.44), rgba(2, 8, 16, 0.74)),
    url("Minecraftbagground.png?v=20260304p") center center / cover no-repeat fixed;
}

body.theme-minecraft::before {
  background:
    radial-gradient(circle at 50% 16%, rgba(180, 211, 255, 0.12) 0%, rgba(0, 0, 0, 0) 46%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 1px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px
    );
  opacity: 0.62;
}

body.theme-minecraft::after {
  background:
    radial-gradient(circle at 10% 72%, rgba(246, 170, 92, 0.2) 0%, rgba(246, 170, 92, 0) 42%),
    radial-gradient(circle at 90% 68%, rgba(246, 170, 92, 0.17) 0%, rgba(246, 170, 92, 0) 40%);
  mix-blend-mode: screen;
  animation: torchFlicker 4.2s steps(12, end) infinite;
}

body.theme-minecraft .dream-container {
  border-radius: 0;
  border: 4px solid #7f848a;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(111, 131, 152, 0.18) 0 8px,
      rgba(103, 121, 140, 0.14) 8px 16px
    ),
    rgba(26, 28, 32, 0.78);
  box-shadow:
    inset 2px 2px 0 #d0d4d8,
    inset -2px -2px 0 #2e3338,
    0 16px 44px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: cardBreathe 8s ease-in-out infinite;
}

body.theme-minecraft .profile-shell {
  border-radius: 0;
  padding: 10px;
  border: 4px solid #3a2414;
  background:
    repeating-linear-gradient(90deg, #7f5530 0 8px, #6e4929 8px 16px);
  box-shadow:
    inset 2px 2px 0 rgba(231, 198, 161, 0.5),
    inset -2px -2px 0 rgba(41, 25, 12, 0.7),
    0 8px 18px rgba(0, 0, 0, 0.45);
  animation: squareDrift 7s ease-in-out infinite;
}

body.theme-minecraft .profile-shell::before {
  inset: 0;
  border-radius: 0;
  background: none;
}

body.theme-minecraft .profile-img {
  border-radius: 0;
  border: 3px solid #2b1b10;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
  filter: saturate(0.92) brightness(0.92);
}

body.theme-minecraft h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.1rem, 3.6vw, 2rem);
  line-height: 1.35;
  color: #f4e8b6;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.72);
  letter-spacing: 0;
}

body.theme-minecraft .subtitle {
  color: #c8d2d7;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.06;
}

body.theme-minecraft .status-pill {
  border-radius: 0;
  border: 3px solid #3a4a5c;
  background: rgba(51, 69, 87, 0.52);
  color: #d2eaf5;
  box-shadow: inset 0 0 0 2px rgba(185, 215, 234, 0.22);
  font-size: clamp(1.2rem, 2.2vw, 1.56rem);
}

body.theme-minecraft .mode-note {
  color: rgba(223, 233, 241, 0.74);
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
}

body.theme-minecraft .music-toggle {
  font-family: "Press Start 2P", monospace;
  font-size: 0.58rem;
  border-radius: 0;
  border: 3px solid #4f5f71;
  color: #f0f4f8;
  background: linear-gradient(180deg, #8da0b4 0%, #6f8296 58%, #566779 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Birthday mode: March 4 all day */
body.theme-birthday {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 186, 218, 0.28) 0%, rgba(255, 186, 218, 0) 38%),
    radial-gradient(circle at 80% 16%, rgba(255, 214, 136, 0.24) 0%, rgba(255, 214, 136, 0) 36%),
    linear-gradient(180deg, #2f123f 0%, #140b2a 100%);
}

body.theme-birthday::before {
  background:
    radial-gradient(circle at 50% -5%, rgba(255, 232, 171, 0.24) 0%, rgba(255, 232, 171, 0) 50%);
}

body.theme-birthday::after {
  opacity: 0.26;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255, 184, 232, 0.95) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255, 235, 160, 0.95) 0 1px, transparent 2px);
  background-size: 36px 36px, 42px 42px, 30px 30px;
  background-position: 0 0, 18px 10px, 8px 24px;
  animation: confettiDrift 14s linear infinite;
}

body.theme-birthday .dream-container {
  border-color: rgba(255, 220, 170, 0.45);
  background: linear-gradient(170deg, rgba(93, 39, 116, 0.52) 0%, rgba(42, 22, 78, 0.58) 100%);
}

body.theme-birthday h1 {
  color: #fff3bf;
  text-shadow: 0 0 14px rgba(255, 214, 118, 0.4), 0 0 28px rgba(255, 108, 207, 0.24);
}

body.theme-birthday .subtitle {
  color: #ffdff5;
}

body.theme-birthday .status-pill {
  color: #ffe7a5;
  border-color: rgba(255, 231, 165, 0.36);
  background: rgba(255, 177, 210, 0.16);
}

/* Animations */
@keyframes cardFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-13px);
  }
}

@keyframes cardBreathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.01);
  }
}

@keyframes squareDrift {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-6px) rotate(0.8deg);
  }
}

@keyframes causticShift {
  0% {
    transform: translate3d(-1.8%, 1.2%, 0) scale(1.02);
    background-position: 18% 24%, 82% 64%, 50% 50%;
  }

  50% {
    transform: translate3d(1.2%, -1.4%, 0) scale(1.06);
    background-position: 24% 18%, 78% 68%, 48% 52%;
  }

  100% {
    transform: translate3d(-1.1%, -0.8%, 0) scale(1.03);
    background-position: 16% 26%, 86% 60%, 52% 48%;
  }
}

@keyframes torchFlicker {
  0%,
  100% {
    opacity: 0.42;
  }

  35% {
    opacity: 0.52;
  }

  70% {
    opacity: 0.36;
  }
}

@keyframes confettiDrift {
  0% {
    transform: translateY(-8px);
  }

  100% {
    transform: translateY(18px);
  }
}

@media (max-width: 520px) {
  .subtitle {
    font-size: 1.02rem;
  }

  .status-pill {
    font-size: 0.86rem;
  }

  .profile-img {
    width: min(210px, 66vw);
    height: min(210px, 66vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
