:root {
  --bg: #f7f4ec;
  --bg-deep: #ebe7dc;
  --paper: rgba(255, 253, 249, 0.78);
  --paper-strong: #fffdf8;
  --ink: #1c242c;
  --ink-soft: #596975;
  --line: rgba(104, 121, 136, 0.22);
  --line-strong: rgba(104, 121, 136, 0.45);
  --accent: #dd5630;
  --accent-strong: #b84526;
  --ghost: #e1e8ee;
  --ghost-hover: #d6e0e8;
  --shadow: 0 22px 60px rgba(34, 38, 45, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

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

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

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
  animation: backgroundDrift 12s ease-in-out infinite;
}

body::before {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -90px;
  background: radial-gradient(circle, rgba(255, 165, 98, 0.32) 0%, rgba(255, 165, 98, 0) 70%);
}

body::after {
  width: 460px;
  height: 460px;
  bottom: -140px;
  right: -110px;
  background: radial-gradient(circle, rgba(132, 194, 212, 0.28) 0%, rgba(132, 194, 212, 0) 72%);
  animation-delay: 1.5s;
}

.shell {
  max-width: 1220px;
  margin: 2.2rem auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.1rem;
}

.panel {
  background: var(--paper);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  animation: panelRise 0.45s ease forwards;
}

h1,
h2 {
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
  color: var(--ink-soft);
}

label {
  display: block;
  margin-top: 0.95rem;
  margin-bottom: 0.38rem;
  font-weight: 700;
  color: #2c3740;
}

input,
select,
textarea,
button {
  width: 100%;
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.72rem 0.78rem;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(221, 86, 48, 0.65);
  box-shadow: 0 0 0 3px rgba(221, 86, 48, 0.16);
}

textarea {
  resize: vertical;
  min-height: 210px;
}

.actions {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

button {
  border: none;
  border-radius: 12px;
  padding: 0.72rem 0.8rem;
  cursor: pointer;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 700;
  transition: transform 0.14s ease, filter 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.05) brightness(1.02);
}

button:active {
  transform: translateY(0);
}

button.ghost {
  background: var(--ghost);
  color: var(--ink);
}

button.ghost:hover {
  background: var(--ghost-hover);
  filter: none;
}

.status {
  margin-top: 0.72rem;
  color: var(--ink-soft);
  min-height: 1.45rem;
}

.hidden {
  display: none;
}

.output-controls {
  display: grid;
  gap: 0.36rem;
  margin-bottom: 0.82rem;
}

progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: #e8edf2;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, #f28764 0%, #de5e37 100%);
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, #f28764 0%, #de5e37 100%);
}

pre {
  margin: 0;
  max-height: 68vh;
  overflow: auto;
  padding: 1rem;
  border-radius: 14px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
}

#failuresWrap h2 {
  margin-top: 1rem;
}

.disclaimer {
  text-align: center;
  padding: 1.2rem 1rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  grid-column: 1 / -1;
}

@media (max-width: 740px) {
  .shell {
    margin: 1.1rem auto;
    gap: 0.9rem;
  }

  .panel {
    padding: 0.95rem;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 185px;
  }
}
