/* DropNZ design system: tokens and rules come from the dropnz-design skill (design-model.yaml). */

:root {
  --font-display: 'Bungee', Impact, 'Arial Black', sans-serif;
  --font-body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-pixel: 'Silkscreen', 'Space Mono', monospace;

  --text-display: 44px;
  --text-heading: 26px;
  --text-subheading: 17px;
  --text-body: 15px;
  --text-body-sm: 13px;
  --text-caption: 12px;
  --text-label: 11px;
  --price-lg: 22px;
  --price-md: 16px;
  --price-was: 13px;

  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --radius-element: 2px;
  --radius-control: 4px;
  --radius-component: 8px;
  --radius-container: 12px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-fast: 100ms;
  --duration-medium: 180ms;
  --duration-slow: 280ms;

  --shadow-1: 3px 3px 0 0 var(--shadow-ink);
  --shadow-2: 5px 5px 0 0 var(--shadow-ink);
  --shadow-3: 8px 8px 0 0 var(--shadow-ink);
  --shadow-selected: 3px 3px 0 0 var(--accent);
  --glow-restock: 0 0 0 1px var(--restock), 0 0 24px -4px var(--restock);
}

/* Dark "Cabinet" is the default. */
:root,
[data-theme='dark'] {
  --background: #08070f;
  --bg: var(--background);
  --surface1: #111020;
  --surface2: #1b1a2e;
  --surface3: #2c2b45;
  --border: #1b1a2e;
  --border-visible: #4c4b69;
  --text1: #f4f3f9;
  --text2: #b3b2cb;
  --text3: #8c8bab;
  --text4: #6a6989;
  --accent: #22dcec;
  --accent-subtle: #062a31;
  --on-accent: #08070f;
  --success: #3df5a0;
  --success-bg: #06331f;
  --warning: #ffd93d;
  --warning-bg: #3a2e00;
  --error: #ff5a6e;
  --error-bg: #420a13;
  --restock: #ff3dcb;
  --restock-bg: #25041a;
  --deal: #ff8a3d;
  --deal-bg: #401a03;
  --shadow-ink: #2c2b45;
  --card-border: var(--border);
  --btn-border: transparent;
  --grain-opacity: 0.06;
  --halftone: rgb(34 220 236 / 16%);
  --scanline: rgb(255 255 255 / 5%);
  color-scheme: dark;
}

/* Light "Daylight Print": ink borders on paper. */
[data-theme='light'] {
  --background: #f4f3f9;
  --bg: var(--background);
  --surface1: #ffffff;
  --surface2: #e9e8f2;
  --surface3: #d5d4e4;
  --border: #d5d4e4;
  --border-visible: #08070f;
  --text1: #08070f;
  --text2: #4c4b69;
  --text3: #6a6989;
  --text4: #8c8bab;
  --accent: #00788a;
  --accent-subtle: #e6fdff;
  --on-accent: #ffffff;
  --success: #0a7f50;
  --success-bg: #e7fef3;
  --warning: #7a6000;
  --warning-bg: #fffbe0;
  --error: #c21832;
  --error-bg: #ffebee;
  --restock: #b80a89;
  --restock-bg: #ffe8f9;
  --deal: #b34400;
  --deal-bg: #fff0e5;
  --shadow-ink: #08070f;
  --card-border: var(--border-visible);
  --btn-border: var(--border-visible);
  --grain-opacity: 0.04;
  --halftone: rgb(8 7 15 / 14%);
  --scanline: rgb(8 7 15 / 5%);
  color-scheme: light;
}

/* ── Base ─────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--background);
}

body {
  min-height: 100vh;
  background: var(--background);
  color: var(--text1);
  font: 400 var(--text-body) / 1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* Grain: page background only. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  background: transparent;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pixel {
  font-family: var(--font-pixel);
  font-size: var(--text-label);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.glyph {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.glyph-24 {
  width: 24px;
  height: 24px;
}

.glyph-36 {
  width: 36px;
  height: 36px;
}

.scanlines {
  position: relative;
}

.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, var(--scanline) 0 1px, transparent 1px 3px);
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: var(--success);
  flex-shrink: 0;
}

.live-dot.is-live {
  animation: blink 1s steps(2, end) infinite;
}

.live-dot.is-warn {
  background: var(--warning);
}

.live-dot.is-error {
  background: var(--error);
}

@keyframes blink {
  50% {
    opacity: 0.15;
  }
}

/* ── Shell ────────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: 20px 14px;
  background: var(--surface1);
  border-right: 2px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
}

.logo b {
  color: var(--accent);
  font-weight: 400;
}

.logo-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-1);
}

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

.nav button {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: var(--radius-control);
  font-weight: 500;
  font-size: var(--text-body-sm);
  color: var(--text2);
  text-align: left;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.nav button i {
  font-size: 18px;
}

.nav button:hover {
  color: var(--text1);
  background: var(--surface2);
}

.nav button[aria-selected='true'] {
  color: var(--text1);
  background: var(--surface2);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav button[aria-selected='true'] i {
  color: var(--accent);
}

.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text3);
}

.nav-count .badge {
  height: 18px;
}

/* Status LCD: the one place scanlines and pixel type meet in the chrome. */
.lcd {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-control);
  background: var(--background);
  border: 2px solid var(--border);
}

