/* The app's colors: navy and mint from the icon, and the status colors of the cards
   (statusColors in ui/theme/Theme.kt). */
:root {
  --navy: #1B1F3B;
  --mint: #7CE0C3;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #1a1d2e;
  --muted: #5b6075;
  --border: #e1e4ee;
  --accent: #127a5e;
  --head-bg: #f6f7fb;
  --yes: #1E8E5A;
  --likely: #2F6FB5;
  --no: #C0392B;
  --unknown: #6B6B75;
  color-scheme: light;
}

/* Until lang.js puts in the texts (the home page does it once its module has loaded), the menu,
   the content and the footer stay hidden: otherwise the badges and empty boxes show up first. */
.loading .tabs, .loading main, .loading footer { visibility: hidden; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11142a;
    --surface: #1B1F3B;
    --text: #e9ebf5;
    --muted: #a5aac4;
    --border: #2c3156;
    --accent: #7CE0C3;
    --head-bg: #20254a;
    --yes: #6FD8A0;
    --likely: #9CCBFF;
    --no: #FF9A8F;
    --unknown: #B8B8C0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Header in the app icon's navy */
.site-header {
  background: var(--navy);
  color: #fff;
  padding: 22px 0 26px;
  border-bottom: 4px solid var(--mint);
}
.header-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 76px; height: 36px; flex: none;
  fill: none; stroke: var(--mint); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
}
.logo .wave { stroke-width: 3.2; }
.logo .fill { fill: var(--mint); stroke: none; }
.site-header h1, .site-title { margin: 0; font-size: 1.7rem; line-height: 1.2; font-weight: 700; }
a.brand { color: inherit; text-decoration: none; }

/* Section menu under the title (home page), centered; the open section is underlined in mint */
.site-header.with-tabs { padding-bottom: 0; border-bottom-width: 1px; border-bottom-color: #2c3156; }
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 16px; }
.tab {
  font: inherit; font-size: 1rem; cursor: pointer; color: #a5aac4;
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px;
}
.tab:hover, .tab:focus-visible { color: #fff; }
.tab[aria-selected="true"] { color: #fff; font-weight: 600; border-bottom-color: var(--mint); }

/* Last row of the footer: Ad Swap ad on the left and language selector on the right.
   On mobile, both centered: the selector first and the ad below it. */
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px;
}
/* color-scheme: light like the ad's own page; otherwise, in dark mode, the browser paints an opaque
   white box behind the frame (the schemes differ) instead of leaving it transparent */
.ad-swap { border: 0; width: 260px; height: 50px; max-width: 100%; display: block; color-scheme: light; }
/* Language menu: a rounded button and, above it, a card with the languages (the current one in bold,
   in the accent color) */
.lang { position: relative; display: block; }
.lang-button {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--text);
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--accent);
}
.lang-button:hover { background: var(--head-bg); }
.lang-globe { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lang-caret { width: 9px; height: 6px; fill: currentColor; transition: transform 0.15s; }
.lang-button[aria-expanded="false"] .lang-caret { transform: rotate(180deg); }
.lang-list {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 10;
  min-width: 190px; margin: 0; padding: 8px 0; list-style: none; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20, 24, 50, 0.16);
}
.lang-list li { padding: 9px 18px; font-size: 0.95rem; cursor: pointer; color: var(--text); }
.lang-list li:hover, .lang-list li:focus { background: var(--head-bg); outline: none; }
.lang-list li[aria-selected="true"] { color: var(--accent); font-weight: 700; }

main { padding-bottom: 24px; }

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 22px 18px;
  margin-top: 20px;
}
section h2 {
  font-size: 1.15rem; margin: 18px 0 4px;
  padding-left: 10px; border-left: 4px solid var(--mint);
}
section p { margin: 4px 0 10px; }

.muted { color: var(--muted); }

