/* Rarityfolio · application styles. Tokens live in tokens.css. Mobile first:
   <768 phone (drawer + tab bar) · 768–1099 tablet (icon rail) · ≥1100 desktop (sidebar). */

/* ============ 1 · Base ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 12px);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: var(--fw-regular) var(--fs-md) / var(--lh) var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img {
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  text-wrap: balance;
}
h2 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  line-height: var(--lh-snug);
}
h3 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}
small {
  font-size: var(--fs-sm);
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}
::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}
[hidden] {
  display: none !important;
}
.muted {
  color: var(--text-3);
}
.num,
.price,
.stat-value,
.tile-meta,
.tile-price,
.pager-label {
  font-variant-numeric: tabular-nums;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.i {
  flex: none;
  display: block;
}
.eyebrow {
  display: block;
  margin-bottom: var(--s-1);
  color: var(--accent-text);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.text-gradient {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============ 2 · Buttons ============ */
.btn {
  --btn-h: var(--h-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--btn-h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition:
    transform var(--dur-1) var(--ease),
    background-color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease);
}
.btn:active {
  transform: scale(0.97);
}
.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}
.btn-primary {
  background: var(--grad);
  color: var(--on-accent);
  box-shadow: var(--glow);
}
.btn-primary:hover {
  background: var(--grad-hover);
  box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--surface-2);
}
.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.btn-soft:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.btn-ghost {
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-glass {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  backdrop-filter: blur(10px);
}
.btn-glass:hover {
  background: rgba(255, 255, 255, 0.2);
}
.btn-white {
  background: #fff;
  color: #2a1458;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}
.btn-sm {
  --btn-h: var(--h-sm);
  padding: 0 14px;
  border-radius: 10px;
  font-size: var(--fs-sm);
}
.btn-lg {
  --btn-h: var(--h-lg);
  padding: 0 24px;
  border-radius: 14px;
  font-size: var(--fs-md);
}
.btn-block {
  width: 100%;
}
.btn .i {
  margin-inline: -2px;
}
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--h-md);
  height: var(--h-md);
  border-radius: 12px;
  color: var(--text-2);
  transition:
    background-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease),
    transform var(--dur-1) var(--ease);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn.outlined {
  background: var(--surface);
  border: 1px solid var(--border-strong);
}
.icon-btn.sm {
  width: var(--h-sm);
  height: var(--h-sm);
  border-radius: 10px;
}
.icon-btn.is-placeholder {
  visibility: hidden;
}
.icon-btn .count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--grad);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 18px;
  text-align: center;
}
.link-more {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.link-more:hover .i {
  transform: translateX(2px);
}
.link-more .i {
  transition: transform var(--dur-2) var(--ease);
}
.source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.source:hover {
  color: var(--accent-text);
}

/* ============ 3 · Forms ============ */
.input,
.select select,
textarea.input {
  width: 100%;
  height: var(--h-md);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px; /* avoids iOS zoom */
  transition:
    border-color var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
  appearance: none;
}
textarea.input {
  height: auto;
  min-height: 112px;
  padding: 12px 14px;
  resize: vertical;
  line-height: var(--lh);
}
.input::placeholder {
  color: var(--text-3);
}
.input:hover,
.select select:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong));
}
.input:focus,
.select select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.input[type='file'] {
  height: auto;
  padding: 10px;
  font-size: var(--fs-sm);
}
.select {
  position: relative;
  display: block;
  min-width: 0;
}
.select select {
  padding-right: 38px;
  text-overflow: ellipsis;
  cursor: pointer;
}
.select .i {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.select.sm select {
  height: var(--h-sm);
  font-size: var(--fs-sm);
  border-radius: 10px;
}
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field-label {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.field-hint {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.field-hint.is-ok {
  color: var(--success);
}
.form-grid {
  display: grid;
  gap: var(--s-4);
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
.searchbox {
  position: relative;
  display: block;
  flex: 1;
  min-width: 0;
}
.searchbox > .i {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.searchbox .input {
  padding-left: 42px;
}
.searchbox .input::-webkit-search-cancel-button {
  cursor: pointer;
}
.input-wrap {
  position: relative;
}
.input-wrap > .i {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.input-wrap .input {
  padding-left: 44px;
}
.input-wrap .reveal {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 40px;
  height: 40px;
}
.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur-2) var(--spring);
}
.switch:checked {
  background: var(--grad);
}
.switch:checked::after {
  transform: translateX(18px);
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 56px;
  cursor: pointer;
}
.switch-row b {
  display: block;
  font-weight: var(--fw-semibold);
}
.switch-row small {
  display: block;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.check {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.choice {
  position: relative;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--dur-2) var(--ease);
}
.choice input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}
.choice input:focus-visible + span {
  box-shadow: var(--focus-ring);
}
.form-error {
  min-height: 1.4em;
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

/* ============ 4 · Chips & badges ============ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tier-common);
}
.chip[data-tier='rare'] i {
  background: var(--tier-rare);
}
.chip[data-tier='ultra'] i {
  background: var(--tier-ultra);
}
.chip[data-tier='promo'] i {
  background: var(--tier-promo);
}
.chip[data-tier='secret'] i {
  background: var(--holo);
  box-shadow: 0 0 0 1px rgba(224, 169, 27, 0.4);
}
.chip.ok {
  border-color: transparent;
  background: var(--success-soft);
  color: var(--success);
}
.chip.accent {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.chip.warn {
  border-color: transparent;
  background: var(--warning-soft);
  color: var(--warning);
}
a.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-scroll {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding: 2px var(--gutter);
  scroll-padding-inline: var(--gutter);
}
.chip-scroll::-webkit-scrollbar {
  display: none;
}
.pill-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: var(--h-sm);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition: all var(--dur-2) var(--ease);
}
.pill-link:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.pill-link.is-active {
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
}
.pill-link.removable {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.mini-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--grad);
  color: #fff;
  font-size: 11px;
  font-weight: var(--fw-bold);
}

/* ============ 5 · Surfaces & lists ============ */
.panel {
  padding: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--e-1);
}
.panel + .panel {
  margin-top: var(--s-4);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.panel-head h2 {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.panel-head h2 .i {
  color: var(--accent);
}
.panel.flush {
  padding: var(--s-2) var(--s-5);
}
.list {
  display: grid;
}
.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 60px;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child {
  border-bottom: 0;
}
a.row {
  margin-inline: calc(var(--s-3) * -1);
  padding-inline: var(--s-3);
  border-radius: 12px;
  border-bottom-color: transparent;
  transition: background var(--dur-2) var(--ease);
}
a.row:hover {
  background: var(--surface-2);
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-title {
  display: block;
  overflow: hidden;
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub {
  display: block;
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-end {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--s-2);
  text-align: right;
}
.row-thumb {
  flex: none;
  width: 40px;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-2);
}
.row-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.row-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.price {
  display: inline-grid;
  justify-items: end;
  line-height: 1.25;
}
.price b {
  font-weight: var(--fw-bold);
}
.price small {
  color: var(--text-3);
  font-size: var(--fs-2xs);
}
.price .stale {
  color: var(--warning);
}
.notice {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  font-size: var(--fs-sm);
}
.notice .i {
  color: var(--accent-text);
}
.notice .btn {
  margin-left: auto;
}

/* ============ 6 · Navigation primitives ============ */
.segmented {
  display: flex;
  gap: 2px;
  max-width: 100%;
  width: max-content;
  padding: 4px;
  overflow-x: auto;
  border-radius: 14px;
  background: var(--surface-2);
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar {
  display: none;
}
.segmented a,
.segmented button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition:
    background var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}
.segmented a:hover,
.segmented button:hover {
  color: var(--text);
}
.segmented .is-active,
.segmented [aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--e-1), 0 0 0 1px var(--border);
}
.segmented b {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: var(--fs-2xs);
  text-align: center;
}
.segmented .is-active b {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.segmented.full {
  width: 100%;
}
.segmented.full > * {
  flex: 1;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-6);
}
.pager .icon-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.pager-label {
  min-width: 72px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-align: center;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 var(--s-2) -6px;
  padding: 4px 8px 4px 2px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.back-link:hover {
  color: var(--accent-text);
}

/* ============ 7 · Progress & stats ============ */
.ring {
  position: relative;
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--size);
  height: var(--size);
}
.ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 4;
}
.ring-track {
  stroke: var(--surface-3);
}
.ring-value {
  stroke: url(#g-accent);
  stroke-linecap: round;
  stroke-dashoffset: var(--offset);
  animation: ring-fill 1.1s var(--ease) both;
}
.ring b {
  position: relative;
  font-size: calc(var(--size) * 0.27);
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.ring b small {
  font-size: 0.55em;
  font-weight: var(--fw-bold);
  opacity: 0.7;
}
.on-dark .ring-track {
  stroke: rgba(255, 255, 255, 0.16);
}
.bar {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}
.bar i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  animation: bar-grow 0.9s var(--ease) both;
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: var(--s-3);
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}
a.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--e-2);
}
.stat-icon {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.stat-value {
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat-label {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ 8 · Card tiles ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
@media (min-width: 560px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
    gap: var(--s-4);
  }
}
@media (min-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: var(--s-4);
  }
}
@media (min-width: 1280px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
    gap: var(--s-4);
  }
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  animation: rise var(--dur-3) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 28ms);
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
}
.tile[data-tier='ultra'] {
  border-color: color-mix(in srgb, var(--tier-ultra) 30%, var(--border));
}
.tile[data-tier='secret'] {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--holo) border-box;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--e-2);
}
.tile-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  border-radius: inherit;
}
.tile-art {
  position: relative;
  aspect-ratio: 63 / 88;
  margin: 8px 8px 0;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-2);
}
.tile-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 0.6s var(--ease),
    filter var(--dur-3) var(--ease);
}
.tile:hover .tile-art img {
  transform: scale(1.035);
}
.tile-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.5) 46%,
    rgba(196, 181, 253, 0.35) 52%,
    transparent 68%
  );
  transform: translateX(-130%);
  pointer-events: none;
}
.tile:hover .tile-shine {
  transform: translateX(130%);
  transition: transform 0.9s var(--ease);
}
.tile.is-dim .tile-art img {
  filter: grayscale(0.6) opacity(0.62);
}
.tile.is-dim .tile-name {
  color: var(--text-2);
}
.tile.is-dim:hover .tile-art img {
  filter: none;
}
.tile-qty {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(80, 20, 140, 0.55);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 24px;
  text-align: center;
}
.tile-body {
  display: grid;
  gap: 2px;
  padding: 8px 10px 6px;
}
.tile-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
}
.tile-meta > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-prints.is-complete {
  color: var(--success);
}
.tile-prints.is-partial {
  color: var(--warning);
}
.tile-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  font-weight: var(--fw-semibold);
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding: 2px 10px 10px;
  min-width: 0;
}
.tile-price {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tile-missing {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 10px 8px;
}
.tile-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
}
.tile-add {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent-text);
  transition:
    transform var(--dur-2) var(--spring),
    border-color var(--dur-2) var(--ease),
    background var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease);
}
.tile-add:hover {
  border-color: transparent;
  background: var(--grad);
  color: #fff;
  transform: scale(1.06);
}
.tile-add:active {
  transform: scale(0.94);
}
.art-missing {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--text-3);
}
.carousel {
  display: grid;
  grid-auto-columns: minmax(148px, 42%);
  grid-auto-flow: column;
  gap: var(--s-3);
  margin-inline: calc(var(--gutter) * -1);
  padding: 4px var(--gutter) 8px;
  overflow-x: auto;
  scroll-padding-inline: var(--gutter);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar {
  display: none;
}
.carousel > * {
  scroll-snap-align: start;
}
@media (min-width: 768px) {
  .carousel {
    grid-auto-columns: 176px;
    gap: var(--s-4);
  }
}

/* ============ 9 · Set tiles ============ */
.set-grid {
  display: grid;
  gap: var(--s-3);
}
@media (min-width: 640px) {
  .set-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--s-4);
  }
}
.set-tile {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: var(--s-3) 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  animation: rise var(--dur-3) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 24ms);
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
}
.set-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--e-2);
}
.set-logo {
  display: grid;
  place-items: center;
  width: 84px;
  height: 58px;
  padding: 6px;
  overflow: hidden;
  border-radius: 12px;
  background:
    radial-gradient(80% 90% at 50% 100%, color-mix(in srgb, var(--accent) 14%, transparent), transparent),
    var(--surface-2);
}
.set-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}
.set-code {
  color: var(--accent-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  letter-spacing: 0.04em;
}
.set-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.set-info b {
  display: -webkit-box;
  overflow: hidden;
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.set-info span {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.set-info .bar {
  margin-top: 8px;
}
.set-tile .ring {
  --size: 50px;
}

/* ============ 10 · Empty & skeleton ============ */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-10) var(--s-5);
  text-align: center;
}
.empty-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--s-2);
  border-radius: 22px;
  background: var(--accent-soft);
  color: var(--accent-text);
  animation: float 4s ease-in-out infinite;
}
.empty strong {
  font-size: var(--fs-lg);
}
.empty p {
  max-width: 34ch;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.empty .btn {
  margin-top: var(--s-3);
}
.skeleton-page {
  display: grid;
  gap: var(--s-4);
}
.sk {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--skeleton);
}
.sk::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s infinite;
}
.sk-title {
  width: 46%;
  height: 34px;
}
.sk-line {
  width: 70%;
  height: 16px;
}
.sk-tile {
  aspect-ratio: 63 / 100;
  border-radius: 16px;
}
.sk-block {
  height: 160px;
  border-radius: var(--r-lg);
}