.lcd-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
}

.lcd.is-warn .lcd-line {
  color: var(--warning);
}

.lcd.is-error .lcd-line {
  color: var(--error);
}

.lcd-sub {
  font-size: 11px;
  color: var(--text3);
}

.meter {
  display: flex;
  gap: 2px;
  height: 8px;
}

.meter i {
  flex: 1;
  border-radius: 1px;
  background: var(--surface3);
}

.meter i.on {
  background: var(--success);
}

.meter i.warn {
  background: var(--warning);
}

.meter i.err {
  background: var(--error);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 var(--space-lg);
  background: var(--background);
  border-bottom: 2px solid var(--border);
}

.top h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-heading);
  line-height: 1;
}

.logo-mobile {
  display: none;
}

.top-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: var(--space-lg) var(--space-lg) var(--space-2xl);
}

/* ── Controls ─────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

.btn i {
  font-size: 16px;
}

.btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-2);
}

.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.4;
  box-shadow: none;
  cursor: not-allowed;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid var(--btn-border);
  box-shadow: var(--shadow-1);
}

/* Quiet: Log in beside the one bright Sign up. */
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 2px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  color: var(--text1);
  background: var(--surface2);
}

/* Header buttons all stand the same height as the icon buttons beside them. */
.top-end .btn,
.lp-header-end .btn {
  height: 38px;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text1);
  border: 2px solid var(--border-visible);
  box-shadow: var(--shadow-1);
}

.btn-restock {
  background: var(--restock);
  color: var(--on-accent);
  border: 2px solid var(--btn-border);
  box-shadow: var(--shadow-1);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--surface2);
  border: 2px solid var(--border-visible);
  font-size: 18px;
  color: var(--text1);
}

.icon-btn:hover {
  border-color: var(--text2);
}

.toggle-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius-control);
  border: 2px solid var(--border-visible);
  background: var(--surface1);
  color: var(--text2);
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.toggle-btn i {
  font-size: 16px;
}

.toggle-btn:hover {
  color: var(--text1);
  border-color: var(--text2);
}

.toggle-btn[aria-pressed='true'] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.link-btn {
  font-weight: 600;
  font-size: var(--text-body-sm);
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--text1);
  text-decoration-color: var(--accent);
}

.kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  min-width: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-element);
  background: var(--surface3);
  color: var(--text2);
  font: 400 var(--text-caption) / 1 var(--font-mono);
}

/* ── Badges & tags ────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-element);
  border: 1.5px solid currentColor;
  font: 400 var(--text-label) / 1 var(--font-pixel);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge svg {
  width: 10px;
  height: 10px;
}

.badge-in {
  background: var(--success-bg);
  color: var(--success);
}

.badge-low {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-restock {
  background: var(--restock-bg);
  color: var(--restock);
}

.badge-out {
  background: var(--surface3);
  color: var(--text2);
  border-color: var(--surface3);
}

.badge-deal {
  background: var(--deal-bg);
  color: var(--deal);
}

.badge-info {
  background: var(--accent-subtle);
  color: var(--accent);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error);
}

.badge-nodata {
  background: transparent;
  color: var(--text3);
  border-style: dashed;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-element);
  background: var(--surface3);
  color: var(--text2);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.count-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-element);
  background: var(--restock);
  color: var(--on-accent);
  outline: 2px solid var(--surface1);
  font: 400 var(--text-label) / 1 var(--font-pixel);
}

.count-badge.is-error {
  background: var(--error);
}

/* ── Cards / KPIs ─────────────────────────────────────── */

.card {
  position: relative;
  background: var(--surface1);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-component);
  box-shadow: var(--shadow-1);
}

/* What the radar holds, under the last card: context, not a dashboard. */
.summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: var(--text-body-sm);
  color: var(--text3);
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 8px;
}

