:root {
  color-scheme: dark;
  --bg: #09111f;
  --bg-deep: #050a13;
  --panel: rgba(10, 20, 37, 0.82);
  --panel-strong: rgba(7, 16, 31, 0.94);
  --text: #eff5ff;
  --muted: #9ba9c2;
  --border: rgba(141, 167, 209, 0.18);
  --border-strong: rgba(141, 167, 209, 0.28);
  --primary: #7dd3fc;
  --primary-contrast: #08111f;
  --secondary: rgba(18, 32, 56, 0.88);
  --success: #7ef7c7;
  --warn: #f5c56b;
  --error: #ff8c8c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(42, 84, 160, 0.45), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(14, 125, 172, 0.22), transparent 24%),
    linear-gradient(180deg, #0c1730, var(--bg-deep) 70%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.topbar {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 96px);
}

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

.auth-panel {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
}

.site-title {
  margin: 12px 0 0;
  font-size: clamp(2.1rem, 4vw, 3.6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.site-copy {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.topbar-meta {
  display: grid;
  gap: 14px;
}

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

.session-user {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(13, 24, 43, 0.82);
  color: var(--text);
}

.session-button {
  min-height: 42px;
}

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

.tool-switcher {
  display: grid;
  gap: 18px;
  padding: 20px;
  margin-bottom: 20px;
}

.tool-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tool-tab {
  background: rgba(13, 24, 43, 0.92);
  color: var(--muted);
  border-color: var(--border);
}

.tool-tab:hover {
  transform: none;
}

.tool-tab:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.tool-tab-active {
  background: rgba(125, 211, 252, 0.16);
  color: var(--primary);
  border-color: rgba(125, 211, 252, 0.28);
}

.tool-meta {
  display: grid;
  gap: 6px;
}

.tool-kicker,
.tool-name,
.tool-description,
.section-tag {
  margin: 0;
}

.tool-kicker,
.section-tag {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}

.tool-name {
  font-size: 1.25rem;
  font-weight: 700;
}

.tool-description {
  color: var(--muted);
  line-height: 1.6;
}

.hero {
  display: grid;
  gap: 28px;
  padding: 28px;
}

.hero-copy h2 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.eyebrow {
  display: inline-block;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.16);
  color: var(--primary);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(125, 211, 252, 0.28);
}

.subcopy {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.input-panel {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel-strong);
}

label,
h2,
h3 {
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: rgba(3, 9, 20, 0.78);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

input {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: rgba(3, 9, 20, 0.78);
  color: var(--text);
  font: inherit;
}

textarea:focus,
input:focus,
button:focus,
.download-link:focus,
.copy-button:focus {
  outline: 2px solid rgba(125, 211, 252, 0.55);
  outline-offset: 2px;
}

.actions {
  display: grid;
  gap: 12px;
}

button,
.download-link,
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover,
.download-link:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

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

.primary:disabled,
.secondary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status-line {
  margin: 0;
  min-height: 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.hidden {
  display: none !important;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.chip,
.badge-neutral {
  background: rgba(18, 32, 56, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
}

.badge-success {
  background: rgba(126, 247, 199, 0.12);
  color: var(--success);
}

.badge-warn {
  background: rgba(245, 197, 107, 0.12);
  color: var(--warn);
}

.badge-error {
  background: rgba(255, 140, 140, 0.12);
  color: var(--error);
}

.results {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.result {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.result-main {
  min-width: 0;
}

.result-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

.result-url {
  color: var(--muted);
  word-break: break-all;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-block {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(6, 14, 27, 0.72);
  border: 1px solid rgba(141, 167, 209, 0.1);
}

.result-block h3 {
  margin-top: 0;
}

.download-link {
  background: var(--primary);
  color: var(--primary-contrast);
}

.error-text {
  color: var(--error);
}

.pending-text {
  color: var(--muted);
}

.transcript-shell {
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(141, 167, 209, 0.14);
  background: rgba(2, 8, 18, 0.72);
}

.transcript-preview {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
  white-space: pre-wrap;
}

.source-label {
  margin: 10px 0 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
}

.thumb-shell {
  align-self: start;
  aspect-ratio: 16 / 9;
  min-height: auto;
  width: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, #101f39, #153357);
  border: 1px solid rgba(141, 167, 209, 0.14);
}

.thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 860px) {
  .topbar {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: end;
  }

  .hero {
    grid-template-columns: 1.15fr 0.85fr;
    padding: 36px;
  }

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

  .result {
    grid-template-columns: minmax(0, 1.3fr) 320px;
    align-items: start;
  }

  .result-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}