/* About: "Coming soon on Google Play" badge and the Liberapay badge (both 54px tall) */
.badges { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 14px; margin: 18px 0 6px; }
.play-badge {
  display: inline-flex; align-items: center; gap: 12px; height: 54px; box-sizing: border-box;
  padding: 0 14px 0 16px; border-radius: 10px; border: 1px solid #3a3f66;
  background: var(--navy); color: #fff; line-height: 1.1;
}
.play-icon { width: 22px; height: 22px; fill: #fff; flex: none; }
.play-text { display: flex; flex-direction: column; }
.play-small { font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; color: #c9cde6; }
.play-name { font-size: 1.2rem; font-weight: 700; }
.play-pill {
  margin-left: 6px; padding: 3px 10px; border-radius: 999px;
  background: #ff6b6b; color: #fff; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
}
.donate-badge { display: block; line-height: 0; }
.donate-badge img { width: 151px; height: 54px; }
/* Phones: one badge under the other */
@media (max-width: 480px) {
  .badges { flex-direction: column; }
}

/* Reported Phones uses the whole width of the page (16px margins) so the columns have room */
main.wrap:has(> #panel-phones:not([hidden])) { max-width: none; }
/* The footer follows the table's width, so the ad and the language selector line up with its edges. */
body:has(#panel-phones:not([hidden])) > .footer { max-width: none; }
/* Above the table: the "confirmed only" switch (left) and the search box (right). Under it: how many
   phones are shown (left) and the page navigator (right). On narrow screens each goes on its own line. */
.table-tools, .table-foot {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px;
}
.table-count { margin: 0; font-size: 0.85rem; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 0.92rem; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex-shrink: 0; width: 38px; height: 22px; border-radius: 999px; position: relative;
  background: var(--border); transition: background 0.15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: left 0.15s;
}
.switch input:checked + .switch-track { background: var(--yes); }
.switch input:checked + .switch-track::after { left: 19px; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.search {
  font: inherit; font-size: 0.9rem; width: min(100%, 280px);
  padding: 7px 12px; border-radius: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pager { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.pager:empty { display: none; }
.pager button {
  font: inherit; font-size: 0.9rem; min-width: 34px; height: 34px; padding: 0 8px; cursor: pointer;
  border-radius: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.pager button[aria-current="page"] {
  background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600;
}
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager .gap { padding: 0 4px; color: var(--muted); }
.table-scroll { overflow-x: auto; margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
/* Headers centered both ways; long names wrap (the button's max-width) so they don't widen the columns */
th, th.num { background: var(--head-bg); font-weight: 600; color: var(--muted); text-align: center; vertical-align: middle; }
td.phone { font-weight: 600; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.date { white-space: nowrap; }
/* The two resolution columns (without and with a DAC) share one width */
th.res, td.res { width: 150px; min-width: 150px; }
/* Firmware versions are long codes without spaces: smaller, and they can break anywhere */
td.firmware { font-size: 0.85rem; min-width: 11em; overflow-wrap: anywhere; }

/* Column headers: buttons to sort the table; the sorted column is highlighted */
.sort-button {
  font: inherit; color: inherit; font-weight: 600; text-align: inherit; cursor: pointer;
  background: none; border: 0; padding: 0; max-width: 9em;
  /* The name wraps inside its own box and the sort arrow always stays beside it */
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.sort-button > span:first-child { text-align: center; }
.sort-button:hover, .sort-button:focus-visible, .sort-button.active { color: var(--accent); }
.sort-arrow { font-size: 0.8em; opacity: 0.6; flex-shrink: 0; }
.sort-button.active .sort-arrow { opacity: 1; }

/* Like the app's cards: background in the status color at 15% and text in that color */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap;
}
.badge.yes { color: var(--yes); background: color-mix(in srgb, var(--yes) 15%, transparent); }
.badge.likely { color: var(--likely); background: color-mix(in srgb, var(--likely) 15%, transparent); }
.badge.no { color: var(--no); background: color-mix(in srgb, var(--no) 15%, transparent); }
.badge.unknown { color: var(--unknown); background: color-mix(in srgb, var(--unknown) 15%, transparent); }

/* "DACs Tested" cell with several DACs ("+N"), and its dialog */
.dacs-button {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: none; border: 0; padding: 0;
}
.dacs-button .more {
  display: inline-block; margin-left: 2px; padding: 0 8px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  color: var(--accent); border: 1px solid var(--accent);
}
.dacs-button:hover .more, .dacs-button:focus-visible .more { background: var(--accent); color: var(--surface); }
.dacs-dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 64px);
  padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text);
}
.dacs-dialog::backdrop { background: rgba(10, 12, 30, 0.55); }
.dacs-dialog h2 { margin: 0 0 6px; font-size: 1.15rem; }
.dacs-dialog form { text-align: right; margin-top: 14px; }
.table-note { margin: 12px 0 0; font-size: 0.85rem; }

/* Supported Apps: one row per app, with how many phones reported it */
.apps-list { list-style: none; margin: 10px 0 0; padding: 0; }
.apps-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.apps-list li:last-child { border-bottom: 0; }
.apps-list .app-name { font-weight: 600; }
.apps-list a { color: var(--accent); }
.dialog-close {
  font: inherit; font-weight: 600; cursor: pointer; padding: 6px 18px; border-radius: 8px;
  border: 0; background: var(--accent); color: var(--surface);
}

/* About: native bit-perfect vs. the app's own driver; the row names on the left, like headers.
   Fixed column widths, so a long word (MIXER_BEHAVIOR_BIT_PERFECT) breaks instead of widening the table */
.compare table { table-layout: fixed; }
.compare td { overflow-wrap: anywhere; }
.compare thead td { background: var(--head-bg); width: 28%; }
.compare tbody th { text-align: left; vertical-align: top; color: var(--text); hyphens: auto; }

.footer { padding-top: 4px; padding-bottom: 28px; font-size: 0.85rem; text-align: center; }
.footer p { margin: 0 0 4px; }
/* Wide screens: one row with the ad on the left, the links in the middle and the language on the right */
@media (min-width: 821px) {
  .footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
  .footer-bottom { display: contents; }
  .ad-swap { grid-column: 1; grid-row: 1; justify-self: start; }
  .footer-links { grid-column: 2; grid-row: 1; }
  .lang { grid-column: 3; grid-row: 1; justify-self: end; }
}
.footer a, .back a, .legal a, .help a, .phones td a { color: var(--accent); }

/* Privacy policy and terms */
.back { margin: 16px 0 0; }
.legal { padding-bottom: 22px; }
.legal h1 { font-size: 1.6rem; margin: 18px 0 2px; }
.legal p { max-width: 75ch; }

/* Phones and tablets: the table scrolls sideways, so the phone model column stays fixed on the left
   (its name wraps, so it doesn't take half the screen) */
@media (max-width: 820px) {
  .phones .table-scroll tr > :first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--surface); box-shadow: inset -1px 0 0 var(--border);
  }
  .phones .table-scroll th:first-child { background: var(--head-bg); }
  .phones .table-scroll td.phone { white-space: normal; min-width: 7.5em; max-width: 9em; }
}

/* Mobile: language selector above the ad; the three tabs share one row (long names wrap) */
@media (max-width: 600px) {
  /* The title stays on one line: the logo and the font shrink with the screen's width */
  .brand { gap: 2vw; }
  .logo { width: min(13vw, 76px); height: min(6.2vw, 36px); }
  .site-header h1 { font-size: min(5.6vw, 1.7rem); white-space: nowrap; }
  .tabs { flex-wrap: nowrap; gap: 0; }
  .tab { flex: 1 1 0; padding: 10px 6px; font-size: 0.92rem; line-height: 1.25; }
  /* The comparison's three columns fit the screen without scrolling */
  .compare table { font-size: 0.82rem; }
  .compare th, .compare td { padding: 8px; }
  .footer-bottom { flex-direction: column-reverse; }
}

/* Music Player: two columns without borders (logo and screenshot | features), one on phones.
   Orange is the app's icon color; the darker shade keeps the white button text readable. */
.mp-columns {
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 40px;
  align-items: start; padding: 18px 0 6px;
}
.mp-media { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.mp-logo { width: 100%; max-width: 340px; height: auto; }
.mp-phone {
  width: 240px; max-width: 70%; padding: 9px; border-radius: 36px;
  background: #1c1c20; line-height: 0;
}
.mp-phone img { width: 100%; height: auto; border-radius: 27px; }
/* Front camera hole, centered at the top of the screen (sizes in % so it scales with the phone) */
.mp-phone { position: relative; }
.mp-phone::after {
  content: ""; position: absolute; left: 50%; top: 2.6%; transform: translateX(-50%);
  width: 5.5%; aspect-ratio: 1; border-radius: 50%;
  background: #0b0b0e; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}
.mp-intro { margin-top: 0; }
.mp-features { list-style: none; margin: 14px 0; padding: 0; }
.mp-features li { position: relative; padding-left: 30px; margin-bottom: 12px; color: var(--muted); }
.mp-features strong { color: var(--text); }
/* Orange check mark drawn with two borders */
.mp-features li::before {
  content: ""; position: absolute; left: 6px; top: 0.35em;
  width: 6px; height: 12px; border: solid #E8650A; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.mp-buttons { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; }
.mp-button {
  display: inline-block; padding: 10px 18px; border-radius: 10px; font-weight: 600; text-decoration: none;
  color: var(--text); border: 1px solid var(--border);
}
.mp-button:hover { border-color: var(--muted); }
.mp-github { background: #C9520A; border-color: #C9520A; color: #fff; }
.mp-github:hover { background: #A94408; border-color: #A94408; }
.mp-credit { font-size: 0.8rem; margin-top: 18px; }
.mp-credit a { color: var(--accent); }
@media (max-width: 720px) {
  .mp-columns { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