.summary b {
  color: var(--text1);
  font-weight: 600;
}

.summary .is-hot,
.summary .is-hot b {
  color: var(--restock);
}

.summary .is-hot i {
  margin-right: 4px;
  vertical-align: -2px;
}

.summary .sep {
  color: var(--border-visible);
}

/* ── Pop-ups (watched items in stock, what just changed) ─ */
/* Float over the page in a corner, never pushing it about; each has a cross. */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  position: relative;
  padding: 12px 40px 12px 14px;
  border-radius: var(--radius-component);
  background: var(--surface1);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-1);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast.is-restock {
  border-color: var(--restock);
  box-shadow: var(--glow-restock);
}

.toast.is-deal {
  border-color: var(--deal);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

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

.toast-x {
  position: absolute;
  top: 6px;
  right: 6px;
}

.toast-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.toast.is-restock .toast-head i {
  color: var(--restock);
}

.toast.is-deal .toast-head i {
  color: var(--deal);
}

.toast-title {
  margin: 6px 0 0;
  font-weight: 600;
  font-size: var(--text-body-sm);
}

.toast-meta {
  display: block;
  margin: 2px 0 0;
  font-size: var(--text-caption);
  color: var(--text3);
}

.toast-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: var(--text-body-sm);
}

.toast-list a {
  color: var(--text1);
  font-weight: 600;
}

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

/* ── Watchlist rows ───────────────────────────────────── */

.watch-list {
  display: grid;
  gap: 10px;
}

.watch-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 12px;
}

.watch-row.is-in {
  border-color: var(--restock);
}

.watch-thumb {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-control);
  background: var(--surface2);
  overflow: hidden;
}

.watch-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.watch-main h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.watch-main h3 a {
  color: var(--text1);
}

.watch-store {
  margin-top: 2px;
  font-size: var(--text-caption);
  color: var(--text3);
}

.watch-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  font-size: var(--text-body-sm);
  color: var(--text2);
}

.watch-updates {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-caption);
  color: var(--text2);
}

.watch-updates li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.watch-updates time {
  margin-left: auto;
  color: var(--text3);
}

.watch-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

@media (max-width: 600px) {
  .watch-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .watch-thumb {
    width: 56px;
    height: 56px;
  }

  .watch-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .watch-actions [data-unwatch] {
    margin-left: auto;
  }
}

/* ── Choosing stores ──────────────────────────────────── */

.watch-sheet-product {
  margin: 0 0 12px;
  font-size: var(--text-body-sm);
  color: var(--text2);
}

.watch-sheet-product b {
  color: var(--text1);
  font-size: 15px;
}

.scope-choice {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
}

.store-picks {
  display: grid;
  gap: 10px;
  max-height: min(46vh, 380px);
  overflow-y: auto;
  padding: 4px 2px 8px;
  border-top: 1px solid var(--border);
}

.store-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.store-group legend {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
  font: 700 var(--text-caption) / 1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}

.store-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 8px;
  border-radius: var(--radius-control);
  font-size: var(--text-body-sm);
  cursor: pointer;
}

.store-pick:hover {
  background: var(--surface2);
}

.store-pick span {
  flex: 1;
  min-width: 0;
}

.store-pick small {
  font: 400 var(--text-caption) var(--font-mono);
  color: var(--text3);
}

.store-pick.is-in small {
  color: var(--success);
}

.opt-sub {
  margin-left: 26px;
}

/* ── Filter bar ───────────────────────────────────────── */

.filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  margin-bottom: 20px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field {
  flex: 1;
  min-width: 220px;
}

.input-lg {
  height: 56px;
  padding: 0 52px 0 50px;
  font-size: 17px;
}

.search-field:has(.input-lg) > i {
  left: 18px;
  font-size: 20px;
}

.search-field:has(.input-lg) .kbd {
  right: 16px;
}

.field > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 16px;
  pointer-events: none;
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 40px;
  border-radius: var(--radius-control);
  background: var(--surface2);
  border: 2px solid var(--border-visible);
  color: var(--text1);
  outline: none;
  transition:
    border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

