:root {
  color-scheme: light dark;
  --bg: #f4f5f8;
  --card: #ffffff;
  --text: #1b2130;
  --muted: #5a6377;
  --border: #dde1e8;
  --accent: #1f5eff;
  --accent-hover: #1749cc;
  --accent-text: #ffffff;
  --success: #12704a;
  --success-bg: #e7f6ee;
  --error: #b42318;
  --error-bg: #fdecea;
  --info-bg: #eef2fb;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --card: #1b1f27;
    --text: #e7eaf0;
    --muted: #a0a9b8;
    --border: #2f3542;
    --accent: #6d94ff;
    --accent-hover: #8aa9ff;
    --accent-text: #0b1020;
    --success: #5fd09b;
    --success-bg: #14291f;
    --error: #ff8f86;
    --error-bg: #2e1715;
    --info-bg: #1c2333;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.card {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: 0 8px 28px rgb(0 0 0 / 6%);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 { margin: 0; font-size: 1.5rem; line-height: 1.25; }
.lede { margin: 8px 0 24px; color: var(--muted); }

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

button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.source {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  text-align: left;
}
.source:not(:disabled):hover { background: var(--accent-hover); }
.source-title { font-weight: 600; font-size: 1.05rem; }
.source-hint { font-size: 0.85rem; opacity: 0.85; }

.status {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--info-bg);
  overflow-wrap: anywhere;
}
.status[data-tone="success"] { background: var(--success-bg); color: var(--success); }
.status[data-tone="error"] { background: var(--error-bg); color: var(--error); }

.files {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.files dl { margin: 0; }
.files dl div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 8px; }
.files dt { color: var(--muted); }
.files dd { margin: 0; overflow-wrap: anywhere; }
.files-note { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions:not(:has(button:not([hidden]))) { display: none; }

a.secondary { display: inline-block; text-decoration: none; }

.secondary {
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

footer { margin-top: 24px; font-size: 0.85rem; color: var(--muted); }
.privacy { margin: 0; }

.link {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}

[hidden] { display: none !important; }
