:root {
  color-scheme: dark;
  --bg: #0a0f1f;
  --bg-2: #0f1730;
  --panel: rgba(17, 24, 45, 0.88);
  --panel-strong: #121a31;
  --panel-soft: #18223e;
  --text: #edf2ff;
  --muted: #9aa7c7;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #5b8cff;
  --accent-hover: #78a4ff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(91, 140, 255, 0.18), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}

input {
  font: inherit;
}

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.auth-shell {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.auth-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0d1427;
  color: var(--text);
  padding: 14px 16px;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 28px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a9b8dc;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  max-width: 680px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero-badge {
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  color: #cbd8f7;
  background: rgba(255, 255, 255, 0.04);
}

.workspace {
  padding: 22px;
}

.workspace-header h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.workspace-header p {
  margin: 0 0 18px;
  color: var(--muted);
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  min-height: 520px;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #dbe5ff;
  margin-bottom: 14px;
}

.composer {
  display: flex;
  flex-direction: column;
  height: calc(100% - 30px);
}

.controls-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.controls-row-wrap {
  flex-wrap: wrap;
}

select,
textarea,
button {
  font: inherit;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0d1427;
  color: var(--text);
}

select {
  min-height: 48px;
  max-width: 220px;
  padding: 10px 12px;
}

textarea {
  flex: 1;
  min-height: 350px;
  resize: vertical;
  padding: 18px;
  line-height: 1.6;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.status {
  color: var(--muted);
  font-size: 0.95rem;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.copy-button {
  min-height: 46px;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
}

.primary-button:hover {
  background: var(--accent-hover);
}

.secondary-button,
.copy-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-button:hover,
.copy-button:hover {
  background: rgba(255, 255, 255, 0.04);
}

.copy-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
}

.hidden {
  display: none;
}

.typing-dots {
  display: inline-flex;
  gap: 6px;
}

.typing-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.45;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.result {
  min-height: 420px;
  border-radius: 18px;
  padding: 18px;
  background: var(--panel-soft);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  transition: opacity 0.18s ease;
}

.result.is-placeholder {
  color: var(--muted);
  display: flex;
  align-items: center;
}

.result.is-error {
  color: #ffb4b4;
  border: 1px solid rgba(255, 100, 100, 0.22);
}

@media (max-width: 920px) {
  .hero {
    flex-direction: column;
  }

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

  .panel {
    min-height: auto;
  }

  textarea,
  .result {
    min-height: 260px;
  }
}

@media (max-width: 640px) {
  .app {
    width: min(100%, calc(100% - 16px));
    padding: 14px 0 20px;
  }

  .hero,
  .workspace,
  .auth-card,
  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .hero h1,
  .auth-card h1 {
    font-size: 1.6rem;
  }

  .controls-row,
  .actions,
  .auth-actions {
    flex-direction: column;
    align-items: stretch;
  }

  select {
    max-width: none;
  }

  textarea {
    min-height: 220px;
    padding: 14px;
  }

  .result {
    min-height: 220px;
    padding: 14px;
  }

  .button-row {
    justify-content: stretch;
  }

  .button-row button,
  .auth-actions button,
  .copy-button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
