/* VintRADAR — a price-hunting tool, built phone-first.
   Numbers lead; chrome recedes. One loud signal: the margin badge, which
   answers the only question that matters — does this beat CEX? */

:root {
  /* Cool paper rather than warm cream — this is a tool, not a magazine */
  --field: #F1F3F6;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #ECEFF3;
  --line: #E1E5EB;
  --line-strong: #CFD5DE;

  --ink: #101114;
  --ink-2: #545A66;
  --ink-3: #626976;

  /* The near-black used for dark chrome -- the header, the primary button,
     the FAB. Deliberately separate from --ink: --ink is the *text* colour
     and has to invert for a dark theme, whereas these surfaces stay dark in
     both. They were the same value, which meant inverting --ink turned the
     header white with white text on it. */
  --chrome: #101114;
  --chrome-hover: #23262C;

  /* Semantic, and dark enough to pass contrast on white */
  --under: #06764A;   /* cheaper than CEX — the good outcome */
  --over: #BF2F28;    /* dearer than CEX */
  --under-bg: #E7F5ED;
  --over-bg: #FCEDEC;
  --live: #06764A;
  /* Used for the sync pill — distinct from the green/red price semantics,
     so status never reads as a price signal. */
  --sync: #5B3FD1;

  --focus: #2B62D9;

  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-pill: 999px;

  --display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  /* One family throughout. Figures get tabular numerals so prices align in
     a column without needing a separate monospace face. */
  --mono: var(--body);

  --shadow-sm: 0 1px 2px rgba(16, 17, 20, .05);
  --shadow-md: 0 2px 6px rgba(16, 17, 20, .06), 0 8px 20px rgba(16, 17, 20, .05);
  --shadow-lg: 0 8px 20px rgba(16, 17, 20, .10), 0 24px 48px rgba(16, 17, 20, .10);

  /* iPhone notch / home indicator */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

/* Any element given display:flex/grid would otherwise ignore the `hidden`
   attribute and stay visible. This makes hidden mean hidden, everywhere. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%; /* stop iOS resizing text on rotate */
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* The page itself doesn't scroll — an inner container does. This is what
     stops iOS rubber-banding dragging the whole header down with it. */
  height: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

body {
  -webkit-tap-highlight-color: transparent;
}

/* Full-height column: fixed bar on top, scrolling content beneath */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.app__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* Keeps the bounce inside this box rather than passing it to the page */
  overscroll-behavior-y: contain;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* 16px minimum on inputs — anything smaller makes iOS zoom on focus */
input, select, textarea { font-size: 16px; }

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

a { color: inherit; }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px calc(96px + var(--safe-b));
  padding-left: max(16px, var(--safe-l));
  padding-right: max(16px, var(--safe-r));
}

/* ============ header ============ */

/* Sticky so the scan status and controls stay reachable while scrolling
   a long feed on a phone. */
/* Dark bar: sits outside the scroll container, so it never moves. */
.app__header {
  flex-shrink: 0;
  z-index: 40;
  padding: calc(10px + var(--safe-t)) 0 10px;
  background: var(--chrome);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 max(16px, var(--safe-l)) 0 max(16px, var(--safe-r));
  display: flex;
  align-items: center;
  gap: 10px;
}

.app__header .brand h1 { color: #fff; }
.app__header .brand__sub { color: rgba(255, 255, 255, .55); }
.app__header .brand__icon { border-color: rgba(255, 255, 255, .16); }

.app__header .status {
  color: rgba(255, 255, 255, .5);
  border-right-color: rgba(255, 255, 255, .14);
}

/* Buttons in the bar are ghosted rather than white cards */
.app__header .btn {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .92);
  box-shadow: none;
}

@media (hover: hover) {
  .app__header .btn:hover {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .22);
  }
}

.app__header .btn--icon { color: rgba(255, 255, 255, .7); }

@media (hover: hover) {
  .app__header .btn--icon:hover { color: #fff; }
}

/* The idle pulse needs to read against dark rather than white */
.app__header .brand__pulse-core { background: rgba(255, 255, 255, .4); }
.app__header .brand__pulse--live .brand__pulse-core { background: #4ADE9B; }
.app__header .brand__pulse--live::before,
.app__header .brand__pulse--live::after { border-color: #4ADE9B; }

/* Phone: the title alone carries the brand; the subtitle is a luxury the
   width can't afford, and the scan button becomes an icon. */
.brand__sub { display: none; }

.btn--scan {
  width: 40px;
  padding: 0;
  font-size: 17px;
}

.btn--scan .btn__label { display: none; }
.btn--scan .btn__glyph { display: block; line-height: 1; }

/* Spins while a sync is in flight, so the button itself reports progress */
.btn--scan.is-syncing .btn__glyph {
  animation: spin .9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
}

.brand__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.brand h1 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand__sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-view__intro .brand__sub { display: block; white-space: normal; }
.auth-brand .brand__sub { display: block; white-space: normal; }

.brand__pulse {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.brand__pulse-core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ink-3);
  transition: background .3s ease;
}

.brand__pulse--live .brand__pulse-core { background: var(--live); }

.brand__pulse--live::before,
.brand__pulse--live::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--live);
  animation: ping 2.8s cubic-bezier(0, 0, .2, 1) infinite;
  opacity: 0;
}

.brand__pulse--live::after { animation-delay: 1.4s; }

@keyframes ping {
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(3.4); opacity: 0; }
}

.header__controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.status {
  display: none; /* phone: the pulse dot already says this */
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

/* ============ buttons ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
}

.btn:active { transform: scale(.98); }

@media (hover: hover) {
  .btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
}

/* Primary action is ink-black: precise, and unmistakable on white */
.btn--accent {
  background: var(--chrome);
  border-color: var(--chrome);
  color: #fff;
  font-weight: 600;
}

@media (hover: hover) {
  .btn--accent:hover { background: var(--chrome-hover); border-color: var(--chrome-hover); }
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-3);
  padding: 6px 10px;
  min-height: 36px;
  font-size: 13px;
}

@media (hover: hover) {
  .btn--ghost:hover { background: var(--over-bg); color: var(--over); border-color: transparent; }
}

.btn--icon {
  width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 16px;
  color: var(--ink-2);
}

.btn--subtle {
  align-self: flex-start;
  background: transparent;
  border-style: dashed;
  border-color: var(--line-strong);
  box-shadow: none;
  color: var(--ink-2);
  font-size: 13.5px;
  padding: 8px 13px;
}

@media (hover: hover) {
  .btn--subtle:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
}

/* ============ panels ============ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.panel__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin: 0 0 14px;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel__header .panel__title { margin: 0; }

.panel__count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-left: 3px;
}

/* ============ home: category tiles ============ */

.home-view__intro { margin-bottom: 14px; }
.home-view__intro .panel__title { margin-bottom: 4px; }
.home-view__intro .brand__sub { white-space: normal; }

/* Phone: one tile per row, so each is a proper tap target and the platform
   colour actually gets room to register. */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ============ collection "shelf" tiles ============ */
/* Squarer than the wide row-style tiles above, built from each category's
   own item covers rather than a single generic watermark, so different
   categories are actually visually distinct at a glance. */

.shelf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 14px;
}

.shelf-tile {
  display: block;
  text-decoration: none;
  color: inherit;
}

.shelf-tile__art {
  --cat: var(--ink-3);
  position: relative;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  background: var(--cat);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease;
}

.shelf-tile:active .shelf-tile__art { transform: scale(.98); }

