:root {
  --bg-night: #04050d;
  --bg-burn: #1d0812;
  --bg-deep: #091124;
  --surface: rgba(12, 10, 32, 0.76);
  --surface-strong: rgba(15, 12, 40, 0.92);
  --border-hot: rgba(255, 95, 182, 0.22);
  --border-cool: rgba(99, 221, 255, 0.18);
  --text: #fff7fb;
  --muted: #c9cade;
  --accent-hot: #ff4db8;
  --accent-lime: #d8ff4b;
  --accent-cyan: #63ddff;
  --accent-mango: #ffb44d;
  --danger: #ff9ebb;
  --success: #a6ffd4;
  --shadow: 0 40px 150px rgba(0, 0, 0, 0.58);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Noto Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(99, 221, 255, 0.18), transparent 28%),
    radial-gradient(circle at 80% 18%, rgba(255, 95, 182, 0.16), transparent 26%),
    radial-gradient(circle at 55% 85%, rgba(216, 255, 75, 0.11), transparent 23%),
    linear-gradient(155deg, var(--bg-burn) 0%, var(--bg-night) 42%, var(--bg-deep) 100%);
  overflow: hidden;
}

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

body::before {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.04), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 36%);
  opacity: 0.62;
}

body::after {
  inset: -12%;
  background:
    radial-gradient(circle at 24% 26%, rgba(255, 85, 170, 0.18), transparent 22%),
    radial-gradient(circle at 72% 34%, rgba(99, 221, 255, 0.2), transparent 24%),
    radial-gradient(circle at 58% 78%, rgba(216, 255, 75, 0.12), transparent 20%);
  filter: blur(54px);
  opacity: 0.96;
}

.space-shell {
  position: relative;
  min-height: 100vh;
}

.space-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

.starfield {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.space-count {
  position: fixed;
  right: clamp(0.85rem, 2vw, 1.4rem);
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 2;
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid rgba(99, 221, 255, 0.18);
  border-radius: 999px;
  background: rgba(8, 12, 28, 0.62);
  color: rgba(247, 244, 255, 0.88);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.space-count__value {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff5c8;
}

.space-count__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(232, 237, 248, 0.72);
  text-transform: uppercase;
}

.star {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--star-size, 2px);
  height: var(--star-size, 2px);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.98) 0%, var(--star-color, rgba(255, 255, 255, 0.7)) 56%, transparent 72%);
  box-shadow: 0 0 var(--star-glow, 12px) var(--star-glow-color, rgba(255, 255, 255, 0.2));
  opacity: 0.6;
  will-change: transform, opacity;
}

.hero-wrap {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  pointer-events: none;
}

.hero-card,
.panel-toggle {
  pointer-events: auto;
}

