:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6a66;
  --line: #e4e1da;
  --accent: #1f5f4a;
  --accent-text: #ffffff;
  --works: #1f6f43;
  --works-bg: #e3f3e9;
  --ok2g: #4b6a12;
  --ok2g-bg: #eef4dc;
  --check: #8a5a00;
  --check-bg: #fbf0d6;
  --bad: #a1271f;
  --bad-bg: #fbe4e1;
  --unknown: #5a5a5a;
  --unknown-bg: #ececea;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
  --ph-body: #e9e6df;
  --ph-screen: #c9d6cf;
  --ph-key: #d3cfc6;
  --ph-hinge: #cfcac0;
}

/* Dark theme: follows the device unless the visitor picked a theme with the
   header toggle (data-theme on <html>, set by theme.js). Keep both copies equal. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161614;
    --surface: #1f1f1d;
    --text: #ecebe6;
    --muted: #a4a29c;
    --line: #34332f;
    --accent: #7fc8a9;
    --accent-text: #10241c;
    --works: #8fd8a8;
    --works-bg: #1d3626;
    --ok2g: #c5dc8a;
    --ok2g-bg: #2c3418;
    --check: #f0c66b;
    --check-bg: #3a2f14;
    --bad: #f2a199;
    --bad-bg: #40201d;
    --unknown: #c4c3be;
    --unknown-bg: #2e2e2b;
    --ph-body: #34332f;
    --ph-screen: #2c4038;
    --ph-key: #46443f;
    --ph-hinge: #3d3b37;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161614;
  --surface: #1f1f1d;
  --text: #ecebe6;
  --muted: #a4a29c;
  --line: #34332f;
  --accent: #7fc8a9;
  --accent-text: #10241c;
  --works: #8fd8a8;
  --works-bg: #1d3626;
  --ok2g: #c5dc8a;
  --ok2g-bg: #2c3418;
  --check: #f0c66b;
  --check-bg: #3a2f14;
  --bad: #f2a199;
  --bad-bg: #40201d;
  --unknown: #c4c3be;
  --unknown-bg: #2e2e2b;
  --ph-body: #34332f;
  --ph-screen: #2c4038;
  --ph-key: #46443f;
  --ph-hinge: #3d3b37;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; font-size: 1.0625rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
img, svg { max-width: 100%; }

/* Keyboard focus: always visible, never just a colour change. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--accent); color: var(--accent-text); padding: 10px 16px; border-radius: 6px; font-weight: 600; }
.skip-link:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Comfortable line length for reading. */
main p, main li, main dd { max-width: 70ch; }
.card p, .card li, .results li, .specs li, .chips li, .country-list li, .alternatives li { max-width: none; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 1.2rem 0 0.6rem; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 0.6rem; }
.lead { font-size: 1.1rem; color: var(--muted); }

header.site { border-bottom: 1px solid var(--line); background: var(--surface); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px; }
.logo { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--text); }
nav { display: flex; gap: 16px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--text); }

.notice { background: var(--check-bg); color: var(--check); padding: 10px 0; font-size: 0.95rem; }
.notice-inline { background: var(--unknown-bg); padding: 6px 10px; border-radius: 6px; display: inline-block; }

.hero p { color: var(--muted); font-size: 1.1rem; margin-top: 0; }
.hero p.tagline { color: var(--text); font-size: 1.25rem; font-weight: 600; margin-bottom: 6px; }