/* ============ 11 · Overlays ============ */
dialog {
  color: var(--text);
}
.sheet-dialog,
#dialog {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.sheet-dialog::backdrop,
#dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(3px);
  animation: fade var(--dur-2) var(--ease);
}
.sheet {
  display: flex;
  flex-direction: column;
  max-height: 92dvh;
  padding-bottom: var(--safe-b);
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  box-shadow: var(--e-3);
  animation: sheet-up 0.38s var(--ease);
}
.sheet-grab {
  flex: none;
  width: 40px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: var(--r-pill);
  background: var(--border-strong);
}
.sheet-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 8px 12px 4px 20px;
}
.sheet-body {
  padding: 8px 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet-foot {
  position: sticky;
  bottom: -24px;
  display: flex;
  gap: var(--s-2);
  margin: var(--s-4) -20px -24px;
  padding: 14px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.sheet-foot .btn {
  flex: 1;
}
@media (min-width: 640px) {
  #dialog,
  .sheet-dialog {
    inset: 0;
    width: min(520px, calc(100% - 48px));
    height: fit-content;
    margin: auto;
  }
  #dialog.wide {
    width: min(760px, calc(100% - 48px));
  }
  .sheet {
    max-height: 86vh;
    border-radius: 24px;
    animation: pop 0.28s var(--spring);
  }
  .sheet-grab {
    display: none;
  }
  .sheet-head {
    padding-top: 14px;
  }
}
#toast {
  position: fixed;
  left: 0;
  right: 0;
  width: fit-content;
  margin-inline: auto;
  /* Under the top bar: the tab bar and its Scan button stay free. */
  top: calc(var(--topbar-h) + 10px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(460px, calc(100% - 32px));
  padding: 10px 12px 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: #1c1532;
  color: #f4f1ff;
  box-shadow: 0 20px 50px -14px rgba(10, 4, 30, 0.6);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-14px) scale(0.96);
  transition:
    opacity var(--dur-2) var(--ease),
    transform var(--dur-3) var(--spring);
}
#toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
#toast:empty {
  display: none;
}
.toast-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
}
#toast[data-tone='error'] .toast-icon {
  background: #e11d48;
}
.toast-text {
  flex: 1;
}
.toast-action {
  flex: none;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #d8c4ff;
  font-weight: var(--fw-bold);
}
.toast-action:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Search palette */
#search {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
#search::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(4px);
  animation: fade var(--dur-2) var(--ease);
}
.palette {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  animation: fade var(--dur-2) var(--ease);
}
.palette-bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.palette-bar .searchbox .input {
  height: var(--h-lg);
  border-color: transparent;
  background: var(--surface-2);
  font-size: 17px;
}
.palette-bar .searchbox .input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.palette-body {
  flex: 1;
  padding: 8px 16px 24px;
  overflow-y: auto;
}
.palette-label {
  margin: 14px 0 6px;
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.palette .row {
  min-height: 64px;
}
.palette .row[aria-selected='true'] {
  background: var(--accent-soft);
}
.palette-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.palette-all {
  margin-top: var(--s-3);
}
@media (min-width: 768px) {
  #search {
    inset: 0;
    width: min(640px, calc(100% - 48px));
    height: fit-content;
    max-height: 76vh;
    margin: 10vh auto auto;
  }
  .palette {
    height: auto;
    max-height: 76vh;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--e-3);
    animation: pop 0.24s var(--spring);
  }
  .palette-bar {
    padding: 10px;
  }
}

/* ============ 12 · App shell ============ */
.app {
  min-height: 100dvh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(312px, 86vw);
  padding: 12px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  transform: translateX(-102%);
  transition:
    transform var(--dur-3) var(--ease),
    width var(--dur-3) var(--ease),
    box-shadow var(--dur-3) var(--ease);
}
.nav-open .sidebar {
  transform: none;
  box-shadow: var(--e-3);
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-3) var(--ease);
}
.nav-open .scrim {
  opacity: 1;
  pointer-events: auto;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 52px;
  padding: 0 4px 0 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 19px;
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
}
.brand img {
  flex: none;
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 4px 10px rgba(124, 58, 237, 0.35));
}
.brand b {
  font-weight: inherit;
}
.brand b span {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav {
  flex: 1;
  margin: 8px -4px 0;
  padding: 0 4px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.nav-group + .nav-group {
  margin-top: 14px;
}
.nav-label {
  display: block;
  padding: 6px 12px;
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  margin-top: 2px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--text-2);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition:
    background var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease);
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}
.nav-item.is-active::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--grad);
}
.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item .badge {
  margin-left: auto;
}
.sidebar-foot {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px;
  border-radius: 14px;
  transition: background var(--dur-2) var(--ease);
}
.account:hover {
  background: var(--surface-2);
}
.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  text-transform: uppercase;
}
.avatar.guest {
  background: var(--surface-3);
  color: var(--text-2);
}
.account-text {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}
.account-text b {
  overflow: hidden;
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-text small {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.quick-prefs {
  display: flex;
  gap: 6px;
}
.quick-prefs .btn {
  flex: 1;
}
.workspace {
  min-width: 0;
  transition: margin var(--dur-3) var(--ease);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  border-bottom: 1px solid transparent;
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  transition: border-color var(--dur-2) var(--ease);
}
.scrolled .topbar {
  border-bottom-color: var(--border);
}
.topbar .brand {
  font-size: 0;
}
.topbar .brand img {
  width: 32px;
  height: 32px;
}
.search-trigger {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 560px;
  height: var(--h-md);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-md);
  text-align: left;
  transition:
    border-color var(--dur-2) var(--ease),
    background var(--dur-2) var(--ease);
}
.search-trigger:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}
.search-trigger span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-trigger kbd {
  display: none;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-3);
  font: var(--fw-semibold) var(--fs-2xs) / 1.4 var(--font);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.topbar-actions .lang {
  width: auto;
  padding: 0 10px;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
.topbar-actions .lang,
.topbar-actions .theme {
  display: none;
}
/* Quiet V1/V2 edition switch (visible on every width, deliberately understated). */
.topbar .avatar {
  width: 36px;
  height: 36px;
}
.topbar .account-btn {
  padding: 4px;
  border-radius: 50%;
}
main#main {
  display: block;
  min-height: calc(100dvh - var(--topbar-h));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 32px);
  outline: none;
}
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-4) var(--gutter) 0;
  animation: page-in 0.36s var(--ease) both;
}
.tabbar {
  position: fixed;
  inset: auto 0 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 0 6px var(--safe-b);
  border-top: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
}
.tab {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  height: var(--tabbar-h);
  color: var(--text-3);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  -webkit-tap-highlight-color: transparent;
}
.tab .i {
  box-sizing: content-box;
  padding: 4px 18px;
  border-radius: var(--r-pill);
  transition:
    background var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease),
    transform var(--dur-2) var(--spring);
}
.tab.is-active {
  color: var(--accent-text);
}
.tab.is-active .i {
  background: var(--accent-soft);
}
.tab:active .i {
  transform: scale(0.9);
}
.tab-fab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: end;
  height: var(--tabbar-h);
  padding-bottom: 10px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  -webkit-tap-highlight-color: transparent;
}
.tab-fab .fab {
  position: absolute;
  top: -24px;
  left: 50%;
  translate: -50% 0;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 4px solid var(--bg);
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  box-shadow: var(--glow);
  transition: scale var(--dur-2) var(--spring);
}
.tab-fab:active .fab {
  scale: 0.92;
}
.tab-fab.is-active {
  color: var(--accent-text);
}
.drawer-close {
  display: inline-grid;
}
.rail-toggle {
  display: none;
}

/* Tablet · icon rail that expands as an overlay */
@media (min-width: 768px) {
  .tabbar {
    display: none;
  }
  main#main {
    padding-bottom: var(--s-12);
  }
  .sidebar {
    width: var(--rail-w);
    padding: 12px 10px;
    transform: none;
  }
  .workspace {
    margin-left: var(--rail-w);
  }
  .sidebar:not(:hover) .nav-label,
  .sidebar .nav-label {
    height: 1px;
    margin: 10px 8px;
    padding: 0;
    overflow: hidden;
    background: var(--border);
    color: transparent;
  }
  .nav-item {
    justify-content: center;
    padding: 0;
  }
  .nav-item span,
  .nav-item .badge,
  .sidebar .brand b,
  .account-text,
  .quick-prefs {
    display: none;
  }
  .nav-item .badge-dot {
    position: absolute;
    top: 9px;
    right: 13px;
  }
  .nav-item.is-active::before {
    left: -10px;
  }
  .sidebar-head {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 4px 0;
  }
  .drawer-close {
    display: none;
  }
  .account {
    justify-content: center;
  }
  .nav-open .sidebar {
    width: var(--sidebar-w);
    padding: 12px;
  }
  .nav-open .sidebar .nav-label {
    height: auto;
    margin: 0;
    padding: 6px 12px;
    background: none;
    color: var(--text-3);
  }
  .nav-open .nav-item {
    justify-content: flex-start;
    padding: 0 12px;
  }
  .nav-open .nav-item span,
  .nav-open .nav-item .badge,
  .nav-open .sidebar .brand b,
  .nav-open .account-text,
  .nav-open .quick-prefs {
    display: initial;
  }
  .nav-open .account-text {
    display: grid;
  }
  .nav-open .quick-prefs {
    display: flex;
  }
  .nav-open .nav-item .badge-dot {
    display: none;
  }
  .nav-open .sidebar-head {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 4px 0 8px;
  }
  .nav-open .account {
    justify-content: flex-start;
  }
  .topbar .brand {
    display: none;
  }
  .topbar-actions .lang,
  .topbar-actions .theme {
    display: inline-grid;
  }
  .topbar-actions .lang {
    display: inline-flex;
  }
  .search-trigger kbd {
    display: inline-block;
  }
  .rail-toggle {
    display: inline-grid;
  }
}
/* Desktop · full sidebar, collapsible to a rail */
@media (min-width: 1100px) {
  .sidebar {
    width: var(--sidebar-w);
    padding: 12px;
  }
  .workspace {
    margin-left: var(--sidebar-w);
  }
  .scrim {
    display: none;
  }
  .sidebar .nav-label {
    height: auto;
    margin: 0;
    padding: 6px 12px;
    background: none;
    color: var(--text-3);
  }
  .nav-item {
    justify-content: flex-start;
    padding: 0 12px;
  }
  .nav-item span,
  .nav-item .badge,
  .sidebar .brand b {
    display: initial;
  }
  .account-text {
    display: grid;
  }
  .quick-prefs {
    display: flex;
  }
  .nav-item .badge-dot {
    display: none;
  }
  .sidebar-head {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 4px 0 8px;
  }
  .account {
    justify-content: flex-start;
  }
  .nav-rail .sidebar {
    width: var(--rail-w);
    padding: 12px 10px;
  }
  .nav-rail .workspace {
    margin-left: var(--rail-w);
  }
  .nav-rail .sidebar .nav-label {
    height: 1px;
    margin: 10px 8px;
    padding: 0;
    overflow: hidden;
    background: var(--border);
    color: transparent;
  }
  .nav-rail .nav-item {
    justify-content: center;
    padding: 0;
  }
  .nav-rail .nav-item span,
  .nav-rail .nav-item .badge,
  .nav-rail .sidebar .brand b,
  .nav-rail .account-text,
  .nav-rail .quick-prefs {
    display: none;
  }
  .nav-rail .nav-item .badge-dot {
    display: block;
  }
  .nav-rail .sidebar-head {
    flex-direction: column;
    justify-content: center;
    padding: 0;
  }
  .nav-rail .account {
    justify-content: center;
  }
  .page {
    padding-top: var(--s-6);
  }
}
.badge-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2, #e0338f);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ============ 13 · Page structure ============ */
.page-head {
  margin-bottom: var(--s-5);
}
.page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3) var(--s-4);
}
.page-title {
  min-width: 0;
  flex: 1 1 240px;
}
.page-title p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: var(--fs-md);
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.section {
  margin-top: var(--s-8);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.section-head h2 {
  min-width: 0;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.sort-btn {
  position: relative;
  overflow: hidden;
}
.sort-btn select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
.toolbar-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-3) 0 var(--s-4);
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar-meta::-webkit-scrollbar {
  display: none;
}
.result-count {
  flex: none;
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.result-count b {
  color: var(--text);
}
.split {
  display: grid;
  gap: var(--s-4);
}
@media (min-width: 900px) {
  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-5);
  }
}
.stack {
  display: grid;
  gap: var(--s-4);
}
.on-dark {
  color: #fff;
}

