:root {
  color-scheme: dark;
  --bg-dark: #081712;
  --bg-darker: #040c09;
  --green-primary: #124031;
  --green-light: #1b5e48;
  --green-glow: rgba(18, 64, 49, 0.6);
  --gold-primary: #e5b869;
  --gold-light: #f3d49b;
  --gold-glow: rgba(229, 184, 105, 0.3);
  --text-white: #ffffff;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;

  --glass-bg: rgba(18, 48, 38, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(229, 184, 105, 0.4);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);

  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-darker);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-white);
  -webkit-font-smoothing: antialiased;
}

/* Декоративный живой фон (Dynamic glowing blobs) */
.bg-glows {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, var(--bg-dark) 0%, var(--bg-darker) 100%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  mix-blend-mode: screen;
  animation: float 12s infinite alternate ease-in-out;
}

.bg-glow--1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--green-light) 0%, transparent 70%);
  animation-delay: 0s;
}

.bg-glow--2 {
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  animation-duration: 16s;
  animation-delay: -3s;
}

.bg-glow--3 {
  top: 40%;
  left: 30%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, var(--green-glow) 0%, transparent 70%);
  animation-duration: 20s;
  animation-delay: -5s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(8%, 12%) scale(1.15);
  }
}

/* Page Layout & Brand Header */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 12px;
  animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.brand__logo {
  width: min(220px, 65vw);
  height: auto;
  max-height: 70px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(18, 64, 49, 0.3));
}

/* Stage & Panel (Glassmorphism) */
.stage {
  min-height: 0;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 12px 20px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.panel {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  box-shadow: var(--glass-shadow), 
              inset 0 1px 0 rgba(255, 255, 255, 0.1),
              inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel[hidden] {
  display: none !important;
  opacity: 0;
  transform: scale(0.95) translateY(10px);
}

.panel--fade-out {
  opacity: 0;
  transform: scale(0.96) translateY(-8px);
  pointer-events: none;
}

/* Эффект плавного проявления для панели, когда убирают hidden */
.panel:not([hidden]) {
  animation: panelFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Intro Typography */
.intro {
  text-align: center;
  margin-bottom: 4px;
}

.intro__label {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--gold-primary);
  text-shadow: 0 0 12px rgba(229, 184, 105, 0.2);
}

.intro__title {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-white) 30%, #e2e8f0 70%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Form Fields */
.fields {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
  text-align: left;
}

.field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding-left: 4px;
  transition: var(--transition-smooth);
}

.field input {
  width: 100%;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--text-white);
  background: rgba(0, 0, 0, 0.25);
  outline: none;
  transition: var(--transition-smooth);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.field input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.field input:focus {
  border-color: var(--gold-primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(229, 184, 105, 0.15),
              inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.field:focus-within span {
  color: var(--gold-primary);
}

/* Buttons */
.button {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.button--primary {
  color: var(--text-dark);
  background: linear-gradient(135deg, var(--gold-primary) 0%, #f3d49b 100%);
  box-shadow: 0 6px 20px rgba(229, 184, 105, 0.25);
}

.button--primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: all 0.6s ease;
}

.button--primary:hover::before {
  left: 150%;
}

.button--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(229, 184, 105, 0.35);
}

.button--primary:active {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(229, 184, 105, 0.2);
}

.button--primary:disabled {
  cursor: progress;
  background: #a89474;
  box-shadow: none;
  transform: none;
  color: rgba(0, 0, 0, 0.5);
}

/* Instagram Buttons */
.button--instagram {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button--instagram:hover {
  background: linear-gradient(45deg, #f9ce34 0%, #ee2a7b 50%, #6228d7 100%);
  border-color: transparent;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(238, 42, 123, 0.25);
}

.button--instagram:active {
  transform: translateY(1px);
}

.instagram-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.4s ease;
}

.button--instagram:hover .instagram-icon {
  transform: rotate(12deg) scale(1.1);
}

/* Rules list */
.rules {
  margin: 4px 0;
  display: grid;
  gap: 12px;
  list-style: none;
  counter-reset: item;
}

.rules li {
  position: relative;
  padding-left: 38px;
  font-size: 15px;
  line-height: 1.4;
  color: #cbd5e1;
  text-align: left;
}

/* Стилизованные цифры правил */
.rules li::before {
  content: counter(item);
  counter-increment: item;
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  background: rgba(229, 184, 105, 0.15);
  border: 1px solid var(--gold-primary);
  border-radius: 50%;
  color: var(--gold-primary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(229, 184, 105, 0.1);
}

.rules strong {
  color: var(--text-white);
  font-weight: 600;
}

.rules__link {
  color: var(--gold-primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed rgba(229, 184, 105, 0.4);
  transition: var(--transition-smooth);
}

.rules__link:hover {
  color: var(--gold-light);
  border-bottom-color: var(--gold-light);
  text-shadow: 0 0 8px rgba(229, 184, 105, 0.3);
}

/* Status & Success Panel details */
.status,
.success-note {
  min-height: 18px;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  color: var(--text-muted);
}

.status:empty,
.success-note:empty {
  display: none;
}

.status.is-error {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.instagram-actions {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

/* Keyframe Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Адаптивность для небольших экранов по высоте */
@media (max-height: 740px) {
  .brand {
    padding: 16px 20px 8px;
  }
  .brand__logo {
    max-height: 56px;
  }
  .stage {
    padding: 8px 16px 16px;
  }
  .panel {
    padding: 20px;
    gap: 14px;
    border-radius: 20px;
  }
  .intro__title {
    font-size: 20px;
  }
  .field input {
    height: 44px;
  }
  .button {
    min-height: 44px;
  }
  .rules li {
    font-size: 14px;
    padding-left: 32px;
  }
  .rules li::before {
    width: 20px;
    height: 20px;
    font-size: 11px;
    top: 0;
  }
}

@media (max-height: 610px) {
  .brand {
    padding: 10px 20px 4px;
  }
  .brand__logo {
    max-height: 46px;
  }
  .stage {
    padding: 4px 10px 10px;
  }
  .panel {
    padding: 14px;
    gap: 10px;
    border-radius: 16px;
  }
  .intro__label {
    font-size: 11px;
    margin-bottom: 4px;
  }
  .intro__title {
    font-size: 17px;
  }
  .fields {
    gap: 10px;
  }
  .field {
    gap: 4px;
  }
  .field span {
    font-size: 12px;
  }
  .field input {
    height: 38px;
    font-size: 14px;
    border-radius: 10px;
  }
  .button {
    min-height: 40px;
    font-size: 14px;
    border-radius: 10px;
  }
  .rules li {
    font-size: 13px;
    padding-left: 28px;
  }
  .rules li::before {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  .instagram-actions {
    gap: 8px;
  }
}