.shelf-tile__cover {
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shelf-tile__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.shelf-tile__placeholder {
  width: 34%;
  height: 34%;
  color: var(--ink-3);
  opacity: .5;
}

.shelf-tile__cover--solo { grid-column: span 2; grid-row: span 2; }
.shelf-tile__cover--half { grid-row: span 2; }

.shelf-tile__label {
  margin-top: 10px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelf-tile__count {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 1px;
}

/* ============ collection search bar & view toggle ============ */

.collection-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.collection-search-bar__input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 15px;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.collection-search-bar__input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(43, 98, 217, .13);
}

.collection-search-bar__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.view-toggle {
  flex-shrink: 0;
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}

.view-toggle__btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.view-toggle__btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-toggle__btn--active {
  background: var(--surface);
  color: var(--sync);
  box-shadow: var(--shadow-sm);
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cover-grid__item {
  display: block;
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.cover-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-grid__item svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 30%;
  height: 30%;
  color: var(--ink-3);
  opacity: .5;
}

.cover-grid__dot {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.cover-grid__dot--live { background: var(--under); }
.cover-grid__dot--pending { background: var(--ink-3); }
.cover-grid__dot--error { background: var(--over); }

@media (min-width: 460px) {
  .cover-grid { grid-template-columns: repeat(4, 1fr); }
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  /* Without this, every tile in a row stretches to match the tallest one,
     which would put empty space under the shorter (squarer) covers -- the
     exact thing this view is meant to avoid. */
  align-items: start;
}

.case-grid__item {
  display: block;
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* No art to measure, so nothing would give the tile a height -- fall back
   to the tall case shape rather than collapsing to nothing. */
.case-grid__item--noart { aspect-ratio: 2 / 3; }

.case-grid__item img {
  width: 100%;
  /* auto, not 100% -- the image's own proportions set the tile's height,
     so square SNES boxes render square and tall DVD-style cases render
     tall, instead of everything being letterboxed into one fixed frame. */
  height: auto;
  display: block;
  background: var(--surface-3);
}

.case-grid__item svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26%;
  height: 26%;
  color: var(--ink-3);
  opacity: .5;
}

.case-grid__dot {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.case-grid__dot--live { background: var(--under); }
.case-grid__dot--pending { background: var(--ink-3); }
.case-grid__dot--error { background: var(--over); }

@media (min-width: 460px) {
  .case-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============ dashboard entry cards & summary ============ */

.dash-entry-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.dash-entry {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* Filled with their own colour rather than being white cards with a small
     coloured icon -- these are the two ways into the whole app, and as plain
     cards they read as no more important than the panels below them. */
  background: var(--dash-fill);
  border: none;
  border-radius: var(--r-lg);
  padding: 16px;
  text-decoration: none;
  color: #fff;
  box-shadow: var(--dash-glow);
  transition: border-color .18s ease, transform .12s ease, box-shadow .18s ease;
}

.dash-entry:active { transform: scale(.99); }

/* Two clearly different colours so they're told apart at a glance rather
   than by reading the labels. The tinted shadow under each picks up its own
   hue, which is what stops a saturated tile looking like it's floating. */
.dash-entry--collection {
  --dash-fill: linear-gradient(140deg, #6D4AFF 0%, #9B7BFF 100%);
  --dash-glow: 0 6px 18px rgba(109, 74, 255, .32);
}

.dash-entry--wanted {
  --dash-fill: linear-gradient(140deg, #0E7C6B 0%, #22B79A 100%);
  --dash-glow: 0 6px 18px rgba(14, 124, 107, .32);
}

@media (hover: hover) {
  .dash-entry:hover { filter: brightness(1.06); }
}

.dash-entry__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  /* Translucent white on the tile's own colour, so it reads as part of the
     tile rather than a second block of colour competing with it. */
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 12px;
}

.dash-entry__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Fixed white rather than var(--ink): the tile now supplies its own colour,
   so the text has to contrast with that, not with the page behind it. Using
   --ink here would flip to dark in the light theme and vanish. */
.dash-entry__title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 3px;
}

.dash-entry__sub {
  font-size: 12px;
  color: rgba(255, 255, 255, .82);
  font-weight: 500;
  line-height: 1.35;
}

/* ============ home screen news slider ============ */

.home-news { margin-top: 22px; }

.home-news__title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-bottom: 10px;
}

.home-news__slider {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.home-news__slider::-webkit-scrollbar { display: none; }

.news-card {
  flex-shrink: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  width: 100%;
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.news-card__image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--surface-3);
  display: block;
}

.news-card__image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-card__image--placeholder svg {
  width: 30%;
  height: 30%;
  color: var(--ink-3);
  opacity: .5;
}

.news-card__body { padding: 10px 12px 12px; }

.news-card__source {
  font-size: 11px;
  font-weight: 800;
  color: var(--sync);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.news-card__title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card__time {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 6px;
}

.home-news__slider--multi { gap: 10px; }

.coming-soon-card {
  flex-shrink: 0;
  scroll-snap-align: start;
  /* Three per "page" with two 10px gaps between them. */
  width: calc((100% - 20px) / 3);
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.coming-soon-card__image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface-3);
  display: block;
}

.coming-soon-card__image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.coming-soon-card__image--placeholder svg {
  width: 30%;
  height: 30%;
  color: var(--ink-3);
  opacity: .5;
}

.coming-soon-card__body { padding: 7px 8px 9px; }

.coming-soon-card__name {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.coming-soon-card__date {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sync);
}

.collection-total {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--sync);
  box-shadow: var(--shadow-sm);
}

.tile {
  --cat: var(--ink-3);
  position: relative;
  display: block;
  min-height: 94px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--cat);
  border-radius: var(--r-md);
  padding: 16px 18px 15px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  isolation: isolate;
  transition: border-color .18s ease, transform .12s ease, box-shadow .18s ease;
}

/* A wash of the platform colour, strongest at the accent edge */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--cat) 0%, transparent 62%);
  opacity: .09;
  z-index: -2;
}

.tile:active { transform: scale(.99); }

@media (hover: hover) {
  .tile:hover {
    border-color: var(--line-strong);
    border-left-color: var(--cat);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
  .tile:hover .tile__mark { opacity: .24; transform: rotate(-6deg) scale(1.05); }
}

/* Watermark: the app mark ghosted into the corner, so the tile has some
   depth without competing with the numbers. */
/* Watermark: a gamepad outline in the platform's own colour, ghosted into
   the corner so the tile has depth without competing with the numbers. */
.tile__mark {
  position: absolute;
  right: -8px;
  bottom: -6px;
  width: 104px;
  height: 66px;
  color: var(--cat);
  opacity: .16;
  transform: rotate(-6deg);
  pointer-events: none;
  z-index: -1;
  transition: opacity .2s ease, transform .2s ease;
}

/* Uploaded artwork gets the same ghosted treatment as the gamepad, but
   sized to fill the corner and desaturated so photos don't shout. */
.tile__mark--photo {
  right: 0;
  bottom: 0;
  width: 46%;
  height: 100%;
  max-width: 170px;
  object-fit: cover;
  transform: none;
  opacity: .17;
  filter: grayscale(.35);
  /* Fades into the tile rather than ending on a hard edge */
  -webkit-mask-image: linear-gradient(to left, #000 40%, transparent 100%);
  mask-image: linear-gradient(to left, #000 40%, transparent 100%);
}

@media (hover: hover) {
  .tile:hover .tile__mark--photo { opacity: .26; transform: none; }
}

.tile__label {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--cat);
  margin-bottom: 12px;
}

.tile__stats {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.tile__stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.tile__num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tile__num--zero { color: var(--ink-3); font-weight: 700; }
.tile__num--finds { color: var(--under); }
.tile__num--value { color: var(--sync); }

.tile__unit {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}

/* ============ category view ============ */

.category-view__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  font-size: 19px;
  line-height: 1;
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.back-link:active { transform: scale(.96); }

@media (hover: hover) {
  .back-link:hover { border-color: var(--line-strong); color: var(--ink); }
}

.category-view__title {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.category-view__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

/* On phones the primary action lives as a thumb-reachable floating button,
   so hide the inline one there. */
#openAddTag { display: none; }
#openAddCollectionItem { display: none; }

/* ============ floating add button (phone) ============ */

.fab {
  position: fixed;
  right: max(16px, var(--safe-r));
  bottom: calc(16px + var(--safe-b));
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 20px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--chrome);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform .12s ease;
}

.fab:active { transform: scale(.96); }
.fab[hidden] { display: none; }

.fab__plus { font-size: 19px; line-height: 1; margin-top: -2px; }

/* ============ modals / sheets ============ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;   /* phone: bottom sheet */
  justify-content: center;
}

.modal[hidden] { display: none; }

/* This can be opened from inside another modal (Link CEX price) as a
   nested search step -- an explicit higher z-index here means it always
   stacks above whatever opened it, rather than depending on which one
   happens to come later in the DOM (same z-index would otherwise let
   DOM order decide, which is what let the modal underneath swallow taps
   meant for this one). */
#cexSearchModal { z-index: 90; }

/* ============ barcode scanner ============ */

.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #000;
  display: flex;
  flex-direction: column;
}

.scan-overlay[hidden] { display: none; }

.scan-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-t)) 16px 14px;
  color: #fff;
  flex-shrink: 0;
}