.input::placeholder {
  color: var(--text3);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input::-webkit-search-cancel-button {
  display: none;
}

/* Checkbox rendered as a single-segment pill toggle. */
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip input:focus-visible + span {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

.chips {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.chip span {
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-visible);
  background: var(--surface1);
  color: var(--text2);
  font-weight: 500;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.chip:hover span {
  color: var(--text1);
  border-color: var(--text2);
}

.chip input:checked + span,
.chip[aria-pressed='true'] span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-1);
}

.chips-bare {
  margin-bottom: 20px;
}

/* One row of dropdown pills and toggles: Store, Region, Language, In stock, Watching ... Sort. */
.filterbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.menu-anchor {
  position: relative;
}

.sort-anchor {
  margin-left: auto;
}

/* The Type pill and the short sort label are for phones; a computer has room for the chip strip. */
.type-anchor,
.fpill-short {
  display: none;
}

@media (min-width: 861px) {
  .type-sheet,
  .type-sheet[hidden] {
    display: contents !important;
  }

  .type-sheet > .menu-head,
  .type-sheet > .menu-foot {
    display: none;
  }
}

.fpill {
  position: relative;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-visible);
  background: var(--surface1);
  color: var(--text2);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.fpill:hover {
  color: var(--text1);
  border-color: var(--text2);
}

.fpill > i {
  font-size: 15px;
}

.fpill .caret {
  font-size: 12px;
  color: var(--text3);
  transition: transform var(--duration-fast) var(--ease);
}

.fpill[aria-expanded='true'] {
  color: var(--text1);
  border-color: var(--accent);
}

.fpill[aria-expanded='true'] .caret {
  transform: rotate(180deg);
}

/* Picked: accent ink on the subtle accent fill. The solid accent stays with the type chips above. */
.fpill.is-active,
.fpill-toggle:has(input:checked) {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--text1);
}

.fpill.is-active > i,
.fpill-toggle:has(input:checked) > i {
  color: var(--accent);
}

.fpill-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sort is a setting, not a filter, so it sits quiet until hovered. */
.fpill-quiet {
  border-color: transparent;
  background: transparent;
}

.fpill-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fpill:focus-visible,
.fpill-toggle:has(input:focus-visible) {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: 300px;
  max-height: min(460px, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--surface1);
  border: 2px solid var(--border-visible);
  border-radius: var(--radius-component);
  box-shadow: var(--shadow-2);
}

.menu[hidden] {
  display: none;
}

.menu-end {
  left: auto;
  right: 0;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 12px 14px 8px;
}

.menu-head b {
  font-weight: 600;
  font-size: 15px;
}

/* Desktop closes on a click outside; the sheet on a phone gets a close button. */
.menu-x {
  display: none;
}

.menu-note {
  padding: 0 14px 8px;
  font-size: var(--text-caption);
  color: var(--text3);
}

.menu-search {
  padding: 0 10px 8px;
}

.menu-search > i {
  left: 22px;
  top: calc(50% - 4px);
}

.menu-search .input {
  height: 36px;
  padding: 0 12px 0 34px;
  font-size: 14px;
}

.menu-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  padding: 2px 6px 6px;
}

.menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: var(--radius-control);
  font-size: 14px;
  color: var(--text1);
  cursor: pointer;
}

.opt:hover {
  background: var(--surface2);
}

.opt.is-empty {
  color: var(--text3);
}

.opt-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opt-name small {
  display: block;
  font: 400 var(--text-caption) / 1.3 var(--font-mono);
  color: var(--text3);
}

.opt-count {
  font: 400 var(--text-caption) var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text3);
}

/* Checkbox and radio as the system draws them: 18px, 2px border, accent when on. */
.opt input {
  appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--border-visible);
  border-radius: var(--radius-element);
  background: var(--surface1);
  cursor: pointer;
}

.opt input[type='radio'] {
  border-radius: 50%;
}

.opt:hover input {
  border-color: var(--text2);
}

.opt input:checked {
  border-color: var(--accent);
}

.opt input[type='checkbox']:checked {
  background: var(--accent);
}

.opt input[type='checkbox']:checked::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

.opt input[type='radio']:checked::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.opt input:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

.menu-backdrop {
  display: none;
}

/* Each active filter as a chip that undoes it; only there once something is picked. */
.results-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  min-height: 28px;
}

/* Under the grid: how much is showing, then the radar's summary. */
.results-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-lg);
  padding: var(--space-md) 0;
  border-top: 2px dashed var(--border);
  text-align: center;
}

.count {
  font-size: var(--text-body-sm);
  color: var(--text2);
}

.count b {
  font: 700 var(--text-body-sm) var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text1);
}

.count:empty {
  display: none;
}

.active-chips {
  display: contents;
}

.active-chip {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--accent);
  background: var(--accent-subtle);
  color: var(--text1);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}

.active-chip i {
  font-size: 12px;
  color: var(--accent);
}

.active-chip:hover i {
  color: var(--text1);
}

