/* Sentry
   Calm utility. ENERGY 1 / RHYTHM 1 / MOTION 1.
   Identity motif: the "ID plate", a labelled, recessed mono value with an attached Copy button.
   Every identifier on the site (Steam IDs, hashes, coordinates, URLs) is shown this way. */

/* Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: light;
  --bg:            #F4F3EF;   /* warm paper, easier on the eyes than pure white during long shifts */
  --surface:       #FFFFFF;
  --surface-2:     #ECEAE4;   /* recessed: plates, tabs track */
  --border:        #D9D6CE;
  --border-strong: #B9B5AA;
  --text:          #1C1E1F;
  --text-2:        #55595C;
  --accent:        #0B6B5D;   /* the original teal, toned from neon to ink */
  --accent-hover:  #09594D;
  --accent-ink:    #FFFFFF;
  --accent-soft:   #DCEFEA;
  --danger:        #B42318;
  --danger-soft:   #FCE8E6;
  --warn:          #8A5300;
  --warn-soft:     #FBF0DB;
  --overlay:       rgba(20, 22, 21, 0.45);

  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;

  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:            #141615;
    --surface:       #1C1F1E;
    --surface-2:     #232726;
    --border:        #2F3432;
    --border-strong: #444A47;
    --text:          #E7E9E6;
    --text-2:        #A3AAA6;
    --accent:        #5CC8B2;
    --accent-hover:  #77D6C3;
    --accent-ink:    #0E1513;
    --accent-soft:   #1F3631;
    --danger:        #FF8A80;
    --danger-soft:   #3A1F1D;
    --warn:          #F2B95B;
    --warn-soft:     #3A2E17;
    --overlay:       rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #141615;
  --surface:       #1C1F1E;
  --surface-2:     #232726;
  --border:        #2F3432;
  --border-strong: #444A47;
  --text:          #E7E9E6;
  --text-2:        #A3AAA6;
  --accent:        #5CC8B2;
  --accent-hover:  #77D6C3;
  --accent-ink:    #0E1513;
  --accent-soft:   #1F3631;
  --danger:        #FF8A80;
  --danger-soft:   #3A1F1D;
  --warn:          #F2B95B;
  --warn-soft:     #3A2E17;
  --overlay:       rgba(0, 0, 0, 0.6);
}

/* Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 600; line-height: 1.25; }
code, kbd { font-family: var(--font-mono); font-size: .9em; }
ul { list-style: none; }
img, video { max-width: 100%; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

a[href], button:not(:disabled), select, summary, label[for], [role="tab"] { cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 3000;
  background: var(--surface); color: var(--text);
  padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
.skip-link:focus { top: 12px; }

/* Shell ----------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
main { overflow-y: auto; min-width: 0; outline: none; }

.topbar { display: none; }

.brand-mark {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  font-weight: 600; font-size: 16px; letter-spacing: -.01em;
  color: var(--text); text-decoration: none; border-radius: var(--r-sm);
}
.brand-mark:hover { color: var(--text); }
.logo { flex-shrink: 0; }
.logo-plate { fill: var(--text); }
.logo-glyph { fill: none; stroke: var(--bg); stroke-width: 5.5; }
.logo-tab   { fill: var(--accent); }

/* Sidebar */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 4px; }
.sidebar-head .icon-btn { display: none; }

.nav { padding: 4px 12px 16px; flex: 1; }
.nav-group {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  padding: 16px 8px 6px;
}
.nav ul { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text); text-decoration: none; font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item i { width: 16px; text-align: center; color: var(--text-2); font-size: 14px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:active { background: var(--border); }
/* Current page: weight + edge marker + tint, so it never relies on colour alone */
.nav-item[aria-current="page"] {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-item[aria-current="page"] i { color: var(--accent); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.theme-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 40px; padding: 8px 10px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--text); font: inherit; font-size: 14px; text-align: left;
}
.theme-toggle:hover { background: var(--surface-2); }
.switch {
  position: relative; flex-shrink: 0;
  width: 32px; height: 18px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-2);
  transition: transform .15s ease;
}
.theme-toggle[aria-pressed="true"] .switch { background: var(--accent); border-color: var(--accent); }
.theme-toggle[aria-pressed="true"] .switch::after { transform: translateX(14px); background: var(--accent-ink); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--text); font-size: 18px;
}
.icon-btn:hover { background: var(--surface-2); }

.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 900; }

/* Pages ----------------------------------------------------------------- */
.page { max-width: 1040px; padding: 40px 48px 64px; }