/* ============ 14 · Views ============ */
/* Night surface shared by hero, set hero, scanner, auth */
.night {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--night);
  color: #fff;
}
.night::before,
.night::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.55;
  pointer-events: none;
}
.night::before {
  top: -30%;
  right: -10%;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, #8b5cf6, transparent 65%);
  animation: drift 14s ease-in-out infinite alternate;
}
.night::after {
  bottom: -40%;
  left: -10%;
  width: 55%;
  aspect-ratio: 1;
  background: radial-gradient(circle, #e0338f, transparent 65%);
  animation: drift 18s ease-in-out infinite alternate-reverse;
}
.night .muted,
.night p {
  color: rgba(240, 232, 255, 0.74);
}
.glass-stat {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
}
.glass-stat b {
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.glass-stat span {
  color: rgba(240, 232, 255, 0.7);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
a.glass-stat:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Dashboard */
.hero {
  display: grid;
  gap: var(--s-5);
  padding: var(--s-6) var(--s-5);
}
.hero-top {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.hero-top .ring {
  --size: 92px;
}
.hero-top .ring b {
  color: #fff;
}
.hero h1 {
  color: #fff;
  font-size: var(--fs-3xl);
}
.hero-greet {
  color: rgba(240, 232, 255, 0.8);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-2);
}
.hero-fan {
  display: none;
}
@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    padding: var(--s-8);
  }
  .hero-fan {
    position: relative;
    display: block;
    height: 250px;
  }
  .hero-fan img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 148px;
    border-radius: 9px;
    box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.7);
    transition: transform 0.6s var(--spring);
  }
  .hero-fan img:nth-child(1) {
    transform: translate(-112%, -46%) rotate(-12deg);
  }
  .hero-fan img:nth-child(2) {
    z-index: 2;
    transform: translate(-50%, -54%);
  }
  .hero-fan img:nth-child(3) {
    transform: translate(12%, -46%) rotate(12deg);
  }
  .hero:hover .hero-fan img:nth-child(1) {
    transform: translate(-124%, -48%) rotate(-16deg);
  }
  .hero:hover .hero-fan img:nth-child(3) {
    transform: translate(24%, -48%) rotate(16deg);
  }
  .hero:hover .hero-fan img:nth-child(2) {
    transform: translate(-50%, -58%) scale(1.03);
  }
}
.quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
  margin-top: var(--s-4);
}
.quick a {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-align: center;
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease);
}
.quick a:hover {
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: var(--e-2);
}
.quick a .q-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
  transition: transform var(--dur-2) var(--spring);
}
.quick a:first-child .q-icon {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--glow);
}
.quick a:hover .q-icon {
  transform: scale(1.08) rotate(-4deg);
}
@media (min-width: 768px) {
  .quick a {
    grid-template-columns: auto 1fr;
    justify-items: start;
    align-items: center;
    padding: 12px 14px;
    font-size: var(--fs-sm);
    text-align: left;
  }
}
@media (min-width: 1100px) {
  .quick {
    display: none;
  }
}
.progress-list {
  display: grid;
  gap: var(--s-2);
}
.progress-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  padding: 8px;
  margin: 0 -8px;
  border-radius: 14px;
  transition: background var(--dur-2) var(--ease);
}
.progress-item:hover {
  background: var(--surface-2);
}
.progress-item .set-logo {
  width: 56px;
  height: 40px;
  padding: 4px;
  border-radius: 10px;
}
.progress-item .bar {
  margin-top: 6px;
}
.progress-item .num {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
.miss-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
.miss-card {
  display: grid;
  gap: 4px;
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  transition: background var(--dur-2) var(--ease);
}
.miss-card:hover {
  background: var(--accent-soft);
}
.miss-card b {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.miss-card span {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.rank {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}
.rank.gold {
  background: var(--holo);
  color: #3a2600;
}

/* Set hero */
.set-hero {
  display: grid;
  gap: var(--s-5);
  margin-bottom: var(--s-5);
  padding: var(--s-5);
}
.set-hero-top {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.set-hero-logo {
  display: grid;
  flex: none;
  place-items: center;
  width: 104px;
  height: 72px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
}
.set-hero-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.set-hero h1 {
  color: #fff;
}
.set-hero .chip {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
}
.set-hero-stats {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: var(--s-2);
}
.set-hero-stats .ring {
  --size: 76px;
  margin-right: var(--s-2);
}
.set-hero-stats .ring b {
  color: #fff;
}
@media (max-width: 520px) {
  .set-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .set-hero-stats .ring {
    display: none;
  }
  .set-hero-top .ring-mobile {
    display: inline-grid;
  }
}
.set-hero-top .ring-mobile {
  display: none;
  --size: 64px;
  margin-left: auto;
}
.set-hero-top .ring-mobile b {
  color: #fff;
}
@media (min-width: 900px) {
  .set-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: var(--s-6) var(--s-8);
  }
  .set-hero-stats {
    min-width: 440px;
  }
}

/* Card detail */
.detail {
  display: grid;
  gap: var(--s-5);
}
.detail-art {
  position: relative;
  display: grid;
  place-items: center;
  padding: var(--s-2) 0 0;
}
.detail-art::before {
  content: '';
  position: absolute;
  inset: 10% 15%;
  z-index: -1;
  border-radius: 50%;
  background: var(--grad);
  filter: blur(60px);
  opacity: 0.32;
}
.card3d {
  width: min(210px, 56vw);
  perspective: 900px;
}
.card3d-inner {
  position: relative;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 4.6% / 3.3%;
  background: var(--surface-2);
  box-shadow:
    0 30px 60px -20px rgba(30, 10, 60, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease);
  will-change: transform;
}
.card3d.is-tilting .card3d-inner {
  transition: transform 0.08s linear;
}
.card3d-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card3d-glare,
.card3d-holo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease);
}
.card3d-glare {
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.45),
    transparent 55%
  );
  mix-blend-mode: soft-light;
}
.card3d-holo {
  background: var(--holo);
  background-size: 220% 220%;
  background-position: var(--mx, 50%) var(--my, 50%);
  mix-blend-mode: color-dodge;
}
.card3d.is-tilting .card3d-glare {
  opacity: 1;
}
.card3d.is-tilting[data-tier='secret'] .card3d-holo,
.card3d.is-tilting[data-tier='ultra'] .card3d-holo {
  opacity: 0.28;
}
.zoom-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.zoom-link:hover {
  color: var(--accent-text);
}
.detail-head {
  display: grid;
  gap: var(--s-2);
}
.set-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: border-color var(--dur-2) var(--ease);
}
.set-link:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}
.set-link .set-logo {
  width: 44px;
  height: 26px;
  padding: 2px 4px;
  border-radius: var(--r-pill);
}
.set-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
}
.detail-head h1 {
  font-size: var(--fs-3xl);
}
.detail-price {
  display: inline-flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-variant-numeric: tabular-nums;
}
.detail-price b {
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.detail-price small {
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
}
#card-traits[hidden] {
  display: none;
}
.own-summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-2);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.own-summary .row-icon {
  width: 36px;
  height: 36px;
}
.own-summary.is-owned {
  background: var(--success-soft);
}
.own-summary.is-owned .row-icon {
  background: var(--success);
  color: #fff;
}
.own-summary b {
  display: block;
  font-size: var(--fs-md);
}
.print-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.print-row:last-child {
  border-bottom: 0;
}
.print-main {
  flex: 1;
  min-width: 0;
}
.print-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: var(--fw-semibold);
}
.print-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.print-row.is-owned .print-name::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.stepper {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
}
.stepper button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-2);
  transition:
    background var(--dur-2) var(--ease),
    transform var(--dur-1) var(--ease);
}
.stepper button:hover {
  background: var(--surface);
  color: var(--text);
}
.stepper button:active {
  transform: scale(0.9);
}
.stepper button.plus {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(124, 58, 237, 0.7);
}
.stepper button[disabled] {
  opacity: 0.35;
  pointer-events: none;
}
.stepper output {
  min-width: 28px;
  font-weight: var(--fw-black);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.stepper output.bump {
  animation: bump 0.4s var(--spring);
}
.album-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.album-pick .select {
  min-width: 0;
  max-width: 180px;
}
.pending-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--warning-soft);
  font-size: var(--fs-sm);
}
.tab-panel {
  margin-top: var(--s-4);
}
.quote {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.quote:last-child {
  border-bottom: 0;
}
.quote-print {
  margin: var(--s-4) 0 var(--s-1);
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.quote-print:first-child {
  margin-top: 0;
}
.origin {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.origin:last-child {
  border-bottom: 0;
}
.origin-thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--accent-text);
}
.origin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.action-list {
  display: grid;
  gap: 4px;
}
.action-list .row {
  min-height: 56px;
  border-bottom: 0;
  margin: 0 -12px;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: left;
  width: calc(100% + 24px);
  transition: background var(--dur-2) var(--ease);
}
.action-list .row:hover {
  background: var(--surface-2);
}
@media (min-width: 900px) {
  .detail {
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: var(--s-10);
    align-items: start;
  }
  .detail-art {
    position: sticky;
    top: calc(var(--topbar-h) + 24px);
    padding-top: var(--s-2);
  }
  .card3d {
    width: 100%;
    max-width: 360px;
  }
}
.scan-status {
  min-height: 1.5em;
  color: rgba(240, 232, 255, 0.85);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.scan-price {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.scan-price b {
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.scan-price span {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.confirm-art .card3d {
  width: 100%;
}
.confirm {
  display: grid;
  gap: var(--s-5);
}
.confirm-art {
  width: 150px;
  margin: 0 auto;
}
.confirm-art img {
  display: block;
  width: 100%;
  border-radius: 8px;
  box-shadow: var(--e-2);
}
@media (min-width: 640px) {
  .confirm {
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: start;
  }
  .confirm-art {
    width: 100%;
  }
}
.camera-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62%;
  aspect-ratio: 63 / 88;
  transform: translate(-50%, -50%);
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(8, 4, 20, 0.45);
}
.camera-guide i {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
}
.camera-guide i:nth-child(1) {
  top: -2px;
  left: -2px;
  border-right: 0;
  border-bottom: 0;
  border-radius: 14px 0 0 0;
}
.camera-guide i:nth-child(2) {
  top: -2px;
  right: -2px;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 14px 0 0;
}
.camera-guide i:nth-child(3) {
  bottom: -2px;
  left: -2px;
  border-right: 0;
  border-top: 0;
  border-radius: 0 0 0 14px;
}
.camera-guide i:nth-child(4) {
  right: -2px;
  bottom: -2px;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 14px 0;
}
.camera-message {
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-align: center;
}

/* Products */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--s-4);
  }
}
.product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  animation: rise var(--dur-3) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 28ms);
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}
.product:hover {
  transform: translateY(-3px);
  box-shadow: var(--e-2);
}
.product-art {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 14px;
  background:
    radial-gradient(70% 70% at 50% 60%, color-mix(in srgb, var(--accent) 12%, transparent), transparent),
    var(--surface-2);
}
.product-art img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(20, 10, 40, 0.22));
  transition: transform 0.5s var(--ease);
}
.product:hover .product-art img {
  transform: scale(1.05) rotate(-1deg);
}
.product-body {
  display: grid;
  gap: 4px;
  padding: 12px 14px 14px;
}
.product-body small {
  color: var(--accent-text);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.product-body b {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.product-body .price {
  justify-items: start;
  margin-top: 4px;
}
.product-hero {
  display: grid;
  gap: var(--s-5);
}
.product-hero .product-art {
  border-radius: var(--r-xl);
  max-height: 380px;
}
@media (min-width: 900px) {
  .product-hero {
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    align-items: start;
  }
}
.insight {
  display: grid;
  gap: var(--s-3);
}
.insight-big {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}
.insight-big b {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
}
.fineprint {
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.5;
}
.contents-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.contents-list li {
  display: flex;
  gap: 10px;
  font-size: var(--fs-sm);
}
.contents-list li::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 0.55em;
  border-radius: 50%;
  background: var(--grad);
}

/* Profile */
.profile-hero {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  padding: var(--s-6) var(--s-5);
}
.profile-hero .avatar {
  width: 64px;
  height: 64px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  font-size: var(--fs-xl);
}
.profile-hero h1 {
  color: #fff;
}
.settings-list .row {
  min-height: 56px;
}
.settings-list .row-end .segmented {
  width: auto;
}

/* Auth */
.auth {
  display: grid;
  min-height: 100dvh;
  background: var(--bg);
}
.auth-art {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 38dvh;
  padding: 20px 20px 56px;
  border-radius: 0;
}
.auth-art .brand {
  color: #fff;
  font-size: 20px;
}
.auth-art .brand b span {
  background: linear-gradient(90deg, #c4b5fd, #f9a8d4);
  -webkit-background-clip: text;
  background-clip: text;
}
.auth-tagline {
  position: relative;
  z-index: 2;
  max-width: 11.5ch;
  margin-top: var(--s-6);
  text-shadow: 0 2px 18px rgba(10, 4, 30, 0.6);
  color: #fff !important;
  font-size: clamp(22px, 5vw, 40px);
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.auth-tagline em {
  font-style: normal;
  background: linear-gradient(90deg, #c4b5fd, #f9a8d4, #fde68a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-cards {
  position: absolute;
  z-index: 0;
  top: 64px;
  right: -26px;
  width: 190px;
  height: 170px;
  pointer-events: none;
}
.auth-cards img {
  position: absolute;
  bottom: 0;
  width: 84px;
  border-radius: 7px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.7);
  animation: float 6s ease-in-out infinite;
}
.auth-cards img:nth-child(1) {
  right: 92px;
  transform: rotate(-14deg);
  animation-delay: -1s;
}
.auth-cards img:nth-child(2) {
  right: 48px;
  bottom: 18px;
  z-index: 2;
  animation-delay: -3s;
}
.auth-cards img:nth-child(3) {
  right: 4px;
  transform: rotate(13deg);
  animation-delay: -5s;
}
.auth-panel {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: var(--s-5);
  margin-top: -32px;
  padding: 28px 20px calc(28px + var(--safe-b));
  border-radius: 28px 28px 0 0;
  background: var(--surface);
}
.auth-panel h1 {
  font-size: var(--fs-2xl);
}
.auth-panel > p {
  margin-top: -12px;
  color: var(--text-2);
}
.auth-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}
.auth-switch::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--e-1), 0 0 0 1px var(--border);
  transition: transform var(--dur-3) var(--spring);
}
.auth-switch[data-mode='register']::before {
  transform: translateX(100%);
}
.auth-switch a {
  position: relative;
  display: grid;
  place-items: center;
  height: 40px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: color var(--dur-2) var(--ease);
}
.auth-switch a[aria-current='page'] {
  color: var(--text);
}
.auth-form {
  display: grid;
  gap: var(--s-4);
}
.auth-perks {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.auth-perks li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-perks .i {
  color: var(--success);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
@media (min-width: 900px) {
  .auth {
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, 1fr);
  }
  .auth-art {
    min-height: 100dvh;
    padding: 40px 48px;
  }
  .auth-tagline {
    max-width: 14ch;
  }
  .auth-cards {
    top: auto;
    right: 50%;
    bottom: 50%;
    width: 360px;
    height: 300px;
    transform: translate(50%, 60%);
  }
  .auth-cards img {
    width: 170px;
    border-radius: 11px;
  }
  .auth-cards img {
    width: 170px;
    border-radius: 11px;
  }
  .auth-cards img:nth-child(1) {
    right: 190px;
  }
  .auth-cards img:nth-child(2) {
    right: 95px;
    bottom: 34px;
  }
  .auth-cards img:nth-child(3) {
    right: 0;
  }
  .auth-panel {
    align-content: center;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 48px 32px;
    background: transparent;
  }
}

/* Trade, wishlist, misc */
.trade-card {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
}
.trade-card:last-child {
  border-bottom: 0;
}
.trade-swap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2);
}
.trade-swap > div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.trade-swap > .i {
  color: var(--accent);
}
.trade-swap b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.deal {
  display: grid;
  gap: var(--s-3);
}
.deal-top {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}
.deal-off {
  display: inline-grid;
  place-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
}
pre {
  max-height: 320px;
  padding: var(--s-3);
  overflow: auto;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: var(--fs-xs);
  white-space: pre-wrap;
}
details.disclosure {
  border-bottom: 1px solid var(--border);
}
details.disclosure summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 52px;
  font-weight: var(--fw-semibold);
  list-style: none;
  cursor: pointer;
}
details.disclosure summary::-webkit-details-marker {
  display: none;
}
details.disclosure summary .i:last-child {
  margin-left: auto;
  color: var(--text-3);
  transition: transform var(--dur-2) var(--ease);
}
details.disclosure[open] summary .i:last-child {
  transform: rotate(180deg);
}
details.disclosure > div {
  padding-bottom: var(--s-4);
}
.cert-thumb {
  width: 44px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
}
.offline-banner {
  margin-bottom: var(--s-4);
}

