/* Theme: dark is the bare/default palette (matches the site's original
   dark-only look exactly, so anyone with no saved preference and no
   system signal sees no change). Light overrides apply two ways: system
   preference via the media query below, or an explicit choice from the
   toggle button via [data-theme] — see theme.js. The explicit attribute
   always wins over system preference in either direction. */
:root {
  --bg: #0f1013;
  --panel: #0f1013;
  --modal-bg: #16171b;
  --border: #26272c;
  --text: #f2f1ee;
  --text-body: #c9c8c3;
  --text-muted: #8f8e8a;
  --accent: #d89a44;
  --chip-active-bg: #6e4614;
  --chip-active-text: #fdecd0;
  --chip-inactive-border: #3a3b42;
  --row-hover: #17181c;
  --thumb-panel: #23242a;
  --danger: #e5484d;
  --aperture-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23d89a44' d='M22,12 A10,10 0 0 1 17,20.7 L15.3,13.1 Z M17,20.7 A10,10 0 0 1 7,20.7 L12.7,15.4 Z M7,20.7 A10,10 0 0 1 2,12 L9.4,14.3 Z M2,12 A10,10 0 0 1 7,3.3 L8.7,10.9 Z M7,3.3 A10,10 0 0 1 17,3.3 L11.3,8.6 Z M17,3.3 A10,10 0 0 1 22,12 L14.6,9.7 Z'/%3E%3C/svg%3E");
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

/* Light palette, WCAG AA-checked the same way DESIGN.md's dark palette
   was: text-muted ~4.64:1, accent ~5.47:1, danger ~5.15:1, chip-active-
   text on chip-active-bg ~6.99:1 against the light bg/chip fill below.
   Preserve these ratios if adjusted further. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f6f3;
    --panel: #f7f6f3;
    --modal-bg: #ffffff;
    --border: #ded9d0;
    --text: #1c1b19;
    --text-body: #45423d;
    --text-muted: #726f68;
    --accent: #8a5a16;
    --chip-active-bg: #d9ad6a;
    --chip-active-text: #3d2400;
    --chip-inactive-border: #c7c2b8;
    --row-hover: #efece6;
    --thumb-panel: #efece6;
    --danger: #c62a30;
    --aperture-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%238a5a16' d='M22,12 A10,10 0 0 1 17,20.7 L15.3,13.1 Z M17,20.7 A10,10 0 0 1 7,20.7 L12.7,15.4 Z M7,20.7 A10,10 0 0 1 2,12 L9.4,14.3 Z M2,12 A10,10 0 0 1 7,3.3 L8.7,10.9 Z M7,3.3 A10,10 0 0 1 17,3.3 L11.3,8.6 Z M17,3.3 A10,10 0 0 1 22,12 L14.6,9.7 Z'/%3E%3C/svg%3E");
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f7f6f3;
  --panel: #f7f6f3;
  --modal-bg: #ffffff;
  --border: #ded9d0;
  --text: #1c1b19;
  --text-body: #45423d;
  --text-muted: #726f68;
  --accent: #8a5a16;
  --chip-active-bg: #d9ad6a;
  --chip-active-text: #3d2400;
  --chip-inactive-border: #c7c2b8;
  --row-hover: #efece6;
  --thumb-panel: #efece6;
  --danger: #c62a30;
  --aperture-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%238a5a16' d='M22,12 A10,10 0 0 1 17,20.7 L15.3,13.1 Z M17,20.7 A10,10 0 0 1 7,20.7 L12.7,15.4 Z M7,20.7 A10,10 0 0 1 2,12 L9.4,14.3 Z M2,12 A10,10 0 0 1 7,3.3 L8.7,10.9 Z M7,3.3 A10,10 0 0 1 17,3.3 L11.3,8.6 Z M17,3.3 A10,10 0 0 1 22,12 L14.6,9.7 Z'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-body);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Groups the title with the theme toggle as a single flex child of
   .topbar, keeping .topbar back down to exactly two top-level children
   (this group, .topbar-actions) so justify-content: space-between still
   just pins them to opposite edges the way it always did — including
   when .topbar wraps at narrow widths, where each wrapped line's lone
   item sits flush left (space-between has no effect with one item on a
   line). The toggle deliberately lives here rather than inside
   .topbar-actions so it shares row 1 with the title on mobile instead of
   getting stranded alone on its own row below the wrapping action
   buttons. */
.topbar-brand { display: flex; align-items: center; gap: 10px; }

.topbar h1 { font-size: 18px; margin: 0; color: var(--text); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.result-count { color: var(--text-muted); font-size: 13px; font-family: var(--font-mono); }

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.view-toggle button {
  border: none;
  background: transparent;
  color: var(--text-body);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
}

.view-toggle button[aria-pressed="true"] {
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
}

.search-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  width: 220px;
  background: var(--bg);
  color: var(--text-body);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-body);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-bg);
  color: var(--chip-active-text);
}