.active-chip:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

/* ── Product grid ─────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--space-md);
}

.product {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--space-md);
  min-width: 0;
  transition:
    transform var(--duration-medium) var(--ease),
    box-shadow var(--duration-medium) var(--ease);
}

.product:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-2);
}

.product.is-watched {
  border-color: var(--accent);
  box-shadow: var(--shadow-selected);
}

/* The glow belongs to the single freshest restock on screen. */
.product.is-restock {
  border-color: var(--restock);
  box-shadow: var(--glow-restock);
}

/* One link stretched over the card is the click target; the watch button, maps links and the
   availability toggle sit above it and stay independently clickable. */
.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.card-link:focus-visible {
  outline-offset: 2px;
}

.well {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--surface2);
}

.well img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

/* Product photos are shot on white; multiply lets that white take the paper tone instead of
   glaring out of the dark cabinet. */
.well.has-image {
  background: #e9e8f2;
}

.well.has-image img,
.event-thumb.has-image img {
  mix-blend-mode: multiply;
}

.product.is-out .well img {
  filter: grayscale(1);
  opacity: 0.55;
}

.halftone::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--halftone) 1.2px, transparent 1.4px);
  background-size: 6px 6px;
  -webkit-mask-image: linear-gradient(135deg, #000 0%, transparent 75%);
  mask-image: linear-gradient(135deg, #000 0%, transparent 75%);
}

.well .glyph {
  color: var(--text4);
}

.well-status {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(100% - 56px);
}

.watch-btn {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--surface1);
  border: 2px solid var(--border-visible);
  color: var(--text2);
  font-size: 16px;
}

.watch-btn:hover {
  color: var(--text1);
}

.watch-btn[aria-pressed='true'] {
  color: var(--accent);
  border-color: var(--accent);
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.product h3 {
  font-weight: 600;
  font-size: var(--text-body);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  min-height: 2.6em;
}

.product-where {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: -6px;
  font-size: var(--text-body-sm);
  color: var(--text2);
}

.product-where span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-where i {
  flex-shrink: 0;
  color: var(--success);
}

.product-where.is-none,
.product-where.is-none i {
  color: var(--text3);
}

.product-store {
  margin-top: -4px;
  font: 700 var(--text-caption) var(--font-mono);
  color: var(--text2);
}

/* A store-wide caution on each of its products (Toyworld's unreliable stock). Above the card's
   full-card link, so its text can be read and selected. */
.stock-notice {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 4px 8px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: var(--text-caption);
  line-height: 1.35;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: 6px;
}

.stock-notice i {
  flex: none;
  margin-top: 2px;
}

.product-price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.price {
  font: 700 var(--price-lg) / 1.1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text1);
}

.price-md {
  font-size: var(--price-md);
}

.price-was {
  font: 400 var(--price-was) var(--font-mono);
  color: var(--text3);
  text-decoration: line-through;
}

.product.is-out .price {
  color: var(--text3);
}

/* Per-branch availability */
.stock-detail {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.stock-detail summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  font-size: var(--text-body-sm);
  color: var(--text2);
}

.stock-detail summary::-webkit-details-marker {
  display: none;
}

.stock-detail summary i {
  margin-left: auto;
  color: var(--text3);
  transition: transform var(--duration-medium) var(--ease);
}

.stock-detail[open] summary i {
  transform: rotate(180deg);
  color: var(--accent);
}

.stock-detail summary:hover {
  color: var(--text1);
}

.stock-list {
  list-style: none;
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: var(--text-body-sm);
}

.stock-row:first-child {
  border-top: none;
}

.stock-row .loc {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stock-row .loc span:last-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-row.is-out {
  color: var(--text3);
}

.stock-row .level {
  flex-shrink: 0;
  font: 400 var(--text-caption) var(--font-mono);
  color: var(--text3);
}

.stock-row.is-in .level {
  color: var(--success);
}

.maps-link {
  color: var(--text3);
  font-size: 14px;
}

.maps-link:hover {
  color: var(--accent);
}

/* Skeleton: a hard-edged band stepping across, never a soft shimmer. */
.skel {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--surface2);
}

.skel::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  background: var(--surface3);
  animation: sweep 1.2s steps(8, end) infinite;
}

@keyframes sweep {
  from {
    left: -30%;
  }
  to {
    left: 100%;
  }
}

.empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
}

.empty-art {
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--accent);
}

.empty-art .glyph {
  position: relative;
  z-index: 1;
}

.empty h2 {
  font-weight: 600;
  font-size: var(--text-subheading);
  color: var(--text2);
}