/* ============ 15 · Motion ============ */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
}
@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}
@keyframes ring-fill {
  from {
    stroke-dashoffset: var(--full);
  }
}
@keyframes bar-grow {
  from {
    width: 0;
  }
}
@keyframes float {
  50% {
    translate: 0 -6px;
  }
}
@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}
@keyframes bump {
  40% {
    transform: scale(1.45);
    color: var(--accent);
  }
}
@keyframes scanline {
  0%,
  100% {
    top: 8%;
  }
  50% {
    top: 90%;
  }
}
@keyframes drift {
  to {
    transform: translate(-12%, 10%) scale(1.15);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Origin evidence disclosure */
.origin-proof summary {
  margin-top: 4px;
  list-style: none;
  cursor: pointer;
}
.origin-proof summary::-webkit-details-marker {
  display: none;
}
a.mini-chip {
  gap: 3px;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
a.mini-chip:hover {
  background: var(--accent-soft);
  color: var(--accent-text);
}
/* Grid children may shrink below their content (long names,
prices) instead of widening the page. */
.split > *,
.stack > *,
.detail > *,
.list > *,
.set-grid > *,
.product-hero > *,
.confirm > *,
.form-grid > *,
.hero > * {
  min-width: 0;
}

/* In-place refresh after an action: no entrance animations, no flicker. */
.page.is-soft,
.page.is-soft .tile,
.page.is-soft .set-tile,
.page.is-soft .product,
.page.is-soft .ring-value,
.page.is-soft .bar i {
  animation: none;
}
.form-error:empty {
  display: none;
}

/* ============ Charts ============ */
.chart-block {
  position: relative;
}
.chart-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-3);
  margin-bottom: var(--s-3);
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.chart-legend span,
.chart-tip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-legend i,
.chart-tip i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--series-1);
}
.chart-legend i.s2,
.chart-tip i.s2 {
  background: repeating-linear-gradient(90deg, var(--series-2) 0 4px, transparent 4px 6px);
}
.chart-range button {
  height: 30px;
  padding: 0 10px;
  font-size: var(--fs-xs);
}
.chart {
  position: relative;
  min-height: 190px;
  touch-action: pan-y;
  cursor: crosshair;
}
.chart svg {
  display: block;
  overflow: visible;
}
.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}
.chart-label {
  fill: var(--text-3);
  font-size: 11px;
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}
.chart-line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-line.s2 {
  stroke: var(--series-2);
  stroke-dasharray: 5 4;
}
.chart-area-top {
  stop-color: var(--series-1);
  stop-opacity: 0.22;
}
.chart-area-bottom {
  stop-color: var(--series-1);
  stop-opacity: 0;
}
.chart-dot {
  fill: var(--series-1);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart-dot.s2 {
  fill: var(--series-2);
}
.chart-crossline,
.chart-marker {
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart-marker-label {
  fill: var(--text-2);
}
.chart-tip {
  position: absolute;
  top: 44px;
  z-index: 2;
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--e-3);
  font-size: var(--fs-xs);
  pointer-events: none;
  transform: translateX(12px);
}
.chart-tip[data-side='left'] {
  transform: translateX(calc(-100% - 12px));
}
.chart-tip small {
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
}
.chart-tip b {
  margin-left: auto;
  padding-left: 12px;
  font-variant-numeric: tabular-nums;
}
.chart-empty {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 120px;
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.chart-empty .i {
  color: var(--accent);
}

/* Portfolio */
.hero-value {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: background var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.hero-value:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}
.hero-value .row-main {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--s-3);
  min-width: 0;
}
.hero-value .row-main small {
  flex-basis: 100%;
}
.hero-value small {
  color: rgba(240, 232, 255, 0.72);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.hero-value b {
  color: #fff;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.delta.up {
  background: var(--success-soft);
  color: var(--success);
}
.delta.down {
  background: var(--danger-soft);
  color: var(--danger);
}
.delta.flat {
  background: var(--surface-2);
  color: var(--text-2);
}
.on-dark .delta.up {
  background: rgba(52, 211, 153, 0.18);
  color: #6ee7b7;
}
.on-dark .delta.down {
  background: rgba(251, 113, 133, 0.18);
  color: #fda4af;
}
.on-dark .delta.flat {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
}
.hero-ring {
  display: grid;
  flex: none;
  justify-items: center;
  gap: 4px;
  color: rgba(240, 232, 255, 0.72);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.value-hero {
  display: grid;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.value-hero .big {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

/* ============ History timeline (public/history.js, HISTORIE-plan.md) ============ */
.history {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
}
[data-lane] { --lane-c: var(--lane-set); }
[data-lane='mechanic'] { --lane-c: var(--lane-mechanic); }
[data-lane='rarity'] { --lane-c: var(--lane-rarity); }
[data-lane='print'] { --lane-c: var(--lane-print); }
[data-lane='product'] { --lane-c: var(--lane-product); }
[data-lane='rule'] { --lane-c: var(--lane-rule); }
[data-lane='format'] { --lane-c: var(--lane-format); }
[data-lane='company'] { --lane-c: var(--lane-company); }

/* Hero and era strip */
.history-hero {
  display: grid;
  gap: var(--s-5);
  padding: var(--s-6) var(--s-5) var(--s-5);
}
.history-hero-top {
  display: grid;
  gap: var(--s-4);
}
.history-title .eyebrow {
  color: #d8c4ff;
}
.history-title h1 {
  color: #fff;
  font-size: var(--fs-3xl);
}
.history-title p {
  max-width: 48ch;
  margin-top: 6px;
  font-size: var(--fs-sm);
}
.history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
}
.history-stats .glass-stat {
  padding: 10px 12px;
}
.era-strip {
  position: relative;
  display: grid;
  gap: 6px;
  padding-top: 4px;
  touch-action: pan-y;
  user-select: none;
}
.era-marks {
  position: relative;
  height: 10px;
}
.era-marks i {
  position: absolute;
  top: 2px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}
.era-marks i[data-lane='mechanic'] { background: #c4b5fd; }
.era-marks i[data-lane='rarity'],
.era-marks i[data-lane='print'] { background: #fde68a; }
.era-marks i[data-lane='product'] { background: #fdba74; }
.era-bar {
  display: flex;
  gap: 2px;
  height: 32px;
}
.era-seg {
  display: grid;
  place-items: center;
  min-width: 3px;
  overflow: hidden;
  border-radius: 7px;
  background: color-mix(in srgb, var(--era-c) 82%, #000 0%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-black);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  container-type: inline-size;
  transition:
    filter var(--dur-2) var(--ease),
    transform var(--dur-2) var(--ease);
}
.era-seg:hover,
.era-seg:focus-visible {
  filter: brightness(1.18) saturate(1.1);
  transform: translateY(-2px);
}
.era-seg span {
  white-space: nowrap;
}
.era-ticks {
  position: relative;
  height: 34px;
}
.era-ticks i {
  position: absolute;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px 2px 0 0;
  background: rgba(255, 255, 255, 0.55);
}
.era-ticks i.is-minor {
  background: rgba(255, 255, 255, 0.22);
}
.era-ticks i.is-mine {
  background: #6ee7b7;
  box-shadow: 0 0 6px rgba(110, 231, 183, 0.6);
}
.era-ticks i.is-announced {
  border: 1px dashed rgba(255, 255, 255, 0.7);
  background: transparent;
}
.era-today {
  position: absolute;
  top: -2px;
  bottom: -2px;
  border-left: 1px dashed rgba(255, 255, 255, 0.75);
}
.era-axis {
  position: relative;
  height: 14px;
  color: rgba(240, 232, 255, 0.62);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.era-axis span {
  position: absolute;
  transform: translateX(-50%);
}
.era-axis span:first-child {
  transform: none;
}
.era-window {
  position: absolute;
  top: 14px;
  bottom: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
  opacity: 0;
  pointer-events: none;
  transition:
    left var(--dur-3) var(--ease),
    width var(--dur-3) var(--ease),
    opacity var(--dur-2) var(--ease);
}
.era-window.is-on {
  opacity: 1;
}
@media (hover: hover) {
  .era-strip {
    cursor: ew-resize;
  }
}
.history-mine {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  font-size: var(--fs-sm);
}
.history-mine > span {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
@media (min-width: 900px) {
  .history-hero {
    padding: var(--s-8);
  }
  .history-hero-top {
    grid-template-columns: minmax(0, 1fr) minmax(420px, auto);
    align-items: end;
  }
}
@media (max-width: 520px) {
  .history-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tools */
.history-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3);
}
.history-tools .searchbox {
  flex: 1;
  min-width: 0;
}
.history-tools .searchbox .input {
  width: 100%;
  min-width: 0;
}
.history-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2);
}
.history-pills {
  margin-block: -4px;
}
.history-find {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.history-find:empty {
  display: none;
}
@media (max-width: 559px) {
  .hide-sm {
    display: none;
  }
}

/* Pokémon panel */
.history-poke {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
}
.history-poke .row-main {
  min-width: 0;
}
.history-poke .row-sub {
  white-space: normal;
}
.history-poke-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.history-poke-head .row-thumb {
  width: 52px;
}
.history-poke-head h2 {
  font-size: var(--fs-xl);
}

/* Timeline */
.tl,
.tl-items,
.thread-track {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tl {
  display: grid;
  gap: var(--s-2);
}
.tl-era {
  position: relative;
  display: grid;
  gap: 4px;
  margin-top: var(--s-5);
  padding: var(--s-4) var(--s-5) var(--s-4) calc(var(--s-5) + 4px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--era-c) 30%, var(--border));
  border-radius: var(--r-lg);
  background: linear-gradient(115deg, color-mix(in srgb, var(--era-c) 15%, var(--surface)) 0%, var(--surface) 72%);
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.tl-era:first-child {
  margin-top: 0;
}
.tl-era::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--era-c);
}
.tl-era .eyebrow {
  color: var(--text-3);
}
.tl-era h2 {
  font-size: var(--fs-xl);
}
.tl-era p {
  max-width: 72ch;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tl-era-count {
  justify-self: start;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--era-c) 16%, var(--surface-2));
  color: var(--text-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
}
.tl-block {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0 var(--s-2);
  padding-block: var(--s-2);
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.tl-year {
  position: sticky;
  top: calc(var(--topbar-h) + 10px);
  align-self: start;
  padding-top: 12px;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tl-items {
  position: relative;
  display: grid;
  gap: var(--s-2);
  padding-left: 18px;
}
.tl-items::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(var(--border-strong), var(--border));
  transform-origin: top;
}
.tl-item {
  position: relative;
  min-width: 0;
}
.tl-item::before {
  content: '';
  position: absolute;
  top: 24px;
  left: -23px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--era-c, var(--lane-c));
  border-radius: 50%;
  background: var(--bg);
}
.tl-item.is-milestone::before {
  border-color: var(--lane-c);
  border-radius: 4px;
  transform: rotate(45deg) scale(0.85);
}
.tl-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--e-1);
  color: inherit;
  text-align: left;
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    opacity var(--dur-2) var(--ease);
}
.tl-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--e-2);
}
.tl-card:focus-visible {
  box-shadow: var(--focus-ring);
}
.is-set .tl-card {
  border-left: 4px solid var(--era-c);
}
.tl-logo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 48px;
  padding: 4px;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(80% 90% at 50% 100%, color-mix(in srgb, var(--era-c, var(--accent)) 16%, transparent), transparent),
    var(--surface-2);
}
.tl-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.14));
}
.tl-logo .set-code {
  font-size: var(--fs-xs);
}
.tl-pokecard {
  width: 40px;
  height: 56px;
  padding: 0;
  border-radius: 4px;
}
.tl-pokecard img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tl-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--lane-c) 14%, var(--surface));
  color: var(--lane-c);
}
[data-lane='rarity'] > .tl-card .tl-icon,
.hd-icon[data-lane='rarity'] {
  background: var(--holo);
  color: #4a3500;
}
.tl-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  min-width: 0;
}
.tl-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.tl-lane {
  color: var(--lane-c);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.tl-flag {
  color: var(--accent-text);
  font-weight: var(--fw-bold);
}
.tl-title {
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.tl-sub {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tl-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.tl-jp {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.tl-tags,
.tl-products {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.tl-tags .mini-chip,
.tl-products .mini-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 559px) {
  .era-axis span:nth-child(2) {
    display: none;
  }
}
.mini-chip[data-lane] {
  background: color-mix(in srgb, var(--lane-c) 13%, var(--surface-2));
  color: color-mix(in srgb, var(--lane-c) 62%, var(--text));
}
.tl-thumbs {
  display: flex;
  padding-right: 4px;
}
.tl-thumb {
  width: 30px;
  overflow: hidden;
  aspect-ratio: 63 / 88;
  border-radius: 3px;
  background: var(--surface-2);
  box-shadow: 0 2px 6px rgba(22, 18, 42, 0.28);
  transform: rotate(-4deg);
  transition: transform var(--dur-2) var(--spring);
}
.tl-thumb + .tl-thumb {
  margin-left: -12px;
  transform: rotate(3deg) translateY(2px);
}
.tl-thumb:nth-child(3) {
  transform: rotate(9deg) translateY(4px);
}
.tl-card:hover .tl-thumb {
  transform: rotate(-8deg) translateX(-4px);
}
.tl-card:hover .tl-thumb + .tl-thumb {
  transform: rotate(2deg) translateY(-2px);
}
.tl-card:hover .tl-thumb:nth-child(3) {
  transform: rotate(12deg) translate(4px, 2px);
}
.tl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tl-card .ring {
  --size: 44px;
}
.tl-item.is-dim .tl-card {
  opacity: 0.5;
}
.tl-item.kind-announced .tl-card {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.tl-item:is(.kind-promo, .kind-energy, .kind-pop, .kind-trainer-kit, .kind-mcdonalds, .kind-other, .kind-subset) .tl-card {
  padding-block: 6px;
}
.tl-item:is(.kind-promo, .kind-energy, .kind-pop, .kind-trainer-kit, .kind-mcdonalds, .kind-other, .kind-subset) .tl-logo {
  width: 56px;
  height: 36px;
}
.tl-item.is-selected .tl-card {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--e-2);
}
.tl-item.is-linked .tl-card {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}
.tl-item.is-pulse .tl-card,
.thread-node.is-pulse .thread-card {
  animation: tl-pulse 1.4s var(--ease) 2;
}
@keyframes tl-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(124, 58, 237, 0);
  }
}
.tl-more {
  padding-top: 2px;
}
.tl-more .pill-link {
  height: 32px;
  font-size: var(--fs-xs);
}
.history.is-searching .tl-era,
.history.is-searching .tl-more {
  display: none;
}
.history-anim :is(.tl-item, .tl-era, .era-card, .thread):not(.is-in) {
  opacity: 0;
  transform: translateY(12px);
}
.history-anim :is(.tl-item, .tl-era, .era-card, .thread).is-in {
  transition:
    opacity var(--dur-3) var(--ease),
    transform var(--dur-3) var(--ease);
}
@supports (animation-timeline: view()) {
  .tl-items::before {
    animation: tl-spine linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 45%;
  }
}
@keyframes tl-spine {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
/* Desktop: sets on the left, milestones on the right, the year on the spine between them. */
@media (min-width: 1100px) {
  .tl-block {
    grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr);
  }
  .tl-year {
    z-index: 1;
    grid-row: 1;
    grid-column: 2;
    justify-self: center;
    margin-top: 6px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--bg);
    font-size: var(--fs-md);
  }
  .tl-items {
    grid-row: 1;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr);
    grid-auto-flow: row dense;
    align-items: start;
    column-gap: 0;
    padding-left: 0;
  }
  .tl-items::before {
    left: 50%;
    margin-left: -1px;
  }
  .tl-item[data-col='1'] {
    grid-column: 1;
  }
  .tl-item[data-col='2'] {
    grid-column: 3;
  }
  .tl-item[data-col='1']::before {
    right: -48px;
    left: auto;
  }
  .tl-item[data-col='2']::before {
    left: -48px;
  }
  .tl-more {
    grid-column: 1 / -1;
    justify-self: center;
  }
  .tl.is-single .tl-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-2) var(--s-5);
    padding-left: 104px;
  }
  .tl.is-single .tl-year {
    grid-column: 1;
    justify-self: start;
  }
  .tl.is-single .tl-items::before {
    left: 42px;
  }
  .tl.is-single .tl-item[data-col] {
    grid-column: auto;
  }
  .tl.is-single .tl-item::before {
    display: none;
  }
}