.btn-primary:not(:disabled):hover { filter: brightness(1.15); }

.btn-ghost:hover { background: var(--row-hover); border-color: var(--chip-inactive-border); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  width: 30px;
  height: 30px;
  color: var(--text-body);
}

/* Icon shown = destination, not current state (tap the sun to go light,
   tap the moon to go dark) — matches the common GitHub-style convention.
   Purely CSS-driven so it tracks a live system-preference change with no
   JS involved; theme.js only needs to handle the click, not the icon. */
.theme-icon { display: inline-flex; }
.theme-icon-moon { display: none; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-icon-sun { display: none; }
  :root:not([data-theme="dark"]) .theme-icon-moon { display: inline-flex; }
}

:root[data-theme="light"] .theme-icon-sun { display: none; }
:root[data-theme="light"] .theme-icon-moon { display: inline-flex; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  align-items: start;
}

.filters {
  padding: 20px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--chip-inactive-border) transparent;
}

.filters::-webkit-scrollbar { width: 8px; }
.filters::-webkit-scrollbar-thumb { background: var(--chip-inactive-border); border-radius: 4px; }
.filters::-webkit-scrollbar-track { background: transparent; }

.filter-category {
  padding: 10px 0 10px 10px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid var(--border);
}

.filter-category summary,
.filter-subcategory summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  user-select: none;
}

.filter-category summary:hover,
.filter-subcategory summary:hover { color: var(--text); }

.filter-category[open] summary { margin-bottom: 6px; }

.filter-cat-body { padding-top: 4px; }

.filter-subcategory {
  margin: 4px 0 14px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

.filter-subcategory .filter-cat-body { padding-top: 8px; }

.btn-more {
  display: block;
  width: 100%;
  text-align: left;
  padding: 5px 8px;
  font-size: 12px;
  margin-top: 4px;
}

.filter-group { margin-bottom: 18px; }

.filter-group:last-child { margin-bottom: 0; }

.filter-group h3 {
  font-size: 12px;
  color: var(--text);
  margin: 0 0 8px;
  font-weight: 500;
}

/* Filter values render as chips: solid brass fill when active, transparent
   with a muted border when inactive. The checkbox stays in the DOM (for
   keyboard/screen-reader use) but is visually hidden; :has() drives state. */
.check-list { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }

.check-list label {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--chip-inactive-border);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}

.check-list label:hover { border-color: var(--text-muted); color: var(--text-body); }

.check-list label:has(input:checked) {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-bg);
  color: var(--chip-active-text);
}

.check-list label input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* The columns picker (in its modal) is a settings checklist, not a facet
   filter — kept as a plain vertical list rather than pill chips. */
.check-list-plain { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

.check-list-plain label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--text-body);
}

.check-list-plain label:hover { border: none; color: var(--text-body); }

.check-list-plain label:has(input:checked) {
  background: none;
  border: none;
  color: var(--text-body);
}

.check-list-plain label input {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  opacity: 1;
  accent-color: var(--accent);
}

.bool-select {
  font-size: 13px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-body);
}

.range-row { position: relative; height: 28px; }

.range-input {
  position: absolute;
  width: 100%;
  top: 8px;
  pointer-events: none;
  appearance: none;
  background: transparent;
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  pointer-events: all;
  width: 16px;
  height: 16px;
  background: var(--aperture-icon) no-repeat center / contain;
  cursor: pointer;
  margin-top: -7px;
}

.range-input::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--border);
}

.range-input::-moz-range-thumb {
  pointer-events: all;
  width: 16px;
  height: 16px;
  background: var(--aperture-icon) no-repeat center / contain;
  cursor: pointer;
  border: none;
}

.range-input::-moz-range-track { height: 2px; background: var(--border); }

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 4px;
}

.content { padding: 20px 24px; overflow-x: auto; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
  font-size: 12px;
  line-height: 1.4;
}

.active-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.active-chip-remove:hover { background: rgba(0, 0, 0, 0.25); }

.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }

/* Card view — an alternative to the table, primarily for narrow/mobile
   screens where the table's ~15 default columns mean scrolling past
   Brand/Model/Buy to see anything else. Shows a small curated set of
   specs (not the Columns-picker selection, which is table-only — a
   card doesn't have room for 15 columns) plus a headline resolution
   figure, so at least one differentiator is visible without any
   interaction. See buildCardFields() in app.js for the field list. */
.card-list { display: flex; flex-direction: column; gap: 16px; }

/* The `hidden` attribute alone can't override the rule above once it's
   applied once — an explicit `display` in author CSS beats the browser's
   default `[hidden] { display: none }` regardless of source order, since
   user-agent styles are always lowest-priority. Needs its own higher-
   specificity rule to actually hide again after being shown. */
.card-list[hidden] { display: none; }

.cam-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }

.cam-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.cam-card-head input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

.cam-card-name {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  flex-grow: 1;
  cursor: pointer;
}

.cam-card-name:hover { color: var(--accent); text-decoration: underline; }

.cam-card-headline { color: var(--text-body); font-family: var(--font-mono); font-size: 13px; }

.cam-card-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; }

.cam-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--chip-inactive-border);
  font-size: 11px;
}

.cam-tag-label { color: var(--text-muted); }

.cam-tag-value { color: var(--text-body); font-family: var(--font-mono); }

.cam-tag-value.unverified-value { text-underline-offset: 1px; }

.cam-tag-buy {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-bg);
  color: var(--chip-active-text);
  font-family: var(--font-sans);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

table { border-collapse: collapse; width: 100%; font-size: 13px; white-space: nowrap; }

thead th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--panel);
}

thead th:hover { color: var(--text); }

.col-align-right { text-align: right; }

thead th.sorted-asc::after { content: " \25B2"; color: var(--accent); }
thead th.sorted-desc::after { content: " \25BC"; color: var(--accent); }

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  color: var(--text-body);
}

tbody tr:last-child td { border-bottom: none; }

tbody td.no-data,
.compare-table td.no-data { color: var(--text-muted); }

tbody tr:hover { background: var(--row-hover); }

.model-cell {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.model-cell:hover { color: var(--accent); text-decoration: underline; }

/* Marks a value sourced from somewhere other than the manufacturer, or an
   estimate — hover shows why (see data_notes). */
.unverified-value {
  font-style: italic;
  text-decoration: underline dotted var(--text-muted);
  text-underline-offset: 2px;
  cursor: help;
}

.notes-cell {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  white-space: normal;
  max-width: 260px;
}

/* Per-resolution-tier compare rows (see buildVideoTierRows in app.js) —
   replaces the old flat max-resolution/max-framerate rows. */
.video-mode-fps {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}

.video-mode-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.video-mode-expand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
}

.video-mode-expand:hover { text-decoration: underline; }

@media (pointer: coarse) {
  .video-mode-expand { padding: 6px 0; margin-top: 2px; }
}

.video-mode-expand::before {
  content: '\25b8';
  display: inline-block;
  transition: transform 0.12s ease;
}

.video-mode-expand[aria-expanded="true"]::before { transform: rotate(90deg); }

.video-mode-alt-list {
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--modal-bg);
  border-radius: 4px;
}

.video-mode-alt + .video-mode-alt { margin-top: 6px; }

/* A mode's free-text note, shown when its cell is expanded (tap-friendly:
   no hover needed). Wraps rather than widening the compare column. */