.hero-card {
  position: relative;
  width: min(760px, 100%);
  padding: clamp(1.4rem, 4vw, 2.9rem);
  border: 1px solid var(--border-hot);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(34, 16, 46, 0.88) 0%, rgba(9, 11, 27, 0.86) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 30px 90px rgba(0, 0, 0, 0.4),
    var(--shadow);
  backdrop-filter: blur(18px) saturate(135%);
  text-align: center;
  transition:
    transform 620ms cubic-bezier(0.2, 0.84, 0.2, 1),
    opacity 420ms ease,
    filter 420ms ease;
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.hero-card::before {
  background:
    linear-gradient(120deg, rgba(255, 89, 178, 0.12), transparent 30%, transparent 70%, rgba(99, 221, 255, 0.14)),
    radial-gradient(circle at top, rgba(255, 196, 70, 0.08), transparent 46%);
}

.hero-card::after {
  inset: 1px;
  border: 1px solid rgba(99, 221, 255, 0.1);
  opacity: 0.7;
}

.hero-wrap.is-collapsed .hero-card {
  transform: translateY(min(84vh, 40rem)) scale(0.94);
  opacity: 0;
  filter: blur(10px);
}

.hero-kicker {
  margin: 0 0 0.95rem;
  color: rgba(240, 247, 255, 0.66);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Noto Serif Display", Georgia, serif;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
  background: linear-gradient(180deg, #fff7d6 0%, #ffd178 36%, #ff73c0 68%, #a7ff74 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 10px 24px rgba(255, 92, 176, 0.18));
}

.hero-subtitle {
  width: min(38rem, 100%);
  margin: 1.05rem auto 2.1rem;
  color: rgba(234, 238, 250, 0.84);
  font-size: clamp(1.04rem, 2.7vw, 1.28rem);
  line-height: 1.65;
}

.submission-form {
  display: grid;
  gap: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid rgba(111, 225, 255, 0.16);
  border-radius: 999px;
  padding: 1rem 1.25rem;
  color: var(--text);
  background: linear-gradient(180deg, rgba(17, 14, 38, 0.94) 0%, rgba(11, 14, 34, 0.76) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(255, 84, 170, 0.04);
}

input::placeholder {
  color: rgba(220, 216, 238, 0.46);
}

input:focus,
button:focus {
  outline: none;
}

input:focus-visible,
button:focus-visible {
  box-shadow:
    0 0 0 1px rgba(99, 221, 255, 0.92),
    0 0 0 6px rgba(99, 221, 255, 0.12);
}

#submit-button {
  border: 0;
  border-radius: 999px;
  padding: 1rem 1.55rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #100714;
  background: linear-gradient(135deg, #ff67c7 0%, #ffd66d 34%, #d9ff52 70%, #67dfff 100%);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
  box-shadow:
    0 18px 50px rgba(255, 95, 182, 0.18),
    0 10px 32px rgba(99, 221, 255, 0.14);
}

#submit-button:hover {
  transform: translateY(-1px) scale(1.01);
}

#submit-button:disabled {
  opacity: 0.64;
  cursor: progress;
  transform: none;
}

.form-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.status-message {
  min-height: 1.2rem;
  margin: 0;
  color: rgba(233, 237, 248, 0.72);
  text-align: left;
}

.status-message[data-tone="error"] {
  color: var(--danger);
}

.status-message[data-tone="success"] {
  color: var(--success);
}

.character-counter {
  color: rgba(220, 220, 241, 0.72);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel-toggle {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid rgba(99, 221, 255, 0.22);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  background: rgba(8, 12, 28, 0.78);
  color: rgba(247, 244, 255, 0.9);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.panel-toggle:hover {
  transform: translateX(-50%) translateY(-1px);
}

.panel-toggle__arrow {
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 95, 182, 0.18), rgba(99, 221, 255, 0.18));
  font-size: 1rem;
  line-height: 1;
}

.panel-toggle__label {
  font-size: 0.92rem;
  font-weight: 700;
}

.hero-wrap.is-collapsed .panel-toggle {
  background: linear-gradient(135deg, rgba(255, 95, 182, 0.16), rgba(99, 221, 255, 0.14));
  border-color: rgba(255, 192, 95, 0.28);
}

.floating-text {
  position: absolute;
  display: grid;
  place-items: center;
  max-width: min(40vw, 400px);
  min-height: clamp(3.9rem, 8vw, 5.3rem);
  padding: 0.95rem 1.35rem;
  border: 1px solid var(--bubble-border, rgba(255, 255, 255, 0.14));
  border-radius: 999px;
  background: var(
    --bubble-background,
    linear-gradient(135deg, rgba(20, 14, 40, 0.84), rgba(10, 17, 34, 0.76))
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 22px 54px rgba(0, 0, 0, 0.3),
    0 0 24px var(--bubble-glow, rgba(99, 221, 255, 0.18));
  backdrop-filter: blur(14px) saturate(120%);
  pointer-events: none;
  text-align: center;
  will-change: transform;
}

.floating-text::before,
.floating-text::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.floating-text::before {
  inset: 10px;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.08) 48%, transparent 100%);
  opacity: 0.2;
}

.floating-text::after {
  inset: -2px;
  border-radius: inherit;
  opacity: 0;
  box-shadow: 0 0 24px var(--bubble-highlight, rgba(255, 255, 255, 0.28));
}

.floating-text__badge {
  position: absolute;
  top: -0.82rem;
  left: 50%;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(252, 246, 255, 0.94);
  color: #1c0820;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(10px) scale(0.92);
}

.floating-text__content {
  margin: 0;
  width: 100%;
  font-size: var(--font-size, 1rem);
  font-weight: 800;
  line-height: 1.28;
  color: var(--bubble-text, rgba(255, 247, 251, 0.96));
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.floating-text.is-new::after {
  animation: halo-flash 2.5s ease;
}

.floating-text.is-new .floating-text__content {
  animation: troll-glitch 220ms steps(2, end) 8, troll-bounce 2.6s cubic-bezier(0.22, 0.88, 0.24, 1);
}

.floating-text.is-new .floating-text__badge {
  animation: badge-burst 2.5s ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes troll-glitch {
  0% {
    transform: translate3d(0, 0, 0);
  }

  25% {
    transform: translate3d(-4px, 2px, 0);
  }

  50% {
    transform: translate3d(5px, -1px, 0);
  }

  75% {
    transform: translate3d(-3px, -2px, 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes troll-bounce {
  0% {
    filter: brightness(1.65) saturate(1.45);
    transform: scale(0.9);
  }

  18% {
    transform: scale(1.08);
  }

  36% {
    transform: scale(0.98);
  }

  100% {
    filter: brightness(1) saturate(1);
    transform: scale(1);
  }
}

@keyframes halo-flash {
  0% {
    opacity: 0;
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes badge-burst {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.92);
  }

  16% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }

  74% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-6px) scale(0.96);
  }
}

@media (max-width: 720px) {
  .hero-card {
    border-radius: 24px;
    padding: 1.25rem 1.15rem 1.35rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .character-counter {
    text-align: right;
  }

  .floating-text {
    max-width: min(78vw, 320px);
    min-height: 3.7rem;
  }

  .panel-toggle {
    width: calc(100% - 1.5rem);
    justify-content: center;
  }

  .space-count {
    right: 0.75rem;
    left: 0.75rem;
    justify-content: center;
    bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 4.3rem);
  }

  .space-count__label {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-card,
  .floating-text.is-new::after,
  .floating-text.is-new .floating-text__content,
  .floating-text.is-new .floating-text__badge {
    animation: none;
    transition: none;
  }

  .star {
    transition: none;
  }
}