/* Eras */
.era-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: var(--s-3);
}
.era-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: var(--s-5);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, color-mix(in srgb, var(--era-c) 16%, var(--surface)) 0%, var(--surface) 62%);
  transition:
    transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}
.era-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--era-c);
}
.era-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--e-2);
}
.era-card .eyebrow {
  color: var(--text-3);
}
.era-card h2 {
  font-size: var(--fs-xl);
}
.era-card p {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.era-card-ticks {
  position: relative;
  height: 24px;
  margin-top: 4px;
  border-bottom: 1px solid var(--border);
}
.era-card-ticks i {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 75%;
  margin-left: -1px;
  border-radius: 2px 2px 0 0;
  background: var(--era-c);
  opacity: 0.85;
}
.era-card-meta {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

/* Lines */
.history-lines {
  display: grid;
  gap: var(--s-4);
}
.thread {
  display: grid;
  gap: var(--s-3);
  overflow: hidden;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.thread.is-focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.thread-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.thread-head h2 {
  font-size: var(--fs-lg);
}
.thread-axis {
  position: relative;
  height: 14px;
  border-radius: 7px;
  background: var(--surface-2);
}
.thread-span {
  position: absolute;
  top: 6px;
  height: 2px;
  background: color-mix(in srgb, var(--lane-c) 55%, transparent);
}
.thread-axis i {
  position: absolute;
  top: 3px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--lane-c);
  box-shadow: 0 0 0 2px var(--surface);
}
.thread-track {
  display: flex;
  margin-inline: calc(var(--s-5) * -1);
  padding: 2px var(--s-5) 6px;
  overflow-x: auto;
  scroll-padding-inline: var(--s-5);
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.thread-node {
  display: flex;
  flex: none;
  align-items: center;
  scroll-snap-align: start;
}
.thread-rel {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 70px;
  padding: 0 8px 14px;
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.thread-rel::before {
  content: '';
  position: absolute;
  right: 10px;
  bottom: 6px;
  left: 8px;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--lane-c) 50%, var(--border));
}
.thread-rel::after {
  content: '';
  position: absolute;
  right: 6px;
  bottom: 3px;
  border: 4px solid transparent;
  border-left: 6px solid color-mix(in srgb, var(--lane-c) 50%, var(--border));
}
.thread-card {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 6px;
  width: 170px;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: inherit;
  text-align: left;
  transition:
    transform var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    background var(--dur-2) var(--ease);
}
.thread-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--surface);
}
.thread-card b {
  font-size: var(--fs-sm);
  line-height: 1.25;
}
.thread-card .tl-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.thread-logo {
  display: grid;
  place-items: center;
  width: 70px;
  height: 36px;
}
.thread-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.thread-node.is-focus .thread-card {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Detail sheet */
.history-detail {
  display: grid;
  gap: var(--s-4);
}
.hd-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.hd-logo {
  width: 104px;
  height: 66px;
}
.hd-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}
.hd-date {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}
.hd-summary {
  font-size: var(--fs-md);
  line-height: var(--lh);
}
.hd-note {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.hd-section {
  display: grid;
  gap: 4px;
}
.hd-section h3 {
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.history-detail button.row {
  width: 100%;
  margin-inline: calc(var(--s-3) * -1);
  padding-inline: var(--s-3);
  width: calc(100% + 2 * var(--s-3));
  border-bottom-color: transparent;
  border-radius: 12px;
  color: inherit;
  text-align: left;
  transition: background var(--dur-2) var(--ease);
}
.history-detail button.row:hover {
  background: var(--surface-2);
}
.history-detail .row-icon[data-lane] {
  background: color-mix(in srgb, var(--lane-c) 14%, var(--surface));
  color: var(--lane-c);
}
.set-thumb {
  flex: none;
  width: 64px;
}
.set-thumb .set-logo {
  width: 64px;
  height: 44px;
}
.hd-thread {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}
.hd-thread .eyebrow {
  margin: 0;
}
.hd-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
}
.hd-card {
  display: grid;
  gap: 4px;
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.hd-card-art {
  display: block;
  overflow: hidden;
  aspect-ratio: 63 / 88;
  border-radius: 6%;
  background: var(--surface-2);
  box-shadow: var(--e-1);
  transition: transform var(--dur-2) var(--spring);
}
.hd-card:hover .hd-card-art {
  transform: translateY(-3px) rotate(-1deg);
}
.hd-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hd-card-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hd-mine {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}
.hd-mine span {
  display: grid;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.hd-mine b {
  color: var(--text);
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
}
.hd-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.jp-mark {
  color: #d4163f;
  font-size: 11px;
  font-weight: var(--fw-black);
}
.history-checks {
  margin: 0;
  padding: 0;
  border: 0;
}
.history-checks legend {
  width: 100%;
  margin-bottom: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.history-checks .choice span .i {
  color: var(--lane-c, currentColor);
}
.history-foot {
  margin-top: var(--s-2);
}
.eyebrow-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
}
.eyebrow-link:hover {
  text-decoration-color: currentColor;
}

/* ============ 17 · Set symbols, set picker, collection grouping ============ */
/* Expansion symbol beside a set name; a set placeholder where no symbol is published. */
.set-sym {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--sym, 20px);
  height: var(--sym, 20px);
  margin-inline-end: 6px;
  vertical-align: -0.28em;
}
.set-sym img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: var(--sym-filter);
}
.set-sym.is-ph,
.set-sym.is-all {
  border-radius: 30%;
  background: var(--accent-soft);
  color: var(--accent-text);
}
/* One placeholder language for missing card, set and product images. */
.art-missing {
  border-radius: inherit;
  background:
    radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--surface-2);
  color: color-mix(in srgb, var(--accent-text) 70%, var(--text-3));
}
.art-missing .i {
  opacity: 0.8;
}
.set-code {
  display: grid;
  justify-items: center;
  gap: 2px;
}
.set-code .i {
  opacity: 0.75;
}
.set-code b {
  font: inherit;
}
.view-switch {
  margin-bottom: var(--s-4);
}
/* Collection header: one line of title and actions, one line of counts. */
.page-head.is-compact {
  margin-bottom: var(--s-4);
}
.page-head.is-compact .page-head-row {
  flex-wrap: nowrap;
  align-items: center;
}
.page-head.is-compact .page-title {
  flex: 1 1 auto;
}
.page-head.is-compact h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-head.is-compact .page-title p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.page-head.is-compact .page-actions {
  flex-wrap: nowrap;
}
@media (max-width: 559px) {
  .page-head.is-compact .page-actions .btn {
    width: var(--h-sm);
    padding: 0;
  }
  .page-head.is-compact .page-actions .btn span {
    display: none;
  }
}
/* Toolbar button for series and sets; icon-only on phones. */
.set-btn {
  flex: none;
  gap: 8px;
  max-width: min(240px, 34vw);
  padding: 0 14px;
}
.set-btn .set-sym {
  margin: 0;
}
.set-btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.set-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}
@media (max-width: 479px) {
  .set-btn {
    width: var(--h-md);
    padding: 0;
  }
  .set-btn-label {
    display: none;
  }
}
.toolbar-meta .pill-link .set-sym {
  margin: 0;
}
/* Set headings inside a card grid. */
.card-grid > .grid-group {
  grid-column: 1 / -1;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.card-grid > .grid-group:not(:first-child) {
  margin-top: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.grid-group .eyebrow {
  margin-bottom: var(--s-2);
}
.grid-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  min-width: 0;
}
.grid-group-head .set-sym {
  margin: 0;
}
.grid-group-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease);
}
.grid-group-head:hover .grid-group-name {
  color: var(--accent-text);
}
.grid-group-meta {
  flex: none;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.grid-group-head .num {
  flex: none;
  margin-left: auto;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
/* "Vylosoval jsem" — pulled from a pack. */
.tile-pull {
  background: var(--accent-soft);
}
.pull-btn {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.pull-btn:hover {
  background: var(--grad);
  color: #fff;
}
.pull-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text-2);
}
/* Set picker sheet. */
.set-picker {
  display: grid;
  gap: var(--s-3);
}
.set-picker .chip-scroll {
  margin-inline: -4px;
  padding: 2px 4px;
}
.set-pick-list {
  display: grid;
}
.set-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-4) 0 var(--s-1);
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.set-pick-head .link-more {
  flex: none;
  font-size: var(--fs-xs);
  letter-spacing: 0;
  text-transform: none;
}
.set-pick {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 52px;
  margin-inline: calc(var(--s-3) * -1);
  padding: 6px var(--s-3);
  border-radius: 12px;
  transition: background var(--dur-2) var(--ease);
}
.set-pick:hover {
  background: var(--surface-2);
}
.set-pick.is-active {
  background: var(--accent-soft);
}
.set-pick .set-sym {
  margin: 0;
}
.set-pick > .i {
  flex: none;
  color: var(--accent-text);
}
.set-pick .num {
  flex: none;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
.set-pick-rest,
.rest-sets {
  margin-top: var(--s-4);
  border-top: 1px solid var(--border);
  border-bottom: 0;
}
.set-pick-rest summary,
.rest-sets summary {
  color: var(--text-2);
}
.rest-sets {
  margin-top: var(--s-8);
}
.row-icon.row-sym {
  background: var(--surface-2);
}
.row-icon.row-sym .set-sym {
  margin: 0;
}

/* ---------- Scanner: status, your photo, candidate pick (scan-flow.js) ---------- */
.scan-status.is-busy,
.scan-status:has(.spinner) {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.confirm-art {
  position: relative;
}
.scan-photo {
  margin: 0;
}
.scan-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 63 / 88;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--e-2);
}
.scan-photo figcaption {
  margin-top: 4px;
  color: var(--text-3);
  font-size: var(--fs-xs, 0.75rem);
  text-align: center;
}
.scan-pick {
  display: grid;
  gap: 16px;
  align-items: start;
}
.scan-pick > .scan-photo {
  width: 96px;
}
@media (min-width: 640px) {
  .scan-pick {
    grid-template-columns: 120px minmax(0, 1fr);
  }
  .scan-pick > .scan-photo {
    width: 120px;
  }
}
fieldset.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
fieldset.field legend {
  margin-bottom: 6px;
  padding: 0;
}