.scan-overlay__title { font-weight: 700; font-size: 15px; }

.scan-overlay__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.scan-overlay__video {
  flex: 1;
  width: 100%;
  object-fit: cover;
  background: #000;
}

.scan-overlay__frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(78vw, 340px);
  height: 140px;
  border: 3px solid rgba(255, 255, 255, .85);
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35);
  pointer-events: none;
}

.scan-overlay__hint {
  text-align: center;
  color: #fff;
  font-size: 13.5px;
  padding: 14px 16px calc(16px + var(--safe-b));
  flex-shrink: 0;
}

/* ============ screenshot lightbox ============ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(10, 10, 12, .96);
  display: flex;
  flex-direction: column;
}

.lightbox[hidden] { display: none; }

.lightbox__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-t)) 16px 14px;
  flex-shrink: 0;
}

.lightbox__counter {
  color: rgba(255, 255, 255, .75);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lightbox__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.lightbox__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px calc(16px + var(--safe-b));
  min-height: 0;
}

.lightbox__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-sm);
}

.lightbox__nav {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.lightbox__nav:disabled { opacity: .3; pointer-events: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 17, 20, .38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in .18s ease;
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 18px 16px calc(20px + var(--safe-b));
  box-shadow: var(--shadow-lg);
  animation: sheet-up .26s cubic-bezier(.16, 1, .3, 1);
}

/* The grab handle reads as "drag me" and marks this as a sheet, not a page */
.modal__dialog::before {
  content: '';
  display: block;
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: -6px auto 14px;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal__title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 0;
}

.modal__close {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  color: var(--ink-2);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.modal__actions {
  display: flex;
  gap: 9px;
  margin-top: 6px;
}

.modal__actions .btn { flex: 1; min-height: 46px; }

/* ============ form fields ============ */

.add-tag-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.icon-editor {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-editor__preview {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--surface-2);
}

.icon-editor__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 7px;
}

.field__optional {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 4px;
  font-weight: 400;
}

.field input,
.field select,
.add-category-form input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23626976' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.field input::placeholder,
.add-category-form input::placeholder { color: var(--ink-3); }

.field input:focus,
.field select:focus,
.add-category-form input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(43, 98, 217, .13);
}

.field__input-row {
  display: flex;
  gap: 8px;
}

.field__input-row input { flex: 1; min-width: 0; }

.field__scan-btn {
  flex-shrink: 0;
  width: 46px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.field__scan-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .field__scan-btn:hover { border-color: var(--sync); color: var(--sync); }
}

.field__hint {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-3);
}

.field__hint code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 1px 4px;
}

.keyword-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keyword-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.keyword-row input { flex: 1; min-width: 0; }

.keyword-row__remove {
  flex-shrink: 0;
  width: 44px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-size: 17px;
  cursor: pointer;
}

/* ============ tag list ============ */

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-empty {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-3);
}

.tag-chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 13px;
}

.tag-chip__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-3);
}

.tag-dot--live    { background: var(--under); box-shadow: 0 0 0 3px var(--under-bg); }
.tag-dot--pending { background: #B4820A;      box-shadow: 0 0 0 3px #FBF2DC; }
.tag-dot--error   { background: var(--over);  box-shadow: 0 0 0 3px var(--over-bg); }

.tag-chip__label {
  flex: 1;
  font-size: 15px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-chip__remove {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}

.tag-chip__meta,
.tag-chip__cex {
  margin-left: 17px;
  font-family: var(--mono);
  font-size: 11px;
}

.tag-chip__meta { margin-top: 5px; color: var(--ink-3); }
.tag-chip__cex  { margin-top: 3px; color: var(--over); }
.tag-chip__cex--error { color: var(--ink-3); }

.tag-chip__keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  margin-left: 17px;
}

.keyword-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
}

/* ============ finds feed ============ */

/* Cards sit directly on the page rather than nested inside a panel — one
   less box, and each find gets to feel like its own object. */
.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 10px;
}

.feed-head .panel__title { margin: 0; }

.feed-empty {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-3);
  max-width: 44ch;
  margin: 0;
  padding: 22px 18px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease;
}

/* The delete action sits behind the card, uncovered by swiping left */
.feed-card__actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 96px;
  display: flex;
  align-items: stretch;
}