.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; }
.field span, .features legend { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
select, button { font: inherit; }
select { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
.more-filters { grid-column: 1 / -1; }
.more-filters summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; padding: 4px 0; }
.features { border: 0; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.features label { font-size: 0.95rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 28px; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
@media (max-width: 520px) {
  .filters { grid-template-columns: 1fr 1fr; padding: 12px; gap: 10px 12px; }
  .filters .field:first-child { grid-column: 1 / -1; }
  .features label { white-space: normal; }
}
.check { grid-column: 1 / -1; font-size: 0.95rem; }
.actions { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; }
button { background: var(--accent); color: var(--accent-text); border: 0; padding: 10px 18px; border-radius: 6px; font-weight: 600; cursor: pointer; }

.count { color: var(--muted); margin: 18px 0 8px; }
.results { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .card { grid-template-columns: 1fr 260px; } }
.card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.card h2 a { color: var(--text); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.card p { margin: 0 0 6px; }
.specs { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.specs li { font-size: 0.85rem; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.why { font-size: 0.9rem; color: var(--muted); margin-top: 6px !important; }
.price { font-weight: 600; }
.empty { padding: 20px; text-align: center; color: var(--muted); }

.badge { display: inline-block; font-size: 0.85rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.v-works { color: var(--works); background: var(--works-bg); }
.v-works_on_2g { color: var(--ok2g); background: var(--ok2g-bg); }
.v-check { color: var(--check); background: var(--check-bg); }
.v-issues, .v-no_calls { color: var(--bad); background: var(--bad-bg); }
.v-unknown { color: var(--unknown); background: var(--unknown-bg); }

.verdict-box { border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.verdict-box .badge { background: var(--surface); }
.verdict-box p { margin: 8px 0 0; font-size: 1.1rem; color: var(--text); }

.checks, .reports { padding-left: 0; list-style: none; }
.checks li, .reports li { padding: 8px 12px 8px 36px; position: relative; border-bottom: 1px solid var(--line); }
.checks li::before { position: absolute; left: 10px; font-weight: 700; }
.c-pass::before { content: "✓"; color: var(--works); }
.c-fail::before { content: "✗"; color: var(--bad); }
.c-warn::before { content: "!"; color: var(--check); }
.c-unknown::before { content: "?"; color: var(--unknown); }
.reports li::before { position: absolute; left: 12px; content: "•"; }

.two-col { display: grid; gap: 24px; }
@media (min-width: 800px) { .two-col { grid-template-columns: 1fr 1fr; } }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table th { font-weight: 500; color: var(--muted); width: 50%; }
.yes { color: var(--works); font-weight: 600; }
.no { color: var(--muted); }
@media (max-width: 600px) { .hide-sm { display: none; } }

.offers { list-style: none; padding: 0; }
.offers li { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.crumbs { margin: 16px 0 0; font-size: 0.9rem; }
.sources { margin-top: 32px; font-size: 0.9rem; }
.sources a { word-break: break-word; }
.net-facts { padding-left: 18px; }
.net-list { columns: 2; padding-left: 18px; }
.prose { max-width: 680px; }
.story { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.story h2 { font-size: 1.25rem; }
.story h3 { font-size: 1.05rem; margin-bottom: 4px; }
.pros-cons { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 24px; }
dl dt { margin-top: 14px; }
dl dd { margin: 4px 0 0; }

footer.site { border-top: 1px solid var(--line); margin-top: 48px; padding: 20px 0; color: var(--muted); font-size: 0.9rem; }
.countries { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.countries a[aria-current] { font-weight: 600; color: var(--text); text-decoration: none; }
.country-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.country-list a { display: block; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 1.1rem; font-weight: 600; text-decoration: none; }
.country-list a:hover { border-color: var(--accent); }

/* Finder: live filtering */
.js .no-js-only { display: none; }
.n { color: var(--muted); font-size: 0.85em; }
.is-empty { color: var(--muted); }
.chips { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 0.9rem; color: var(--text); }
.chips a:hover { border-color: var(--accent); }
.chips .clear a { border-style: dashed; color: var(--muted); }
.hidden-note { font-size: 0.95rem; }
#results { transition: opacity 0.15s; }
#results.loading { opacity: 0.55; }
.empty p { margin: 4px 0; }

/* Phone images and placeholder outlines */
.ph { width: 100%; height: 100%; display: block; }
.ph-body { fill: var(--ph-body); stroke: var(--line); stroke-width: 1.5; }
.ph-screen { fill: var(--ph-screen); }
.ph-key { fill: var(--ph-key); }
.ph-hinge { fill: var(--ph-hinge); }
.phone-img { display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 8px; overflow: hidden; }
.phone-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.phone-img--thumb { width: 100%; aspect-ratio: 3 / 4; padding: 6px; }
.phone-img--large { width: 100%; aspect-ratio: 4 / 5; padding: 16px; background: var(--surface); border: 1px solid var(--line); }
.phone-img--placeholder.phone-img--large { padding: 40px; }

.card { grid-template-columns: 76px 1fr; }
.card-img { grid-row: span 2; align-self: start; }
.card-side { grid-column: 2; }
@media (min-width: 700px) {
  .card { grid-template-columns: 110px 1fr 260px; }
  .card-img { grid-row: auto; }
  .card-side { grid-column: auto; }
}

.phone-hero { display: grid; gap: 16px 28px; align-items: center; margin-top: 8px; }
@media (min-width: 700px) { .phone-hero { grid-template-columns: minmax(220px, 320px) 1fr; } }
.phone-hero--compact { grid-template-columns: 72px 1fr; gap: 16px; }
@media (min-width: 700px) { .phone-hero--compact { grid-template-columns: 96px 1fr; } }
.phone-hero h1 { margin-top: 0; }
.gallery { margin: 0; }
.gallery figcaption { font-size: 0.85rem; margin-top: 6px; }
.gallery-more { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 8px; }
.gallery-more img { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.gallery { max-width: 340px; }
@media (max-width: 699px) { .gallery { max-width: 220px; } }

/* Working alternatives on a "doesn't work / not confirmed" verdict page */
.alternatives ul { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.alternatives li a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.alternatives li a:hover { border-color: var(--accent); }
.alternatives .alt-name { font-weight: 600; }
.alternatives .badge { align-self: flex-start; }

/* Theme toggle */
.theme-toggle { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 3px 12px; font-size: 0.85rem; font-weight: 500; cursor: pointer; }
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }

/* Stock */
.stock { font-size: 0.8rem; font-weight: 600; border-radius: 999px; padding: 1px 8px; }
.stock--out { color: var(--unknown); background: var(--unknown-bg); }
.stock--back, .stock--pre { color: var(--check); background: var(--check-bg); }
.stock-notice { font-size: 0.9rem; border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.stock-notice a { color: inherit; font-weight: 600; }

/* Linked maker photos: fall back to the outline if the maker's image fails to load */
.ph-fallback { display: none; width: 100%; height: 100%; }
.img-failed img { display: none; }
.img-failed .ph-fallback { display: block; }

/* 4G calling table */
.findings ul { padding-left: 18px; }
.findings li { margin: 6px 0; }
.findings li .muted { display: block; font-size: 0.9rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; background: var(--surface); }
.table-scroll:focus { outline: 2px solid var(--accent); }
table.calling { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 0.85rem; }
table.calling th, table.calling td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: center; }
table.calling thead th { vertical-align: bottom; font-weight: 600; }
table.calling thead th a { color: var(--text); text-decoration: none; }
table.calling thead th.mvno { font-weight: 500; color: var(--muted); }
table.calling .runs-on { display: block; font-size: 0.75rem; font-weight: 400; color: var(--muted); }
table.calling .phone-col { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; border-right: 1px solid var(--line); }
table.calling tbody th a { color: var(--text); }
.cell { display: inline-block; border-radius: 999px; padding: 2px 8px; font-weight: 600; font-size: 0.78rem; text-decoration: none; }
.legend { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; align-items: center; font-size: 0.9rem; }
.legend dd { margin: 0; }