/* ============ Historie změn (journal.js) ============ */
.journal-day {
  margin-top: var(--s-6);
  text-transform: capitalize;
}
.journal-filter {
  margin-bottom: var(--s-4);
}
.journal-row {
  align-items: flex-start;
}
.journal-row .row-thumb,
.journal-row .row-icon {
  margin-top: 2px;
}
.journal-row .row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  white-space: normal;
}
.journal-row .journal-line {
  margin-top: 2px;
  color: var(--text-2);
  white-space: normal;
  overflow-wrap: anywhere;
}
.journal-row .journal-line a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}
.journal-row .journal-line a:hover {
  color: var(--accent-text);
}
.journal-was,
.journal-row .journal-time {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.journal-row .journal-time {
  margin-top: 4px;
  font-size: var(--fs-xs);
}
.journal-row.is-undone .row-thumb,
.journal-row.is-undone .row-icon {
  opacity: 0.45;
  filter: grayscale(1);
}
.journal-row.is-undone .journal-line {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}
.journal-pager {
  display: flex;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-6);
}
@media (max-width: 559px) {
  /* Phones: icon-only Undo/Redo, the change text gets the width. */
  .journal-row .row-end .btn {
    width: var(--h-sm);
    padding: 0;
  }
  .journal-row .row-end .btn span {
    display: none;
  }
}

/* ============ 18 · Scanner result and celebration (pack.js, ui.js celebrate) ============ */
/* The photo you took is the hero; the catalogue front leans on it for comparison. */
.scan-result .confirm-art {
  width: min(176px, 48vw);
  margin-inline: auto;
}
.scan-result.has-shot .confirm-art {
  padding: 0 18px 12px 0;
}
.scan-result.confirm {
  gap: var(--s-3);
}
.scan-photo.is-hero img {
  border-radius: 14px;
  box-shadow: var(--e-3);
}
.scan-ref {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 36%;
  margin: 0;
  transform: rotate(5deg);
}
.scan-ref .card3d {
  width: 100%;
  pointer-events: none;
}
.scan-ref .card3d-inner {
  border: 2px solid var(--surface);
  box-shadow: var(--e-2);
}
.scan-ref figcaption {
  position: absolute;
  bottom: -9px;
  left: 50%;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--e-1);
  color: var(--text-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  transform: translateX(-50%) rotate(-5deg);
}
@media (min-width: 640px) {
  .scan-result.confirm {
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: var(--s-5);
  }
  .scan-result .confirm-art {
    width: 100%;
  }
  .scan-result.has-shot .confirm-art {
    padding: 0 26px 20px 0;
  }
}
.scan-id h1 {
  font-size: var(--fs-2xl);
}
.scan-set {
  display: flex;
  align-items: center;
  margin-top: 4px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.scan-id .chip-row {
  margin-top: 10px;
}
.chip.chip-new {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.scan-result .scan-price b {
  font-size: var(--fs-2xl);
}
.scan-alts-link {
  justify-self: start;
  min-height: 36px;
}
.scan-alts {
  margin-top: var(--s-4);
  padding: 4px 20px;
}
.scan-alts .list {
  padding-bottom: var(--s-3);
}
/* Celebration: canvas particles over the page plus a short accent on the card. */
.cele-canvas {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
.cele > :first-child {
  position: relative;
  animation: cele-pop 560ms var(--spring);
}
.cele-rare > :first-child,
.cele-promo > :first-child {
  animation:
    cele-pop 560ms var(--spring),
    cele-glow 1100ms var(--ease);
}
.cele-secret > :first-child {
  animation:
    cele-shake 640ms cubic-bezier(0.36, 0.07, 0.19, 0.97) 60ms,
    cele-rainbow 1700ms linear;
}
.cele-ultra > :first-child::after,
.cele-secret > :first-child::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 14px;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.85) 45%,
    rgba(125, 249, 255, 0.6) 50%,
    rgba(255, 122, 230, 0.6) 55%,
    transparent 70%
  );
  background-size: 300% 100%;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: cele-sweep 1000ms var(--ease) 120ms both;
}
.cele-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  z-index: 4;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  background: var(--grad);
  box-shadow: var(--glow);
  color: #fff;
  font-size: var(--fs-md);
  font-weight: var(--fw-black);
  white-space: nowrap;
  pointer-events: none;
  animation: cele-badge 1500ms var(--spring) both;
}
.cele-ultra .cele-badge {
  background: linear-gradient(90deg, #7df9ff, #b78cff, #ff7ae6);
  color: #1b1030;
}
.cele-secret .cele-badge {
  background: var(--holo);
  color: #1b1030;
  animation-duration: 1900ms;
}
.cele-stamp {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 4;
  padding: 4px 16px;
  border: 4px solid #e11d48;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #e11d48;
  font-size: 26px;
  font-weight: var(--fw-black);
  letter-spacing: 0.14em;
  pointer-events: none;
  animation: cele-stamp 1250ms cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
@keyframes cele-pop {
  0% {
    transform: scale(0.92);
  }
  45% {
    transform: scale(1.04);
  }
}
@keyframes cele-glow {
  35% {
    filter: drop-shadow(0 0 22px color-mix(in srgb, var(--accent) 70%, transparent));
  }
}
@keyframes cele-shake {
  15%,
  55% {
    transform: rotate(-3deg) scale(1.05);
  }
  35%,
  75% {
    transform: rotate(3deg) scale(1.05);
  }
}
@keyframes cele-rainbow {
  0%,
  100% {
    filter: none;
  }
  20% {
    filter: drop-shadow(0 0 22px #ff3b6b);
  }
  45% {
    filter: drop-shadow(0 0 24px #ffe14d);
  }
  70% {
    filter: drop-shadow(0 0 24px #3ab7ff);
  }
}
@keyframes cele-sweep {
  from {
    background-position: 100% 0;
    opacity: 1;
  }
  to {
    background-position: 0 0;
    opacity: 0;
  }
}
@keyframes cele-badge {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.4);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.1);
  }
  28% {
    transform: translate(-50%, 0) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px) scale(1);
  }
}
@keyframes cele-stamp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-14deg) scale(2.6);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-14deg) scale(0.9);
  }
  26% {
    transform: translate(-50%, -50%) rotate(-14deg) scale(1);
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-14deg) scale(1);
  }
}
/* Scan candidates directly under the scanner status (scan-flow.js renderCandidates). */
#scan-results:empty {
  display: none;
}
.scan-results {
  margin-top: var(--s-4);
}
.scan-results .empty {
  padding: var(--s-4) var(--s-2);
}

