/* Diagnostics page (test.html). Kept separate from the app so it renders even when the app is broken. */
/* Self-hosted Public Sans so the page renders identically offline / when the CDN is blocked.
   This page is deliberately dependency-free: no bundler, no app modules — it must work
   even when the rest of FileSync is broken. */
@font-face {
  font-family: 'Public Sans'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../assets/fonts/public-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Public Sans'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../assets/fonts/public-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --border: #e4e7ec;
  --border-strong: #d4d9e0;
  --text: #1c2128;
  --muted: #677082;
  --accent: #0d6efd;
  --accent-contrast: #ffffff;
  --ok: #0f8a4d; --ok-bg: rgba(15, 138, 77, 0.10);
  --warn: #9a6207; --warn-bg: rgba(214, 138, 18, 0.14);
  --bad: #d12b3b; --bad-bg: rgba(209, 43, 59, 0.10);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1217;
    --surface: #161b22;
    --surface-2: #1d242d;
    --border: #2a313b;
    --border-strong: #38414d;
    --text: #e6e9ee;
    --muted: #98a2b3;
    --accent: #4d9bff;
    --accent-contrast: #0e1217;
    --ok: #3fb950; --ok-bg: rgba(63, 185, 80, 0.14);
    --warn: #e3a008; --warn-bg: rgba(227, 160, 8, 0.14);
    --bad: #f85149; --bad-bg: rgba(248, 81, 73, 0.14);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
/* Chrome's translator popup, unstyled under the CSP (see app.css). */
#goog-gt-tt, .goog-te-balloon-frame, .goog-te-spinner-pos { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 32px 20px 64px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 760px; margin: 0 auto; }

/* ---- Header ---- */
header.page { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
header.page img { width: 40px; height: 40px; border-radius: 9px; }
header.page .titles h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
header.page .titles p { margin: 1px 0 0; font-size: 13px; color: var(--muted); }
.lead { font-size: 14px; color: var(--muted); margin: 14px 0 22px; }

/* ---- Hero verdict ---- */
.hero {
  display: flex; gap: 16px; align-items: flex-start;
  border: 1px solid var(--border); border-left-width: 4px;
  border-radius: var(--radius); background: var(--surface);
  padding: 18px 20px; margin-bottom: 26px; box-shadow: var(--shadow);
  transition: border-color .2s ease;
}
.hero-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.hero-title { font-size: 17px; font-weight: 700; margin: 0 0 2px; letter-spacing: -0.01em; }
.hero-sub { font-size: 14px; color: var(--muted); margin: 0; }
.hero--ok   { border-left-color: var(--ok); }
.hero--warn { border-left-color: var(--warn); }
.hero--bad  { border-left-color: var(--bad); }
.hero--wait { border-left-color: var(--border-strong); }
.hero--ok   .hero-icon { background: var(--ok-bg);   color: var(--ok); }
.hero--warn .hero-icon { background: var(--warn-bg); color: var(--warn); }
.hero--bad  .hero-icon { background: var(--bad-bg);  color: var(--bad); }
.hero--wait .hero-icon { background: var(--surface-2); color: var(--muted); }

/* ---- Sections / cards ---- */
section { margin-bottom: 26px; }
.section-head { margin: 0 0 10px; padding: 0 2px; }
.section-head h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
.section-head p { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card.pad { padding: 6px 18px; }

/* ---- Capability rows ---- */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.row:last-child { border-bottom: none; }
.row > span:first-child { color: var(--text); }

/* ---- Status pill ---- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.3;
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok   { color: var(--ok);   background: var(--ok-bg); }
.pill.bad  { color: var(--bad);  background: var(--bad-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.wait { color: var(--muted); background: var(--surface-2); }
.pill.wait::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ---- Status lines (ICE / signaling) ---- */
.status-line {
  margin: 0; padding: 13px 16px; font-size: 13.5px;
  border-bottom: 1px solid var(--border); display: flex; gap: 9px; align-items: baseline;
}
.status-line:last-child { border-bottom: none; }
.status-line code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.status-line strong { font-weight: 650; }

/* ---- Sink tiers ---- */
.tier { display: flex; gap: 13px; padding: 15px 16px; border-bottom: 1px solid var(--border); }
.tier:last-child { border-bottom: none; }
.tier.selected { background: var(--ok-bg); box-shadow: inset 3px 0 0 var(--ok); }
.tier.unavailable { opacity: 0.5; }
.tier-icon { font-size: 17px; line-height: 1.4; flex-shrink: 0; width: 22px; text-align: center; }
.tier-body { flex: 1; min-width: 0; }
.tier-title { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tier-tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.04em; text-transform: uppercase; }
.tier-tag.selected-tag { background: var(--ok); color: var(--accent-contrast); }
.tier-tag.forced-tag   { background: var(--bad); color: #fff; }
.tier-tag.fallback-tag { background: var(--warn); color: #fff; }
.tier-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tier-reason { font-size: 12px; color: var(--muted); margin-top: 5px; font-family: var(--mono); }
.explain { font-size: 13px; color: var(--muted); margin-top: 10px; padding: 0 2px; }

/* ---- Notice ---- */
.notice {
  display: none; gap: 12px; align-items: flex-start;
  background: var(--warn-bg); border: 1px solid var(--warn);
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 24px; font-size: 13.5px;
}
.notice .notice-icon { flex-shrink: 0; font-size: 16px; line-height: 1.4; }
.notice code { font-family: var(--mono); font-size: 12.5px; background: rgba(0,0,0,0.06); padding: 1px 6px; border-radius: 5px; }
@media (prefers-color-scheme: dark) { .notice code { background: rgba(255,255,255,0.08); } }

/* ---- Share ---- */
.share-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
button#copy-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
  border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-contrast); cursor: pointer;
  transition: filter .15s ease, transform .05s ease;
}
button#copy-btn:hover { filter: brightness(1.06); }
button#copy-btn:active { transform: translateY(1px); }
#copy-status { font-size: 13px; color: var(--muted); }
pre#diagnostics-json {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 12px; line-height: 1.5; overflow-x: auto;
  white-space: pre-wrap; word-break: break-word; font-family: var(--mono);
  color: var(--text); margin: 0; max-height: 360px; overflow-y: auto;
}

/* ---- Footer ---- */
footer.page { margin-top: 36px; text-align: center; font-size: 13px; color: var(--muted); }
footer.page a { color: var(--accent); text-decoration: none; }
footer.page a:hover { text-decoration: underline; }

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