:root {
  --bg: #120707;
  --bg-soft: #201012;
  --panel: rgba(31, 16, 18, 0.88);
  --panel-strong: rgba(48, 21, 24, 0.96);
  --line: rgba(255, 255, 255, 0.1);
  --text: #fff4ef;
  --muted: #e8cfc5;
  --accent: #ff2e2e;
  --accent-soft: #ff7a5c;
  --ok: #29d18c;
  --warn: #ffb347;
  --danger: #ff6969;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", "Aptos", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 46, 46, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 122, 92, 0.18), transparent 24%),
    linear-gradient(160deg, #090304 0%, #16090a 45%, #260d0f 100%);
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-note,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 46, 46, 0.26), transparent 70%);
}

.eyebrow,
.section-kicker,
.mini-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  font-size: 0.74rem;
  color: var(--accent-soft);
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 0.95;
  max-width: 11ch;
}

.hero-text,
.hero-note li,
.summary-text,
.live-text,
.event-log,
.field span,
.checkbox-field span {
  color: var(--muted);
}

.hero-text {
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 60ch;
}

.hero-note {
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 46, 46, 0.18), transparent 70%),
    var(--panel-strong);
}

.note-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  color: var(--text);
}

.hero-note ol {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.dashboard {
  display: grid;
  gap: 24px;
}

.setup-panel,
.test-panel,
.output-panel {
  padding: 28px;
}

.panel-heading,
.finals-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.panel-heading h2,
.finals-header h3 {
  margin: 0;
}

.field,
.checkbox-field {
  display: grid;
  gap: 10px;
}

.field span,
.checkbox-field span,
.mini-label {
  font-size: 0.78rem;
}

.mini-label {
  margin: 0 0 6px;
  color: var(--accent-soft);
}

.field input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
}

.field select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(255, 46, 46, 0.42);
  outline-offset: 2px;
  border-color: transparent;
}

.advanced-card {
  margin-top: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  padding: 0 18px 18px;
}

.advanced-card summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 0;
  color: var(--text);
}

.advanced-card summary::-webkit-details-marker {
  display: none;
}

.advanced-grid {
  display: grid;
  gap: 16px;
}

.provider-fields {
  display: grid;
  gap: 16px;
}

.provider-fields-full {
  grid-column: 1 / -1;
}

.provider-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.advanced-note {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.checkbox-field {
  grid-template-columns: 18px 1fr;
  align-items: start;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, #ff4d2f 100%);
}

.button.secondary {
  color: white;
  background: linear-gradient(135deg, #6b2e2e 0%, #9d2e2e 100%);
}

.button.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.button.small {
  padding: 9px 13px;
  font-size: 0.88rem;
}

.config-summary,
.session-meta {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.summary-text {
  margin: 0;
  min-height: 1.4em;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-wide {
  grid-column: 1 / -1;
}

.live-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.live-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.live-text {
  margin: 0;
  min-height: 84px;
  line-height: 1.7;
  font-size: 1rem;
}

.muted {
  opacity: 0.85;
}

.finals-panel,
.log-panel,
.limits-panel,
.latency-panel {
  margin-top: 22px;
}

.limits-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.latency-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.metric-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.metric-row strong {
  color: var(--text);
  font-size: 1.02rem;
}

.metric-row:first-of-type {
  border-top: 0;
}

.final-events {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.event-card {
  border-radius: 22px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.chip,
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.chip {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.pill.ok {
  background: rgba(41, 209, 140, 0.14);
  color: #b4ffd9;
}

.pill.warn {
  background: rgba(255, 179, 71, 0.16);
  color: #ffe1a6;
}

.pill.danger {
  background: rgba(255, 105, 105, 0.18);
  color: #ffd0d0;
}

.pill.neutral {
  background: rgba(255, 255, 255, 0.08);
}

.source-line,
.translation-line {
  margin: 0;
  line-height: 1.7;
}

.translation-line {
  margin-top: 8px;
  color: var(--text);
}

.event-log {
  margin: 14px 0 0;
  max-height: 300px;
  overflow: auto;
  border-radius: 20px;
  padding: 16px;
  background: rgba(7, 5, 5, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.55;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .hero,
  .live-columns,
  .latency-grid,
  .test-grid,
  .config-summary,
  .session-meta {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-note,
  .setup-panel,
  .test-panel,
  .output-panel {
    padding: 22px;
  }
}