.empty p {
  max-width: 380px;
  color: var(--text3);
}

/* ── Activity feed ────────────────────────────────────── */

.feed {
  list-style: none;
  overflow: hidden;
}

.event {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.event:first-child {
  border-top: none;
}

.event:hover {
  background: var(--surface2);
}

.event.is-new {
  background: var(--restock-bg);
  box-shadow: inset 3px 0 0 var(--restock);
}

.event-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--surface2);
  color: var(--text4);
}

.event-thumb.has-image {
  background: #e9e8f2;
}

.event-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

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

.event-main a {
  font-weight: 600;
  font-size: var(--text-body-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-main a:hover {
  color: var(--accent);
}

.event-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--text-body-sm);
  color: var(--text2);
}

.event-line .num {
  color: var(--text1);
  font-weight: 700;
}

.event-line s {
  color: var(--text3);
  font-weight: 400;
}

.event time {
  font: 400 var(--text-caption) var(--font-mono);
  color: var(--text3);
  white-space: nowrap;
}

/* ── Stores ───────────────────────────────────────────── */

.stores {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.store {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  min-width: 0;
}

.store.is-failing {
  border-color: var(--error);
}

.store-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.monogram {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--surface3);
  font-family: var(--font-display);
  font-size: 15px;
}

.store-name {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-name:hover {
  color: var(--accent);
}

.store-via {
  font: 400 var(--text-caption) var(--font-mono);
  color: var(--text3);
}

.store-mid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.store-count {
  font-family: var(--font-display);
  font-size: var(--text-heading);
  line-height: 1;
}

.store-count.is-zero {
  color: var(--text4);
}

.store-count small {
  display: block;
  margin-top: 6px;
  color: var(--text3);
}

.store-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 400 var(--text-caption) var(--font-mono);
  color: var(--text3);
  text-align: right;
}

.store-error {
  padding: 8px 10px;
  border-radius: var(--radius-control);
  background: var(--error-bg);
  box-shadow: inset 3px 0 0 var(--error);
  font: 400 var(--text-caption) / 1.4 var(--font-mono);
  color: var(--text1);
  overflow-wrap: anywhere;
}

.store-foot > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.store-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font: 400 var(--text-caption) var(--font-mono);
  color: var(--text3);
}

/* ── Watchlist tab ────────────────────────────────────── */

.watch-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.watch-head-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 22px;
}

.watch-head h2 {
  margin-bottom: 4px;
  font-weight: 600;
  font-size: var(--text-subheading);
}

.watch-head p {
  max-width: 640px;
  font-size: var(--text-body-sm);
  line-height: 1.55;
  color: var(--text2);
}

.count-badge.is-in {
  background: var(--success);
  color: var(--on-accent);
}

/* ── Account ──────────────────────────────────────────── */

.acct-btn .badge {
  margin-left: 2px;
}

/* A member's account button carries the accent, so it still says "member" on a phone, where
   the button shrinks to its icon. */
.acct-btn.is-member {
  color: var(--accent);
  border-color: var(--accent);
}

.watch-sync {
  margin-top: 8px;
}

.watch-sync .link-btn {
  font-size: inherit;
}

.acct-plan {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 4px;
  background: var(--surface2);
  border-left: 2px solid var(--text3);
  font-size: var(--text-body-sm);
  line-height: 1.5;
  color: var(--text2);
}

.acct-plan.is-on {
  background: var(--accent-subtle);
  border-left-color: var(--accent);
}

.acct-plan i {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 18px;
  color: var(--accent);
}

.acct-plan b {
  color: var(--text1);
}

.acct-plan a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
}

.acct .opt {
  padding-left: 0;
}

.acct-note {
  font-size: var(--text-body-sm);
  line-height: 1.5;
  color: var(--text2);
}

.acct-error {
  margin-top: 12px;
  font-size: var(--text-body-sm);
  color: var(--error);
}

.acct-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

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

.acct-note a,
.acct-fine a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.acct-fine {
  margin-top: 14px;
  font-size: var(--text-caption);
  line-height: 1.5;
  color: var(--text3);
}

/* Straight back from member login: one line saying what just switched on. */
.member-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--success-bg);
  border-left: 2px solid var(--success);
  font-size: var(--text-body-sm);
}

.member-note i {
  font-size: 18px;
  color: var(--success);
}

/* The radar trails the Discord; one quiet line says so, and where live is. */
.delay-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-caption);
  color: var(--text3);
}

.delay-note .sep {
  color: var(--border-visible);
}