.feed-card__delete {
  flex: 1;
  border: none;
  background: var(--over);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.feed-card__delete:active { background: #A82722; }

/* Everything visible rides on this layer so it slides as one piece */
.feed-card__surface {
  position: relative;
  background: var(--surface);
  /* No radius of its own — the card clips it, and rounding here would let
     the red action panel peek through at the corners. */
  transition: transform .26s cubic-bezier(.16, 1, .3, 1);
  /* Vertical stays with the browser so the list still scrolls normally */
  touch-action: pan-y;
}

.feed-card--closed .feed-card__surface { background: var(--surface-2); }

@media (hover: hover) {
  .feed-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
}

.feed-card__link {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 42px 14px 14px;
  text-decoration: none;
  color: inherit;
}

.feed-card__thumb {
  width: 76px;
  height: 76px;
  border-radius: var(--r-md);
  background: var(--surface-3) center/cover no-repeat;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Listings without a photo get a quiet tint rather than a grey void */
.feed-card__thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, var(--surface-2), var(--surface-3));
}

.feed-card__thumb--has-photo::after { display: none; }

.feed-card__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.feed-card__tagrow {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  /* Leave room for the heart and dismiss buttons pinned top-right */
  padding-right: 40px;
}

.feed-card__tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.feed-card__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.33;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-card__prices {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* The listing price is the headline number on the card */
.feed-card__price {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.feed-card__ship {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.feed-card__cex {
  font-size: 12px;
  font-weight: 600;
  color: var(--over);
  font-variant-numeric: tabular-nums;
}

.feed-card__time {
  font-size: 12px;
  color: var(--ink-3);
}

.feed-card__meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

/* Sold / removed: still legible, clearly not actionable */
.feed-card--closed { background: var(--surface-2); box-shadow: none; }
.feed-card--closed .feed-card__thumb { opacity: .45; }
.feed-card--closed .feed-card__title { color: var(--ink-2); }
.feed-card--closed .feed-card__price { color: var(--ink-3); text-decoration: line-through; }
.feed-card--closed .margin-badge { opacity: .55; }

.status-pill {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

/* Sold is the one that actually costs you something if you miss it — a
   deal that's gone — so it gets a solid, unmissable tag rather than the
   pale inline pill everything else uses. */
.status-pill--sold {
  background: var(--over);
  color: #fff;
  box-shadow: 0 1px 3px rgba(191, 47, 40, .35);
}
.status-pill--gone { background: var(--surface-3); color: var(--ink-2); }

/* Same purple used for the accent icon buttons elsewhere -- distinct from
   sold (red) and removed (grey), and reads as "something good happened"
   rather than a status change. */
.status-pill--new {
  background: var(--sync);
  color: #fff;
  box-shadow: 0 1px 3px rgba(91, 63, 209, .35);
}

.feed-card__dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--ink-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

/* On touch the swipe replaces this, so it's only shown where a mouse is
   available and dragging would be awkward. */
.feed-card__dismiss { display: none; }

@media (hover: hover) {
  .feed-card__dismiss {
    display: flex;
    opacity: 0;
    transition: opacity .15s ease, color .15s ease, background .15s ease;
  }
  .feed-card:hover .feed-card__dismiss { opacity: 1; }
  .feed-card__dismiss:focus-visible { opacity: 1; }
  .feed-card__dismiss:hover { color: var(--over); background: var(--over-bg); }
}

/* --- signature: the margin badge --- */
/* The one question this app exists to answer, answered without arithmetic. */
.margin-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.margin-badge__amount {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.margin-badge__label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  opacity: .8;
}

.margin-badge--under { background: var(--under-bg); color: var(--under); }
.margin-badge--over  { background: var(--over-bg);  color: var(--over); }
.margin-badge--level { background: var(--surface-3); color: var(--ink-2); }

/* ============ pagination ============ */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.pager__btn { min-width: 88px; }
.pager__btn:disabled { opacity: .35; cursor: default; }

.pager__info {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ============ favourites ============ */

.btn--fav { position: relative; }

.btn--fav svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linejoin: round;
}

.btn--search svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn--dash svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A count badge so you can see at a glance there's something saved */
.btn__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--over);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Heart on each find card */
.feed-card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
  transition: color .15s ease, background .15s ease, transform .12s ease;
}

.feed-card__fav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linejoin: round;
  transition: fill .18s ease;
}

.feed-card__fav:active { transform: scale(.88); }

.feed-card__fav.is-fav { color: var(--over); }
.feed-card__fav.is-fav svg { fill: var(--over); }

@media (hover: hover) {
  .feed-card__fav:hover { color: var(--over); background: var(--over-bg); }
}

/* A small nudge when you heart something, so the tap registers */
.feed-card__fav.just-hearted svg { animation: heart-pop .34s cubic-bezier(.2, .9, .3, 1); }

/* Where a mouse is available the close button takes the corner, so the
   heart shifts left to make room for it. */
@media (hover: hover) {
  .feed-card__fav { right: 44px; }
}

@keyframes heart-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Favourites list shows which category each find came from */
.feed-card__cat {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  flex-shrink: 1;
  min-width: 0;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ confirm dialog ============ */

.btn--danger {
  background: var(--over);
  border-color: var(--over);
  color: #fff;
  font-weight: 700;
}

@media (hover: hover) {
  .btn--danger:hover { background: #A82722; border-color: #A82722; }
}

.modal--confirm { align-items: center; padding: 20px; }

.modal__dialog--confirm {
  width: min(380px, 100%);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  animation: dialog-in .18s cubic-bezier(.16, 1, .3, 1);
}

.modal__dialog--confirm::before { display: none; }
.modal__dialog--confirm .modal__head { margin-bottom: 10px; }

.confirm__body {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.modal--confirm .modal__actions .btn { flex: 1; min-height: 48px; }

.diag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diag-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--under);
  border-radius: var(--r-sm);
  padding: 9px 11px;
}

.diag-row--bad { border-left-color: var(--over); background: var(--over-bg); }

.diag-row__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
}

.diag-row__value {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  word-break: break-word;
}

/* ============ browse ============ */

.sort-toggle {
  display: inline-flex;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
  max-width: 100%;
}

/* Phone: the heading and toggle don't fit side by side, so the toggle takes
   its own full-width row rather than pushing off the edge. */
@media (max-width: 560px) {
  .browse-view .feed-head { flex-wrap: wrap; }
  .browse-view .sort-toggle { width: 100%; }
  .browse-view .sort-toggle__btn { flex: 1; }
}

.sort-toggle__btn {
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}

.sort-toggle__btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tag-chip__browse {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--sync);
  text-decoration: none;
  border: 1px solid rgba(91, 63, 209, .3);
  background: rgba(91, 63, 209, .08);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  white-space: nowrap;
}

@media (hover: hover) {
  .tag-chip__browse:hover { background: rgba(91, 63, 209, .16); }
}

/* ============ view transitions ============ */

/* Navigating deeper slides in from the right, going back slides in from the
   left — the same push/pop language a native app uses, so the direction of
   travel is legible without reading anything. */
.view-in--forward { animation: view-push .3s cubic-bezier(.22, .9, .28, 1) both; }
.view-in--back    { animation: view-pop  .3s cubic-bezier(.22, .9, .28, 1) both; }

@keyframes view-push {
  from { opacity: 0; transform: translate3d(22px, 0, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes view-pop {
  from { opacity: 0; transform: translate3d(-22px, 0, 0); }
  to   { opacity: 1; transform: none; }
}

/* Tiles, item cards and find cards arrive in a quick stagger so a screen
   assembles rather than snapping in all at once — but only as part of an
   actual navigation, never on the cosmetic timestamp-refresh tick. */
.view-in--back .tile,
.view-in--back .item-card,
.view-in--forward .tile,
.view-in--forward .item-card,
.view-in--forward .feed-card {
  animation: tile-rise .34s cubic-bezier(.22, .9, .28, 1) both;
  animation-delay: calc(var(--i, 0) * 28ms);
}

@keyframes tile-rise {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ============ startup error banner ============ */

/* Only ever appears if the app failed to load its own data on startup, or a
   page failed to render — deliberately loud, since the alternative is a
   silently blank screen with no way to tell what went wrong, especially on
   a phone with no dev tools. Sits in normal document flow right below the
   header, never as a fixed overlay — a fixed banner here would sit on top
   of the header and block its buttons, defeating the point of a banner
   meant to help you keep using the app while something's wrong. */
.boot-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
  background: var(--over);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  padding: 10px 16px;
  padding-left: max(16px, var(--safe-l));
  padding-right: max(10px, var(--safe-r));
}

.boot-error__text { flex: 1; word-break: break-word; }

.boot-error__close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .18);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

/* ============ sync status pill ============ */

.sync-pill {
  position: fixed;
  left: 50%;
  /* Sits above the floating add button on phones so the two never collide */
  bottom: calc(84px + var(--safe-b));
  transform: translate(-50%, 14px);
  z-index: 55;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 16px;
  border-radius: var(--r-lg);
  background: var(--sync);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 6px 16px rgba(91, 63, 209, .28), 0 16px 36px rgba(16, 17, 20, .16);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .28s cubic-bezier(.16, 1, .3, 1);
  /* Long messages (e.g. a note tacked onto a success) wrap onto more than
     one line instead of forcing the pill wider than the screen — it was
     previously cut off at both edges on a phone. */
  white-space: normal;
  /* A URL or long token has no spaces at all, so the browser has nowhere
     to break it under plain word-wrapping -- it was treated as one
     unbreakable "word" and silently overflowed the pill's fixed width
     instead of wrapping, which is what made a diagnostic message look
     truncated even though the full text was always in the DOM. */
  overflow-wrap: break-word;
  word-break: break-word;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
}

.sync-pill[hidden] { display: none; }
.sync-pill--in { opacity: 1; transform: translate(-50%, 0); }

.sync-pill__spinner {
  width: 13px;
  height: 13px;
  margin-top: 2px; /* keeps it level with the first line of text once wrapped */
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}

/* Once it's reporting a result there's nothing left to spin. The dot stays
   white on purple rather than switching to the price colours, which mean
   something else in this app. */
.sync-pill--done .sync-pill__spinner {
  animation: none;
  border: none;
  background: #fff;
}

/* Failure is the one case worth breaking the purple for */
.sync-pill--fail {
  background: var(--over);
  box-shadow: 0 6px 16px rgba(191, 47, 40, .26), 0 16px 36px rgba(16, 17, 20, .16);
}

.sync-pill--fail .sync-pill__spinner {
  animation: none;
  border: none;
  background: #fff;
}

/* Nothing new turned up, but something's worth a second look (a filtering
   or setup issue, say) -- not a failure, but not a plain, nothing-to-report
   success either. Same amber already used for a "pending" item-card dot. */
.sync-pill--warn {
  background: #B4820A;
  box-shadow: 0 6px 16px rgba(180, 130, 10, .26), 0 16px 36px rgba(16, 17, 20, .16);
}

.sync-pill--warn .sync-pill__spinner {
  animation: none;
  border: none;
  background: #fff;
}

/* ============ settings rows (admin) ============ */

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child { border-bottom: none; padding-bottom: 0; }

.setting__label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
}

.setting__hint {
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink-3);
}

.setting__control {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
}

/* iOS-style switch, big enough to hit with a thumb */
.switch {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 32px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch__track {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: background .2s ease, border-color .2s ease;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .2s cubic-bezier(.16, 1, .3, 1);
}

.switch input:checked + .switch__track {
  background: var(--under);
  border-color: var(--under);
}

.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Plain icon variant of the gamepad mark — no absolute positioning, no
   oversized watermark box, just an icon that fills whatever container it's
   dropped into. Used inside item cards and the item hero, as opposed to
   .tile__mark's ghosted-corner treatment on category tiles. */
.pad-icon {
  display: block;
  width: 58%;
  height: 58%;
  color: var(--ink-3);
}

/* ============ item cards (category page) ============ */

.items-panel { min-height: 40px; }

.item-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

.item-card {
  display: flex;
  gap: 13px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .16s ease, box-shadow .16s ease, transform .12s ease;
  /* Without this, holding a card to drag it competes with the browser's
     own "long-press a link" preview/share menu (iOS Safari, and browsers
     built on WebKit like Edge/Chrome on iOS) -- since it's a real <a>. */
  -webkit-touch-callout: none;
  user-select: none;
}

.item-card:active { transform: scale(.99); }

@media (hover: hover) {
  .item-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
}

.item-card--dragging {
  box-shadow: 0 14px 30px rgba(16, 17, 20, .22), 0 4px 10px rgba(16, 17, 20, .14);
  transform: scale(1.02);
  z-index: 30;
  pointer-events: none;
}

.item-grid--reordering .item-card:not(.item-card--dragging) {
  transition: transform 160ms ease;
}

.item-card__art {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.item-card__dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.item-card__dot--live    { background: var(--under); }
.item-card__dot--pending { background: #B4820A; }
.item-card__dot--error   { background: var(--over); }

.item-card__body { min-width: 0; flex: 1; }

.item-card__namerow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  min-width: 0;
}

.item-card__namerow .item-card__name { margin-bottom: 0; min-width: 0; }

.item-card__cat {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  background: transparent;
}

.item-card__name {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card__price {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 2px;
}

.item-card__price--set { color: var(--over); font-weight: 700; }
.item-card__price--soldout { color: #8A6200; }
.item-card__price-paid { color: var(--ink-3); font-weight: 600; }

.item-card__category {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 3px;
}

.item-card__finds {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ============ item detail page ============ */

.item-view { position: relative; }

.item-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.item-notes {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.item-notes__textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
  min-height: 44px;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.item-notes__textarea::placeholder { color: var(--ink-3); }

.item-notes__textarea:focus {
  outline: none;
  border-color: var(--sync);
  box-shadow: 0 0 0 3px rgba(91, 63, 209, .14);
}

.purchase-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.purchase-form__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.purchase-form__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.purchase-form__field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.purchase-form__field input:focus {
  outline: none;
  border-color: var(--sync);
  box-shadow: 0 0 0 3px rgba(91, 63, 209, .14);
}

.purchase-form__price-wrap { position: relative; }

.purchase-form__currency {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

.purchase-form__price-wrap input { padding-left: 26px; }

.purchase-form__save { align-self: flex-start; }

/* ============ game info (collection items) ============ */

.game-info {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.game-info--empty {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-info__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.game-info__title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.game-info__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-info__unlink {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.game-summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.game-summary-card__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-line;
}

.game-summary-card__text--clamped {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-summary-card__toggle {
  display: block;
  margin-top: 8px;
  background: none;
  border: none;
  padding: 0;
  color: var(--sync);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.game-details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.game-detail-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.game-detail-row:last-child { border-bottom: none; }

.game-detail-row__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(91, 63, 209, .12);
  color: var(--sync);
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-detail-row__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-detail-row__body { flex: 1; min-width: 0; }

.game-detail-row__label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 2px;
}

.game-detail-row__value {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.game-info__trailer-wrap {
  position: relative;
  display: block;
  margin-bottom: 10px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #000;
  line-height: 0; /* kills the inline-element gap under the video */
}

.game-info__trailer-wrap[hidden] { display: none; }

.game-info__trailer {
  display: block;
  width: 100%;
  max-height: 220px;
  background: #000;
}

/* Native controls are all-or-nothing -- this replaces them entirely so the
   trailer has a play/stop toggle and nothing else (no scrubber, volume,
   fullscreen, or download menu). */
.game-info__trailer-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: opacity .18s ease;
}

.game-info__trailer-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Fades back while playing so it isn't sat over the picture, but stays
   present and tappable rather than disappearing entirely. */
.game-info__trailer-wrap--playing .game-info__trailer-btn { opacity: .25; }
.game-info__trailer-wrap--playing .game-info__trailer-btn:hover,
.game-info__trailer-wrap--playing .game-info__trailer-btn:focus-visible { opacity: 1; }

.game-info__trailer-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: none;
}

/* Driven off the wrapper's playing class rather than a hidden attribute on
   the SVGs -- `hidden` is an HTMLElement property, so setting it from JS on
   an SVG element silently does nothing and the icon never swaps. */
.game-info__trailer-icon--stop { display: none; }
.game-info__trailer-wrap--playing .game-info__trailer-icon--play { display: none; }
.game-info__trailer-wrap--playing .game-info__trailer-icon--stop { display: block; }

.game-info__screenshots {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px;
}

.game-info__screenshots::-webkit-scrollbar { display: none; }

.game-info__screenshots img {
  flex-shrink: 0;
  width: 200px;
  height: 112px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  cursor: pointer;
}

.game-search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  max-height: 50vh;
  overflow-y: auto;
}

.game-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

@media (hover: hover) {
  .game-search-result:hover { border-color: var(--sync); }
}

.game-search-result__cover {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-3);
}

.game-search-result__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}

.game-search-result__cover--placeholder svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.game-search-result__body { flex: 1; min-width: 0; }

.game-search-result__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-search-result__year {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}

.item-hero__art {
  width: 116px;
  /* Square only as the no-artwork fallback -- with a real image the
     --photo rule below hands the height over to the image itself. */
  height: 116px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.item-hero__art-hint {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(16, 17, 20, .68);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.item-hero__art-hint svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Matches the case ("DVD") view: the artwork's own proportions set the
   height instead of being cropped into a fixed square, so a tall box shows
   tall and a square one shows square. */
.item-hero__art--photo { height: auto; }

.item-hero__art img {
  width: 100%;
  height: auto;
  display: block;
}

.item-hero__body { flex: 1; min-width: 0; }

.item-hero__art-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-shrink: 0;
  width: 116px;
}

.item-hero__keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.item-hero__toolbar {
  display: flex;
  /* flex-wrap stays as a safety net (e.g. large accessibility zoom), but the
     gap is tightened so the normal five wanted-item actions actually sit on
     one line rather than relying on it: at 8px they needed 202px against
     the ~195px this narrow column beside the artwork actually has, so
     Delete wrapped onto its own row even after Notes was removed. */
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.item-hero__icon-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
}

@media (hover: hover) {
  .item-hero__icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
}

.item-hero__icon-btn--active {
  background: var(--sync);
  border-color: var(--sync);
  color: #fff;
}

.item-hero__icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.item-hero__price {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

/* The price itself leads; the matched CEX product name sits under it in a
   quieter style so a long label can't bury the number. */
.item-hero__price-value {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.item-hero__price-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  margin-top: 1px;
  line-height: 1.3;
}

.item-hero__price--muted { color: var(--ink-3); font-weight: 500; }
.item-hero__price--error { color: var(--over); font-weight: 500; }

/* Qualifies the sell price specifically -- CEX still generally buys
   trade-ins regardless of their own stock, so amber (the same "worth a
   second look" convention used elsewhere) rather than red, which would
   overstate it as CEX being unavailable as a source altogether. */
.item-hero__stock {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #8A6200;
  background: #FFF3D6;
  border-radius: var(--r-pill);
  padding: 3px 9px;
  margin-bottom: 6px;
}

/* Describes movement, not a recommendation — up/down colouring follows the
   ordinary "green rose, red fell" convention rather than implying good or
   bad news, since whether a rising price is good for you depends on what
   you're trying to do. */
.item-hero__trend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  min-height: 20px;
}

.item-hero__trend {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}

.item-hero__trend--up { color: var(--under); }
.item-hero__trend--down { color: var(--over); }
.item-hero__trend--flat { color: var(--ink-3); }

.item-hero__sparkline { flex-shrink: 0; line-height: 0; }
.sparkline-line--up { stroke: var(--under); }
.sparkline-line--down { stroke: var(--over); }
.sparkline-line--flat { stroke: var(--ink-3); }

/* What CEX would pay to trade the item in — deliberately understated next
   to the sell price above it, since it's supplementary reference info, not
   something any find gets compared against. */
.item-hero__trade {
  /* 11px / weight 500 rather than 12px / 600: the column beside the
     artwork is only ~195px wide, and at the previous size this wrapped
     onto two lines for almost any realistic trade-in value -- tested down
     to the smallest reduction that reliably keeps a two- or three-digit
     amount on one line. */
  font-size: 11px;
  font-weight: 500;
  color: var(--under);
  margin-bottom: 4px;
}

.item-hero__updated {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

/* Shown only when there's genuinely nothing to report yet ("Never
   refreshed yet") -- once there's a real timestamp, this becomes a row of
   .sync-tag pills instead, each coloured by its own age. */
.item-hero__updated--empty {
  font-size: 12px;
  color: var(--ink-3);
}

/* Each clock gets its own tag, coloured by how stale *that one* is --
   Vinted Sync and CEX Check don't happen together (linking a CEX match
   fetches its price immediately, independent of whenever Vinted was last
   scanned), so a shared colour for both would misrepresent whichever one
   wasn't actually the one just refreshed. */
.sync-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.sync-tag--fresh { background: var(--under-bg); color: var(--under); }
.sync-tag--stale { background: var(--over-bg); color: var(--over); }

.item-view__feed-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sort-toggle--full {
  width: 100%;
  margin-bottom: 14px;
}

.sort-toggle--full .sort-toggle__btn { flex: 1; }

/* ============ pull-to-refresh ============ */

.pull-indicator {
  position: absolute;
  top: 8px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -40px);
  opacity: 0;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

.pull-indicator__spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink-2);
  flex-shrink: 0;
}

.pull-indicator.pull-ready .pull-indicator__spinner { border-top-color: var(--sync); }

.pull-indicator.is-refreshing .pull-indicator__spinner {
  animation: spin .8s linear infinite;
}

#itemRefreshGlyph { display: block; line-height: 1; }
.is-syncing #itemRefreshGlyph { animation: spin .9s linear infinite; }

/* ============ admin ============ */

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.add-category-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.add-category-form input { flex: 1; min-width: 0; }

.admin-cat-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 11px;
}

/* Phone: give the name the full width and drop the controls onto their own
   row, rather than squeezing long names like "Xbox Series X|S". */
.admin-cat__main { flex: 1 1 100%; min-width: 0; }
.admin-cat__controls { margin-left: auto; }

.admin-cat__image {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface) center/cover no-repeat;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.admin-cat__image.has-image {
  border-color: var(--line-strong);
  font-size: 0;
}

@media (hover: hover) {
  .admin-cat__image:hover { border-color: var(--ink-3); }
}

.admin-cat__swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
}

.admin-cat__swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.admin-cat__swatch::-webkit-color-swatch { border: none; border-radius: 5px; }
.admin-cat__swatch::-moz-color-swatch { border: none; border-radius: 5px; }

.admin-cat__label {
  font-size: 15px;
  font-weight: 550;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 6px;
  margin-left: -6px;
  width: 100%;
}

.admin-cat__label:focus {
  outline: none;
  border-color: var(--focus);
  background: var(--surface);
}

.admin-cat__meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 2px;
}

.admin-cat__controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:disabled { opacity: .32; cursor: default; }

@media (hover: hover) {
  .icon-btn:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
  .icon-btn--danger:hover:not(:disabled) { color: var(--over); border-color: var(--over); }
}

.admin-note {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  margin: 0 0 12px;
  line-height: 1.55;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-actions .btn { flex: 1; min-width: 150px; }

/* ============ toggle switch ============ */

.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

/* Multiple rows stacked in a list (e.g. per-source toggles) get a bit of
   breathing room and a divider between them, matching the app's other
   row-list patterns -- doesn't affect a lone .toggle-row used on its own. */
.toggle-row + .toggle-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.toggle-row__text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.toggle-row__label { font-size: 15px; font-weight: 700; color: var(--ink); }

.toggle-switch { flex-shrink: 0; position: relative; }
.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.toggle-switch__track {
  display: block;
  width: 46px;
  height: 27px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s ease;
  /* Purely decorative -- without this, the visible track/thumb can end up
     intercepting the tap meant for the actual (invisible) checkbox
     underneath, making the switch unreliable to tap despite looking fine. */
  pointer-events: none;
}

.toggle-switch__thumb {
  display: block;
  width: 23px;
  height: 23px;
  margin: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .18s ease;
}

.toggle-switch input:checked ~ .toggle-switch__track { background: var(--sync); }
.toggle-switch input:checked ~ .toggle-switch__track .toggle-switch__thumb { transform: translateX(19px); }
.toggle-switch input:focus-visible ~ .toggle-switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ============ floating nav ============ */

.floating-nav {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(14px + var(--safe-b));
  z-index: 50;
  display: flex;
  align-items: stretch;
  gap: 2px;
  background: #2c2e33;
  border-radius: var(--r-pill);
  padding: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .2);
}

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

.floating-nav__item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 0;
  border-radius: var(--r-pill);
  text-decoration: none;
  color: rgba(255, 255, 255, .65);
  min-width: 0;
}

.floating-nav__item svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.floating-nav__item--active {
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

.floating-nav__item--active svg {
  stroke-width: 2.3;
}

/* The "+ Add item" FAB sits bottom-right by default, which the floating
   nav's right edge can reach on a narrow phone -- push the FAB up clear
   of the whole pill (its own height plus a visible gap) whenever the nav
   is showing, so they never sit on top of each other. */
body.has-floating-nav .fab {
  bottom: calc(88px + var(--safe-b));
}

/* Wide enough that a bottom pill nav stops making sense next to a
   header that already has room to spare -- phone-only feature. */
@media (min-width: 700px) {
  .floating-nav { display: none !important; }
}

/* ============ toasts ============ */

/* Phone: slide down from the top, clear of the thumb and the FAB */
.toast-layer {
  position: fixed;
  top: calc(8px + var(--safe-t));
  left: max(10px, var(--safe-l));
  right: max(10px, var(--safe-r));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 70;
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--under);
  border-radius: var(--r-md);
  padding: 12px 34px 12px 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateY(-130%);
  opacity: 0;
  transition: transform .42s cubic-bezier(.16, 1, .3, 1), opacity .3s ease;
  /* Claim the gesture entirely — otherwise the browser scrolls the page
     instead of letting the toast follow the finger. */
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

/* While a finger is down the toast must track it exactly, so no easing */
.toast.is-dragging {
  transition: none;
  cursor: grabbing;
}

.toast__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--ink-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

@media (hover: hover) {
  .toast__close:hover { color: var(--ink); background: var(--surface-3); }
}

.toast--in  { transform: translateY(0); opacity: 1; }
.toast--out { transform: translateY(-130%); opacity: 0; }

.toast__thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  background: var(--surface-3) center/cover no-repeat;
  flex-shrink: 0;
}

.toast__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.toast__eyebrow {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--under);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toast__prices {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.toast__price {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.toast__cex {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--over);
}

.toast .margin-badge { margin-top: 0; }

/* ============ auth screens ============ */

.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-b));
}

.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h1 {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 0;
}

.auth-error {
  margin: 0;
  font-size: 13.5px;
  color: var(--over);
  background: var(--over-bg);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.auth-submit { width: 100%; min-height: 48px; }
.auth-card .field input:disabled,
.auth-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ============ larger screens ============ */

@media (min-width: 700px) {
  .app { padding-left: 24px; padding-right: 24px; }
  .header__inner { padding-left: 24px; padding-right: 24px; }

  .status { display: inline-flex; }
  .brand__sub { display: block; }
  .brand h1 { font-size: 20px; }
  .brand__icon { width: 42px; height: 42px; }

  .btn--scan { width: auto; padding: 9px 15px; font-size: 14px; }
  .btn--scan .btn__label { display: block; }
  .btn--scan .btn__glyph { display: none; }

  /* Desktop has room for the button inline, so drop the floating one */
  #openAddTag { display: inline-flex; }
  #openAddCollectionItem { display: inline-flex; }
  .fab { display: none; }

  /* No floating button here, so the pill can sit low */
  .sync-pill { bottom: calc(22px + var(--safe-b)); }

  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

  .feed-card__link { padding: 16px 46px 16px 16px; gap: 16px; grid-template-columns: 84px 1fr; }
  .feed-card__thumb { width: 84px; height: 84px; }
  .feed-card__title { font-size: 16px; }

  /* Push the badge to the right edge so they line up into a column you can
     scan straight down for the best deals. */
  .feed-card__prices { gap: 12px; }
  .feed-card__prices .margin-badge { margin-left: auto; }

  .header__controls { gap: 10px; }

  /* Modals become centred dialogs rather than bottom sheets */
  .modal { align-items: center; padding: 24px; }
  .modal__dialog {
    width: min(440px, 100%);
    border-radius: var(--r-lg);
    padding: 22px;
    animation: dialog-in .2s cubic-bezier(.16, 1, .3, 1);
  }
  .modal__dialog::before { display: none; }
  .modal__actions { justify-content: flex-end; }
  .modal__actions .btn { flex: 0 0 auto; min-width: 104px; }

  /* Toasts return to the bottom-right */
  .toast-layer {
    top: auto;
    left: auto;
    bottom: 20px;
    right: 20px;
    width: min(400px, calc(100vw - 40px));
    flex-direction: column-reverse;
  }
  .toast { transform: translateX(115%); }
  .toast--in  { transform: translateX(0); }
  .toast--out { transform: translateX(115%); }

  .admin-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    grid-auto-flow: dense;
  }
  /* Categories is the tall one — give it its own column so Scanning and
     Data stack neatly beside it instead of leaving a hole. */
  .admin-grid > .panel:nth-child(2) { grid-row: span 2; }
  .admin-cat { flex-wrap: nowrap; }
  .admin-cat__main { flex: 1 1 auto; }
  .pager { justify-content: center; gap: 14px; }
  .pager__info { min-width: 128px; }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

@media (min-width: 1000px) {
  .app { padding-left: 32px; padding-right: 32px; }
  .header__inner { padding-left: 32px; padding-right: 32px; }
}

/* ============ dashboard ============ */

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.dash-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.dash-stat__value {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.dash-stat__label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  margin-top: 3px;
}

.dash-section { margin-bottom: 14px; }

.dash-list { display: flex; flex-direction: column; gap: 2px; }

.dash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
}

.dash-list .dash-row:last-child { border-bottom: none; }

.dash-row__rank {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  width: 16px;
  flex-shrink: 0;
  text-align: center;
}

.dash-row__body { min-width: 0; flex: 1; }

.dash-row__name {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dash-row__sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.dash-row__trend {
  flex-shrink: 0;
  text-align: right;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}

.dash-row__trend--up { color: var(--under); }
.dash-row__trend--down { color: var(--over); }
.dash-row__trend--flat { color: var(--ink-3); }

.dash-row__spark { flex-shrink: 0; width: 52px; height: 20px; }

/* ============ CEX store locator ============ */

.cex-locator__bar {
  display: flex;
  gap: 8px;
}

.cex-locator__bar input {
  flex: 1;
  min-width: 0;
}

.cex-locator__picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.cex-store-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
}

.cex-store-choice__region {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.cex-locator__saved {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cex-locator__saved-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px 13px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.cex-locator__saved-chip-remove {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.cex-locator__results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 10px;
}

.cex-locator__results-head .field__hint { margin: 0; }

.cex-locator__save-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.cex-locator__save-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

.cex-locator__save-btn--active {
  background: #FFF3D6;
  border-color: #F0C346;
  color: #B4820A;
}

.cex-locator__save-btn--active svg { fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* Same-depth moves (tab to tab) fade rather than slide -- a sideways slide
   would imply moving up or down a hierarchy that hasn't changed. */
.view-in--same { animation: view-fade .2s ease-out both; }

@keyframes view-fade {
  from { opacity: 0; transform: translate3d(0, 6px, 0); }
  to   { opacity: 1; transform: none; }
}

/* Touch feedback. A small give on press is a lot of why native lists feel
   responsive rather than inert; phone widths only, since it's meaningless
   without a finger. */
@media (max-width: 699px) {
  .item-card,
  .feed-card,
  .tile,
  .shelf-tile,
  .cover-grid__item,
  .case-grid__item,
  .news-card,
  .coming-soon-card,
  .dash-row {
    transition: transform .12s ease;
  }

  .item-card:active,
  .feed-card:active,
  .tile:active,
  .shelf-tile:active,
  .cover-grid__item:active,
  .case-grid__item:active,
  .news-card:active,
  .coming-soon-card:active,
  .dash-row:active {
    transform: scale(.982);
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-in--same { animation: none; }
}

/* ============ dark theme ============ */
/* Applied by adding .theme-dark to <body>. Everything here is a variable
   override plus a short list of exceptions -- the handful of places that
   hardcode a colour because it sits on a coloured background and had no
   reason to be themeable until now. */

body.theme-dark {
  /* Not pure black: a slightly lifted charcoal keeps the elevation steps
     between page, card and input readable, which pure black flattens. */
  --field: #14161A;
  --surface: #1B1E24;
  --surface-2: #21252B;
  --surface-3: #282D35;
  --line: #2F353E;
  --line-strong: #3E4650;

  --ink: #E9ECF1;
  --ink-2: #AAB2BE;
  --ink-3: #8E97A5;

  /* Chrome lifts away from the page rather than sinking into it -- a
     near-black button on a near-black page would simply vanish. */
  --chrome: #2C323B;
  --chrome-hover: #3A414C;

  /* Brightened so they still read as green/red against a dark surface;
     the light-theme values are tuned for contrast on white and go muddy. */
  --under: #4ADE9B;
  --over: #FF7A70;
  --under-bg: #12301F;
  --over-bg: #351917;
  --live: #4ADE9B;
  --sync: #A995FF;
  --focus: #6E9BFF;

  /* Shadows can't rely on darkening a light surface any more, so they lean
     on opacity against black instead. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .40);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .45), 0 8px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, .50), 0 24px 48px rgba(0, 0, 0, .45);

  background: var(--field);
  color: var(--ink);
}

/* --- exceptions: hardcoded colours that assume a light background --- */

/* Amber "worth a look" notices: pale wash + dark text doesn't survive the
   flip, so it becomes dark wash + bright text. */
body.theme-dark .item-hero__stock,
body.theme-dark .scan-result__stock {
  background: #3A2E10;
  color: #F0C346;
}

body.theme-dark .item-card__price--soldout { color: #E0AE3C; }

/* The pending dot's halo was a pale amber ring meant for a white card. */
body.theme-dark .tag-dot--pending { box-shadow: 0 0 0 3px #3A2E10; }

/* Search fields and inputs sit on cards, so they need to be distinguishable
   from the card rather than from a white page. */
body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-strong);
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder { color: var(--ink-3); }

/* Toggle track in its off state: --line-strong is now a dark grey, which
   reads as "on" against the surface. Pull it back down. */
body.theme-dark .toggle-switch__track { background: #454D58; }

/* The floating nav is already dark by design; against a dark page it needs
   a border to separate rather than a shadow. */
body.theme-dark .floating-nav {
  background: #22272E;
  border: 1px solid var(--line);
}

/* Code spans in hint text. */
body.theme-dark code {
  background: var(--surface-3);
  color: var(--ink-2);
}

/* Lightbox header actions: delete sits beside close. */
.lightbox__actions { display: flex; align-items: center; gap: 8px; }
.lightbox__actions .lightbox__close[hidden] { display: none; }

/* ============ collapsible game info (wanted items) ============ */

.game-accordion {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.game-accordion__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.game-accordion__title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  flex-shrink: 0;
}

/* Names the linked game (or says there isn't one) so the panel doesn't have
   to be opened just to find out whether it's worth opening. */
.game-accordion__hint {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-accordion__chev {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--ink-3);
  transition: transform .2s ease;
}

.game-accordion__head[aria-expanded="true"] .game-accordion__chev { transform: rotate(180deg); }

.game-accordion__body { padding: 0 16px 4px; }
.game-accordion__body[hidden] { display: none; }

/* The cards inside already carry their own frame; nested borders and
   shadows inside the accordion just look busy. */
.game-accordion__body .game-info,
.game-accordion__body .game-summary-card,
.game-accordion__body .game-details {
  border: none;
  box-shadow: none;
  background: none;
  padding-left: 0;
  padding-right: 0;
}

@media (prefers-reduced-motion: reduce) {
  .game-accordion__chev { transition: none; }
}

/* The accordion header already says "Game info", so the inner card's own
   title is a duplicate once nested. Its action buttons still matter, so
   only the heading goes. */
.game-accordion__body .game-info__title { display: none; }
.game-accordion__body .game-info__header { justify-content: flex-end; }

/* Marks a find that didn't come from Vinted. Vinted is the default source
   and most finds are Vinted, so only the exceptions get labelled. */
.feed-card__source {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  flex-shrink: 0;
}

/* Delete sits with the other item actions now. Tinted red so a destructive
   action doesn't look identical to the harmless ones beside it. */
.item-hero__icon-btn--danger { color: var(--over); }
.item-hero__icon-btn--danger:active { background: var(--over-bg); }

/* Sync button: blue at rest, purple while a refresh is running. */
.btn--icon.is-sync { background: var(--focus); border-color: var(--focus); color: #fff; }
.btn--icon.is-sync.is-syncing { background: var(--sync); border-color: var(--sync); }

/* Sort control on the wanted category page. */
.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sort-row__label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  flex-shrink: 0;
}

.sort-row select { flex: 1; min-width: 0; }

/* Boxed / manual, in the purchase details form. */
.completeness-row { display: flex; gap: 8px; }

.completeness-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
}

/* Checked state is a filled chip, so at a glance you can see what's ticked
   without having to read the small boxes. */
.completeness-opt:has(input:checked) {
  background: var(--sync);
  border-color: var(--sync);
  color: #fff;
}

/* Explicit size and no flex growth: the app's global input styling makes
   fields fill their row, which stretched these checkboxes into big blank
   pills instead of leaving them checkbox-sized. */
.completeness-opt input[type="checkbox"] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--sync);
}

.completeness-opt:has(input:checked) input[type="checkbox"] { accent-color: #fff; }

/* Shown on the item itself: "Boxed · Manual", or "Complete" when both. */
.item-hero__complete {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--under-bg);
  color: var(--under);
  margin-top: 6px;
}

/* ============ dashboard: collection performance callout ============ */

.dash-performance {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.dash-performance__label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.dash-performance__figures {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 14px;
  font-weight: 700;
}

.dash-performance__figures .sep { color: var(--ink-3); font-weight: 500; }

/* Reuses the same green/red pair as the under/over margin badges on find
   cards, so "gained" and "lost" read the same way everywhere in the app. */
.dash-performance__gain { color: var(--under); }
.dash-performance__loss { color: var(--over); }

/* ============ home screen: price movement overview ============ */

.home-movers {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.home-movers__title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
}

.home-movers__chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-mover {
  display: grid;
  /* Name and delta value both fixed width, bar track gets whatever's left.
     The delta used to be positioned relative to the bar itself, which
     overflowed the panel whenever a bar grew close to full width -- there
     was nowhere left to put the label. A dedicated column has no such
     ceiling: it's never affected by how wide the bar happens to be. */
  grid-template-columns: 78px 1fr 58px;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.home-mover__name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A single central zero-line with the bar growing left (fall) or right
   (rise) from it -- a diverging bar chart, the standard shape for "some
   went up, some went down" data. Two half-width tracks either side of a
   shared centre line, rather than one full-width bar, is what makes both
   directions readable against the same axis. */
.home-mover__track {
  position: relative;
  height: 18px;
  display: flex;
}

.home-mover__half {
  width: 50%;
  position: relative;
  height: 100%;
}

.home-mover__half--down { display: flex; justify-content: flex-end; }
.home-mover__half--up { display: flex; justify-content: flex-start; }

.home-mover__bar {
  height: 100%;
  border-radius: 3px;
  min-width: 3px;
}

.home-mover__bar--up { background: var(--under); }
.home-mover__bar--down { background: var(--over); }

.home-mover__zero {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
}

.home-mover__delta {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  text-align: right;
}

.home-mover__delta--up { color: var(--under); }
.home-mover__delta--down { color: var(--over); }
