:root {
  --bg: #0c0d0f;
  --bg-elevated: #15171c;
  --bg-soft: #1b1e26;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f1ea;
  --text-muted: #9a958b;
  --accent: #ff6a3d;
  --accent-soft: rgba(255, 106, 61, 0.16);
  --accent-text: #ffd5c6;
  --success: #7dffa3;
  --danger: #ff7b7b;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

button,
textarea,
select {
  font: inherit;
  color: inherit;
}

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

.bg__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: drift 16s ease-in-out infinite alternate;
}

.bg__glow--a {
  width: min(70vw, 520px);
  height: min(70vw, 520px);
  top: -12%;
  left: -10%;
  background: radial-gradient(circle, rgba(255, 106, 61, 0.45), transparent 68%);
}

.bg__glow--b {
  width: min(60vw, 460px);
  height: min(60vw, 460px);
  right: -8%;
  bottom: 8%;
  background: radial-gradient(circle, rgba(90, 140, 255, 0.22), transparent 70%);
  animation-delay: -6s;
}

.bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 20%, black 20%, transparent 75%);
  opacity: 0.5;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(24px, -18px, 0) scale(1.08); }
}

.shell {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.hero {
  text-align: center;
  margin-bottom: 1.75rem;
  animation: rise 0.7s ease both;
}

.hero__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0.85rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--accent-text);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  font-weight: 600;
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.hero__subtitle {
  margin: 0.85rem auto 0;
  max-width: 28rem;
  color: var(--text-muted);
  font-size: clamp(1rem, 2.8vw, 1.15rem);
}

.panel {
  animation: rise 0.8s ease 0.08s both;
}

.form {
  display: grid;
  gap: 1.1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(180deg, rgba(27, 30, 38, 0.92), rgba(21, 23, 28, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.field {
  display: grid;
  gap: 0.55rem;
}

.field__label {
  font-size: 0.92rem;
  font-weight: 600;
}

.field__textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  padding: 0.95rem 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field__textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.55;
}

.field__textarea:focus {
  border-color: rgba(255, 106, 61, 0.7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.field__hint {
  opacity: 0.75;
}

.audience {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.audience > .field__label {
  padding: 0;
}

.audience__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.audience__option {
  position: relative;
  cursor: pointer;
}

.audience__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.audience__option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.audience__option:hover span {
  border-color: rgba(255, 106, 61, 0.45);
  color: var(--text);
}

.audience__option input:checked + span {
  color: #1a0b07;
  border-color: transparent;
  background: linear-gradient(135deg, #ff7a4d, #ff4d2e 55%, #e23a1c);
  box-shadow: 0 8px 20px rgba(255, 77, 46, 0.22);
}

.audience__option input:focus-visible + span {
  outline: 2px solid rgba(255, 106, 61, 0.8);
  outline-offset: 2px;
}

.audience__option input:disabled + span {
  opacity: 0.45;
  cursor: not-allowed;
}

.audience__option:active span {
  transform: scale(0.98);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 52px;
  padding: 0.85rem 1.15rem;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  width: 100%;
  background: linear-gradient(135deg, #ff7a4d, #ff4d2e 55%, #e23a1c);
  color: #1a0b07;
  box-shadow: 0 12px 30px rgba(255, 77, 46, 0.28);
}

.btn--primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn--primary.is-loading .btn__label {
  opacity: 0.15;
}

.btn--primary.is-loading .btn__spinner {
  opacity: 1;
}

.btn__spinner {
  position: absolute;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(26, 11, 7, 0.25);
  border-top-color: #1a0b07;
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.8s linear infinite;
}

.btn--primary {
  position: relative;
}

.btn--secondary,
.btn--ghost {
  flex: 1 1 140px;
  background: var(--bg-soft);
  border-color: var(--line);
}

.btn--secondary:hover:not(:disabled),
.btn--ghost:hover:not(:disabled) {
  border-color: rgba(255, 106, 61, 0.45);
  background: rgba(255, 106, 61, 0.08);
}

.btn--ghost.is-copied {
  color: var(--success);
  border-color: rgba(125, 255, 163, 0.35);
}

.btn--amplify {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-text);
  background: transparent;
  border-color: rgba(255, 106, 61, 0.28);
  border-style: dashed;
}

.btn--amplify:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: rgba(255, 106, 61, 0.55);
  border-style: solid;
}

.alert {
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 123, 123, 0.35);
  background: rgba(255, 80, 80, 0.1);
  color: #ffd0d0;
  animation: rise 0.35s ease both;
}

.result {
  margin-top: 1.15rem;
}

.result__card {
  padding: 1.25rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 106, 61, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(27, 30, 38, 0.96), rgba(18, 20, 24, 0.98));
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.result__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.result__eyebrow--accent {
  color: var(--accent-text);
}

.result__source,
.result__text {
  margin: 0.55rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.result__source {
  color: var(--text-muted);
  font-size: 1rem;
}

.result__text {
  font-size: 1.08rem;
  line-height: 1.65;
}

.result__arrow {
  margin: 1rem 0;
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
}

.result__footer {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.model-badge {
  margin: 0;
  width: fit-content;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer {
  margin-top: 1.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer p {
  margin: 0;
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 720px) {
  .shell {
    padding-top: 3.5rem;
  }

  .form,
  .result__card {
    padding: 1.5rem;
  }

  .field__textarea {
    min-height: 170px;
  }
}

@media (max-width: 480px) {
  .shell {
    width: min(100% - 1.25rem, 720px);
    padding-top: 1.75rem;
  }

  .field__hint {
    display: none;
  }

  .result__actions {
    flex-direction: column;
  }

  .btn--secondary,
  .btn--ghost {
    width: 100%;
  }
}