.video-mode-note {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.video-mode-alt-list > .video-mode-note { margin: 0 0 6px; }

.video-mode-alt-fps {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}

/* Sidebar "min fps at resolution" control (see buildVideoModeFilterControl
   in app.js) — pairs the existing .bool-select style with a plain number
   input sized for a short fps value. */
.video-mode-filter-row {
  display: flex;
  gap: 8px;
}

.video-mode-fps-input {
  width: 80px;
}

/* Buy column stays pinned to the right edge of the table so it's reachable
   even when many columns are visible and the table scrolls horizontally. */
.buy-col {
  position: sticky;
  right: 0;
  background: var(--panel);
  box-shadow: -6px 0 6px -6px rgba(0, 0, 0, 0.5);
}

thead th.buy-col { cursor: default; z-index: 2; }

tbody tr:hover .buy-col { background: var(--row-hover); }

.buy-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

.buy-buttons-icon { flex-wrap: nowrap; }

.btn-buy {
  display: inline-block;
  font-family: var(--font-sans);
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-buy:hover { filter: brightness(1.15); }

.btn-buy-sm { padding: 4px 9px; font-size: 12px; }

/* Compare-header variant: icon-only so a "check price" link can sit inline next to the
   camera name instead of costing a full row of its own -- the wide full-width button this
   replaced there was the single biggest thing eating vertical space in a short/landscape
   modal (see .camera-name-row). Rounded-square rather than circular per the request that
   introduced this, and sized to type comfortably (touch-first: no hover-only affordance). */
.btn-buy-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.camera-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal[hidden] {
  display: none;
}

/* While any modal is open the page behind it must not scroll. The page scrolls
   on the window, so wheel/touch over the non-scrolling parts of a modal (camera
   names, header, backdrop) used to chain through to it. Locking the root fixes
   every modal at once; overscroll-behavior stops a modal's own scroller from
   handing leftover scroll to the page at its ends. scrollbar-gutter keeps the
   page from shifting sideways when its scrollbar disappears. */
html { scrollbar-gutter: stable; }
html:has(.modal:not([hidden])) { overflow: hidden; }
.modal, .modal-body, .compare-scroll-area { overscroll-behavior: contain; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-panel {
  position: relative;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 85vh;
  width: min(460px, 92vw);
  display: flex;
  flex-direction: column;
}

.modal-panel-wide { width: min(1000px, 92vw); }

.columns-actions { display: flex; gap: 8px; margin-bottom: 16px; }

.columns-category { margin-bottom: 18px; }

.columns-category:last-child { margin-bottom: 0; }

.columns-category h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { margin: 0; font-size: 16px; color: var(--text); }

.modal-header-actions { display: flex; align-items: center; gap: 8px; }

.modal-body {
  padding: 16px 20px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--chip-inactive-border) transparent;
}

.modal-body::-webkit-scrollbar { width: 8px; height: 8px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--chip-inactive-border); border-radius: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }

/* A second, more prominent entry point to the compare/details modal
   alongside #compareBtn in the topbar — see the HTML comment above this
   element. Uses the same brass "active" treatment as .active-chip and
   .btn-primary (rather than a neutral panel) specifically so it reads as
   obviously interactive/alive against the dark page, not just a floating
   info panel. No drop shadow per DESIGN.md — the saturated fill already
   gives it enough definition without one. */
.floating-compare-bar {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 4px 4px 4px 8px;
  background: var(--chip-active-bg);
  border-radius: 999px;
  z-index: 50;
}

.floating-compare-bar[hidden] { display: none; }

.floating-compare-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--chip-active-text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.floating-compare-action:hover { filter: brightness(1.15); }

.floating-compare-divider { width: 1px; background: rgba(0, 0, 0, 0.25); margin: 6px 0; }

.floating-compare-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--chip-active-text);
  font-size: 13px;
  cursor: pointer;
}

.floating-compare-clear:hover { background: rgba(0, 0, 0, 0.25); }

/* The camera-name row used to be a sticky <thead> inside this same table,
   pinned via position: sticky. Dropped that entirely after finding it's a
   genuinely unreliable technique across browsers -- Firefox has its own
   long history of distinct, still-unresolved bugs with position: sticky
   on table cells/thead (separate from whatever Chromium does), on top of
   the border-collapse and repaint issues already hit fixing this once.
   The header now lives in a wholly separate table (#compareHeadTable, see
   .compare-head-wrap) that's simply never part of the scrolling content,
   sidestepping the entire category of bugs rather than working around it.
   table-layout: fixed + an identical <colgroup> (built in
   buildCompareColgroup in app.js) on both tables is what keeps their
   columns aligned despite being two unrelated tables. */
.compare-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }

.compare-modal-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.compare-head-wrap { flex: 0 0 auto; padding: 16px 20px 0; overflow: hidden; }

.compare-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--chip-inactive-border) transparent;
}

.compare-scroll-area::-webkit-scrollbar { width: 8px; height: 8px; }
.compare-scroll-area::-webkit-scrollbar-thumb { background: var(--chip-inactive-border); border-radius: 4px; }
.compare-scroll-area::-webkit-scrollbar-track { background: transparent; }

.compare-table th, .compare-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.compare-table td {
  font-family: var(--font-mono);
  color: var(--text-body);
  max-width: 210px;
  white-space: normal;
  overflow-wrap: break-word;
}

.compare-table th.spec-label {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-weight: 500;
  max-width: 160px;
  white-space: normal;
}

.compare-table th.camera-col {
  font-family: var(--font-sans);
  color: var(--text);
  font-weight: 700;
  max-width: 210px;
  white-space: normal;
}

