:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  --bg: #022c22;
  --bg-accent: #065f46;
  --surface: #ffffff;
  --window-bg: #ecfdf5;
  --window-bg-soft: #d1fae5;
  --text: #0f172a;
  --text-muted: #4b5563;
  --primary: #059669;
  --primary-hover: #047857;
  --secondary: #14532d;
  --secondary-hover: #064e3b;
  --border: #b7f0d0;
  --glow: rgba(16, 185, 129, 0.28);
  --radius-m: 12px;
  --radius-l: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% -10%, rgba(16, 185, 129, 0.25), transparent 42%),
    radial-gradient(circle at 82% 8%, rgba(52, 211, 153, 0.2), transparent 36%),
    linear-gradient(180deg, #064e3b 0%, var(--bg) 100%);
  color: var(--text);
  animation: bgPulse 16s ease-in-out infinite;
}

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

body::before {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(167, 243, 208, 0.08) 0,
      rgba(167, 243, 208, 0.08) 1px,
      transparent 1px,
      transparent 16px
    ),
    repeating-linear-gradient(
      45deg,
      rgba(16, 185, 129, 0.06) 0,
      rgba(16, 185, 129, 0.06) 1px,
      transparent 1px,
      transparent 20px
    );
  opacity: 0.55;
  animation: patternSweep 30s linear infinite;
}

body::after {
  background:
    radial-gradient(circle at 30% 30%, rgba(110, 231, 183, 0.15) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 62%, rgba(52, 211, 153, 0.14) 0 2px, transparent 3px);
  background-size: 180px 180px, 220px 220px;
  opacity: 0.45;
  animation: patternDrift 24s linear infinite;
}

.container::before,
.container::after {
  content: "";
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  z-index: 0;
  opacity: 0.45;
  animation: floatGlow 12s ease-in-out infinite;
}

.container::before {
  top: -140px;
  left: -120px;
  background: #34d399;
}

.container::after {
  bottom: -160px;
  right: -130px;
  background: #10b981;
  animation-delay: -4s;
}

.container {
  width: min(960px, 92%);
  margin: 0 auto;
  padding: 32px 0 56px;
  position: relative;
  z-index: 1;
}

.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--window-bg) 0%, var(--window-bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow:
    0 22px 40px rgba(5, 150, 105, 0.14),
    0 6px 16px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(6px);
  padding: clamp(18px, 4vw, 28px);
  animation: cardIn 0.75s ease both, cardFloat 7s ease-in-out infinite;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      120deg,
      rgba(5, 150, 105, 0.08) 0,
      rgba(5, 150, 105, 0.08) 1px,
      transparent 1px,
      transparent 16px
    ),
    repeating-radial-gradient(
      circle at 20% 25%,
      rgba(16, 185, 129, 0.07) 0 2px,
      transparent 3px 16px
    );
  opacity: 0.5;
  animation: cardTextureDrift 14s linear infinite;
}

.card > * {
  position: relative;
  z-index: 1;
}

.section-gap {
  margin-top: 18px;
}

.toolbar {
  justify-content: space-between;
  align-items: center;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(26px, 4vw, 32px);
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, #047857, #10b981);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: titleGlow 5s ease-in-out infinite;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

p {
  margin: 0 0 12px;
  line-height: 1.6;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-block {
  margin-bottom: 12px;
}

.form-tips {
  margin-top: 6px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #065f46;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #9ee7c5;
  border-radius: var(--radius-m);
  background: #f0fdf4;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  background: #ffffff;
}

button {
  border: none;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #10b981 0%, var(--primary) 100%);
  color: #ffffff;
  border-radius: var(--radius-m);
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button::after {
  content: "";
  position: absolute;
  top: -120%;
  left: -35%;
  width: 32%;
  height: 340%;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
  transform: rotate(24deg);
  animation: buttonShine 3.2s ease-in-out infinite;
  pointer-events: none;
}

button.secondary {
  background: linear-gradient(135deg, #166534 0%, var(--secondary) 100%);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px var(--glow);
  filter: saturate(1.08);
}

button.secondary:hover:not(:disabled) {
  box-shadow: 0 12px 22px rgba(20, 83, 45, 0.28);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(16, 185, 129, 0.35);
  outline-offset: 2px;
}

button:disabled {
  background: #86efac;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-m);
  border: 1px solid #86efac;
  background: #ecfdf5;
  color: #047857;
  animation: statusGlow 4.4s ease-in-out infinite;
}

.status-card {
  margin-top: 10px;
}

.error {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #b91c1c;
}

.success {
  background: #ecfdf5;
  color: #047857;
}

.module-card {
  border: 1px solid #9fe6c5;
  border-radius: var(--radius-m);
  padding: 16px;
  background: linear-gradient(145deg, #f7fef9 0%, #dcfce7 100%);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: moduleFloat 6.5s ease-in-out infinite;
}

.module-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 28px rgba(16, 185, 129, 0.2);
}

.module-card h3 {
  margin: 0 0 8px;
}

.module-card p {
  margin-bottom: 6px;
}

.module-card a {
  display: inline-block;
  margin-top: 10px;
  text-decoration: none;
  color: #047857;
  font-weight: 600;
}

.text-link {
  align-self: center;
  color: #065f46;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.stream-box {
  width: 100%;
  min-height: 220px;
  margin-top: 10px;
  border: 1px solid #14532d;
  border-radius: 10px;
  padding: 12px;
  background: #052e2b;
  color: #d1fae5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  animation: streamGlow 3.6s ease-in-out infinite;
}

.link-list a {
  display: block;
  margin-top: 8px;
  color: #047857;
  text-decoration: underline;
}

@keyframes floatGlow {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(22px, -10px, 0) scale(1.08);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes patternDrift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(36px, 20px, 0);
  }
}

@keyframes bgPulse {
  0% {
    filter: saturate(1) brightness(1);
  }
  50% {
    filter: saturate(1.08) brightness(1.06);
  }
  100% {
    filter: saturate(1) brightness(1);
  }
}

@keyframes patternSweep {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(32px, 24px, 0);
  }
}

@keyframes cardIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardFloat {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes cardTextureDrift {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 120px 80px, -90px 70px;
  }
}

@keyframes titleGlow {
  0% {
    filter: drop-shadow(0 0 0 rgba(16, 185, 129, 0.15));
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.35));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(16, 185, 129, 0.15));
  }
}

@keyframes buttonShine {
  0% {
    transform: translateX(-150%) rotate(24deg);
  }
  45% {
    transform: translateX(-150%) rotate(24deg);
  }
  100% {
    transform: translateX(390%) rotate(24deg);
  }
}

@keyframes statusGlow {
  0% {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
  }
  50% {
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.22);
  }
  100% {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes moduleFloat {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes streamGlow {
  0% {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
  }
  50% {
    box-shadow: 0 0 14px rgba(52, 211, 153, 0.25);
  }
  100% {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
  }
}

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

@media (max-width: 720px) {
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions button {
    width: 100%;
  }

  .text-link {
    align-self: flex-start;
    margin-top: 4px;
  }
}
