:root {
  color-scheme: light;
  --bg: #f4ede1;
  --bg-soft: #fbf7f0;
  --panel: rgba(255, 252, 245, 0.92);
  --panel-strong: #fffdf8;
  --text: #18212b;
  --muted: #586473;
  --line: rgba(24, 33, 43, 0.12);
  --line-strong: rgba(24, 33, 43, 0.22);
  --accent: #0f766e;
  --accent-strong: #0b5b56;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --shadow: 0 28px 80px rgba(48, 39, 25, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Avenir Next", "Trebuchet MS", sans-serif;
  --font-body: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.18), transparent 28rem),
    radial-gradient(circle at bottom left, rgba(194, 65, 12, 0.16), transparent 24rem),
    linear-gradient(160deg, #f6eee3 0%, #efe6d6 45%, #f8f4ec 100%);
  color: var(--text);
  font-family: var(--font-body);
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1800px, calc(100% - 1.6rem));
  margin: 0 auto;
  padding: 2rem 0 2.4rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1rem 0 1.8rem;
}

.hero-text {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.hero h1,
.results-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2rem, 3vw, 3.2rem);
  max-width: 12ch;
}

.hero-copy {
  margin: 0.8rem 0 0;
  max-width: 62ch;
  line-height: 1.6;
  color: var(--muted);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 33, 43, 0.08);
  box-shadow: 0 16px 36px rgba(24, 33, 43, 0.08);
}

.brand-logo {
  display: block;
  width: min(180px, 24vw);
  height: auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(700px, 1.2fr);
  gap: 1.35rem;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel-left {
  padding: 1.25rem;
}

.panel-right {
  padding: 1.25rem 1.25rem 1.1rem;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
}

.control {
  display: grid;
  gap: 0.45rem;
}

.control span {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

select {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--text);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #115e59 100%);
  color: #fff;
  box-shadow: 0 16px 32px rgba(15, 118, 110, 0.24);
}

.button-primary:hover {
  background: linear-gradient(135deg, var(--accent-strong) 0%, #0b4f4a 100%);
}

.button-secondary {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-row {
  display: grid;
  gap: 0.25rem;
  min-height: 2.7rem;
  margin-top: 0.9rem;
}

.mode-hint,
.status-message {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.mode-hint {
  font-weight: 600;
}

.status-message.is-error {
  color: #b91c1c;
}

.preview-frame {
  margin-top: 0.9rem;
  padding: 1rem;
  min-height: 58vh;
  border-radius: calc(var(--radius-lg) - 8px);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(251, 247, 240, 0.9));
  overflow: auto;
}

.preview-pages {
  display: grid;
  gap: 1rem;
}

.preview-embed {
  width: 100%;
  min-height: calc(58vh - 2rem);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(24, 33, 43, 0.08);
  box-shadow: 0 14px 34px rgba(24, 33, 43, 0.08);
  background: #fff;
}

.preview-empty {
  margin: 0;
  padding: 1.4rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.results-head h2 {
  font-size: clamp(1.3rem, 2vw, 1.9rem);
}

.table-wrap {
  overflow: auto;
  border-radius: calc(var(--radius-lg) - 10px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

thead {
  background: #f2f9f8;
}

th,
td {
  padding: 0.85rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

tbody tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

.placeholder-row td {
  text-align: center;
  color: var(--muted);
  padding: 1.4rem;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-frame {
    min-height: 44vh;
  }

  .preview-embed {
    min-height: calc(44vh - 2rem);
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100%, calc(100% - 1rem));
    padding-top: 1.2rem;
  }

  .hero {
    flex-direction: column;
  }

  .brand-link {
    align-self: flex-start;
  }

  .toolbar,
  .results-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .button,
  select {
    width: 100%;
  }

  .panel-left,
  .panel-right {
    padding: 1rem;
  }

  th,
  td {
    padding: 0.75rem;
  }
}