.camera-col-nav { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }

/* One small front-view image above each camera name in the compare/detail header (cards and table have none). */
.camera-thumb { height: 96px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
  padding: 6px; border-radius: 6px; background: var(--thumb-panel); }
.camera-thumb img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.camera-thumb-credit { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-bottom: 6px; }
@media (max-width: 600px) { .camera-thumb { height: 72px; } }

/* Landscape phones (short viewport, often wider than 600px so the rule above never fires):
   the compare header's per-camera column (nav arrows, thumbnail, credit, name, buy button,
   report link) is a non-shrinking flex item (compare-head-wrap is flex: 0 0 auto), so on a
   ~375px-tall screen its ~260px content height leaves almost nothing for the actual spec
   table below it -- the one thing this modal exists to show. Dropping the decorative
   thumbnail/credit here is the cheapest way to give the table real room back. */
@media (max-height: 500px) {
  .camera-thumb, .camera-thumb-credit { display: none; }
}

.btn-move {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  color: var(--text-body);
}

.btn-move:hover:not(:disabled) { background: var(--row-hover); }

.btn-move:disabled { opacity: 0.3; cursor: not-allowed; }

.compare-table th.compare-category {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 12px;
}

.filters-toggle-btn { display: none; }

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar-actions { flex-wrap: wrap; row-gap: 8px; }

  .filters-toggle-btn { display: inline-block; }

  .layout { grid-template-columns: 1fr; }
  .filters {
    display: none;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .filters.filters-open { display: block; }
}

/* ---------- Admin portal (public/admin/) ---------- */

.admin-actions-col { white-space: nowrap; }

thead th.admin-actions-col { cursor: default; }

.admin-actions-wrap { display: flex; gap: 6px; }

.admin-status { color: var(--text-muted); font-size: 13px; }

.admin-status.admin-status-error { color: var(--danger); }

.admin-form-category { margin-bottom: 12px; }

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
  padding-top: 4px;
}

.admin-form-row { display: flex; flex-direction: column; gap: 4px; }

.admin-form-row-wide { grid-column: 1 / -1; }

.admin-form-row label { color: var(--text-muted); font-size: 12px; }

.admin-form-row input,
.admin-form-row select,
.admin-form-row textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text-body);
  font-size: 13px;
  font-family: var(--font-mono);
}

.admin-form-row textarea { min-height: 60px; resize: vertical; }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 6px;
}

.tag-input:focus-within { border-color: var(--text-muted); }

.tag-input-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.admin-form-row .tag-input-text {
  flex: 1 1 120px;
  min-width: 120px;
  border: none;
  background: transparent;
  padding: 2px;
}

.tag-input-text:focus { outline: none; }

.btn-sm { padding: 4px 8px; font-size: 12px; }

.video-modes-note { color: var(--text-muted); font-size: 13px; margin: 0; }

.video-modes-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.video-mode-row,
.video-mode-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  flex-wrap: wrap;
}

.video-mode-row-summary { font-size: 13px; color: var(--text-body); }

.video-mode-row-actions,
.video-mode-add-row { gap: 6px; }

.video-mode-row-editing { align-items: flex-start; }

.video-mode-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}

.video-mode-input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 6px;
  color: var(--text-body);
  font-size: 12px;
  font-family: var(--font-mono);
}

.video-mode-input-resolution { flex: 0 0 100px; }
.video-mode-input-fps { flex: 0 0 80px; }
.video-mode-input-crop,
.video-mode-input-bitdepth,
.video-mode-input-notes { flex: 1 1 120px; min-width: 100px; }

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.admin-form-error { color: var(--danger); font-size: 13px; }

.video-mode-input-format { flex: 0 0 130px; }

.data-footnote {
  margin: 16px 0 24px;
  font-size: 12px;
  color: var(--text-muted);
}

/* One small "report a correction" entry point per camera column in the compare/detail
   header — deliberately understated text, not a full button, so it doesn't compete with
   the Buy links above it. touch-first: it's always visible, never hover-only. */
.btn-report-issue {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 4px 0;
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

.btn-report-issue:hover { color: var(--text); }

.report-current-value {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-mono);
}

.report-success { color: var(--text); font-size: 14px; }

.cf-turnstile-wrap { margin-top: 12px; }

.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.report-approve-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  color: var(--text-body);
  font-size: 12px;
  font-family: var(--font-mono);
  min-width: 140px;
}

.report-status-label { font-size: 12px; color: var(--text-muted); }

.report-estimate-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