.page-header { margin-bottom: 28px; max-width: 640px; }
.page-header h1 { font-size: 26px; letter-spacing: -.015em; margin-bottom: 6px; outline: none; }
.page-desc { color: var(--text-2); }

.section-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
  margin-bottom: 20px;
}
.panel-title { font-size: 16px; margin-bottom: 16px; }

/* Forms ----------------------------------------------------------------- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.hint { font-size: 13px; color: var(--text-2); margin: -2px 0 10px; }

input, select {
  font: inherit; font-size: 15px;
  min-height: 44px; padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  width: 100%; min-width: 0;
}
input::placeholder { color: var(--text-2); opacity: .75; }
input:hover, select:hover { border-color: var(--text-2); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="text"], input[type="search"], input[type="number"] { font-family: var(--font-mono); font-size: 14px; }

.search { margin-bottom: 28px; max-width: 760px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; }

.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field-grow { flex: 1 1 280px; }
.field select { min-width: 190px; }

/* Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { background: var(--border); }
.btn:disabled { opacity: .55; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-primary:active { background: var(--accent); filter: brightness(.92); }

.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* Notices --------------------------------------------------------------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-top: 12px;
  border-radius: var(--r-sm); font-size: 14px;
  border: 1px solid transparent;
}
.notice i { margin-top: 3px; }
.notice-error { background: var(--danger-soft); color: var(--danger); border-color: currentColor; }
.notice-warn  { background: var(--warn-soft); color: var(--warn); border-color: currentColor; margin: 0 0 24px; max-width: 760px; }
.notice-warn div, .notice-warn strong { color: var(--text); }
.notice-warn a { color: var(--text); }
.notice-info  { background: var(--surface-2); color: var(--text-2); }

.empty { padding: 40px 0; color: var(--text-2); text-align: center; }
.result-count { font-size: 13px; color: var(--text-2); min-height: 20px; margin-bottom: 12px; }

/* ID plate (the motif) -------------------------------------------------- */
.plates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.plates .plate:first-child { grid-column: 1 / -1; }   /* SteamID64 is the one staff paste most */
.plate { margin-top: 0; min-width: 0; }
.panel > .plate, form > .plate { margin-top: 16px; }
.plate-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.plate-row { display: flex; min-width: 0; }
.copy-val {
  flex: 1; min-width: 0; min-height: 40px;
  display: flex; align-items: center;
  padding: 8px 12px;
  font-family: var(--font-mono); font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-right: 0;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  overflow-x: auto; white-space: nowrap;
}
.copy-val:empty::before { content: 'Result appears here'; color: var(--text-2); font-family: var(--font-sans); font-size: 13px; }
.copy-btn {
  flex-shrink: 0; min-height: 40px; min-width: 64px; padding: 0 12px;
  font: inherit; font-size: 13px; font-weight: 500;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.copy-btn:hover { background: var(--surface-2); }
.copy-btn:active { background: var(--border); }
.copy-btn.is-copied { color: var(--accent); }

/* Steam ----------------------------------------------------------------- */
.formats { max-width: 760px; }
.format-list { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.format-list div { display: grid; grid-template-columns: 220px 1fr; gap: 12px; padding: 10px 16px; background: var(--surface); }
.format-list dt { color: var(--text-2); font-size: 14px; }
.format-list dd { font-family: var(--font-mono); font-size: 14px; overflow-wrap: anywhere; }

.steam-results { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.steam-results .panel { margin-bottom: 0; }
/* With a profile beside it, the ID column is narrow: one plate per row so values are never clipped */
#steam-profile:not([hidden]) + #steam-ids .plates { grid-template-columns: minmax(0, 1fr); }
.steam-results #steam-ids:only-child,
.steam-results #steam-profile[hidden] + #steam-ids { grid-column: 1 / -1; }

.profile-head { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 16px; align-items: center; }
.avatar { width: 72px; height: 72px; border-radius: var(--r-sm); background: var(--surface-2); object-fit: cover; color: transparent; overflow: hidden; }
.profile-name { font-size: 20px; overflow-wrap: anywhere; }
.profile-status { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.profile-meta { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.profile-meta:empty { display: none; }
.profile-links { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--text-2);
}
.tag-online  { background: var(--accent-soft); color: var(--text); }
.tag-online::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.tag-away::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.tag-private { background: var(--danger-soft); color: var(--danger); }

/* Ban record: the focal point of a lookup */
.record { margin: 20px 0; padding: 16px; border-radius: var(--r-sm); background: var(--surface-2); }
.record.has-bans { background: var(--danger-soft); }
.record-title { font-size: 16px; margin-bottom: 10px; }
.record.has-bans .record-title { color: var(--danger); }
.record-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
.record-list li { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.record-list i { width: 14px; text-align: center; }
.record-list .ok i { color: var(--text-2); }
.record-list .bad { font-weight: 600; color: var(--danger); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 20px; margin-bottom: 16px; }
.facts dt { font-size: 13px; color: var(--text-2); }
.facts dd { font-size: 15px; overflow-wrap: anywhere; }
.facts dd:empty::before { content: 'Not shown'; color: var(--text-2); }

.aliases { margin-top: 20px; }
.alias-list li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.alias-list .alias-name { font-family: var(--font-mono); overflow-wrap: anywhere; }
.alias-list .alias-time { color: var(--text-2); white-space: nowrap; }

/* Tabs ------------------------------------------------------------------ */
.tabs {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 24px;
  background: var(--surface-2); border-radius: var(--r-sm);
  max-width: 100%; overflow-x: auto;
}
.sub-tab {
  min-height: 40px; padding: 0 14px;
  font: inherit; font-size: 14px; white-space: nowrap;
  background: none; color: var(--text-2);
  border: 0; border-radius: 4px;
}
.sub-tab:hover { color: var(--text); }
.sub-tab[aria-selected="true"] {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.split .panel { margin-bottom: 0; }

/* Map ------------------------------------------------------------------- */
.page.page-map { max-width: none; padding: 0; height: 100%; display: flex; flex-direction: column; }
.page-map[hidden] { display: none !important; }
.map-bar { padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.map-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.map-title { font-size: 18px; outline: none; }
/* The collapse control and the one-line summary only exist on small screens */
.map-toggle, .map-mini { display: none; }
.map-paste { max-width: 640px; margin-bottom: 14px; }
.map-paste .hint { margin: 6px 0 0; }
.map-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.map-fields .field { width: 130px; }
.map-fields .field-wide { width: 220px; }
.map-actions { display: flex; gap: 8px; }
.map-readout { margin-top: 14px; min-height: 40px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.map-readout .plate { flex: 0 1 auto; max-width: 100%; }
.map-empty, .map-note { font-size: 14px; color: var(--text-2); align-self: center; }
.map-readout .plate-label { font-family: var(--font-mono); font-size: 12px; }
#map-wrap { flex: 1; min-height: 320px; }
#gta-map { width: 100%; height: 100%; background: #10202b; }

/* Hash catalogue -------------------------------------------------------- */
.hash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.hash-card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden;
}
.hash-card-img {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 16 / 9; width: 100%;
  background: var(--surface-2); border: 0; padding: 8px;
  border-bottom: 1px solid var(--border);
}
button.hash-card-img { cursor: zoom-in; }
button.hash-card-img:hover { background: var(--border); }
.hash-card-img img { width: 100%; height: 100%; object-fit: contain; }
.hash-card-fallback { display: none; color: var(--text-2); font-size: 32px; }
.hash-card-body { padding: 14px 14px 4px; flex: 1; min-width: 0; }
.hash-card-title { font-size: 15px; overflow-wrap: anywhere; }
.hash-card-sub { font-size: 13px; color: var(--text-2); font-family: var(--font-mono); overflow-wrap: anywhere; margin-top: 2px; }
.hash-card-meta { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.hash-fields { margin-top: 10px; display: grid; gap: 4px; }
.hash-fields div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.hash-fields dt { color: var(--text-2); }
.hash-fields dd { font-family: var(--font-mono); text-align: right; overflow-wrap: anywhere; }
.hash-card-actions { display: flex; gap: 8px; padding: 12px 14px 14px; }
.hash-card-actions .btn { flex: 1; }

/* Animation table */
.table-wrap { border: 1px solid var(--border); border-radius: var(--r-md); overflow-x: auto; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.data-table td { padding: 8px 14px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); overflow-wrap: anywhere; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.cell-actions { white-space: nowrap; font-family: var(--font-sans); width: 1%; }
.data-table td.cell-actions .btn + .btn { margin-left: 6px; }

/* Pager */
.pager { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; padding: 24px 0 8px; }
.pager:empty { display: none; }
.pager button {
  min-width: 44px; min-height: 44px; padding: 0 10px;
  font: inherit; font-size: 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.pager button:hover:not(:disabled) { background: var(--surface-2); }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pager button:disabled { opacity: .45; }
.pager .gap { display: inline-flex; align-items: center; padding: 0 6px; color: var(--text-2); }

/* Medal ----------------------------------------------------------------- */
.video { display: block; width: 100%; height: auto; max-height: 480px; background: #000; border-radius: var(--r-sm); }

/* Toast ----------------------------------------------------------------- */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 500;
  /* Elevation: the toast floats above whatever page is open */
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  opacity: 0; transform: translateY(8px);
  transition: opacity .15s, transform .15s;
  pointer-events: none;
}
#toast:empty { display: none; }
#toast.show { opacity: 1; transform: none; }
#toast.error { background: var(--danger); color: var(--bg); }

/* Spinner: only while a request is in flight */
.spinner {
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Leaflet + Fancybox fit -------------------------------------------------- */
.leaflet-container { font-family: var(--font-sans); }
.leaflet-container a.leaflet-popup-close-button { width: 32px; height: 32px; font-size: 20px; }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .steam-results { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }

  .topbar {
    display: flex; align-items: center; gap: 8px;
    height: 56px; padding: 0 8px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1000;
    width: min(300px, 85vw);
    display: none;
    /* Elevation: the sheet sits above the page and scrim */
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
  }
  .sidebar.open { display: flex; }
  .sidebar-head { padding: 6px 8px 6px 16px; }
  .sidebar-head .icon-btn { display: inline-flex; }
  .nav-item { min-height: 44px; }

  .page { padding: 24px 16px 48px; }
  .page-header h1 { font-size: 22px; }

  .map-bar { padding: 12px 16px; }
  .map-toggle { display: inline-flex; min-height: 44px; }
  .map-bar.is-collapsed .map-head { margin-bottom: 0; }
  .map-bar.is-collapsed .map-panel { display: none; }
  .map-bar.is-collapsed .map-mini:not(:empty) { display: block; margin-top: 10px; }
  .map-mini .plate-label { font-family: var(--font-mono); font-size: 12px; }
  .map-fields .field { width: calc(50% - 6px); }
  .map-fields .field-wide { width: 100%; }
  .map-readout .plate { flex: 1 1 100%; }
  .map-actions { width: 100%; }
  .map-actions .btn { flex: 1; }
}

@media (max-width: 640px) {
  .search-row { flex-wrap: wrap; }
  .search-row input { flex: 1 1 100%; }
  .search-row .btn { flex: 1; }

  .plates { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .record-list { grid-template-columns: minmax(0, 1fr); }
  .format-list div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .panel { padding: 18px 16px; }

  .filter-bar .btn { width: 100%; }
  .field select { min-width: 0; }
  .filter-bar > .field:not(.field-grow) { flex: 1 1 100%; }

  .hash-grid { grid-template-columns: minmax(0, 1fr); }

  #toast { left: 16px; right: 16px; bottom: 16px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1.5s !important; }
  html { scroll-behavior: auto; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 640px) {
  /* Tabs fill the width and wrap their labels instead of scrolling sideways */
  .tabs { display: flex; width: 100%; overflow: visible; }
  .sub-tab { flex: 1 1 0; min-width: 0; padding: 6px 8px; white-space: normal; line-height: 1.25; min-height: 44px; }
}

/* Install button (only shown when the browser offers installation) */
#install-btn i { width: 32px; text-align: center; color: var(--text-2); }

/* Icon-only button: same height as its neighbours, square */
.btn-icon { flex: 0 0 auto !important; width: 36px; padding: 0; }
a.btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* Map header: title, then screenshot and (phones) the collapse toggle */
.map-head .map-title { margin-right: auto; }
.map-shot { min-height: 36px; }

/* Screenshot dialog */
.shot-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto; padding: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  /* Elevation: the dialog floats above the page */
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.shot-dialog[open] { display: flex; flex-direction: column; }
.shot-dialog::backdrop { background: var(--overlay); }
.shot-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 20px; border-bottom: 1px solid var(--border); }
.shot-head h2 { font-size: 16px; }
.shot-body { padding: 16px 20px; overflow: auto; min-height: 120px; }
.shot-status { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; margin-bottom: 12px; }
.shot-status:last-child { margin-bottom: 0; }
.shot-status.is-ok { color: var(--text); }
.shot-status.is-ok i { color: var(--accent); }
#shot-preview { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); }
.shot-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px 16px; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .shot-actions .btn { flex: 1 1 auto; }
  .map-shot span { display: none; }
  .map-shot { width: 44px; min-height: 44px; padding: 0; }
}