.delay-note i {
  color: var(--text3);
}

.delay-note a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* ── Modals (welcome, account) ────────────────────────── */

.modal {
  width: min(520px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  /* A phone's toolbars eat into 100vh; dvh is the height actually on screen. */
  max-height: min(720px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  color: var(--text1);
  background: var(--surface1);
  border: 2px solid var(--border-visible);
  border-radius: var(--radius-container);
  box-shadow: var(--shadow-3);
}

.modal[open] {
  display: flex;
  flex-direction: column;
}

.modal::backdrop {
  background-color: rgb(8 7 15 / 80%);
  background-color: color-mix(in srgb, var(--background) 80%, transparent);
  background-image: radial-gradient(var(--halftone) 1.2px, transparent 1.4px);
  background-size: 8px 8px;
}

.modal-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px 14px;
}

.modal-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1;
}

.modal-x {
  margin-left: auto;
}

/* flex: 1 1 auto, not flex: 1: Safari squashes a 0%-basis child of an auto-height column to
   nothing, which left the dialogs compressed with their text hidden on iPhones. */
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 24px 16px;
}

/* Warning banner, as the system draws one: tinted fill, 2px left rule, icon in the status colour. */
.modal-note {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 4px;
  background: var(--warning-bg);
  border-left: 2px solid var(--warning);
  font-size: var(--text-body-sm);
}

.modal-note > i {
  flex-shrink: 0;
  font-size: 20px;
  color: var(--warning);
}

.modal-note b {
  font-weight: 600;
}

.modal-note p {
  margin-top: 4px;
  line-height: 1.5;
  color: var(--text2);
}

.modal-intro {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text2);
}

.modal-plan + .modal-note {
  margin-top: 18px;
}

.modal-body h3 {
  margin: 22px 0 8px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}

.modal-plan {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 20px;
  font-size: var(--text-body-sm);
  line-height: 1.5;
  color: var(--text2);
}

.modal-plan b {
  color: var(--text1);
  font-weight: 600;
}

.modal-plan li::marker {
  color: var(--accent);
}

.modal-links {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  font-size: var(--text-body-sm);
  color: var(--text3);
}

.modal-links a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal-foot {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ── Mobile tab bar ───────────────────────────────────── */

.tabbar {
  display: none;
}

/* ── Responsive ───────────────────────────────────────── */

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

  .side {
    display: none;
  }

  .logo-mobile {
    display: flex;
    padding: 0;
    font-size: 18px;
  }

  .top {
    padding: 0 var(--space-md);
  }

  .top h1 {
    display: none;
  }

  .toggle-btn span {
    display: none;
  }

  .top-end {
    gap: 8px;
  }

  .top-end .toggle-btn {
    padding: 0 10px;
  }

  .content {
    padding: var(--space-md) var(--space-md) 96px;
  }

  .filters {
    gap: 12px;
    padding: 14px;
  }

  .input-lg {
    height: 48px;
    padding-right: 16px;
    font-size: 16px;
  }

  .search-field .kbd {
    display: none;
  }

  /* Chips become a single swipeable strip, faded at the edge to say there's more. */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -14px;
    padding: 0 14px 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chips-bare {
    margin: 0 -16px 16px;
    padding: 0 16px 4px;
  }

  /* Every filter in view, nothing to swipe for: Type, Store and Region first, then the quieter
     In stock, Language and Sort. Each pill opens as a bottom sheet. */
  .filterbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .type-anchor {
    display: block;
  }

  .filterbar .fpill {
    width: 100%;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
  }

  .filterbar .fpill-label {
    min-width: 0;
    max-width: none;
  }

  /* Every pill opens a sheet; the caret only costs room a label needs. */
  .filterbar .caret {
    display: none;
  }

  /* The second row: settings more than filters, so they sit lighter until one is picked. */
  .filterbar .fpill-toggle,
  .lang-anchor .fpill,
  .sort-anchor .fpill {
    height: 32px;
    font-weight: 500;
  }

  .filterbar .fpill-toggle:not(:has(input:checked)),
  .lang-anchor .fpill:not(.is-active),
  .sort-anchor .fpill {
    border-color: transparent;
    background: var(--surface2);
  }

  .filterbar .fpill-toggle {
    order: 1;
  }

  .lang-anchor {
    order: 2;
  }

  .sort-anchor {
    order: 3;
    margin-left: 0;
  }

  .sort-anchor .fpill-label {
    display: none;
  }

  .fpill-short {
    display: inline;
  }

  /* A 360px phone has room for the word "Language" or its icon, not both. */
  @media (max-width: 400px) {
    .lang-anchor .fpill > i:first-child {
      display: none;
    }
  }

  /* On a phone the type chips wait in their sheet, wrapped, with room for a thumb. */
  .type-sheet .chips {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0;
    padding: 4px 14px 14px;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .type-sheet .chip span {
    height: 40px;
    padding: 0 16px;
    font-size: 14px;
  }

  .menu,
  .menu-end {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: auto;
    max-height: 80vh;
    border-width: 2px 0 0;
    border-radius: 12px 12px 0 0;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .menu::before {
    content: '';
    align-self: center;
    flex-shrink: 0;
    width: 40px;
    height: 4px;
    margin-top: 8px;
    border-radius: 2px;
    background: var(--surface3);
  }

  .menu-x {
    display: inline-flex;
  }

  .opt {
    min-height: 44px;
  }

  .menu-done {
    flex: 1;
    height: 44px;
  }

  .menu-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: color-mix(in srgb, var(--background) 80%, transparent);
  }

  body.sheet-open {
    overflow: hidden;
  }

  /* The sheets live inside the shell, which sits under the tab bar; lift it so a sheet's
     "Show results" button isn't hidden behind the tabs, and the backdrop dims them too. */
  body.sheet-open .shell {
    z-index: 40;
  }

  .toasts {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface1);
    border-top: 2px solid var(--border);
  }

  .tabbar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 500;
    font-size: 11px;
    color: var(--text3);
  }

  .tabbar button i {
    font-size: 20px;
  }

  .tabbar button[aria-selected='true'] {
    color: var(--accent);
    box-shadow: inset 0 3px 0 var(--accent);
  }

  .icon-wrap {
    position: relative;
    display: inline-flex;
  }
}