/* ============ 19 · Scanner v3: camera on the first screen, modes, compact result (pack.js, camera.js, live-scan.js) ============ */
/* The scanner gets the whole screen: no app header, and on phones no tab bar on the camera. */
.workspace:has(.page[data-view='scanner']) > .topbar {
  display: none;
}
.app:has(.page[data-view='scanner']) .tabbar,
.app:has(.scan-cam) .tabbar {
  display: none;
}
.app:has(.page[data-view='scanner']) main#main,
.app:has(.scan-cam) main#main {
  min-height: 100dvh;
  padding-bottom: calc(var(--safe-b) + 16px);
}
.page[data-view='scanner'] {
  padding-top: var(--s-3);
}
.scan-cam {
  position: relative;
  display: grid;
  gap: var(--s-3);
  padding: 0 0 var(--s-3);
  overflow: hidden;
  border-radius: 22px;
}
.scan-top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px 12px 28px;
  background: linear-gradient(rgba(8, 4, 20, 0.62), transparent);
  pointer-events: none;
}
.scan-top > * {
  pointer-events: auto;
}
.scan-close {
  flex: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.scan-modes {
  display: flex;
  gap: 2px;
  margin: 0 auto;
  padding: 3px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.scan-modes a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  color: rgba(255, 255, 255, 0.82);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.scan-modes a.is-active {
  background: #fff;
  color: #1a1030;
}
@media (max-width: 560px) {
  .scan-mode-long {
    display: none;
  }
  .scan-modes {
    max-width: calc(100vw - var(--h-md) - 28px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .scan-modes::-webkit-scrollbar {
    display: none;
  }
  .scan-modes a {
    gap: 4px;
    padding: 0 9px;
    font-size: var(--fs-xs);
  }
  .scan-modes a svg {
    display: none;
  }
  .scan-top::after {
    display: none;
  }
}
@media (max-width: 375px) {
  .scan-close {
    width: 36px;
    height: 36px;
  }
  .scan-modes {
    max-width: calc(100vw - 56px);
    padding: 2px;
  }
  .scan-modes a {
    height: 32px;
    padding: 0 7px;
    font-size: 11px;
  }
}
/* Same width as the close button, so the mode switch stays centred. */
.scan-top::after {
  content: '';
  flex: none;
  width: var(--h-md);
}
.scan-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: calc(100dvh - 210px);
  overflow: hidden;
  background: #0b0716;
}
@media (min-width: 768px) {
  .scan-stage {
    aspect-ratio: auto;
    height: min(62dvh, 680px);
    max-height: none;
  }
}
.scan-stage video,
.scan-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-stage .camera-guide {
  width: min(62%, 300px);
}
.scan-stage .camera-guide .scanline {
  display: none;
}
.scan-stage.is-busy .camera-guide .scanline {
  display: block;
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #c4b5fd, #f9a8d4, transparent);
  box-shadow: 0 0 16px 2px rgba(196, 181, 253, 0.8);
  animation: scanline 1.6s ease-in-out infinite;
}
.scan-stage .camera-message {
  position: absolute;
  inset: auto 16px 16px;
  z-index: 2;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.scan-stage:is([data-state='waiting'], [data-state='error']) .camera-message {
  inset: 50% 24px auto;
  transform: translateY(-50%);
}
.scan-stage[data-state='error'] .camera-guide,
.scan-stage[data-state='waiting'] .camera-guide {
  opacity: 0.35;
}
.cam-switch,
.cam-torch {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: var(--h-md);
  height: var(--h-md);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.cam-torch {
  top: 62px;
}
.cam-torch.is-on {
  background: rgba(251, 191, 36, 0.88);
  color: #1a1030;
}
.cam-switch[hidden],
.cam-torch[hidden] {
  display: none;
}
/* The native picker sits invisibly over the icon: a real dropdown on every device. */
.cam-switch select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.scan-controls {
  display: grid;
  grid-template-columns: var(--h-lg) minmax(0, 1fr) var(--h-lg);
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-4);
}
.scan-upload {
  width: var(--h-lg);
  height: var(--h-lg);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.scan-shutter {
  justify-self: center;
  width: min(100%, 280px);
}
.scan-cam .scan-status {
  min-height: 1.2em;
  margin: 0;
  padding: 0 var(--s-4);
  text-align: center;
}
.scan-results:empty {
  display: none;
}
.scan-results {
  margin-top: var(--s-3);
}
.scan-search {
  display: grid;
  gap: 6px;
  margin-top: var(--s-3);
}
.scan-read {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.scan-narrow {
  border: 0;
}
.scan-narrow summary {
  min-height: 32px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
@media (max-width: 767px) {
  /* Phones: the camera runs edge to edge. */
  .page[data-view='scanner'] .scan-cam {
    margin-inline: calc(var(--gutter) * -1);
    margin-top: calc(var(--s-3) * -1);
    border-radius: 0 0 22px 22px;
  }
}

/* Result: back, "Not this one?" and "Scan next" in one row; notes can be closed. */
.scan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.scan-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.scan-note {
  margin-bottom: var(--s-3);
}
.scan-note > span {
  flex: 1;
}
.scan-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
}
.scan-name .i {
  flex: none;
  color: var(--accent-text);
  transition: transform var(--dur-2) var(--ease);
}
.scan-name:hover .i {
  transform: translateX(3px);
}
.scan-prints {
  margin: 0;
  padding: 0;
  border: 0;
}
.scan-prints legend {
  margin-bottom: 8px;
}
.scan-add-row {
  display: flex;
  gap: var(--s-2);
}
.scan-add-btn {
  flex: 1;
  height: auto;
  min-height: var(--h-lg);
  padding-block: 8px;
}
.scan-add-btn > span {
  display: grid;
  text-align: left;
  line-height: 1.2;
}
.scan-add-btn small {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium, 500);
  opacity: 0.85;
}
.scan-opts-btn {
  width: var(--h-lg);
  height: auto;
  min-height: var(--h-lg);
  border: 1px solid var(--border);
}
.scan-opts-btn[aria-expanded='true'] {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.scan-opts {
  display: grid;
  gap: 12px;
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.scan-opts[hidden] {
  display: none;
}
.scan-nexts {
  margin-top: var(--s-1);
}
button.row.scan-next {
  width: calc(100% + var(--s-3) * 2);
  margin-inline: calc(var(--s-3) * -1);
  padding-inline: var(--s-3);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button.row.scan-next:last-child {
  border-bottom: 0;
}
button.row.scan-next:hover {
  background: var(--surface-2);
}
.scan-next .row-title,
.scan-next .row-sub {
  white-space: normal;
}
.scan-head .scan-alts-link {
  min-height: var(--h-md);
}

/* Live view: labels pinned to every card the camera sees (live-scan.js). */
.scan-cam.is-live .camera-guide {
  display: none;
}
.live-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.live-layer > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.live-layer polygon {
  fill: rgba(139, 92, 246, 0.08);
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.live-layer polygon.is-owned {
  stroke: #34d399;
  fill: rgba(52, 211, 153, 0.12);
}
.live-layer polygon.is-missing {
  stroke: #f472b6;
  fill: rgba(244, 114, 182, 0.12);
}
.live-tag {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 46%;
  padding: 5px 10px 5px 6px;
  border-radius: var(--r-pill);
  background: rgba(16, 10, 32, 0.86);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: var(--fs-xs);
  line-height: 1.2;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  transition:
    left 0.25s var(--ease),
    top 0.25s var(--ease);
}
.live-tag b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-tag small {
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}
.live-tag .dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.live-tag.is-owned .dot {
  background: #10b981;
}
.live-tag.is-missing .dot {
  background: #ec4899;
}
.live-tag.is-pending .dot {
  animation: live-pulse 1.1s ease-in-out infinite;
}
@keyframes live-pulse {
  50% {
    opacity: 0.35;
  }
}
.live-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  min-height: 2.4em;
  padding: 0 var(--s-4);
  color: rgba(240, 232, 255, 0.88);
  font-size: var(--fs-sm);
  text-align: center;
}
.live-bar b {
  color: #fff;
}
.live-bar .chip {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
/* "Co vidím": every card of the live session, over the bottom of the camera (live-scan.js). */
.live-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  max-height: 128px;
  border-radius: var(--r-lg, 16px);
  background: rgba(16, 10, 32, 0.9);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  color: #fff;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.live-panel[data-open='1'] {
  max-height: min(62%, 520px);
}
.live-panel[hidden] {
  display: none;
}
.live-panel-head {
  display: flex;
  align-items: center;
  flex: none;
}
.live-panel-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}
.live-panel-toggle > span,
.live-panel-toggle > b {
  white-space: nowrap;
}
.live-list-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 4px 2px;
}
.live-mode-dot {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: rgba(52, 211, 153, 0.22);
  color: #6ee7b7;
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
}
.live-panel-toggle .chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.25);
  color: #fff;
}
.live-panel-toggle .chip.is-missing {
  background: rgba(236, 72, 153, 0.25);
}
.live-total {
  margin-left: auto;
  font-weight: 700;
}
.live-busy {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  font-size: var(--fs-xs);
  animation: live-pulse 1.1s ease-in-out infinite;
}
.live-panel-toggle > svg:last-child {
  flex: none;
  transform: rotate(180deg);
  transition: transform 0.2s var(--ease);
}
.live-panel[data-open='1'] .live-panel-toggle > svg:last-child {
  transform: none;
}
.live-clear {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: rgba(240, 232, 255, 0.75);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
}
/* Closed: the newest cards in one swipeable row; open: a scrolling list. */
.live-list {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0 8px 8px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.live-panel[data-open='1'] .live-list {
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}
.live-row {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.09);
}
.live-row a {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 8px;
  height: 64px;
  padding: 0 4px 0 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-decoration: none;
}
.live-panel[data-open='0'] .live-row {
  width: 248px;
}
.live-quick-add {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: transform var(--dur-2) var(--spring), background var(--dur-2) var(--ease);
}
.live-quick-add:hover {
  background: var(--grad);
  border-color: transparent;
  transform: scale(1.06);
}
.live-quick-add:active {
  transform: scale(0.92);
}
.live-quick-add[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.live-row.is-owned .live-quick-add {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}
.live-row img,
.live-thumb {
  flex: none;
  width: 46px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.12);
}
.live-row-text,
.live-row-end {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: var(--fs-xs);
}
.live-row-text {
  flex: 1;
}
.live-row-text b,
.live-row-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-row-text b {
  font-size: var(--fs-sm);
}
.live-row small {
  color: rgba(255, 255, 255, 0.72);
}
.live-row-end {
  flex: none;
  align-items: flex-end;
}
.live-row-end small {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.live-row.is-owned .live-row-end small {
  color: #6ee7b7;
}
.live-row.is-missing .live-row-end small {
  color: #f9a8d4;
}
.live-badge {
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: rgba(251, 191, 36, 0.22);
  color: #fde68a;
  font-size: 10px;
  font-style: normal;
}
/* Live view as glass over a full-screen camera, the same material as the "Rozpoznat" scanner
   (scan-glass.css --sg-*): the top bar, the status pill, the labels and the "Co vidím" panel float
   over the picture. */
.scan-cam.is-live {
  --lv-bg: rgba(18, 10, 36, 0.42);
  --lv-bg-strong: rgba(18, 10, 36, 0.62);
  --lv-line: rgba(255, 255, 255, 0.18);
  --lv-blur: blur(18px) saturate(1.5);
  display: block;
  height: calc(100dvh - 2 * var(--s-3));
  min-height: 520px;
  padding: 0;
}
.page[data-view='scanner']:has(.scan-cam.is-live) {
  padding-bottom: 0;
}
@media (max-width: 767px) {
  .page[data-view='scanner'] .scan-cam.is-live {
    height: 100dvh;
    min-height: 0;
    margin-top: calc(var(--s-3) * -1);
    border-radius: 0;
  }
  .app:has(.scan-cam.is-live) main#main {
    padding-bottom: 0;
  }
}
.scan-cam.is-live .scan-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
}
.scan-cam.is-live .scan-top {
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  background: none;
}
.scan-cam.is-live .cam-switch {
  top: calc(env(safe-area-inset-top, 0px) + 62px);
}
.scan-cam.is-live .cam-torch {
  top: calc(env(safe-area-inset-top, 0px) + 114px);
}
.scan-cam.is-live .scan-modes,
.scan-cam.is-live .scan-close,
.scan-cam.is-live .cam-switch,
.scan-cam.is-live .cam-torch,
.scan-cam.is-live .live-bar,
.scan-cam.is-live .live-panel {
  border: 1px solid var(--lv-line);
  background: var(--lv-bg);
  color: #fff;
  backdrop-filter: var(--lv-blur);
  -webkit-backdrop-filter: var(--lv-blur);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.55);
}
/* What is in the frame right now: a small pill under the mode switch. */
.scan-cam.is-live .live-bar {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  left: 50%;
  z-index: 4;
  width: max-content;
  max-width: calc(100% - 2 * var(--h-md) - 48px);
  min-height: 0;
  padding: 6px 14px;
  border-radius: 18px;
  font-size: var(--fs-xs);
  transform: translateX(-50%);
}
.scan-cam.is-live .live-bar:empty {
  display: none;
}
.scan-cam.is-live .live-panel {
  left: 12px;
  right: 12px;
  bottom: calc(var(--safe-b) + 12px);
  border-radius: 20px;
}
.scan-cam.is-live .live-panel[data-open='1'] {
  background: var(--lv-bg-strong);
}
.scan-cam.is-live .live-row {
  background: rgba(255, 255, 255, 0.1);
}
.scan-cam.is-live .live-row a {
  background: transparent;
}
/* Inline twin/reprint picker floating over Live View camera (live-scan.js). */
.live-picker {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px calc(var(--safe-b) + 12px);
  background: rgba(6, 4, 16, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.live-picker[hidden] {
  display: none;
}
.live-picker-sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(460px, 100%);
  max-height: 78%;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  background: rgba(18, 10, 36, 0.92);
  color: #fff;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
}
.live-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.live-picker-head .icon-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.live-picker-body {
  display: flex;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}
.live-picker-shot {
  flex: none;
  width: 72px;
  height: 100px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.live-picker-list {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.live-pick-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.live-pick-opt:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: rgba(196, 181, 253, 0.6);
}
.live-pick-opt .row-thumb {
  width: 36px;
  height: 50px;
}
.live-pick-opt .num {
  flex: none;
  font-size: var(--fs-xs);
}
.live-picker-foot {
  display: flex;
  justify-content: flex-end;
}
.scan-cam.is-live .live-tag {
  border: 1px solid var(--lv-line);
  background: var(--lv-bg-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
@media (min-width: 768px) {
  .scan-cam.is-live .live-panel {
    left: 50%;
    right: auto;
    width: min(560px, calc(100% - 24px));
    transform: translateX(-50%);
  }
}
.scan-note.is-conflict {
  flex-wrap: wrap;
  background: var(--warn-soft, var(--accent-soft));
}
.scan-note.is-conflict .btn {
  margin-left: auto;
}

/* ============ Page transitions ============ */
/* app.js sets html[data-nav] to fade | forward | back for the length of one view transition.
   The bars and the sidebar keep their own layer, so only the screen content moves. */
:root {
  --vt-shift: 28px;
}
@media (min-width: 768px) {
  :root {
    --vt-shift: 14px;
  }
}
html[data-nav] .topbar {
  view-transition-name: vt-topbar;
}
html[data-nav] .tabbar {
  view-transition-name: vt-tabbar;
}
html[data-nav] .sidebar {
  view-transition-name: vt-sidebar;
}
html[data-nav] .page {
  animation: none;
}
@keyframes vt-out {
  to {
    opacity: 0;
  }
}
@keyframes vt-in {
  from {
    opacity: 0;
  }
}
@keyframes vt-out-left {
  to {
    opacity: 0;
    transform: translateX(calc(var(--vt-shift) * -1));
  }
}
@keyframes vt-in-right {
  from {
    opacity: 0;
    transform: translateX(var(--vt-shift));
  }
}
@keyframes vt-out-right {
  to {
    opacity: 0;
    transform: translateX(var(--vt-shift));
  }
}
@keyframes vt-in-left {
  from {
    opacity: 0;
    transform: translateX(calc(var(--vt-shift) * -1));
  }
}
html[data-nav]::view-transition-old(root) {
  animation: vt-out 130ms var(--ease) both;
}
html[data-nav]::view-transition-new(root) {
  animation: vt-in 240ms var(--ease) both;
}
html[data-nav='forward']::view-transition-old(root) {
  animation-name: vt-out-left;
}
html[data-nav='forward']::view-transition-new(root) {
  animation-name: vt-in-right;
}
html[data-nav='back']::view-transition-old(root) {
  animation-name: vt-out-right;
}
html[data-nav='back']::view-transition-new(root) {
  animation-name: vt-in-left;
}

/* ============ First-run tips ============ */
.tip {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: fit-content;
  max-width: min(100%, 68ch);
  margin-top: var(--s-3);
  padding: 2px 2px 2px var(--s-3);
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-sm);
  line-height: 1.4;
  transition:
    opacity var(--dur-2) var(--ease),
    transform var(--dur-2) var(--ease);
}
.tip > svg {
  flex: none;
}
.tip > span {
  min-width: 0;
  padding: 6px 0;
}
.tip-x {
  display: grid;
  flex: none;
  place-items: center;
  width: var(--h-sm);
  height: var(--h-sm);
  border-radius: var(--r-sm);
  color: inherit;
  opacity: 0.7;
}
.tip-x:hover {
  opacity: 1;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.tip.is-leaving {
  opacity: 0;
  transform: translateY(-4px);
}
.on-dark .tip {
  background: rgb(255 255 255 / 0.12);
  color: #fff;
}

/* ============ Navigation groups ============ */
/* A group caption folds its group; a folded group keeps showing the current page. */
.nav {
  padding-bottom: 28px;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
}
button.nav-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 32px;
  border-radius: var(--r-sm);
  text-align: left;
}
button.nav-label svg {
  flex: none;
  opacity: 0.6;
  transition: transform var(--dur-2) var(--ease);
}
button.nav-label:hover {
  color: var(--text-2);
}
.nav-group.is-closed button.nav-label svg {
  transform: rotate(-90deg);
}
@media (max-width: 767px) {
  button.nav-label {
    min-height: var(--h-sm);
  }
  .nav-group.is-closed .nav-item:not(.is-active) {
    display: none;
  }
}
@media (min-width: 768px) and (max-width: 1099px) {
  body:not(.nav-open) button.nav-label {
    min-height: 0;
    pointer-events: none;
  }
}
@media (min-width: 1100px) {
  /* Captions stay readable without hovering the panel (the rail keeps its thin dividers). */
  body:not(.nav-rail) .sidebar button.nav-label {
    height: auto;
    margin: 0;
    padding: 4px 12px;
    background: none;
    color: var(--text-3);
  }
  body:not(.nav-rail) .nav-group.is-closed .nav-item:not(.is-active) {
    display: none;
  }
  body.nav-rail button.nav-label {
    min-height: 0;
    pointer-events: none;
  }
  .sidebar .nav-item {
    height: 40px;
  }
}

/* ============ Touch targets, spacing and reading width ============ */
/* The scan button rises 24 px above the tab bar: the last element of a page scrolls clear of it. */
@media (max-width: 767px) {
  main#main {
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 56px);
  }
}
/* Small text links keep their look and get a 36 px hit area. */
.link-more,
.source,
.zoom-link {
  position: relative;
}
.link-more::after,
.source::after,
.zoom-link::after {
  content: '';
  position: absolute;
  inset: -9px -6px;
}
.back-link {
  min-height: var(--h-sm);
}
.chart-range button {
  height: var(--h-sm);
}
/* A statistic's caption wraps instead of ending in "…". */
.stat-label {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.25;
}
.stat-value {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 479px) {
  .stat {
    column-gap: 10px;
    padding: 12px;
  }
  .stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .stat-value {
    font-size: var(--fs-lg);
  }
}
/* File fields look like the other controls (the button text comes from the browser's language). */
.input[type='file']::file-selector-button {
  height: 32px;
  margin: 0 var(--s-3) 0 0;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
/* Settings, checklists and short lists keep a readable line length on wide screens. */
@media (min-width: 1100px) {
  .page:is(
      [data-view='profile'],
      [data-view='v2-fakes'],
      [data-view='changes'],
      [data-view='v2-search'],
      [data-view='v2-sealed'],
      [data-view='portfolio'],
      [data-view='v2-value'],
      [data-view='wishlist'],
      [data-view='v2-artists'],
      [data-view='v2-goals'],
      [data-view='lot']
    )
    > * {
    max-width: 960px;
  }
}
/* Multi-card Lot & Sale Workbench (lot-scan.js, lot-view.js) */
.lot-cam-wrap[hidden] {
  display: none;
}
.lot-cam-wrap .camera-guide {
  display: none;
}
.lot-cam-wrap .cam-switch {
  top: calc(env(safe-area-inset-top, 0px) + 62px);
}
.lot-cam-wrap .cam-torch {
  top: calc(env(safe-area-inset-top, 0px) + 114px);
}
/* The lot camera fills the screen like the other scanner modes; hint and shutter float over it. */
.lot-cam-wrap {
  display: block;
  height: calc(100dvh - 2 * var(--s-3));
  min-height: 520px;
  padding: 0;
}
.lot-cam-wrap .scan-stage {
  position: absolute;
  inset: 0;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
}
.lot-cam-wrap .scan-top {
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
}
.page[data-view='scanner']:has(.lot-cam-wrap:not([hidden])) {
  padding-bottom: 0;
}
@media (max-width: 767px) {
  .page[data-view='scanner'] .lot-cam-wrap {
    height: 100dvh;
    min-height: 0;
    margin-top: calc(var(--s-3) * -1);
    border-radius: 0;
  }
  .app:has(.lot-cam-wrap:not([hidden])) main#main {
    padding-bottom: 0;
  }
}
.lot-cam-bar {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  display: grid;
  gap: var(--s-2);
  padding: var(--s-8) var(--s-3) calc(env(safe-area-inset-bottom, 0px) + var(--s-3));
  background: linear-gradient(transparent, rgba(8, 4, 20, 0.72) 45%);
}
.lot-cam-hint {
  margin: 0;
  color: rgba(240, 232, 255, 0.82);
  font-size: var(--fs-xs);
  text-align: center;
}
.lot-busy {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-8) var(--s-4);
  text-align: center;
}
.lot-canvas-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #0d081c;
}
.lot-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}
.lot-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-2);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
.lot-summary small {
  display: block;
  color: var(--text-3);
  font-size: var(--fs-2xs);
}
.lot-summary b {
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
}
.lot-summary-ask b {
  color: var(--success);
}
@media (max-width: 520px) {
  .lot-summary {
    grid-template-columns: 1fr 1fr;
  }
  .lot-summary-ask {
    grid-column: 1 / -1;
    padding-top: var(--s-2);
    border-top: 1px solid var(--border);
  }
}
.lot-price-controls,
.lot-eval-box {
  display: grid;
  gap: var(--s-3);
}
.lot-verdict.is-ok {
  background: var(--success-soft);
  color: var(--success);
}
.lot-verdict.is-warn {
  background: var(--warning-soft);
}
.lot-share-box {
  padding: var(--s-3);
  border: 1px solid color-mix(in srgb, var(--success) 45%, var(--border));
  border-radius: var(--r-md);
  background: var(--success-soft);
}
.lot-share-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--s-2);
  color: var(--success);
  font-size: var(--fs-sm);
}
.lot-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.lot-share-row .input {
  flex: 1 1 200px;
  font-size: var(--fs-xs);
}
.lot-export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.lot-add-manual {
  margin-bottom: var(--s-3);
}
.lot-list {
  display: grid;
  gap: var(--s-2);
}
.lot-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.lot-item:last-child {
  border-bottom: 0;
}
.lot-item.is-off {
  opacity: 0.45;
}
.lot-num {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}
.lot-item-main {
  flex: 1 1 170px;
  min-width: 0;
}
.lot-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.lot-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.lot-alt-sel {
  max-width: 190px;
}
.lot-item-ctrl {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.lot-unit-in {
  width: 82px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.lot-saved {
  margin-top: var(--s-4);
}
/* Public /lot/<slug> page */
.lot-public-hero {
  padding: var(--s-5);
}
.lot-public-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
}
.lot-public-top h1 {
  margin-top: 4px;
  color: #fff;
  font-size: var(--fs-2xl);
}
.lot-public-sub {
  margin-top: 4px;
  color: rgba(226, 214, 255, 0.78);
  font-size: var(--fs-sm);
}
.lot-public-price {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.lot-public-price b {
  display: block;
  color: #6ee7b7;
  font-size: var(--fs-3xl);
  font-weight: var(--fw-black);
  line-height: 1.1;
}
.lot-public-price small {
  color: rgba(255, 255, 255, 0.76);
  font-size: var(--fs-xs);
}
.lot-public-note {
  margin-top: var(--s-3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: var(--fs-sm);
}
.lot-photo-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
}
.lot-photo-stage img {
  display: block;
  width: 100%;
  height: auto;
}
.lot-pin {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 44%;
  padding: 4px 9px 4px 5px;
  border: 1px solid rgba(196, 181, 253, 0.65);
  border-radius: var(--r-pill);
  background: rgba(14, 9, 28, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: var(--fw-semibold);
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
.lot-pin b {
  flex: none;
  padding: 1px 5px;
  border-radius: var(--r-pill);
  background: var(--grad);
  font-size: 10px;
}
.lot-pin span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recovery-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.recovery-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: 0.05em;
  user-select: all;
}
.goal-picks {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-5);
  justify-items: center;
}

/* ============ Sections: a short sidebar, related screens as tabs ============ */
/* The sidebar lists sections without captions; a thin line separates the collector's own
   sections from browsing and the market. Related screens of a section are tabs on its pages. */
.nav-group + .nav-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.section-tabs {
  position: relative;
  display: flex;
  gap: 2px;
  margin: calc(var(--s-2) * -1) calc(var(--gutter) * -1) var(--s-5);
  padding: 0 var(--gutter);
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar {
  display: none;
}
.section-tabs a {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 12px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease);
}
.section-tabs a:hover {
  color: var(--text);
}
.section-tabs a.is-active {
  color: var(--text);
}
.section-tabs a.is-active::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--grad);
}
/* ⋯ after the tabs: the section's other screens in a sheet (app.js sectionMore). */
.section-tabs .section-more {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--text-2);
  cursor: pointer;
}
.section-tabs .section-more:hover {
  color: var(--text);
}
.section-more-list .row.is-active .row-title {
  color: var(--accent, var(--text));
}
@media (min-width: 768px) {
  .section-tabs {
    margin: 0 0 var(--s-5);
    padding: 0;
  }
  .section-tabs a:first-child {
    padding-left: 4px;
  }
  .section-tabs a:first-child.is-active::after {
    left: 2px;
  }
}
/* The icon rail names its sections in small captions under the icons (no hover tooltips). */
@media (min-width: 768px) and (max-width: 1099px) {
  body:not(.nav-open) .sidebar .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 58px;
    padding: 0 2px;
  }
  body:not(.nav-open) .sidebar .nav-item span {
    display: block;
    max-width: 100%;
    font-size: 10.5px;
    font-weight: var(--fw-semibold);
    line-height: 1.15;
  }
  body:not(.nav-open) .sidebar .nav-item.is-active::before {
    top: 16px;
    bottom: 16px;
  }
}
@media (min-width: 1100px) {
  body.nav-rail .sidebar .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 58px;
    padding: 0 2px;
  }
  body.nav-rail .sidebar .nav-item span {
    display: block;
    max-width: 100%;
    font-size: 10.5px;
    font-weight: var(--fw-semibold);
    line-height: 1.15;
  }
  body.nav-rail .sidebar .nav-item.is-active::before {
    top: 16px;
    bottom: 16px;
  }
}

