/* AnyDub extension settings.
   Tokens mirror styles.css so this page belongs to the same site, but it is
   self-contained: it must render correctly on its own, since the extension
   links straight here without loading the marketing stylesheet. */
:root {
  color-scheme: light;
  --page-bg: #f6f2eb;
  --card: #fffdfa;
  --text: #111116;
  --muted: #625f6d;
  --line: rgba(17, 17, 22, 0.1);
  --line-soft: rgba(17, 17, 22, 0.06);
  --accent: #cf9dff;
  --accent-deep: #7b46b8;
  --ok: #1c8b62;
  --warn: #9a5b12;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 96px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }

.wrap { max-width: 720px; margin: 0 auto; }

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
}
.brand img { width: 26px; height: 26px; border-radius: 6px; }

/* Live save indicator. Reserving its width stops the header jittering as the
   text swaps between states. */
.save-state {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 11ch;
  text-align: right;
}
.save-state[data-state="saved"] { color: var(--ok); }
.save-state[data-state="error"] { color: #b3261e; }

/* ── Intro ── */
.intro { padding: 46px 0 34px; }
.eyebrow {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  font-weight: 800;
}
h1 em {
  display: block;
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 0.92em;
}
.intro p { margin: 0; color: var(--muted); line-height: 1.65; max-width: 52ch; }

/* ── Extension-missing banner ── */
.banner {
  display: none;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  margin-bottom: 26px;
  border-radius: 14px;
  background: #fdf3e3;
  border: 1px solid rgba(154, 91, 18, 0.25);
  color: var(--warn);
  line-height: 1.6;
  font-size: 0.9rem;
}
.banner.show { display: flex; }
.banner strong { display: block; color: #7a460c; margin-bottom: 2px; }
.banner a { font-weight: 700; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 22px;
  margin-bottom: 20px;
}
.card > h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  padding: 18px 0 4px;
  letter-spacing: -0.01em;
}
.card > .card-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── Rows ── */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
}
.card > h2 + .row,
.card > .card-note + .row,
.card > .row:first-of-type { border-top: 0; }

.row-label { flex: 1; min-width: 0; }
.row-label b { display: block; font-size: 0.94rem; font-weight: 600; margin-bottom: 3px; }
.row-label small { display: block; color: var(--muted); font-size: 0.83rem; line-height: 1.55; }

/* Switch — a real checkbox underneath, so it stays keyboard-operable and
   announces its state to screen readers. */
.switch { position: relative; flex-shrink: 0; width: 46px; height: 27px; }
.switch input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer; z-index: 1;
}
.switch span {
  position: absolute; inset: 0;
  background: rgba(17, 17, 22, 0.16);
  border-radius: 999px;
  transition: background 160ms ease;
  pointer-events: none;
}
.switch span::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 160ms ease;
}
.switch input:checked + span { background: var(--accent-deep); }
.switch input:checked + span::after { transform: translateX(19px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-deep); outline-offset: 3px; }
/* With no extension to save to, the controls show their defaults but must not
   look like live state the user is reading their real configuration from. */
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: 0.4; }

select {
  flex-shrink: 0;
  min-width: 220px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
select:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Shortcuts ── */
.shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.shortcut:first-of-type { border-top: 0; }
.shortcut-name { font-size: 0.92rem; font-weight: 600; }
.keys { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
kbd {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 7px;
  background: #f2eee7;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  white-space: nowrap;
}
.keys .unset { font-size: 0.83rem; color: var(--muted); font-weight: 500; }

/* Chrome refuses navigation to chrome:// from a web page, so the address is
   presented as copyable text rather than a link that would silently fail. */
.chrome-url {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 18px;
  padding: 12px 14px;
  border-radius: 11px;
  background: #f2eee7;
  border: 1px solid var(--line);
}
.chrome-url code {
  flex: 1;
  font-size: 0.83rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
  white-space: nowrap;
}
.copy-btn {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.copy-btn:hover { background: #111116; color: #fff; }
.copy-btn.done { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }

/* ── Footer ── */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 26px;
  color: var(--muted);
  font-size: 0.85rem;
}
.foot a { font-weight: 600; }

@media (max-width: 560px) {
  .row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .switch, select { align-self: flex-start; }
  select { width: 100%; min-width: 0; }
}