@media (max-width: 600px) {
  /* Two cards side by side: the photo on top, the essentials under it. */
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product {
    gap: 6px;
    padding: 8px;
  }

  .product .well-status {
    top: 6px;
    left: 6px;
    max-width: calc(100% - 40px);
  }

  .product .watch-btn {
    width: 30px;
    height: 30px;
    top: 12px;
    right: 12px;
    font-size: 15px;
  }

  .product h3 {
    font-size: var(--text-body-sm);
  }

  .product-store {
    margin-top: -2px;
    font-size: 11px;
  }

  .product-where {
    margin-top: -2px;
    font-size: 12px;
  }

  .product .tag {
    max-width: 100%;
    height: 20px;
    padding: 0 6px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
  }

  .price {
    font-size: var(--price-md);
  }

  .product .price-was {
    font-size: 12px;
  }

  .product .stock-detail summary {
    font-size: 12px;
  }
}

@media (max-width: 460px) {
  .event {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .event-thumb {
    width: 40px;
    height: 40px;
  }

  .event time {
    grid-column: 2;
  }
}

.row-status {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0ms !important;
  }
}

/* A phone's app bar: the logo mark, the tools, then Log in and Sign up; the word would crowd them. */
@media (max-width: 480px) {
  .logo-mobile .logo-word {
    display: none;
  }
}

@media (max-width: 480px) {
  /* The browser's own dialog rule caps width at 100% - 2em; let it use the phone's width. */
  .modal {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }

  .modal-head {
    padding: 16px 16px 10px;
  }

  .modal-head h2 {
    font-size: 20px;
  }

  .modal-body {
    padding: 0 16px 14px;
  }

  .modal-foot {
    padding: 12px 16px 16px;
  }
}

/* The welcome's one-line caveat about stock, quieter than a warning box. */
.modal-fine {
  margin: 4px 0 0;
  font-size: var(--text-body-sm);
  line-height: 1.5;
  color: var(--text3);
}

.acct-discord {
  align-self: flex-start;
  margin-top: 8px;
}

/* Under the grid: the next page of cards. Wide on a phone, where it's what the thumb lands on. */
.show-more {
  min-width: min(100%, 280px);
}

.show-more[hidden] {
  display: none;
}

/* ── Confirming and saying so ─────────────────────────── */

.modal-confirm {
  width: min(420px, calc(100vw - 32px));
}

.confirm-body {
  margin: 0;
  line-height: 1.55;
  color: var(--text2);
}

.confirm-body b {
  color: var(--text1);
}

.confirm-foot {
  gap: 10px;
}

.btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.toast-ok {
  color: var(--success);
}

.acct-saved {
  margin: 8px 0 0;
  font: 400 var(--text-caption) var(--font-mono);
  color: var(--success);
}