/* Continental retail shops (EU / NA / ASIA) */
.shop-region-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.shop-region-wrap h3 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin: 0;
}
.shop-live-offers {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.shop-offer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 8px;
}
.shop-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.shop-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.shop-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--fs-sm);
}
.shop-card-top b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shop-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: var(--fw-semibold);
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.shop-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.shop-cont-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.shop-cont-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.shop-cont-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.shop-cont-countries {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* Opt-in warming class (fail-open: camera is ALWAYS visible unless explicitly warming) */
.scan-stage video {
  transition: opacity 180ms ease;
}
.scan-stage.is-warming video {
  opacity: 0;
}

/* Screens of each section listed under it in the full sidebar and in the phone menu (app.js
   ensureShell). Hidden in the icon rail, where only sections fit. */
.nav-sub {
  display: none;
  margin: 2px 0 6px 30px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.nav-sub-item {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition:
    color var(--dur-2) var(--ease),
    background var(--dur-2) var(--ease);
}
.nav-sub-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-sub-item.is-active {
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}
.nav-open .nav-sub {
  display: block;
}
@media (min-width: 1100px) {
  body:not(.nav-rail) .nav-sub {
    display: block;
  }
  body:not(.nav-rail) .sidebar .nav-item {
    height: 42px;
  }
  body.nav-rail .nav-sub {
    display: none;
  }
}
/* Lower desktop screens: only the current section shows its screens, so all sections stay in view. */
@media (min-width: 1100px) and (max-height: 999px) {
  body:not(.nav-rail) .nav-sub {
    display: none;
  }
  body:not(.nav-rail) .nav-item.is-active + .nav-sub {
    display: block;
  }
}

/* ---------- Market safety: report sheet and moderation queue (public/v2-safety.js) ---------- */
.safety-reasons .choice span {
  height: auto;
  min-height: 40px;
  padding: 8px 14px;
}
.mod-snap {
  margin: 0 0 var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2, var(--surface));
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.mod-tags {
  flex-wrap: wrap;
  margin-bottom: var(--s-2);
}
.mod-tags .chip {
  white-space: normal;
  height: auto;
}
.safety-sheet .row {
  width: 100%;
  text-align: left;
}
.safety-head,
.page-actions:has(.safety-more) {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1, 4px);
}

/* ============ Phone menu without the tab bar's sections ============ */
/* Menu holds what the tab bar does not (app.js ensureShell marks the rest data-in-tabbar), and a
   header action the tab bar already offers (the scan button) is left out on a phone. */
@media (max-width: 767px) {
  body .sidebar .nav [data-in-tabbar],
  body .not-phone {
    display: none;
  }
  body .sidebar .nav .nav-group:not(:has(> :not([data-in-tabbar]))) {
    display: none;
  }
}

/* ============ Card detail on a phone ============ */
/* The card sits beside its name, price and chips, so ownership and the printings (where a copy
   is added) start on the first screen instead of under a full-width picture. The wrappers turn
   into grid items with display: contents; the third row is flexible so the picture's height
   goes there and the name, price and chips stay together at the top. */
@media (max-width: 767px) {
  .detail {
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    gap: var(--s-2) var(--s-4);
    align-items: start;
  }
  .detail > .stack,
  .detail > .stack > .detail-head {
    display: contents;
  }
  .detail > .detail-art {
    grid-column: 1;
    grid-row: 1 / span 3;
    padding-top: 0;
  }
  .detail > .detail-art::before {
    inset: 5%;
    filter: blur(36px);
  }
  .detail .detail-head > .set-link {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    max-width: 100%;
  }
  .detail .detail-head > .detail-title-row {
    grid-column: 2;
    grid-row: 2;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-1);
  }
  .detail .detail-head > .chip-row:not(.v2-traits) {
    grid-column: 2;
    grid-row: 3;
  }
  .detail .detail-head > .v2-traits,
  .detail .detail-head > .own-summary,
  .detail > .stack > :not(.detail-head) {
    grid-column: 1 / -1;
  }
  .detail .detail-head > .own-summary,
  .detail > .stack > section {
    margin-top: var(--s-2);
  }
  .detail .card3d {
    width: 100%;
  }
  .detail .zoom-link {
    margin-top: var(--s-2);
  }
  .detail .detail-head h1 {
    font-size: var(--fs-2xl);
    overflow-wrap: anywhere;
  }
  .detail .detail-price {
    align-items: flex-start;
  }
  .detail .own-summary {
    gap: var(--s-2);
    padding: 10px;
  }
}
/* Small phones (iPhone SE): the side column is too narrow for the chips, so they go full width
   under the card; the picture link drops its icon to stay on one line. */
@media (max-width: 374px) {
  .detail .detail-head > .chip-row:not(.v2-traits) {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .detail .zoom-link svg {
    display: none;
  }
}

/* ============ History strip on a phone ============ */
/* "Today" is an axis label under its dashed line (history.js strip()), so it no longer covers the
   set ticks; the year just before it gives way on a phone. Era labels shrink in a narrow segment
   and hide only when they cannot fit: two letters from 16 px, three or four (data-long) from 27 px. */
.era-axis .era-axis-today {
  padding-right: 3px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: translateX(-100%);
}
.era-seg span {
  display: block;
  max-width: 100%;
  overflow: hidden;
}
@container (max-width: 34px) {
  .era-seg span {
    display: block;
    font-size: 9px;
    letter-spacing: 0;
  }
}
@container (max-width: 26px) {
  .era-seg[data-long] span {
    display: none;
  }
}
@container (max-width: 15px) {
  .era-seg span {
    display: none;
  }
}
@media (max-width: 559px) {
  .era-axis span.near-today {
    display: none;
  }
}
