:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --app-vw: 100vw;
  --app-vh: 100vh;

  /* Commander identity accents, updated live by app.js */
  --accent: #c9a24b;
  --accent-2: #8a6d2f;
  --accent-soft: rgba(201, 162, 75, 0.22);
  --systemz-blue-gradient: linear-gradient(180deg, #f7fbff 0%, #9fd0ff 30%, #45d8ff 62%, #fff6cf 100%);
  --systemz-blue-glow: rgba(0, 217, 255, 0.18);

  --bg-0: #0b0f14;
  --bg-1: #121924;
  --panel-top: #1b2534;
  --panel-bottom: #121a26;
  --ink: #eef3f8;
  --ink-dim: #9fb0c0;
  --line: rgba(255, 255, 255, 0.08);

  color: var(--ink);
  background: var(--bg-0);
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

/* The hidden attribute must always win over component display rules
   (e.g. .stack sets display:grid, which would otherwise keep hidden forms visible). */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(255, 255, 255, 0.05), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  position: relative;
  transition: background 400ms ease;
}

body.card-modal-open {
  left: 0;
  overflow: hidden;
  position: fixed;
  right: 0;
  width: 100%;
}

.glow-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 40% at 50% 0%, var(--accent-soft), transparent 70%);
  opacity: 0.8;
  transition: background 400ms ease;
  z-index: 0;
}

.topbar,
.layout {
  position: relative;
  z-index: 1;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 30px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.15));
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05), 0 10px 30px rgba(0, 0, 0, 0.4);
}

.topbar-toggle {
  display: none;
}

.wordmark {
  align-items: baseline;
  display: inline-flex;
  flex-wrap: nowrap;
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 900;
  gap: 0.18em;
  letter-spacing: 0;
  line-height: 0.92;
  margin: 0;
  max-width: 100%;
  position: relative;
  white-space: nowrap;
}

.wordmark::after {
  background: linear-gradient(90deg, transparent, rgba(255, 246, 207, 0.8), transparent);
  border-radius: 999px;
  bottom: -6px;
  content: "";
  height: 2px;
  left: 4%;
  position: absolute;
  right: 2%;
}

.wordmark-card,
.wordmark-systemz {
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.75));
}

.wordmark-card {
  background-image: linear-gradient(180deg, #fff8df 0%, #f7d76a 34%, #c8912a 62%, #fff1a6 100%);
  text-shadow: 0 0 18px rgba(255, 215, 85, 0.16);
}

.wordmark-systemz {
  background-image: var(--systemz-blue-gradient);
  text-shadow: 0 0 18px rgba(0, 217, 255, 0.18);
}

.brand-symbol-row {
  display: inline-flex;
  margin-top: 8px;
}

.brand h1:not(.wordmark) {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

h2 {
  font-size: 17px;
  letter-spacing: 0.3px;
  margin-bottom: 16px;
  color: var(--ink);
}

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

button {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(
      180deg,
      #fff8df 0%,
      #ffe58f 14%,
      #eac244 34%,
      #c8912a 48%,
      #8f5f12 60%,
      #f3d77b 80%,
      #b87614 100%
    );
  border: 1px solid #7a5713;
  border-radius: 8px;
  color: #3a2a05;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 6px 13px;
  text-shadow: 0 1px 0 rgba(255, 248, 214, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 5px rgba(94, 56, 6, 0.58),
    inset 0 0 14px rgba(255, 240, 190, 0.42),
    0 6px 14px rgba(0, 0, 0, 0.34);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

/* High-luster foil sheen that sweeps across on hover. */
button:not(.ghost)::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -70%;
  width: 45%;
  height: 140%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 35%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0.15) 65%,
    transparent 100%
  );
  transform: skewX(-20deg);
  pointer-events: none;
  transition: left 650ms ease;
}

button:not(.ghost):hover:not(:disabled)::before {
  left: 130%;
}

button:hover:not(:disabled) {
  filter: brightness(1.1) saturate(1.16);
  transform: translateY(-1px) scale(1.01);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 6px rgba(94, 56, 6, 0.62),
    inset 0 0 18px rgba(255, 244, 200, 0.56),
    0 9px 20px rgba(0, 0, 0, 0.44),
    0 0 18px rgba(231, 188, 69, 0.18);
}

button:disabled {
  background: linear-gradient(180deg, #3a4656, #2a3342);
  color: #8496a6;
  cursor: not-allowed;
  text-shadow: none;
  box-shadow: none;
}

/* Tap-press feedback: quick depress so taps feel responsive (pairs w/ haptic). */
button:active:not(:disabled),
.work-tab:active {
  transform: scale(0.965);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  text-shadow: none;
  box-shadow: none;
}

button.ghost:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Top-right account area */
.account-area {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-signed-out,
.auth-signed-in {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-signed-in {
  justify-content: space-between;
}

.account-right-controls {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.plan-pill {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.plan-pill.plus {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #10151b;
}

.plan-pill.premium {
  background: linear-gradient(180deg, #fff6cf, #e7bc45 55%, #a9761d);
  border-color: #7a5713;
  color: #3a2a05;
}

.account-email {
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 700;
}

.account-menu-wrap {
  position: relative;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #141b28;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  z-index: 80;
}

.account-menu[hidden] {
  display: none;
}

.brand-menu-wrap {
  position: relative;
}

#account-menu-btn,
.brand-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  letter-spacing: 0.5px;
  line-height: 1;
  min-height: 0;
  padding: 0 12px;
  white-space: nowrap;
}

.brand-menu {
  background: #141b28;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  display: grid;
  gap: 8px;
  min-width: 240px;
  padding: 12px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
}

.brand-menu[hidden] {
  display: none;
}

.brand-menu button {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 0;
  padding: 7px 12px;
  text-align: left;
}

.brand-menu button[disabled] {
  opacity: 0.55;
}

/* Account menu items sized like the top work tabs. */
.account-menu button {
  min-height: 0;
  padding: 6px 12px;
  font-size: 0.85rem;
}
[data-device="mobile"] .account-menu button {
  min-height: 0;
  padding: 6px 12px;
}

/* Membership panel */
.membership {
  display: grid;
  gap: 14px;
}

.membership-head {
  align-items: center;
  display: flex;
  gap: 10px;
}

.usage-bars {
  display: grid;
  gap: 12px;
}

.usage-item .usage-label {
  color: var(--ink-dim);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: space-between;
  margin-bottom: 6px;
}

.usage-track {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.usage-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  height: 100%;
  transition: width 250ms ease;
}

.usage-fill.full {
  background: linear-gradient(90deg, #ff7a5c, #d0432a);
}

.muted {
  color: var(--ink-dim);
  margin: 0;
}

/* Modals */
.modal {
  align-items: center;
  background: rgba(4, 7, 10, 0.72);
  display: flex;
  inset: 0;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  position: fixed;
  overscroll-behavior: contain;
  z-index: 60;
  backdrop-filter: blur(4px);
  -webkit-overflow-scrolling: touch;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--line);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  max-height: calc(100dvh - 40px);
  max-width: 420px;
  overflow-y: auto;
  padding: 26px;
  position: relative;
  width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-overflow-scrolling: touch;
}

.modal-close {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 22px;
  padding: 4px 8px;
  position: absolute;
  right: 12px;
  top: 10px;
}

@supports not (height: 100dvh) {
  .modal-card {
    max-height: calc(100vh - 40px);
  }
}

@media (max-width: 700px) {
  .modal {
    align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }

  .modal-card {
    max-height: calc(100dvh - 24px);
    padding: 18px 16px 22px;
  }

  .modal-close {
    align-items: center;
    background: rgba(12, 18, 27, 0.88);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    min-width: 36px;
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 2;
  }
}

.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  margin-top: 2px;
  padding-right: 34px; /* keep the right tab clear of the absolute close button */
}

.modal-tabs .tab {
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--ink-dim);
  flex: 1;
}

.modal-tabs .tab:hover:not(:disabled) {
  box-shadow: none;
  filter: none;
  transform: none;
}

.modal-tabs .tab.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #10151b;
}

.auth-card {
  border-radius: 22px;
  max-width: 430px;
}

.auth-landing {
  display: grid;
  gap: 18px;
  padding-top: 8px;
}

.auth-landing[hidden] {
  display: none;
}

.auth-brand {
  align-items: center;
  display: flex;
  gap: 14px;
  padding-right: 22px;
}

.auth-brand-icon-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 18px;
  isolation: isolate;
}

.auth-brand-icon {
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.52));
  height: 76px;
  width: 76px;
}

.auth-brand-icon-wrap::before,
.auth-brand-icon-wrap::after,
.crest::before,
.crest::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}

.auth-brand-icon-wrap::before,
.crest::before {
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(80% 70% at 18% 6%, rgba(255, 255, 255, 0.32), transparent 42%),
    radial-gradient(90% 78% at 82% 94%, rgba(255, 216, 112, 0.18), transparent 54%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent 34%, rgba(69, 216, 255, 0.08) 66%, transparent 100%);
  filter: blur(0.4px);
  mix-blend-mode: screen;
}

.auth-brand-icon-wrap::after,
.crest::after {
  inset: -18% -58%;
  border-radius: 999px;
  background:
    linear-gradient(104deg, transparent 0 38%, rgba(255, 255, 255, 0.12) 42%, rgba(255, 248, 218, 0.84) 47%, rgba(69, 216, 255, 0.2) 51%, rgba(255, 255, 255, 0.12) 56%, transparent 63%),
    linear-gradient(104deg, transparent 0 47%, rgba(255, 238, 160, 0.28) 49%, transparent 54%);
  filter: blur(1.1px);
  mix-blend-mode: screen;
  transform: translateX(-58%) rotate(12deg);
}

.auth-brand-icon-wrap:hover::before,
.auth-brand-icon-wrap:focus-visible::before,
.crest:hover::before,
.crest:focus-visible::before {
  animation: icon-soft-gleam 1050ms ease both;
}

.auth-brand-icon-wrap:hover::after,
.auth-brand-icon-wrap:focus-visible::after,
.crest:hover::after,
.crest:focus-visible::after {
  animation: icon-specular-sweep 1150ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.auth-brand-icon-wrap:hover .auth-brand-icon,
.auth-brand-icon-wrap:focus-visible .auth-brand-icon,
.crest:hover .crest-cardback,
.crest:focus-visible .crest-cardback {
  animation: icon-polish-lift 900ms ease both;
}

@keyframes icon-soft-gleam {
  0% { opacity: 0; transform: scale(0.985); }
  34% { opacity: 0.62; transform: scale(1.006); }
  70% { opacity: 0.34; transform: scale(1.012); }
  100% { opacity: 0; transform: scale(1.018); }
}

@keyframes icon-specular-sweep {
  0% { opacity: 0; transform: translateX(-62%) rotate(12deg); }
  18% { opacity: 0.62; }
  54% { opacity: 0.88; }
  100% { opacity: 0; transform: translateX(62%) rotate(12deg); }
}

@keyframes icon-polish-lift {
  0% { filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.52)); transform: scale(1) rotate(0deg); }
  42% { filter: brightness(1.12) saturate(1.08) drop-shadow(0 15px 26px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 11px rgba(255, 217, 112, 0.26)); transform: scale(1.025); }
  100% { filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.52)); transform: scale(1); }
}

.auth-brand .auth-wordmark {
  font-size: clamp(26px, 8vw, 34px);
  margin: 0 0 8px;
}

.auth-brand .auth-wordmark::after {
  bottom: -5px;
  left: 2%;
  right: 1%;
}

.auth-brand p {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.35;
  margin: 0;
}

.auth-brand-deck {
  position: relative;
  height: 156px;
  margin: -2px auto 0;
  width: min(100%, 350px);
  perspective: 820px;
}

.auth-brand-deck::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 218px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.52), rgba(0, 0, 0, 0));
  filter: blur(5px);
  transform: translateX(-50%);
}

.brand-drop-card {
  --card-x: 0px;
  --card-y: 0px;
  --card-r: 0deg;
  --card-delay: 0ms;
  --card-hue: #64748b;
  --back-image: none;
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: block;
  width: 66px;
  height: 94px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #eef2ff;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.18) 18%, rgba(15, 23, 42, 0.32) 100%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  opacity: 0;
  transform: translate3d(calc(-50% + var(--card-x)), -165px, 0) rotate(var(--card-r)) rotateX(38deg) scale(0.9);
  animation: brand-card-drop 1550ms cubic-bezier(0.19, 1.02, 0.35, 1.08) forwards;
  animation-delay: var(--card-delay);
}

.brand-drop-card::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  background: linear-gradient(116deg, rgba(255, 255, 255, 0.42) 0 8%, transparent 9% 32%, rgba(255, 255, 255, 0.2) 33% 38%, transparent 39%);
  pointer-events: none;
  mix-blend-mode: screen;
}

.brand-card-back {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background:
    var(--back-image),
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--card-hue) 55%, #ffffff 18%) 0 26%, transparent 27%),
    repeating-radial-gradient(circle at 50% 50%, transparent 0 8px, rgba(255, 255, 255, 0.12) 9px 10px),
    linear-gradient(145deg, color-mix(in srgb, var(--card-hue) 70%, #020617 20%), color-mix(in srgb, var(--card-hue) 48%, #020617 46%));
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 0 2px rgba(2, 6, 23, 0.18), inset 0 0 18px rgba(255, 255, 255, 0.1);
}

.brand-card-back::before,
.brand-card-back::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.brand-card-back::before {
  display: none;
}

.brand-card-back::after {
  inset: 0;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0.22) 0 8%, transparent 9% 38%, rgba(255, 255, 255, 0.1) 39% 44%, transparent 45%);
  mix-blend-mode: screen;
}

.brand-back-logo {
  position: relative;
  z-index: 1;
  max-width: 88%;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.4);
  color: #fff7d6;
  font-size: 8px;
  line-height: 1.05;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.78);
}

.card-sports { --card-x: -112px; --card-y: 22px; --card-r: -20deg; --card-delay: 120ms; --card-hue: #2563eb; --back-image: url("/static/images/brand-cards/BabeRuthSports.webp"); z-index: 1; }
.card-pokemon { --card-x: -72px; --card-y: 12px; --card-r: -12deg; --card-delay: 430ms; --card-hue: #facc15; --back-image: url("/static/images/brand-cards/Pokemon_Trading_Card_Game_cardback.png"); color: #1e293b; z-index: 2; }
.card-onepiece { --card-x: -28px; --card-y: 2px; --card-r: -5deg; --card-delay: 740ms; --card-hue: #dc2626; --back-image: url("/static/images/brand-cards/OnePieceCardBack.webp"); z-index: 3; }
.card-lorcana { --card-x: 20px; --card-y: 2px; --card-r: 6deg; --card-delay: 1050ms; --card-hue: #7c3aed; --back-image: url("/static/images/brand-cards/LorcanaCardBack.png"); z-index: 4; }
.card-yugioh { --card-x: 66px; --card-y: 14px; --card-r: 13deg; --card-delay: 1360ms; --card-hue: #92400e; --back-image: url("/static/images/brand-cards/Yu-gi-ohCardBack.png"); z-index: 5; }

.card-mtg {
  --card-x: 0px;
  --card-y: -18px;
  --card-r: 0deg;
  --card-delay: 1760ms;
  --card-hue: #d6a033;
  z-index: 8;
  color: #2d1d05;
  border-color: rgba(255, 235, 162, 0.92);
  background: linear-gradient(180deg, #fff8df 0%, #e7bc45 18%, #8a5b12 100%);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5), 0 0 24px rgba(255, 217, 112, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.72);
  animation-name: brand-card-drop-top;
}

.card-mtg .brand-card-back {
  background-image: url("/static/images/brand-cards/MagicTheGatheringCardBack.jpg");
  background-size: cover;
  border-color: rgba(255, 241, 166, 0.58);
}

.brand-back-logo {
  display: none;
}

.card-mtg .brand-card-back::before,
.card-mtg .brand-back-logo {
  display: none;
}

@keyframes brand-card-drop {
  0% { opacity: 0; transform: translate3d(calc(-50% + var(--card-x)), -150px, 0) rotate(calc(var(--card-r) - 18deg)) rotateX(52deg) scale(0.86); }
  62% { opacity: 1; transform: translate3d(calc(-50% + var(--card-x)), calc(var(--card-y) + 7px), 0) rotate(calc(var(--card-r) + 2deg)) rotateX(0deg) scale(1.04); }
  78% { transform: translate3d(calc(-50% + var(--card-x)), calc(var(--card-y) - 3px), 0) rotate(calc(var(--card-r) - 1deg)) scale(0.98); }
  100% { opacity: 1; transform: translate3d(calc(-50% + var(--card-x)), var(--card-y), 0) rotate(var(--card-r)) scale(1); }
}

@keyframes brand-card-drop-top {
  0% { opacity: 0; transform: translate3d(-50%, -175px, 0) rotate(-16deg) rotateX(56deg) scale(0.92); }
  56% { opacity: 1; transform: translate3d(-50%, 0, 0) rotate(7deg) rotateX(0deg) scale(1.1); }
  72% { transform: translate3d(-50%, -25px, 0) rotate(-3deg) scale(0.98); }
  100% { opacity: 1; transform: translate3d(-50%, -18px, 0) rotate(0deg) scale(1.04); }
}

.auth-choice-stack {
  display: grid;
  gap: 10px;
}

.auth-form-providers {
  margin-bottom: 2px;
}

.auth-divider {
  align-items: center;
  color: var(--ink-dim);
  display: flex;
  font-size: 12px;
  gap: 10px;
  text-align: center;
}

.auth-divider::before,
.auth-divider::after {
  background: var(--line);
  content: "";
  flex: 1;
  height: 1px;
}

.auth-provider {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
  min-height: 46px;
  width: 100%;
}

.provider-mark {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  transform-origin: center;
  transition: filter 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  width: 26px;
}

.provider-mark svg {
  display: block;
  height: 18px;
  width: 18px;
}

.google-mark {
  background: #fff;
}

.microsoft-mark {
  background: #fff;
  border-radius: 5px;
}

.microsoft-mark svg {
  height: 20px;
  width: 20px;
}

.email-mark {
  background: transparent;
  border: 0;
  color: #f1c84b;
  font-size: 18px;
  text-shadow: 0 0 7px rgba(255, 217, 112, 0.42), 0 1px 0 rgba(255, 255, 255, 0.24);
}

.apple-mark {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #f1c84b;
  height: 28px;
  width: 28px;
}

.apple-mark svg {
  height: 24px;
  width: 24px;
  filter: drop-shadow(0 0 5px rgba(255, 217, 112, 0.34)) drop-shadow(0 1px 0 rgba(255, 255, 255, 0.22));
}

.auth-provider:hover:not(:disabled) .provider-mark,
.auth-provider:focus-visible .provider-mark {
  animation: provider-icon-flare 760ms ease both;
  box-shadow: 0 0 18px rgba(255, 217, 112, 0.34), inset 0 0 10px rgba(255, 255, 255, 0.16);
  filter: brightness(1.18) saturate(1.2);
}

.auth-provider:hover:not(:disabled) .provider-mark svg,
.auth-provider:focus-visible .provider-mark svg {
  animation: provider-icon-sheen 940ms ease both;
}

.auth-provider:hover:not(:disabled) .apple-mark,
.auth-provider:focus-visible .apple-mark {
  background: transparent;
  box-shadow: none;
  filter: none;
}

.auth-provider:hover:not(:disabled) .apple-mark svg,
.auth-provider:focus-visible .apple-mark svg {
  filter: drop-shadow(0 0 8px rgba(255, 217, 112, 0.52)) drop-shadow(0 1px 0 rgba(255, 255, 255, 0.28));
}

@keyframes provider-icon-flare {
  0% { transform: translateY(0) scale(1) rotate(0deg); }
  28% { transform: translateY(-1px) scale(1.18) rotate(-7deg); }
  52% { transform: translateY(0) scale(1.08) rotate(5deg); }
  76% { transform: translateY(-1px) scale(1.12) rotate(-2deg); }
  100% { transform: translateY(0) scale(1.07) rotate(0deg); }
}

@keyframes provider-icon-sheen {
  0% { opacity: 0.86; transform: scale(0.96); }
  38% { opacity: 1; transform: scale(1.1); }
  62% { opacity: 0.94; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .brand-drop-card,
  .auth-brand-icon-wrap:hover::before,
  .auth-brand-icon-wrap:focus-visible::before,
  .auth-brand-icon-wrap:hover::after,
  .auth-brand-icon-wrap:focus-visible::after,
  .auth-brand-icon-wrap:hover .auth-brand-icon,
  .auth-brand-icon-wrap:focus-visible .auth-brand-icon,
  .crest:hover::before,
  .crest:focus-visible::before,
  .crest:hover::after,
  .crest:focus-visible::after,
  .crest:hover .crest-cardback,
  .crest:focus-visible .crest-cardback,
  .auth-provider:hover:not(:disabled) .provider-mark,
  .auth-provider:focus-visible .provider-mark,
  .auth-provider:hover:not(:disabled) .provider-mark svg,
  .auth-provider:focus-visible .provider-mark svg {
    animation: none;
  }

  .brand-drop-card {
    opacity: 1;
    transform: translate3d(calc(-50% + var(--card-x)), var(--card-y), 0) rotate(var(--card-r));
  }
}

.auth-switch-link {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--accent);
  min-height: 0;
  padding: 4px 0;
  text-shadow: none;
}

.auth-switch-link:hover:not(:disabled) {
  box-shadow: none;
  filter: brightness(1.08);
}

.field-hint {
  color: var(--ink-dim);
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.provider-handle-head h2 {
  margin: 0 0 6px;
}

.provider-handle-head p {
  line-height: 1.35;
}

.auth-error {
  color: #ff8a78;
  font-weight: 700;
  margin: 12px 0 0;
  min-height: 18px;
}

.paywall .plan-benefits {
  color: var(--ink);
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 16px 0;
  padding: 0;
}

.paywall .plan-benefits li {
  padding-left: 26px;
  position: relative;
}

.paywall .plan-benefits li::before {
  color: var(--accent);
  content: "\2726";
  left: 0;
  position: absolute;
}

.paywall-copy {
  color: var(--ink-dim);
  line-height: 1.5;
}

.paywall-price {
  color: var(--ink);
  font-weight: 800;
  margin: 8px 0 16px;
}

.paywall-price .price {
  color: var(--accent);
  font-size: 30px;
}

.paywall button {
  width: 100%;
}

.paywall button.ghost {
  margin-top: 8px;
}

/* Mana symbols */
.mana-row {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* Scanner import group + voice controls */
.scan-meta {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.scan-meta .field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scan-meta .field input,
.scan-meta .field select {
  width: auto;
}

.scan-group-field {
  flex: 1 1 220px;
  min-width: 0;
}

.scan-meta.is-sealed-mode .scan-group-field {
  display: none;
}

.scan-meta.is-sealed-mode .sealed-mode-check {
  margin-left: auto;
}

.sealed-mode-check {
  align-items: center;
  align-self: end;
  display: inline-flex;
  gap: 7px;
  justify-content: flex-end;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 800;
  min-height: 40px;
  white-space: nowrap;
}

.sealed-mode-check input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
  width: auto;
}

.scan-group-input {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  position: relative;
}

.combo-toggle {
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  min-height: 0;
  padding: 4px 6px;
}

.combo-new {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  font-size: 16px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  line-height: 1;
  min-height: 26px;
  padding: 0;
  width: 26px;
}
.combo-new:hover,
.combo-new:focus-visible {
  background: rgba(201, 162, 75, 0.16);
  border-color: rgba(201, 162, 75, 0.45);
}

.combo-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 8;
  margin: 0;
  padding: 4px;
  min-width: 180px;
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  background: var(--panel-top);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}

.combo-menu[hidden] {
  display: none;
}

/* Standard/Foil segmented toggle in the scan result. */
.reco-finish {
  display: flex;
  width: min(100%, 290px);
  border: 1px solid var(--accent);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 2px;
}
.reco-finish .finish-opt {
  flex: 1 1 0;
  min-height: 38px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.reco-finish .finish-opt.is-active {
  color: #3a2a05;
  background: linear-gradient(180deg, #fff6cf 0%, #f4d97e 15%, #e7bc45 37%, #c8912a 52%, #a9761d 62%, #f0cf76 82%, #c99a2f 100%);
}
.mana-sep {
  color: var(--ink-dim);
  font-weight: 800;
  margin: 0 4px;
}

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

.cq-status-actions {
  gap: 5px;
  margin-right: -28px;
  white-space: nowrap;
}
#capture-queue .cq-finish {
  min-height: 0;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}
#capture-queue .cq-finish.is-foil {
  color: #3a2a05;
  background: linear-gradient(180deg, #fff6cf 0%, #e7bc45 45%, #a9761d 62%, #f0cf76 82%, #c99a2f 100%);
}

#capture-queue .cq-fix,
#capture-queue .cq-confirm {
  min-height: 0;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 0, 0.6);
  color: #ffcf6b;
  background: transparent;
  box-shadow: none;
}

#capture-queue .cq-confirm {
  border-color: rgba(53, 201, 108, 0.72);
  color: #71e69c;
}

#capture-queue .cq-set-shortcut {
  align-items: center;
  appearance: none;
  background: rgba(69, 216, 255, 0.06);
  border: 1px solid rgba(69, 216, 255, 0.72);
  border-radius: 999px;
  box-shadow: none;
  color: var(--accent);
  display: inline-flex;
  flex: 0 0 30px;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  width: 30px;
}

#capture-queue .cq-set-shortcut .cq-set-symbol,
.queue-preview-set .cq-set-symbol {
  width: 18px;
  height: 18px;
  min-width: 18px;
}

#capture-queue .cq-set-shortcut .cq-set-symbol {
  flex-basis: 26px;
  height: 26px;
  width: 26px;
}

.queue-preview-set {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

#capture-queue .cq-fix.is-open,
#capture-queue .cq-set-shortcut.is-open {
  border-color: #45d8ff;
}

#capture-queue .cq-fix.is-open {
  color: #3a2a05;
  background: linear-gradient(180deg, #fff6cf 0%, #e7bc45 55%, #c8912a 100%);
}

#capture-queue .cq-set-shortcut:hover:not(:disabled),
#capture-queue .cq-set-shortcut:focus-visible,
#capture-queue .cq-set-shortcut.is-open {
  background: rgba(69, 216, 255, 0.16);
  box-shadow: 0 0 0 2px rgba(69, 216, 255, 0.12);
}

.cq-review-panel {
  /* As a flex item of the queue column, min-width:auto would let the inner
     horizontal card rows dictate width and blow the page out; pin to 0 so the
     rows scroll inside the available width instead. */
  min-width: 0;
  max-width: 100%;
  margin: -4px 6px 8px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 179, 0, 0.06);
  border: 1px solid rgba(255, 179, 0, 0.28);
}

.cq-review-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 6px 0 4px;
}

.cq-review-label:first-child {
  margin-top: 0;
}

.cq-review-search {
  width: 100%;
  box-sizing: border-box;
}

.cq-review-results {
  margin-top: 6px;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Search results: one locked horizontal row of large card-shaped thumbnails,
   scrolled right to see more (scrollbar shows below). */
.cq-review-results .cq-pick,
.cq-review-results .cq-pick-art {
  flex: 0 0 auto;
  width: 116px;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  gap: 5px;
}

.cq-review-results .cq-pick-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 63 / 88;
}

.cq-review-results .cq-pick-info {
  align-items: center;
}

.cq-review-results .cq-pick-name {
  white-space: normal;
}

.cq-review-hint {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 2px;
}

.cq-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

/* Closest matches shown as a horizontal, swipeable row of card thumbnails. */
.cq-pick-hscroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.cq-pick-hscroll .cq-pick,
.cq-pick-hscroll .cq-pick-art {
  flex: 0 0 auto;
  width: 116px;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  gap: 5px;
}

.cq-pick-hscroll .cq-pick-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 63 / 88;
}

.cq-pick-hscroll .cq-pick-info {
  align-items: center;
}

.cq-pick-hscroll .cq-pick-name {
  white-space: normal;
}

.cq-pick-hscroll .cq-pick-variants {
  margin-left: 0;
  justify-content: center;
}

.cq-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  text-align: left;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  min-height: 0;
  box-shadow: none;
}

.cq-pick:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.14);
}

.cq-pick-hscroll .cq-pick-cell {
  flex: 0 0 auto;
  position: relative;
  width: 116px;
}

.cq-pick-hscroll .cq-pick-cell .cq-pick {
  width: 100%;
}

.cq-review-panel.is-applying {
  opacity: 0.6;
  pointer-events: none;
}

.cq-review-adding {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.cq-pick-thumb {
  width: 30px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.05);
}

.cq-pick-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cq-pick-name {
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cq-pick-set {
  font-size: 0.68rem;
  color: var(--muted);
}

/* Art card in review: same artwork, Standard / Signed variant pills. */
.cq-pick-art {
  cursor: default;
}

.cq-pick-art:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.cq-pick-variants {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.cq-pick-pill {
  min-height: 0;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}

.cq-pick-pill:hover {
  background: rgba(99, 102, 241, 0.18);
}

.cq-pick-pill.is-signed {
  border-color: #c99a2f;
  color: #3a2a05;
  background: linear-gradient(180deg, #fff6cf 0%, #e7bc45 45%, #a9761d 62%, #f0cf76 82%, #c99a2f 100%);
}

.combo-option {
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.combo-option:hover {
  background: rgba(99, 102, 241, 0.2);
}

.detail-group-import-option {
  color: #ffdf89;
  font-weight: 900;
}

.settings-card,
.share-card {
  max-width: 460px;
  width: 100%;
}

.settings-section {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.settings-section:first-of-type {
  border-top: 0;
  margin-top: 6px;
  padding-top: 0;
}

.settings-section h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-section-head h3,
.settings-section-head p {
  margin: 0;
}

.recently-deleted-detail {
  margin-top: 10px;
}

.recently-deleted-detail[hidden] {
  display: none;
}

.recently-deleted-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.recently-deleted-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.deleted-operation {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.42);
}

.deleted-operation-head,
.deleted-entry {
  display: flex;
  align-items: center;
  gap: 9px;
}

.deleted-operation-copy,
.deleted-entry-copy {
  min-width: 0;
  flex: 1;
}

.deleted-operation-title,
.deleted-entry-name {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.deleted-entry {
  min-height: 58px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.deleted-entry img {
  width: 36px;
  aspect-ratio: 63 / 88;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 4px;
  background: var(--panel-top);
}

.deleted-entry .muted,
.deleted-operation .muted {
  margin: 2px 0 0;
  font-size: 0.78rem;
}

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

.settings-check-row {
  justify-content: space-between;
}

.settings-check-row span {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-check-row input[type="checkbox"] {
  flex: 0 0 auto;
  margin-left: auto;
  width: auto;
}

.torch-default-setting input[type="range"] {
  width: 100%;
  min-height: 30px;
  accent-color: var(--accent);
}

.torch-default-setting output {
  float: right;
  color: var(--ink);
  font-weight: 900;
}

.settings-row.settings-stack {
  align-items: stretch;
  flex-direction: column;
  gap: 5px;
}

.settings-row select {
  width: 100%;
}

.settings-row input:not([type="checkbox"]) {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-plan {
  font-weight: 700;
}

.odin-admin-settings {
  background: linear-gradient(180deg, rgba(255, 207, 63, 0.08), rgba(96, 165, 250, 0.045));
  border: 1px solid rgba(255, 207, 63, 0.26);
  border-radius: 12px;
  margin-top: 16px;
  padding: 12px;
}

.admin-users-section {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.08), rgba(255, 207, 63, 0.035));
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 12px;
  margin-top: 16px;
  padding: 12px;
}

.admin-users-status {
  margin: 8px 0;
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(45vh, 420px);
  overflow-y: auto;
}

.admin-user-row {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr);
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.36);
}

.admin-user-main,
.admin-user-meta {
  min-width: 0;
}

.admin-user-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--ink-dim);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-user-plan {
  border: 1px solid rgba(201, 162, 75, 0.45);
  border-radius: 999px;
  color: #ffdf89;
  padding: 2px 8px;
}

.admin-user-plan.plan-plus,
.admin-user-plan.plan-premium,
.admin-user-plan.plan-owner {
  color: #3a2a05;
  background: linear-gradient(180deg, #fff6cf 0%, #e7bc45 48%, #c8912a 100%);
}

.odin-sfx-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.odin-sfx-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 1.25fr);
}

.odin-sfx-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
}

.odin-sfx-control {
  align-items: center;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.odin-sfx-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.odin-sfx-play {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 34px;
  font-size: 13px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.odin-profile-row {
  margin-top: 12px;
}

.odin-fx-preview {
  margin-top: 10px;
}

.odin-commentary-head {
  margin-top: 14px;
}

.odin-commentary-head h4 {
  font-size: 0.85rem;
  margin: 0 0 4px;
}

.odin-commentary-head p {
  margin: 0;
}

.odin-callout-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.odin-callout-row {
  align-items: end;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 0.75fr) minmax(160px, 1.3fr) auto;
}

.odin-callout-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.odin-callout-text {
  min-height: 66px;
  resize: vertical;
  width: 100%;
}

.odin-callout-play {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.odin-animation-stage {
  aspect-ratio: auto;
  cursor: default;
  font-size: 0.72rem;
  font-weight: 900;
  height: 92px;
  letter-spacing: 0.08em;
  margin-top: 10px;
  text-transform: uppercase;
}

.odin-animation-stage span {
  color: var(--ink-dim);
  pointer-events: none;
}

.odin-reset-fx {
  margin-top: 10px;
  width: 100%;
}

@media (max-width: 560px) {
  .odin-sfx-row,
  .odin-callout-row {
    grid-template-columns: 1fr;
  }
}

.member-detail {
  margin-bottom: 8px;
}

.member-plan {
  margin: 0 0 2px;
}

.member-active {
  color: #7fe098;
  font-weight: 700;
}

.bounce-arrow {
  color: #ff4d4f;
  font-size: 20px;
  line-height: 1;
  animation: scan-group-bounce 0.7s ease-in-out infinite;
}

@keyframes scan-group-bounce {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-8px);
  }
}

.scan-group-flash .field-cap {
  color: #ff4d4f;
}

.scan-group-flash input {
  animation: scan-group-flash 0.6s ease-in-out 2;
  border-color: #ff4d4f !important;
}

@keyframes scan-group-flash {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.55);
  }
}

/* Work-area tab strip — shown on both desktop and mobile */
.work-tabs {
  display: none;
}

.tab-hidden {
  display: none !important;
}

/* ===== Pull-to-refresh indicator ===== */
.ptr {
  position: fixed;
  top: 6px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 130;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(20, 23, 34, 0.96);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 1.1rem;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.ptr-ready {
  color: #2ec86a;
  border-color: rgba(46, 200, 106, 0.6);
}
.ptr-arrow {
  display: block;
  transition: transform 0.15s ease;
}
.ptr-ready .ptr-arrow {
  transform: rotate(180deg);
}
.ptr-spin .ptr-arrow {
  animation: ptr-rotate 0.8s linear infinite;
}
@keyframes ptr-rotate {
  to { transform: rotate(360deg); }
}

/* Momentum snap on the horizontal card rows for a native feel. */
.cq-pick-hscroll,
.cq-review-results {
  scroll-snap-type: x proximity;
}
.cq-pick-hscroll .cq-pick,
.cq-review-results .cq-pick {
  scroll-snap-align: start;
}

/* ===== Toast notifications ===== */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 92vw;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  background: rgba(20, 23, 34, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: 92vw;
  text-align: center;
}

.toast-copy {
  min-width: 0;
  flex: 1;
}

.toast-action {
  min-width: 64px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}
.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}
.toast-ok {
  border-color: rgba(46, 200, 106, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(46, 200, 106, 0.25);
}
.toast-error {
  border-color: rgba(224, 80, 58, 0.6);
}
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .toast.is-in {
    transform: none;
  }
}

/* ===== Scan Celebration FX ===== */
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 90;
}
.fx-banner {
  background: linear-gradient(100deg, #fff8c9 0%, #ffd24d 28%, #ffffff 45%, #ff7ab8 62%, #7dd3fc 78%, #fff8c9 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 95;
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
  font-weight: 800;
  font-size: clamp(28px, 6vw, 64px);
  letter-spacing: 0.05em;
  filter: drop-shadow(0 3px 0 rgba(87, 42, 4, 0.85)) drop-shadow(0 0 18px rgba(255, 215, 0, 0.78)) drop-shadow(0 0 38px rgba(125, 211, 252, 0.46));
  pointer-events: none;
  white-space: nowrap;
  animation: fx-banner-pop 1.6s ease-out forwards;
}
.fx-banner::before {
  content: attr(data-text);
  inset: 0;
  position: absolute;
  -webkit-text-stroke: 0.08em rgba(69, 32, 2, 0.8);
  color: transparent;
  z-index: -1;
}
@keyframes fx-banner-pop {
  0% { opacity: 0; background-position: 0% 50%; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; background-position: 62% 50%; transform: translate(-50%, -50%) scale(1.14); }
  30% { background-position: 100% 50%; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; background-position: 0% 50%; transform: translate(-50%, -62%) scale(1); }
}
.fx-glow::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 88;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18), transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.22), transparent 58%);
  box-shadow: inset 0 0 150px 26px rgba(255, 215, 0, 0.58), inset 0 0 80px rgba(125, 211, 252, 0.24);
  animation: fx-glow-fade 0.7s ease-out forwards;
}
@keyframes fx-glow-fade {
  from { opacity: 1; }
  to { opacity: 0; }
}
.cq-holo {
  animation: cq-holo-sweep 1.2s ease-in-out;
}
@keyframes cq-holo-sweep {
  0% { filter: hue-rotate(0deg) saturate(1); box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
  50% { filter: hue-rotate(180deg) saturate(2); box-shadow: 0 0 16px 4px rgba(180, 220, 255, 0.85); }
  100% { filter: hue-rotate(360deg) saturate(1); box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
}
.scan-feedback .fb-sub {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.scan-feedback.pro-locked .fb-sub {
  opacity: 0.4;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .fx-banner { animation-duration: 0.9s; }
}

.export-block {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 12px 0;
}

.export-block .field {
  flex: 0 0 auto;
}

.export-note {
  flex-basis: 100%;
  margin: 4px 0 0;
  font-size: 0.85em;
}

/* Rapid-scan capture queue */
.capture-queue-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.5);
}

.rapid-strip {
  align-items: center;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.72), rgba(15, 23, 42, 0.48));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.24);
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  margin-top: 10px;
  max-width: 100%;
  min-height: 88px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 8px;
  scroll-snap-type: x proximity;
}

.rapid-strip[hidden] {
  display: none;
}

.rapid-card {
  appearance: none;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  cursor: zoom-in;
  flex: 0 0 52px;
  height: 74px;
  overflow: hidden;
  padding: 0;
  position: relative;
  scroll-snap-align: start;
}

.rapid-thumb {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.rapid-card::before {
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.rapid-card.is-working::before,
.rapid-card.is-retry::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  animation: rapid-card-reading 1.1s ease-in-out infinite;
}

.rapid-card.is-done {
  border-color: rgba(52, 199, 89, 0.8);
  box-shadow: 0 0 0 1px rgba(52, 199, 89, 0.26), 0 10px 22px rgba(0, 0, 0, 0.24);
}

.rapid-card.needs-review {
  border-color: rgba(255, 179, 0, 0.82);
  box-shadow: 0 0 0 1px rgba(255, 179, 0, 0.25), 0 10px 22px rgba(0, 0, 0, 0.24);
}

.rapid-card.is-foil {
  border-color: rgba(125, 211, 252, 0.85);
}

.rapid-card.tier-uncommon {
  box-shadow: 0 0 0 1px rgba(255, 207, 63, 0.25), 0 10px 22px rgba(0, 0, 0, 0.24);
}

.rapid-card.tier-rare,
.rapid-card.tier-chase {
  box-shadow: 0 0 0 1px rgba(255, 207, 63, 0.45), 0 0 20px rgba(255, 207, 63, 0.32), 0 10px 22px rgba(0, 0, 0, 0.24);
}

.rapid-card-status {
  align-items: center;
  background: rgba(5, 10, 18, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 15px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 4px;
  top: 4px;
  width: 22px;
}

.rapid-card.is-done .rapid-card-status {
  background: #22c55e;
  border-color: rgba(255, 255, 255, 0.65);
  color: #06290f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.rapid-card.needs-review .rapid-card-status {
  background: #ffb300;
  color: #3b2100;
}

.rapid-card.is-working .rapid-card-status,
.rapid-card.is-retry .rapid-card-status {
  display: none;
}

.rapid-card-name {
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82));
  bottom: 9px;
  color: #fff;
  display: block;
  font-size: 8px;
  font-weight: 800;
  left: 0;
  line-height: 1.05;
  overflow: hidden;
  padding: 16px 4px 4px;
  pointer-events: none;
  position: absolute;
  right: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rapid-card-set {
  bottom: 1px;
  color: #ffdf89;
  display: block;
  font-size: 7px;
  font-weight: 900;
  left: 4px;
  line-height: 1;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  right: 4px;
  text-align: left;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.rapid-card-pop {
  animation: rapid-card-pop 850ms ease-out both;
}

.rapid-card-firework {
  animation: rapid-card-firework 950ms ease-out both;
}

.rapid-card-jackpot {
  animation: rapid-card-jackpot 1.25s ease-out both;
}

.rapid-card-foil-burst::before {
  background: conic-gradient(from 20deg, rgba(255, 0, 136, 0.7), rgba(255, 221, 0, 0.82), rgba(0, 220, 255, 0.8), rgba(126, 255, 76, 0.72), rgba(155, 92, 255, 0.76), rgba(255, 0, 136, 0.7));
  mix-blend-mode: screen;
  opacity: 0;
  animation: rapid-card-foil 1.15s ease-out both;
}

@keyframes rapid-card-reading {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

@keyframes rapid-card-pop {
  0% { transform: scale(1); }
  18% { transform: scale(1.16); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.35), 0 0 24px rgba(52, 199, 89, 0.58); }
  100% { transform: scale(1); }
}

@keyframes rapid-card-firework {
  0% { transform: scale(1) rotate(0deg); }
  18% { transform: scale(1.18) rotate(-2deg); box-shadow: 0 0 0 3px rgba(255, 207, 63, 0.45), 0 0 36px rgba(255, 207, 63, 0.78); }
  55% { transform: scale(1.05) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes rapid-card-jackpot {
  0% { transform: scale(1); filter: brightness(1); }
  16% { transform: scale(1.22); filter: brightness(1.7) saturate(1.45); box-shadow: 0 0 0 3px rgba(255, 207, 63, 0.65), 0 0 44px rgba(255, 207, 63, 0.95), 0 0 80px rgba(255, 93, 162, 0.55); }
  42% { transform: scale(1.08); filter: brightness(1.35) saturate(1.25); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes rapid-card-foil {
  0% { opacity: 0; transform: scale(0.4) rotate(0deg); filter: blur(0.5px) saturate(1.2); }
  25% { opacity: 0.9; transform: scale(1.1) rotate(25deg); filter: blur(0.2px) saturate(2); }
  100% { opacity: 0; transform: scale(1.35) rotate(90deg); filter: blur(1px) saturate(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .rapid-card,
  .rapid-card::before {
    animation: none !important;
  }
}

.capture-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.capture-queue-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-dim);
}

.capture-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  /* Bounded scroll region so large batches stay reachable without an infinitely tall page. */
  max-height: min(68vh, 640px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.cq-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 34px 6px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
  position: relative;
}

.cq-item.cq-locked {
  opacity: 0.68;
}

.cq-thumb {
  width: 68px;
  height: 96px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: zoom-in;
  flex: 0 0 auto;
}

/* Queue scan-vs-card side-by-side. */
.cq-compare {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.cq-shot {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cq-compare .cq-thumb,
.cq-match {
  width: 65px;
  height: 91px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: zoom-in;
  display: block;
  flex: 0 0 auto;
}

.cq-match.is-guess {
  opacity: 0.72;
  border-style: dashed;
}

.cq-match-wait {
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-dim);
  cursor: default;
  display: flex;
  font-size: 18px;
  justify-content: center;
}

.cq-shot-tag {
  color: var(--ink-dim);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cq-shot-match .cq-shot-tag {
  color: #7fe098;
}

.cq-shot-guess .cq-shot-tag,
.cq-shot-wait .cq-shot-tag {
  color: #ffcf6b;
}

.cq-vs {
  color: var(--ink-dim);
  flex: 0 0 auto;
  font-size: 12px;
  opacity: 0.7;
}

.cq-verify {
  background: rgba(255, 179, 0, 0.16);
  border: 1px solid rgba(255, 179, 0, 0.5);
  border-radius: 999px;
  color: #ffcf6b;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
}

.cq-item.cq-low {
  background: rgba(255, 179, 0, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 179, 0, 0.35);
}

.queue-preview-pair {
  align-items: center;
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 14px;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.queue-preview-figure {
  flex: 0 0 auto;
  margin: 0;
  min-width: 0;
  text-align: center;
  width: min(100%, 300px);
}

.queue-preview-figure figcaption {
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

.queue-preview-figure .queue-preview-img {
  max-height: min(60vh, 520px);
  max-width: 300px;
  width: 100%;
}

.queue-preview-card {
  align-items: center;
  max-width: min(92vw, 520px);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  width: 100%;
}

.queue-preview-card.queue-preview-attention {
  background: linear-gradient(180deg, rgba(84, 57, 13, 0.98), rgba(34, 25, 11, 0.99));
  border-color: rgba(255, 179, 0, 0.68);
  box-shadow: inset 0 0 0 1px rgba(255, 207, 99, 0.2), 0 24px 70px rgba(255, 179, 0, 0.18);
}

.queue-preview-topbar {
  align-items: center;
  color: var(--ink-dim);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  gap: 9px;
  justify-content: center;
  min-height: 28px;
  padding: 0 38px;
  text-transform: uppercase;
}

.queue-preview-count {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.queue-preview-stage {
  align-items: center;
  display: flex;
  justify-content: center;
  min-width: 0;
  position: relative;
  touch-action: pan-y;
  user-select: none;
  width: 100%;
}

.queue-preview-pair[hidden],
.queue-preview-end[hidden] {
  display: none;
}

.queue-preview-end {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(62vh, 520px);
  padding: 48px 44px;
  text-align: center;
  width: 100%;
}

.queue-preview-end h2 {
  color: #ffdf89;
  font-size: 24px;
  margin: 6px 0 8px;
}

.queue-preview-end .muted {
  margin: 0 0 18px;
}

.queue-preview-end-actions {
  display: grid;
  gap: 10px;
  max-width: 260px;
  width: 100%;
}

#queue-preview-restart,
#queue-preview-clear {
  background: linear-gradient(180deg, #fff6cf 0%, #e7bc45 48%, #c8912a 100%);
  border: 1px solid #7a5713;
  border-radius: 6px;
  color: #241a05;
  font-size: 12px;
  font-weight: 900;
  min-height: 38px;
  padding: 8px 18px;
  width: 100%;
}

#queue-preview-clear {
  background: linear-gradient(180deg, #ffcf8a 0%, #e36a3f 46%, #9f2828 100%);
  border-color: #7d221f;
}

#queue-preview-clear:disabled {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.56;
}

.queue-preview-nav {
  align-items: center;
  align-self: center;
  background: rgba(10, 15, 22, 0.88);
  border: 1px solid rgba(201, 162, 75, 0.58);
  border-radius: 50%;
  box-shadow: none;
  color: var(--accent);
  display: flex;
  font-size: 28px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
  padding: 0 0 3px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  z-index: 1;
}

#queue-preview-prev {
  left: 0;
}

#queue-preview-next {
  right: 0;
}

.queue-preview-nav:disabled {
  opacity: 0.18;
}

.queue-preview-img {
  border: 1px solid var(--line);
  border-radius: 12px;
  display: block;
  max-height: min(76vh, 720px);
  max-width: min(82vw, 460px);
  object-fit: contain;
  width: auto;
}

.queue-preview-caption {
  margin: 8px 0 0;
  text-align: center;
}

.queue-preview-actions {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  min-height: 30px;
  padding-top: 7px;
  width: 100%;
}

.queue-preview-action {
  background: transparent;
  border: 1px solid rgba(255, 179, 0, 0.58);
  border-radius: 999px;
  box-shadow: none;
  color: #ffcf6b;
  font-size: 10px;
  font-weight: 900;
  min-height: 24px;
  padding: 2px 14px;
}

.queue-preview-action[data-action="set"] {
  border-color: rgba(69, 216, 255, 0.58);
  color: var(--accent);
}

.queue-preview-action[data-action="remove"] {
  background: linear-gradient(180deg, #f5d98a 0%, #e0a24a 18%, #c65a3c 45%, #a83428 68%, #b64a30 100%);
  border-color: #6e2418;
  color: #2a0d08;
  margin-left: auto;
  text-shadow: 0 1px 0 rgba(255, 235, 200, 0.55);
}

.queue-preview-action[data-action="finish"] {
  border-color: rgba(201, 162, 75, 0.68);
  color: #ffdf89;
}

.queue-preview-action[data-action="finish"][data-finish="foil"],
.queue-preview-action[data-action="finish"][data-finish="signed"] {
  background: linear-gradient(180deg, #fff6cf 0%, #e7bc45 48%, #c8912a 100%);
  border-color: #7a5713;
  color: #3a2a05;
}

.queue-preview-action[data-action="confirm"],
.cq-confirm {
  background: transparent;
  border: 1px solid rgba(53, 201, 108, 0.72);
  border-radius: 999px;
  box-shadow: none;
  color: #71e69c;
  font-size: 10px;
  font-weight: 900;
  min-height: 24px;
  padding: 2px 10px;
}

.queue-preview-hint {
  color: var(--ink-dim);
  font-size: 9px;
  margin: 2px 0 0;
  text-align: center;
}

.queue-preview-review {
  flex: 0 0 auto;
  min-width: 0;
  width: 100%;
}

.queue-preview-review .cq-review-panel {
  margin: 8px 0 0;
  width: 100%;
}

.cq-info {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

/* Standard/Foil + Verify get their own row a touch below the status badge. */
.cq-row2 {
  margin-top: 6px;
}

.cq-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cq-print {
  color: #ffdf89;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin-top: 0;
  white-space: nowrap;
}

.cq-print-line {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-top: 2px;
  min-height: 26px;
}

.cq-set-symbol {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: inline-flex;
  flex: 0 0 26px;
  height: 26px;
  justify-content: center;
  overflow: visible;
  position: relative;
  width: 26px;
}

.cq-set-code {
  color: #ffdf89;
  font-size: 7px;
  font-weight: 900;
  line-height: 1;
  max-width: 30px;
  overflow: hidden;
  text-overflow: clip;
}

.cq-set-icon-img {
  filter: invert(94%) sepia(8%) saturate(187%) hue-rotate(176deg) brightness(102%) contrast(94%) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
  height: 24px;
  inset: 1px;
  object-fit: contain;
  position: absolute;
  width: 24px;
}

.cq-set-icon-img[hidden] {
  display: none;
}

.cq-actions {
  bottom: 6px;
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 0;
}

.cq-hide,
.cq-remove {
  appearance: none;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}

.cq-hide {
  align-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--ink-dim);
  display: flex;
  font-size: 20px;
  height: 30px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 3px;
  top: 3px;
  width: 30px;
  z-index: 2;
}

.cq-hide:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.cq-remove {
  border: 1px solid rgba(255, 143, 143, 0.62);
  border-radius: 999px;
  color: #ff9f9f;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 10px;
}

.cq-remove:hover:not(:disabled) {
  background: rgba(255, 88, 88, 0.1);
  border-color: rgba(255, 143, 143, 0.9);
}

.cq-hide:disabled,
.cq-remove:disabled {
  cursor: default;
  opacity: 0.45;
}

.cq-badge {
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 8px;
}

/* The Review badge doubles as the button that opens the picker. */
button.cq-badge {
  cursor: pointer;
  line-height: 1.4;
  box-shadow: none;
}

/* Attention pulse for the Review button. Animate ONLY transform/opacity (GPU
   compositor in WKWebView) so the live camera preview keeps its frame rate --
   never animate box-shadow, which repaints every frame. The glow is a
   pseudo-element whose shadow is rasterized once; only its opacity fades. */
button.cq-badge.cq-review:not(.is-open) {
  position: relative;
  animation: cq-review-scale 1.4s ease-in-out infinite;
}

button.cq-badge.cq-review:not(.is-open)::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 12px 3px rgba(255, 179, 0, 0.72);
  opacity: 0;
  pointer-events: none;
  animation: cq-review-glow 1.4s ease-in-out infinite;
}

@keyframes cq-review-scale {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes cq-review-glow {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

button.cq-badge.cq-review:hover {
  background: rgba(255, 179, 0, 0.3);
  animation: none;
}

button.cq-badge.cq-review:hover::after {
  animation: none;
  opacity: 0;
}

button.cq-badge.cq-review.is-open {
  background: rgba(255, 179, 0, 0.3);
}

/* Keep it findable without motion for reduced-motion users. */
@media (prefers-reduced-motion: reduce) {
  button.cq-badge.cq-review:not(.is-open),
  button.cq-badge.cq-review:not(.is-open)::after {
    animation: none;
  }
  button.cq-badge.cq-review:not(.is-open)::after {
    opacity: 1;
  }
}

.cq-ok {
  background: rgba(52, 199, 89, 0.16);
  border: 1px solid rgba(52, 199, 89, 0.5);
  color: #7fe098;
}

.cq-review {
  background: rgba(255, 179, 0, 0.16);
  border: 1px solid rgba(255, 179, 0, 0.55);
  color: #ffcf6b;
}

.cq-work {
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #b9bcff;
}

.cq-foil {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
  background: linear-gradient(90deg, #f7e08a, #d4af37, #f7e08a);
  color: #4a3a00;
}

#toggle-voice.voice-on {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    #eafff0 0%,
    #9be9ad 15%,
    #52c46e 37%,
    #2f9c4c 52%,
    #1f7d3a 62%,
    #7fe098 82%,
    #2fa251 100%
  );
  border: 1px solid #175a2c;
  color: #06210f;
  text-shadow: 0 1px 0 rgba(230, 255, 236, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 5px rgba(15, 70, 30, 0.55),
    inset 0 0 12px rgba(190, 255, 205, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.4);
}

/* Sweeping foil luster, always animating while listening. */
#toggle-voice.voice-on::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -70%;
  width: 45%;
  height: 140%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 35%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0.15) 65%,
    transparent 100%
  );
  transform: skewX(-20deg);
  pointer-events: none;
  animation: voice-sheen 2.4s ease-in-out infinite;
}

@keyframes voice-sheen {
  0% { left: -70%; }
  60%, 100% { left: 130%; }
}

.voice-state {
  color: var(--accent);
  font-weight: 700;
}

.voice-panel {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-left: 3px solid #3fae5a;
  border-radius: 8px;
  margin: 8px 0;
  padding: 10px 12px;
}

.voice-status {
  color: #7fe098;
  font-weight: 800;
  margin: 0 0 6px;
}

.voice-legend {
  color: var(--ink-dim);
  font-size: 13px;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}

.voice-legend strong {
  color: var(--ink);
}

/* Official Scryfall mana/symbol icons. */
.mana-icon {
  height: 22px;
  width: 22px;
  vertical-align: middle;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.brand h1 .mana-icon {
  height: 26px;
  width: 26px;
}

.mana {
  align-items: center;
  border-radius: 999px;
  color: #1a1a1a;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  width: 26px;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.65), inset 0 -3px 5px rgba(0, 0, 0, 0.35), 0 3px 6px rgba(0, 0, 0, 0.45);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.mana-w { background: radial-gradient(circle at 30% 25%, #fffef2, #efe6c8); }
.mana-u { background: radial-gradient(circle at 30% 25%, #bfe3ff, #4a90c2); color: #08202e; }
.mana-b { background: radial-gradient(circle at 30% 25%, #b9adb0, #2b2529); color: #f2e9ec; }
.mana-r { background: radial-gradient(circle at 30% 25%, #ffb59a, #d0432a); color: #2a0d06; }
.mana-g { background: radial-gradient(circle at 30% 25%, #bfe8ac, #3f8f45); color: #08240c; }
.mana-c { background: radial-gradient(circle at 30% 25%, #e7ecef, #a9b4bd); }

/* Official set/edition symbol (Keyrune webfont), rarity-tinted. */
.set-symbol {
  font-size: 26px;
  line-height: 1;
  margin-left: 12px;
  vertical-align: -6px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* Commons are near-black in the font; give them a bright, visible tint on dark UI. */
.set-symbol-common,
.set-symbol-special,
.set-symbol-bonus {
  color: #e6ebf1;
}

.finish-toggle .inline-check {
  gap: 6px;
}

.layout {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 24px 30px 40px;
}

.panel {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 40px rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.status-panel,
.commander-panel {
  grid-column: 1 / -1;
}

.commander-panel {
  border-image: linear-gradient(120deg, var(--accent), transparent 60%) 1;
}

.status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.status-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.status-ok { border-left: 4px solid #46d39a; }
.status-error { border-left: 4px solid #ff6a5a; }

.stack {
  display: grid;
  gap: 14px;
}

.commander-identity {
  min-height: 26px;
}

.commander-card {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.1));
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
}

.commander-archetype {
  color: var(--accent);
  font-weight: 800;
  margin: 0 0 6px;
}

.commander-strategy {
  color: var(--ink-dim);
  line-height: 1.5;
  margin: 0;
}

.deck-output {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: 16px;
}

.deck-section {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.16));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.deck-section h3 {
  align-items: center;
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  margin: 0 0 8px;
}

.wishlist-missing-btn {
  margin: 2px 0 10px;
  width: 100%;
}

.inventory-deals-banner {
  align-items: center;
  background: linear-gradient(180deg, rgba(127, 224, 152, 0.14), rgba(127, 224, 152, 0.05));
  border: 1px solid rgba(127, 224, 152, 0.45);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  margin: 0 0 10px;
  padding: 9px 12px;
}

.deals-fire {
  font-size: 18px;
  line-height: 1;
}

.deals-text {
  color: var(--ink);
  flex: 1 1 auto;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deals-text strong {
  color: #7fe098;
}

.deals-view {
  flex: 0 0 auto;
  padding: 6px 14px;
}

.deals-clear {
  flex: 0 0 auto;
}

.deck-section .count-pill {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
}

.deck-section ul {
  color: var(--ink-dim);
  font-size: 13px;
  list-style: none;
  margin: 0;
  max-height: 168px;
  overflow: auto;
  padding: 0;
}

.deck-section li {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
  padding: 4px 0;
}

.deck-summary {
  color: var(--ink-dim);
  font-weight: 700;
  grid-column: 1 / -1;
  margin: 0;
}

.scanner {
  display: grid;
  gap: 12px;
}

.scanner-result:empty {
  display: none;
}

.camera-frame.has-result #camera-video,
.camera-frame.has-result .snapshot-frame,
.camera-frame.has-result .scan-square,
.camera-frame.has-result .cv-card-box,
.camera-frame.has-result .camera-placeholder,
.camera-frame.is-processing #camera-video,
.camera-frame.is-processing .snapshot-frame,
.camera-frame.is-processing .scan-square,
.camera-frame.is-processing .cv-card-box,
.camera-frame.is-processing .camera-placeholder {
  display: none;
}

.camera-frame.has-result,
.camera-frame.is-processing {
  align-items: stretch;
  cursor: default;
  justify-content: stretch;
}

.camera-frame.has-result .scanner-result,
.camera-frame.is-processing .scanner-result {
  display: grid;
  grid-template-columns: minmax(150px, 240px) minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  overflow: auto;
  padding: 18px;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.camera-frame.is-processing .scanner-result {
  align-items: center;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.manual-processing {
  align-items: center;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-self: center;
  text-align: center;
}

.manual-processing strong {
  color: var(--ink);
  font-size: 18px;
}

.manual-processing span:last-child {
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 700;
}

.manual-processing-spinner {
  animation: manual-processing-spin 0.85s linear infinite;
  border: 4px solid rgba(69, 216, 255, 0.18);
  border-radius: 50%;
  border-top-color: var(--systemz-blue, #45d8ff);
  height: 48px;
  width: 48px;
}

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

.camera-frame {
  align-items: center;
  aspect-ratio: 63 / 88;
  background: radial-gradient(circle at 50% 40%, #121b24, #060a0e);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.camera-frame.is-sealed-mode {
  aspect-ratio: 4 / 3;
}

#camera-video {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

/* iOS native camera preview (Option B): the native AVCaptureVideoPreviewLayer renders
   BEHIND the transparent web view, so the camera-frame and its ancestors must be
   transparent to let it show through. The native backdrop view supplies the dark theme
   elsewhere; the DOM overlays (scan square, card edge, torch, result) stay on top.
   NOTE: :root (the <html> element) carries an opaque var(--bg-0) background, so it MUST
   be included or it occludes the native layer (black camera area). */
[data-native-preview="on"],
[data-native-preview="on"] body,
[data-native-preview="on"] .layout,
[data-native-preview="on"] .scanner-panel,
[data-native-preview="on"] .scanner,
[data-native-preview="on"] .camera-frame {
  background: transparent !important;
}
[data-native-preview="on"] .glow-backdrop {
  display: none !important;
}
[data-native-preview="on"] .camera-frame {
  box-shadow: none !important; /* no inset shadow over the live native image */
}
[data-native-preview="on"] #camera-video {
  /* Keep the canvas-backed stream playing (it feeds analysis + snapshot) but let the
     native preview layer show through. */
  opacity: 0 !important;
}

/* Frozen snapshot shown after "Snap Picture" until recognition completes. */
.snapshot-frame {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
  z-index: 2;
}

.scan-square {
  --cv-fill: rgba(4, 7, 10, 0.08);
  background: transparent;
  border-radius: 12px;
  box-shadow: 0 0 32px rgba(69, 216, 255, 0.44), inset 0 0 20px rgba(69, 216, 255, 0.16);
  height: 100%;
  inset: 0;
  pointer-events: none;
  position: absolute;
  width: 100%;
  z-index: 3;
  display: block;
}
.scan-square::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.scan-square::after {
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background: #45d8ff;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 1;
}
@keyframes scanner-guide-glow {
  0%, 100% { box-shadow: 0 0 0 999px var(--cv-fill), 0 0 18px rgba(69, 216, 255, 0.28), inset 0 0 12px rgba(69, 216, 255, 0.1); }
  50% { box-shadow: 0 0 0 999px var(--cv-fill), 0 0 42px rgba(69, 216, 255, 0.56), inset 0 0 22px rgba(69, 216, 255, 0.2); }
}
@keyframes scanner-guide-ring {
  0%, 100% { opacity: 0.22; transform: scale(0.99); }
  50% { opacity: 0.8; transform: scale(1.022); }
}
@media (prefers-reduced-motion: reduce) {
  .scan-square,
  .scan-square::after {
    animation: none;
  }
}
.cv-card-box {
  display: none;
  filter: drop-shadow(0 0 8px rgba(0, 217, 255, 0.46)) drop-shadow(0 0 22px rgba(69, 216, 255, 0.2));
  height: 100%;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 120ms ease, filter 120ms ease;
  width: 100%;
  z-index: 4;
}
.cv-card-box.is-detected {
  opacity: 1;
}
.cv-card-polygon {
  fill: rgba(69, 216, 255, 0.055);
  stroke: url(#cv-systemz-edge);
  stroke-linejoin: round;
  stroke-width: 3.5px;
  vector-effect: non-scaling-stroke;
}
.camera-frame[data-cv-state="live"] .cv-card-box {
  --cv-glow: rgba(0, 217, 255, 0.38);
  --cv-fill: rgba(4, 7, 10, 0.3);
}
.camera-frame[data-cv-state="scanning"] .cv-card-box {
  --cv-glow: rgba(159, 208, 255, 0.5);
  --cv-fill: rgba(4, 7, 10, 0.26);
}
.camera-frame[data-cv-state="match"] .cv-card-box {
  --cv-glow: rgba(69, 216, 255, 0.5);
  --cv-fill: rgba(4, 7, 10, 0.22);
}
.camera-frame[data-cv-state="foil"] .cv-card-box {
  --cv-glow: rgba(247, 251, 255, 0.54);
  --cv-fill: rgba(4, 7, 10, 0.2);
}
.camera-frame[data-cv-state="miss"] .cv-card-box,
.camera-frame[data-cv-state="error"] .cv-card-box {
  --cv-glow: rgba(69, 216, 255, 0.32);
  --cv-fill: rgba(4, 7, 10, 0.34);
}

/* Scan line removed for mobile performance; capture feedback uses finish-text /
  foil overlays below instead of a continuously animated bar. */
.scan-bar {
  display: none;
}
.camera-frame.scan-gleam::before {
  content: "STANDARD";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  pointer-events: none;
  background: linear-gradient(100deg, #fff7d6 0%, #f2b84b 28%, #ffffff 44%, #ffeaa3 58%, #c7ecff 78%, #fff7d6 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-size: clamp(2rem, 9vw, 5.2rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  padding: 0.2em 0.34em;
  text-align: center;
  text-shadow: 0 2px 0 rgba(37, 29, 12, 0.65), 0 0 10px rgba(255, 250, 216, 0.98), 0 0 26px rgba(255, 202, 91, 0.72), 0 0 48px rgba(125, 211, 252, 0.36);
  text-transform: uppercase;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  animation: standard-word-flash 860ms ease-out both;
}
.camera-frame.scan-gleam::after {
  content: "STANDARD";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  pointer-events: none;
  color: transparent;
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-size: clamp(2rem, 9vw, 5.2rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  padding: 0.2em 0.34em;
  text-align: center;
  text-transform: uppercase;
  -webkit-text-stroke: 0.055em rgba(255, 236, 162, 0.62);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 28px rgba(255, 215, 94, 0.7), 0 0 54px rgba(96, 165, 250, 0.45);
  filter: blur(0.35px) saturate(1.2);
  mix-blend-mode: screen;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  animation: standard-word-aura 860ms ease-out both;
}
.camera-frame.scan-foil-burst::before {
  content: "";
  position: absolute;
  inset: 9% 11%;
  z-index: 6;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.92) 0 7%, rgba(255, 255, 255, 0.42) 8% 14%, transparent 26%),
    conic-gradient(from 20deg, rgba(255, 0, 136, 0.75), rgba(255, 221, 0, 0.82), rgba(0, 220, 255, 0.82), rgba(126, 255, 76, 0.74), rgba(155, 92, 255, 0.78), rgba(255, 0, 136, 0.75));
  clip-path: polygon(50% 0%, 56% 38%, 100% 50%, 56% 62%, 50% 100%, 44% 62%, 0% 50%, 44% 38%);
  filter: blur(0.2px) saturate(1.35);
  mix-blend-mode: screen;
  opacity: 0;
  transform: scale(0.2) rotate(0deg);
  animation: foil-holo-burst 760ms ease-out both;
}
.camera-frame.scan-foil-burst::after {
  content: "FOIL";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  pointer-events: none;
  background: linear-gradient(105deg, #fff6cf 0%, #ff67bd 18%, #6ee7ff 36%, #d7ff6e 54%, #b692ff 72%, #fff6cf 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-size: clamp(2.4rem, 11vw, 6rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 18px rgba(125, 211, 252, 0.5), 0 0 36px rgba(255, 103, 189, 0.35);
  transform: translate(-50%, -50%) scale(0.72);
  animation: foil-word-flash 900ms ease-out both;
}
/* Neutral capture confirm (native two-stage): the STANDARD / FOIL word is revealed later. */
.camera-frame.scan-scanned::before {
  content: "SCANNED";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  pointer-events: none;
  background: linear-gradient(100deg, #e4faff 0%, #45d8ff 30%, #ffffff 48%, #8be9ff 66%, #e4faff 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-size: clamp(1.9rem, 8.4vw, 4.8rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1;
  padding: 0.2em 0.34em;
  text-align: center;
  text-shadow: 0 2px 0 rgba(8, 24, 32, 0.6), 0 0 10px rgba(228, 250, 255, 0.96), 0 0 26px rgba(69, 216, 255, 0.72), 0 0 48px rgba(125, 211, 252, 0.4);
  text-transform: uppercase;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  animation: scanned-word-flash 760ms ease-out both;
}
.camera-frame.scan-scanned::after {
  content: "SCANNED";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  pointer-events: none;
  color: transparent;
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-size: clamp(1.9rem, 8.4vw, 4.8rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1;
  padding: 0.2em 0.34em;
  text-align: center;
  text-transform: uppercase;
  -webkit-text-stroke: 0.05em rgba(150, 236, 255, 0.6);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 28px rgba(69, 216, 255, 0.7), 0 0 54px rgba(96, 165, 250, 0.45);
  filter: blur(0.35px) saturate(1.2);
  mix-blend-mode: screen;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  animation: scanned-word-aura 760ms ease-out both;
}
@keyframes scanned-word-flash {
  0% { opacity: 0; background-position: 0% 50%; transform: translate(-50%, -50%) scale(0.72); filter: brightness(0.95); }
  18% { opacity: 1; background-position: 46% 50%; transform: translate(-50%, -50%) scale(1.05); filter: brightness(1.7); }
  44% { opacity: 1; background-position: 78% 50%; transform: translate(-50%, -50%) scale(1); filter: brightness(1.35); }
  100% { opacity: 0; background-position: 100% 50%; transform: translate(-50%, -50%) scale(0.97); filter: brightness(1); }
}
@keyframes scanned-word-aura {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); filter: blur(1px) brightness(0.8); }
  16% { opacity: 0.85; transform: translate(-50%, -50%) scale(1.08); filter: blur(0.35px) brightness(1.7); }
  48% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.16); filter: blur(0.7px) brightness(1.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.28); filter: blur(1.3px) brightness(1); }
}
/* Finish reveal: floats the STANDARD / FOIL word up from its source queue card. */
.finish-reveal {
  position: fixed;
  z-index: 9;
  pointer-events: none;
  transform: translate(-50%, 0) scale(0.7);
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-size: clamp(0.95rem, 4.2vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  animation: finish-reveal-rise 1150ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.finish-reveal-standard {
  background: linear-gradient(100deg, #fff7d6 0%, #f2b84b 30%, #ffffff 50%, #ffeaa3 70%, #c7ecff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 10px rgba(255, 250, 216, 0.6), 0 0 22px rgba(255, 202, 91, 0.42);
}
.finish-reveal-foil {
  background: linear-gradient(105deg, #fff6cf 0%, #ff67bd 20%, #6ee7ff 40%, #d7ff6e 58%, #b692ff 76%, #fff6cf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 14px rgba(125, 211, 252, 0.5), 0 0 30px rgba(255, 103, 189, 0.36);
}
@keyframes finish-reveal-rise {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.66); }
  22% { opacity: 1; transform: translate(-50%, -20px) scale(1.08); }
  68% { opacity: 1; transform: translate(-50%, -52px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -82px) scale(0.98); }
}
@media (prefers-reduced-motion: reduce) {
  .finish-reveal { animation: finish-reveal-fade 900ms ease-out both; }
}
@keyframes finish-reveal-fade {
  0% { opacity: 0; transform: translate(-50%, -34px) scale(1); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -44px) scale(1); }
}
.voice-heard-overlay {
  background: rgba(6, 10, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42), 0 0 14px rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  left: 50%;
  letter-spacing: 0;
  max-width: min(72%, 520px);
  overflow: hidden;
  padding: 7px 16px;
  pointer-events: none;
  position: absolute;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
  top: 10px;
  transform: translateX(-50%);
  white-space: nowrap;
  width: min(72%, 520px);
  z-index: 7;
}
.voice-heard-overlay[hidden] {
  display: none;
}
.voice-heard-overlay span {
  display: inline-block;
  min-width: 100%;
  animation: voice-heard-scroll 3.2s linear both;
}
@keyframes voice-heard-scroll {
  from { transform: translateX(-55%); }
  to { transform: translateX(55%); }
}
@keyframes standard-word-flash {
  0% { opacity: 0; background-position: 0% 50%; transform: translate(-50%, -50%) scale(0.72); filter: brightness(0.95); }
  16% { opacity: 1; background-position: 42% 50%; transform: translate(-50%, -50%) scale(1.06); filter: brightness(1.85); }
  38% { opacity: 1; background-position: 76% 50%; transform: translate(-50%, -50%) scale(1); filter: brightness(1.45); }
  70% { opacity: 0.82; background-position: 100% 50%; transform: translate(-50%, -50%) scale(0.99); filter: brightness(1.18); }
  100% { opacity: 0; background-position: 0% 50%; transform: translate(-50%, -50%) scale(0.96); filter: brightness(1); }
}
@keyframes standard-word-aura {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); filter: blur(1px) brightness(0.8); text-shadow: 0 0 0 rgba(255, 255, 255, 0); }
  14% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.1); filter: blur(0.35px) brightness(1.9); text-shadow: 0 0 12px rgba(255, 255, 255, 0.95), 0 0 34px rgba(255, 220, 105, 0.86), 0 0 70px rgba(96, 165, 250, 0.55); }
  45% { opacity: 0.58; transform: translate(-50%, -50%) scale(1.18); filter: blur(0.75px) brightness(1.35); text-shadow: 0 0 18px rgba(255, 255, 255, 0.7), 0 0 42px rgba(255, 202, 91, 0.6), 0 0 86px rgba(96, 165, 250, 0.36); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.32); filter: blur(1.4px) brightness(1); text-shadow: 0 0 30px rgba(255, 255, 255, 0), 0 0 80px rgba(255, 202, 91, 0); }
}
@keyframes foil-holo-burst {
  0% { opacity: 0; transform: scale(0.18) rotate(-12deg); filter: brightness(1.2) saturate(1.2); }
  14% { opacity: 1; transform: scale(0.48) rotate(8deg); filter: brightness(2.2) saturate(1.9); }
  42% { opacity: 0.88; transform: scale(0.82) rotate(28deg); filter: brightness(1.7) saturate(2.1); }
  100% { opacity: 0; transform: scale(1.15) rotate(54deg); filter: brightness(1) saturate(1.4); }
}
@keyframes foil-word-flash {
  0% { opacity: 0; background-position: 0% 50%; transform: translate(-50%, -50%) scale(0.72); filter: brightness(1.05) saturate(1.3); }
  14% { opacity: 1; background-position: 70% 50%; transform: translate(-50%, -50%) scale(1.12); filter: brightness(1.9) saturate(2); }
  52% { opacity: 0.95; background-position: 100% 50%; transform: translate(-50%, -50%) scale(1.02); filter: brightness(1.35) saturate(1.7); }
  100% { opacity: 0; background-position: 0% 50%; transform: translate(-50%, -50%) scale(0.96); filter: brightness(1) saturate(1.2); }
}
@media (prefers-reduced-motion: reduce) {
  .camera-frame.scan-gleam::before,
  .camera-frame.scan-scanned::before,
  .camera-frame.scan-foil-burst::after { animation: none; opacity: 0.35; transform: translate(-50%, -50%) scale(1); }
  .camera-frame.scan-gleam::after,
  .camera-frame.scan-scanned::after { animation: none; opacity: 0.2; transform: translate(-50%, -50%) scale(1.08); }
  .camera-frame.scan-foil-burst::before { animation: none; opacity: 0.35; transform: scale(1); }
}

.camera-placeholder {
  background: rgba(10, 15, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: var(--ink-dim);
  font-weight: 700;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
  max-width: 90%;
  padding: 12px 16px;
}

.camera-frame > .scanner-auth-out {
  display: block;
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 7;
}

.camera-frame > .scanner-auth-out button {
  left: 50%;
  align-items: center;
  display: inline-flex;
  font-size: 13px;
  height: 38px;
  justify-content: center;
  min-height: 38px;
  pointer-events: auto;
  position: absolute;
  padding: 0 18px;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  width: min(220px, 72%);
}

.camera-frame > .scanner-auth-out #open-signin {
  top: 74%;
}

.camera-frame > .scanner-auth-out #open-signup {
  top: 26%;
}

.camera-frame.camera-on > .scanner-auth-out,
.camera-frame.has-result > .scanner-auth-out,
.camera-frame.is-processing > .scanner-auth-out {
  display: none;
}

/* Flashlight / torch controls, top-right of the camera area. */
.torch-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 10px;
  border-radius: 24px;
  background: rgba(15, 17, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: opacity 320ms ease, padding 320ms ease, gap 320ms ease, background-color 320ms ease, border-color 320ms ease, box-shadow 320ms ease;
}
.torch-controls[hidden] {
  display: none !important;
}
.torch-controls.is-ghost {
  gap: 0;
  padding: 0;
  opacity: 0.24;
  background: transparent;
  border-color: transparent;
  border-width: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.torch-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
  background: rgba(15, 17, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  box-shadow: none;
  text-shadow: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
/* Keep the icon small/clean but give the finger a MUCH larger invisible tap
   target so near-misses hit the torch instead of triggering a frame snap. */
.torch-toggle::before {
  content: "";
  position: absolute;
  inset: -34px;
  border-radius: 999px;
}
.torch-controls.is-ghost .torch-toggle::before {
  inset: -10px;
}
.torch-toggle.is-on {
  background: linear-gradient(180deg, #fff6cf, #f4d97e 40%, #e7bc45);
  color: #3a2a05;
  border-color: #7a5713;
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.5);
}
.torch-level {
  -webkit-appearance: none;
  appearance: none;
  --torch-fill: 23%;
  width: 30px;
  min-width: 30px;
  height: 118px;
  margin: 0;
  accent-color: #f4d97e;
  cursor: pointer;
  writing-mode: vertical-lr;
  direction: rtl;
  touch-action: none;
  border-radius: 999px;
  background:
    repeating-linear-gradient(to top, rgba(255, 255, 255, 0.62) 0 2px, transparent 2px 14px),
    linear-gradient(to top, transparent calc(var(--torch-fill) - 1px), rgba(255, 255, 255, 0.94) calc(var(--torch-fill) - 1px) calc(var(--torch-fill) + 1px), transparent calc(var(--torch-fill) + 1px)),
    linear-gradient(to top, rgba(244, 217, 126, 0.96) 0 var(--torch-fill), rgba(0, 0, 0, 0.82) var(--torch-fill) 100%);
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: inset 0 0 0 4px rgba(15, 17, 23, 0.28), 0 2px 8px rgba(0, 0, 0, 0.36);
  opacity: 1;
  visibility: visible;
  transition: opacity 260ms ease, width 320ms ease, min-width 320ms ease, height 320ms ease, margin 320ms ease, visibility 0s linear;
}
.torch-controls.is-ghost .torch-level {
  width: 0;
  min-width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 180ms ease, width 320ms ease, min-width 320ms ease, height 320ms ease, margin 320ms ease, visibility 0s linear 320ms;
}
.torch-level::-webkit-slider-runnable-track {
  width: 30px;
  height: 118px;
  border-radius: 999px;
  background: transparent;
}
.torch-level::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 8px;
  border-radius: 4px;
  border: 2px solid #3a2a05;
  background: linear-gradient(180deg, #fff8d4, #e4b83d);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.torch-level::-moz-range-track {
  width: 30px;
  height: 118px;
  border-radius: 999px;
  background: transparent;
}
.torch-level::-moz-range-thumb {
  width: 36px;
  height: 8px;
  border-radius: 4px;
  border: 2px solid #3a2a05;
  background: linear-gradient(180deg, #fff8d4, #e4b83d);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.cam-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cam-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.camera-frame.camera-on .camera-placeholder {
  display: none;
}

.camera-gate {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 82%;
  z-index: 6;
  text-align: center;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 77, 79, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: camera-gate-pop 0.25s ease-out;
}

@keyframes camera-gate-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.scanner-controls {
  margin-top: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.scanner-panel .button-row button.scanner-symbol-command {
  align-items: center;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  display: inline-flex;
  min-height: 58px;
  justify-content: center;
  padding: 0;
}

.scanner-stop-sign,
.scanner-camera-circle {
  display: inline-block;
  flex: 0 0 auto;
  height: 52px;
  position: relative;
  width: 52px;
}

.scanner-stop-sign {
  align-items: center;
  background: #ffd4cf;
  clip-path: polygon(29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%);
  display: inline-flex;
  justify-content: center;
}

.scanner-stop-sign::before {
  background: #c92f35;
  clip-path: inherit;
  content: "";
  inset: 2px;
  position: absolute;
}

.scanner-stop-sign span {
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  position: relative;
  text-shadow: 0 1px 2px rgba(82, 0, 0, 0.72);
  z-index: 1;
}

.scanner-camera-circle {
  align-items: center;
  background: #082438;
  border: 1px solid #45d8ff;
  border-radius: 999px;
  display: inline-flex;
  justify-content: center;
}

.scanner-camera-face {
  background: #45d8ff;
  border: 0;
  border-radius: 999px;
  height: 46px;
  position: relative;
  width: 46px;
}

.scanner-state {
  color: var(--ink-dim);
  font-size: 14px;
  font-weight: 700;
  margin: 12px 0;
}

label {
  color: var(--ink-dim);
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

input,
select,
textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 11px;
  width: 100%;
}

/* Force the native dropdown popup to match the dark theme instead of OS white. */
select {
  color-scheme: dark;
}

option,
optgroup {
  background-color: #10151b;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.output {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-dim);
  min-height: 72px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.output.summary {
  white-space: normal;
}

.output.summary p {
  margin: 0 0 6px;
}

.reco-top {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 4px;
}

.reco-art {
  border: 1px solid var(--accent);
  border-radius: 10px;
  display: block;
  max-width: 220px;
  width: 100%;
}

.reco-art-zoom {
  appearance: none;
  background: transparent;
  border: 0;
  display: block;
  justify-self: center;
  margin: 0 0 8px;
  padding: 0;
  width: min(100%, 220px);
}

.reco-art-zoom.is-expanded {
  align-items: center;
  background: rgba(2, 5, 9, 0.97);
  display: flex;
  inset: 0;
  justify-content: center;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  position: fixed;
  width: auto;
  z-index: 1000;
}

.reco-art-zoom.is-expanded .reco-art {
  border: 0;
  max-height: calc(100dvh - 24px);
  max-width: calc(100vw - 24px);
  object-fit: contain;
  width: auto;
}

.reco-printing-panel {
  margin-top: 10px;
}

.reco-price {
  color: var(--ink);
  font-size: 14px;
  margin: 2px 0 6px;
}

.scan-debug {
  display: grid;
  gap: 10px;
}

.scan-preview {
  margin: 0;
}

.scan-preview img {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: block;
  max-height: 220px;
  object-fit: contain;
  width: 100%;
}

.scan-preview figcaption,
.scan-debug summary,
.scan-debug pre {
  color: var(--ink-dim);
  font-size: 12px;
}

.scan-debug pre {
  white-space: pre-wrap;
}

.manual-scan-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  justify-content: stretch;
  margin-top: 6px;
  width: 100%;
}
.manual-scan-row .scan-debug {
  width: 100%;
}
.manual-scan-row .scan-preview img {
  max-height: min(44vh, 420px);
  width: 100%;
}
.manual-scan-actions {
  align-items: center;
  align-self: center;
  display: flex;
  justify-content: center;
  margin-top: 0;
}
.manual-scan-actions .scan-again {
  min-width: 112px;
}

.scan-candidates {
  display: grid;
  gap: 6px;
}

.scan-candidate {
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 8px;
}

.cap-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cap-list li {
  color: var(--ink);
  font-size: 13px;
  padding: 3px 0;
}

.reco-name {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
  /* Reserve room for up to two lines so long titles wrap instead of forcing
     horizontal overflow (which makes mobile browsers zoom the whole page out). */
  min-height: 2.5em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reco-conf {
  flex: 0 0 auto;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
}

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

  /* Collapsed single-column: surface the Camera Scanner first. */
  .scanner-panel {
    order: -1;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .button-row {
    display: grid;
  }
}

/* ============================================================
   MTG branding: original mana-wheel crest + fantasy display type
   ============================================================ */
.brand {
  align-items: center;
  display: flex;
  gap: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-tagline {
  color: var(--ink-dim);
  display: none;
  font-size: 13px;
  margin: 6px 0 0;
}
.brand-tagline .aud-line {
  margin: 2px 0;
  line-height: 1.35;
}
.aud-label {
  font-weight: 800;
  letter-spacing: 0.2px;
}
.aud-players {
  color: var(--accent);
}
.aud-collectors {
  color: #e7bc45;
}

.brand h1,
.panel h2 {
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
}

.crest {
  align-items: center;
  aspect-ratio: 63 / 88;
  border-radius: 9px;
  display: flex;
  flex: 0 0 auto;
  height: 118px;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: auto;
  padding: 0;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.crest-cardback {
  border-radius: 9px;
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

[data-brand="all"] .crest {
  background: transparent;
  box-shadow: none;
}

[data-brand="all"] .crest-cardback {
  object-fit: contain;
}

.crest-placeholder {
  align-items: center;
  color: #2c1f05;
  display: flex;
  font-family: "Cinzel", Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 900;
  inset: 0;
  justify-content: center;
  letter-spacing: 0.08em;
  position: absolute;
  text-shadow: 0 1px 0 rgba(255, 246, 207, 0.7);
}

.brand-symbol-text {
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.03em;
}

/* ============================================================
   Rich desktop / laptop dashboard (>= 1000px, non-touch)
   ============================================================ */
@media (min-width: 1000px) {
  [data-device="desktop"] .layout {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
    margin-inline: auto;
    max-width: 1680px;
    padding: 26px 34px 52px;
  }

  [data-device="desktop"] .work-tabs {
    display: flex;
    order: 0;
    grid-column: 1 / -1;
    gap: 4px;
    padding: 3px;
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 60;
    background: linear-gradient(180deg, rgba(20, 23, 34, 0.97), rgba(15, 17, 23, 0.97));
    border: 1px solid var(--line);
    border-radius: 10px;
    backdrop-filter: blur(6px);
  }
  [data-device="desktop"] .work-tab {
    flex: 0 0 auto;
    padding: 5px 18px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--accent);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  }
  [data-device="desktop"] .work-tab:hover:not(.is-active) {
    background: var(--accent-soft);
  }
  [data-device="desktop"] .work-tab.is-active {
    color: #3a2a05;
    border-color: #7a5713;
    background: linear-gradient(180deg, #fff6cf 0%, #f4d97e 15%, #e7bc45 37%, #c8912a 52%, #a9761d 62%, #f0cf76 82%, #c99a2f 100%);
    text-shadow: 0 1px 0 rgba(255, 248, 214, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 4px rgba(120, 80, 10, 0.5), 0 3px 10px rgba(0, 0, 0, 0.4);
  }
  [data-device="desktop"] .work-tab.is-locked {
    color: #7c8598;
  }
  [data-device="desktop"] .work-tab .tab-lock {
    margin-left: 4px;
    font-size: 0.8em;
  }

  [data-device="desktop"] .status-panel {
    order: 3;
    grid-column: 1 / -1;
  }
  [data-device="desktop"] .scanner-panel {
    order: 1;
    grid-column: 1 / -1;
  }
  [data-device="desktop"] .scanner-panel .camera-frame {
    max-width: 360px;
  }
  [data-device="desktop"] .inventory-panel {
    order: 2;
    grid-column: 1 / -1;
  }
  [data-device="desktop"] .deckbuilder-panel {
    order: 2;
    grid-column: 1 / -1;
  }
  [data-device="desktop"] .constructed-panel {
    order: 2;
    grid-column: 1 / -1;
  }
  [data-device="desktop"] .import-panel {
    order: 2;
    grid-column: 1 / -1;
  }
  [data-device="desktop"] .export-panel {
    order: 2;
    grid-column: 1 / -1;
  }

  [data-device="desktop"] .topbar {
    padding: 26px 40px;
  }

  [data-device="desktop"] h1 {
    font-size: 34px;
    letter-spacing: 1px;
  }

  [data-device="desktop"] .panel {
    border-radius: 16px;
    padding: 24px 26px;
  }

  [data-device="desktop"] .panel h2 {
    border-bottom: 1px solid var(--line);
    font-size: 19px;
    letter-spacing: 1.5px;
    padding-bottom: 12px;
    text-transform: uppercase;
  }

  [data-device="desktop"] .status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  [data-device="desktop"] .camera-frame {
    aspect-ratio: 63 / 88;
  }

  /* Deck output gets more room to breathe on wide screens */
  [data-device="desktop"] .deck-output {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* ============================================================
   Streamlined mobile / tablet (touch) experience
   ============================================================ */
[data-device="mobile"] .layout {
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 0 0 16px;
}

/* Scanner-first flow on phones */
[data-device="mobile"] .scanner-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  order: -1;
  padding: 0;
}

[data-device="mobile"] .scanner-panel h2 {
  display: none;
}

[data-device="mobile"] .scanner {
  gap: 0;
}
[data-device="mobile"] .work-tabs {
  display: flex;
  order: -2;
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 35;
  gap: 4px;
  padding: 3px 42px 3px 3px;
  margin: 0 0 -10px;
  background: linear-gradient(180deg, rgba(20, 23, 34, 0.96), rgba(15, 17, 23, 0.96));
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}
/* When the topbar is collapsed (the default once signed in) it has zero height,
   so reserve the notch/safe-area space on the layout itself; otherwise the
   work-tabs and camera slide up under the iPhone status bar. */
[data-device="mobile"].topbar-collapsed .layout {
  padding-top: env(safe-area-inset-top, 0px);
}
[data-device="mobile"] .work-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  padding: 5px 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 7px;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}
[data-device="mobile"] .work-tab.is-active {
  color: #3a2a05;
  background: linear-gradient(180deg, #fff6cf 0%, #f4d97e 15%, #e7bc45 37%, #c8912a 52%, #a9761d 62%, #f0cf76 82%, #c99a2f 100%);
  text-shadow: 0 1px 0 rgba(255, 248, 214, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 3px 10px rgba(0, 0, 0, 0.4);
}
[data-device="mobile"] .work-tab.is-locked {
  color: #7c8598;
}
[data-device="mobile"] .work-tab .tab-lock {
  margin-left: 3px;
  font-size: 0.8em;
}
[data-device="mobile"] .tab-hidden {
  display: none !important;
}
[data-device="mobile"] .commander-panel,
[data-device="mobile"] .deckbuilder-panel {
  order: 2;
}
[data-device="mobile"] .import-panel {
  order: 3;
}
[data-device="mobile"] .inventory-panel {
  order: 4;
}
[data-device="mobile"] .export-panel {
  order: 4;
}
[data-device="mobile"] .constructed-panel {
  order: 5;
}
[data-device="mobile"] .membership-panel {
  order: 6;
}
[data-device="mobile"] .status-panel {
  order: 8;
}

.deck-result-actions {
  grid-column: 1 / -1;
  margin: 18px 0 20px;
  padding: 16px 0;
  border-top: 1px solid rgba(104, 219, 232, 0.24);
  border-bottom: 1px solid rgba(104, 219, 232, 0.16);
}

.deck-save-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.deck-save-fields label {
  min-width: 0;
}

.deck-save-fields input {
  width: 100%;
}

[data-device="mobile"] .deck-save-fields {
  grid-template-columns: 1fr;
}

[data-device="mobile"] .deck-result-actions .button-row button {
  min-height: 44px;
}

[data-device="mobile"] .topbar {
  max-height: 260px;
  overflow: hidden;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  position: sticky;
  top: 0;
  /* Opaque so the sticky/expanding bar never shows content bleeding through. */
  background: #0c1119;
  transition: max-height 180ms ease, opacity 180ms ease, padding 180ms ease, border-color 180ms ease;
  z-index: 30;
}

/* When a menu is open, let the dropdown escape the topbar's clip. */
[data-device="mobile"].account-menu-open .topbar,
[data-device="mobile"].brand-menu-open .topbar {
  overflow: visible;
}

[data-device="mobile"].topbar-collapsed .topbar {
  border-bottom-color: transparent;
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  padding-top: 0;
  pointer-events: none;
}

[data-device="mobile"] .topbar-toggle {
  align-items: center;
  background: rgba(12, 18, 27, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  color: var(--ink);
  display: inline-flex;
  font-size: 18px;
  height: 28px;
  justify-content: center;
  min-height: 28px;
  line-height: 1;
  padding: 0;
  position: fixed;
  right: 10px;
  top: max(6px, env(safe-area-inset-top));
  width: 28px;
  z-index: 40;
}

[data-device="mobile"] .crest {
  height: 60px;
  width: auto;
}

[data-device="mobile"] h1 {
  font-size: 22px;
}

[data-device="mobile"] .wordmark {
  font-size: clamp(23px, 8vw, 32px);
}

[data-device="mobile"] .brand,
[data-device="mobile"] .brand-text {
  min-width: 0;
  max-width: 100%;
}

[data-device="mobile"] .eyebrow {
  max-width: calc(100vw - 64px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-device="mobile"] .status-grid {
  grid-template-columns: 1fr 1fr;
}

/* Bigger tap targets and full-width controls on touch devices */
[data-device="mobile"] button {
  min-height: 34px;
  padding: 6px 12px;
}
[data-device="mobile"] .button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
}
/* Sticky bottom action bar: pin the scanner controls to the thumb zone. The
   scanner panel only renders on the Inventory tab, so a fixed child here shows
   only there. Page gets bottom padding so nothing hides behind it. */
[data-device="mobile"] body {
  padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
}
[data-device="mobile"] .scanner-panel .button-row {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(15, 17, 23, 0.82), rgba(15, 17, 23, 0.98));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
}
[data-device="mobile"] .scanner-panel .button-row button {
  flex: 1 1 0;
  min-width: 0;
}
/* Float toasts above the action bar so they don't overlap it. */
[data-device="mobile"] .toast-host {
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}
[data-device="mobile"] .account-area {
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.signed-out-locked[data-device="mobile"] .topbar {
  align-items: center;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 2px 4px;
  justify-content: stretch;
  max-height: none;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 5px 8px;
}

.signed-out-locked[data-device="mobile"] .topbar-toggle {
  display: none;
}

.signed-out-locked[data-device="mobile"] .brand {
  align-items: center;
  display: contents;
  flex: 1 1 auto;
  gap: 0;
  justify-content: center;
  min-width: 0;
}

.signed-out-locked .brand-symbol-row {
  display: none;
}

.signed-out-locked .crest {
  background: transparent;
  border-radius: 16px;
  box-shadow: none;
  display: flex;
  grid-column: 1;
  grid-row: 1 / 3;
  height: 68px;
  justify-self: start;
  margin-left: 0;
  order: 1;
  width: 68px;
}

.signed-out-locked .crest-cardback {
  border-radius: 16px;
  object-fit: contain;
  padding: 0;
}

.signed-out-locked[data-device="mobile"] .brand-text {
  display: contents;
  min-width: 0;
}

.signed-out-locked[data-device="mobile"] .wordmark {
  flex: 0 1 auto;
  font-size: clamp(24px, 7.7vw, 34px);
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  margin-right: 0;
  max-width: 100%;
  order: 2;
}

.signed-out-locked .brand-tagline {
  display: flex;
  flex-direction: column;
}

.signed-out-locked[data-device="mobile"] .brand-tagline {
  flex: 1 0 100%;
  font-size: clamp(9px, 2.65vw, 11px);
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: stretch;
  line-height: 1.08;
  margin-top: 0;
  max-width: 100%;
  order: 3;
  width: 100%;
}

.signed-out-locked[data-device="mobile"] .brand-tagline .aud-line {
  margin: 0 0 2px;
  overflow: visible;
  white-space: normal;
}

.signed-out-locked[data-device="mobile"] .account-area {
  flex: 1 0 100%;
  grid-column: 2;
  grid-row: 2;
  justify-content: flex-end;
  margin-left: 0;
  order: 2;
  width: 100%;
}

.signed-out-locked[data-device="mobile"] .auth-signed-out {
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
}

.signed-out-locked[data-device="mobile"] .auth-signed-out button {
  align-items: center;
  display: inline-flex;
  font-size: 12px;
  height: 30px;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  padding: 0 9px;
  white-space: nowrap;
}
[data-device="mobile"] .brand-menu-wrap {
  flex: 0 0 auto;
}
[data-device="mobile"] #account-menu-btn,
[data-device="mobile"] .brand-pill {
  height: 28px;
  max-width: none;
  min-height: 0;
  overflow: hidden;
  padding: 0 10px;
  text-overflow: ellipsis;
}
[data-device="mobile"] .brand-menu {
  left: 50%;
  max-width: calc(100vw - 24px);
  min-width: 0;
  right: auto;
  transform: translateX(-50%);
  width: min(280px, calc(100vw - 24px));
}
[data-device="mobile"] .auth-signed-in {
  flex: 1 1 auto;
  justify-content: space-between;
  min-width: 0;
}
[data-device="mobile"] .account-right-controls {
  flex: 0 0 auto;
  margin-left: auto;
}
[data-device="mobile"] .account-email {
  display: inline-block;
  flex: 1 1 auto;
  max-width: clamp(52px, 18vw, 96px);
  min-width: 42px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-platform="android"][data-device="mobile"] {
  max-width: var(--app-vw);
  overflow-x: clip;
}
[data-platform="android"][data-device="mobile"] body {
  max-width: var(--app-vw);
  overflow-x: clip;
  width: var(--app-vw);
}
[data-platform="android"][data-device="mobile"] .topbar,
[data-platform="android"][data-device="mobile"] .layout,
[data-platform="android"][data-device="mobile"] .scanner-panel .button-row {
  max-width: var(--app-vw);
  width: var(--app-vw);
}
[data-platform="android"][data-device="mobile"] .layout {
  overflow-x: clip;
  padding-left: 10px;
  padding-right: 10px;
}
[data-platform="android"][data-device="mobile"] .topbar,
[data-platform="android"][data-device="mobile"] .panel,
[data-platform="android"][data-device="mobile"] .stack,
[data-platform="android"][data-device="mobile"] .inventory-controls,
[data-platform="android"][data-device="mobile"] .inventory-filterbar,
[data-platform="android"][data-device="mobile"] .scan-meta,
[data-platform="android"][data-device="mobile"] .status-grid,
[data-platform="android"][data-device="mobile"] .account-area,
[data-platform="android"][data-device="mobile"] .auth-signed-in,
[data-platform="android"][data-device="mobile"] .account-right-controls {
  min-width: 0;
  max-width: 100%;
}
[data-platform="android"][data-device="mobile"] .account-area {
  width: calc(100% - 2px);
}
[data-platform="android"][data-device="mobile"] .account-right-controls {
  gap: 6px;
}
[data-platform="android"][data-device="mobile"] #account-menu-btn,
[data-platform="android"][data-device="mobile"] .brand-pill {
  padding-left: 8px;
  padding-right: 8px;
}
[data-platform="android"][data-device="mobile"] .inventory-controls > *,
[data-platform="android"][data-device="mobile"] .inventory-filterbar > *,
[data-platform="android"][data-device="mobile"] .scan-meta > *,
[data-platform="android"][data-device="mobile"] input,
[data-platform="android"][data-device="mobile"] select,
[data-platform="android"][data-device="mobile"] button {
  min-width: 0;
  max-width: 100%;
}
[data-platform="android"][data-device="mobile"] .inventory-controls #inventory-search {
  flex: 1 1 100%;
}
[data-platform="android"][data-device="mobile"] .inventory-controls select {
  flex: 1 1 120px;
}
[data-platform="android"][data-device="mobile"] .scan-meta {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
[data-platform="android"][data-device="mobile"] body {
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
}
[data-platform="android"][data-device="mobile"] .scanner-panel .button-row {
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
[data-platform="android"][data-device="mobile"] .scanner-panel .button-row button {
  align-items: center;
  display: inline-flex;
  flex: 1 1 0;
  font-size: 13px;
  height: 34px;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  padding: 0 6px;
  white-space: nowrap;
}
[data-platform="android"][data-device="mobile"] .toast-host {
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
}
[data-platform="ios"][data-device="mobile"] {
  max-width: var(--app-vw);
  overflow-x: clip;
}
[data-platform="ios"][data-device="mobile"] body {
  max-width: var(--app-vw);
  overflow-x: clip;
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  width: var(--app-vw);
}
[data-platform="ios"][data-device="mobile"] .topbar,
[data-platform="ios"][data-device="mobile"] .layout,
[data-platform="ios"][data-device="mobile"] .scanner-panel .button-row {
  max-width: var(--app-vw);
  width: var(--app-vw);
}
[data-platform="ios"][data-device="mobile"] .layout {
  overflow-x: clip;
  padding-left: 10px;
  padding-right: 10px;
}
[data-platform="ios"][data-device="mobile"] .topbar,
[data-platform="ios"][data-device="mobile"] .panel,
[data-platform="ios"][data-device="mobile"] .stack,
[data-platform="ios"][data-device="mobile"] .scan-meta,
[data-platform="ios"][data-device="mobile"] .status-grid,
[data-platform="ios"][data-device="mobile"] .brand,
[data-platform="ios"][data-device="mobile"] .brand-text,
[data-platform="ios"][data-device="mobile"] .account-area,
[data-platform="ios"][data-device="mobile"] .auth-signed-in,
[data-platform="ios"][data-device="mobile"] .account-right-controls {
  min-width: 0;
  max-width: 100%;
}
[data-platform="ios"][data-device="mobile"] .scanner-panel .button-row {
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
[data-platform="ios"][data-device="mobile"] .scanner-panel .button-row button {
  align-items: center;
  display: inline-flex;
  flex: 1 1 0;
  font-size: 13px;
  height: 34px;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  padding: 0 6px;
  white-space: nowrap;
}
[data-platform="ios"][data-device="mobile"] .capture-queue {
  padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  touch-action: pan-y;
}
[data-platform="ios"][data-device="mobile"].scanner-controls-active .capture-queue {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
[data-platform="ios"][data-device="mobile"] .toast-host {
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
}
[data-device="mobile"] .camera-frame {
  aspect-ratio: 63 / 88;
  border: 0;
  border-radius: 12px;
  box-shadow: inset 0 -60px 90px rgba(0, 0, 0, 0.28);
  width: 100%;
  height: auto;
  max-width: 500px; /* fill phone width; cap on large formats (iPad) so it doesn't dominate */
  margin: 0 auto;
}
[data-device="desktop"] .camera-frame.is-sealed-mode,
[data-device="mobile"] .camera-frame.is-sealed-mode {
  aspect-ratio: 4 / 3;
}
[data-device="mobile"] .scan-square {
  display: block;
}
[data-device="mobile"] .scanner-controls,
[data-device="mobile"] .scanner-state,
[data-device="mobile"] #voice-state,
[data-device="mobile"] .voice-panel {
  margin-left: 16px;
  margin-right: 16px;
}
[data-device="mobile"] .scanner-controls {
  margin-top: 10px;
}
[data-device="mobile"].scanner-controls-active body {
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
}
[data-device="mobile"].scanner-controls-active .scanner-panel .button-row button.scanner-symbol-command {
  height: 56px;
  min-height: 56px;
  padding: 0;
}
[data-device="mobile"].scanner-controls-active .toast-host {
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
[data-device="mobile"] .scanner-stop-sign,
[data-device="mobile"] .scanner-camera-circle {
  height: 48px;
  width: 48px;
}
[data-device="mobile"] .scanner-camera-face {
  height: 42px;
  width: 42px;
}
[data-device="mobile"] .scan-meta {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}
[data-device="mobile"] .scan-meta.is-sealed-mode {
  grid-template-columns: minmax(0, 1fr);
}
[data-device="mobile"] .scan-meta.is-sealed-mode .sealed-mode-check {
  grid-column: 1;
  justify-self: end;
  margin-left: 0;
}
[data-device="mobile"] .scan-group-field {
  grid-column: 1;
}
[data-device="mobile"] .sealed-mode-check {
  grid-column: 2;
  justify-self: end;
}
[data-device="mobile"] .sealed-picker {
  grid-column: 1 / -1;
}
[data-device="mobile"] .scan-meta button,
[data-device="mobile"] .reco-actions button,
[data-device="mobile"] .inventory-share-form button,
[data-device="mobile"] .inventory-toolbar-actions button,
[data-device="mobile"] .inventory-filterbar button,
[data-device="mobile"] .inv-actions button {
  width: auto;
}
[data-device="mobile"] #recognition-output {
  border-radius: 0;
  margin: 0;
  padding: 14px 16px 16px;
}

[data-device="mobile"] .camera-frame.has-result .scanner-result {
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  padding: 16px;
}

[data-device="mobile"] .camera-frame.has-result .reco-art {
  justify-self: center;
  max-width: min(58vw, 220px);
}
[data-device="mobile"] .manual-scan-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
[data-device="mobile"] .manual-scan-row .scan-debug {
  width: 100%;
}
[data-device="mobile"] .manual-scan-row .scan-preview img {
  max-height: min(42vh, 360px);
}
[data-device="mobile"] .manual-scan-actions .scan-again {
  min-width: 96px;
}
[data-device="mobile"] .reco-art {
  max-width: 160px;
}

@media (max-width: 380px) {
  [data-device="mobile"] .manual-scan-row {
    grid-template-columns: 1fr;
  }
  [data-device="mobile"] .manual-scan-row .scan-debug {
    width: min(70vw, 190px);
  }
}

@supports not (height: 100dvh) {
  [data-device="mobile"] .camera-frame {
    height: min(82vh, 720px);
  }
}

/* ============================================================
   Inventory panel
   ============================================================ */
.add-to-inv {
  margin-top: 10px;
}

.reco-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.reco-actions .add-to-inv {
  margin-top: 0;
}

.inventory-add {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  margin-bottom: 12px;
}

.inventory-search-results {
  margin: 0 0 14px;
}

.inventory-search-results .inv-review {
  margin: 0;
}

.inv-pick.is-adding {
  opacity: 0.6;
  pointer-events: none;
}

.inv-pick.inv-pick-added {
  border-color: #2ec84a;
  box-shadow: 0 0 0 2px rgba(46, 200, 74, 0.45);
}

.inventory-add .field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.inventory-add .field input {
  width: 100%;
}

/* Clear (x) button pinned to the right inside the "find a card to add" box. */
.input-with-clear {
  position: relative;
  display: block;
  width: 100%;
}

/* display:block removes the inline-block baseline gap so the box height equals the
   input and the x centres (no transform: it would fight the :active press scale). */
.input-with-clear input {
  display: block;
  padding-right: 40px;
}

.input-clear {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 4px;
  margin-block: auto;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  font-size: 0;
}

/* Draw the x with two bars so it stays perfectly centred regardless of glyph metrics. */
.input-clear::before,
.input-clear::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.input-clear::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.input-clear::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.inventory-share-panel {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px;
}

.inventory-share-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.inventory-share-form .field,
.inventory-share-form .field input,
.inventory-share-form .field select {
  width: 100%;
}

.inventory-share-form > button[type="submit"] {
  align-self: center;
  margin-top: 4px;
  min-width: 160px;
}

.inventory-share-row {
  align-items: center;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-top: 8px;
}

.inventory-share-status {
  min-height: 1.3em;
}

.inventory-view-field select {
  width: 100%;
}

.field-cap {
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.inventory-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

/* Details toggle + compact grid (details-off) inventory view. */
.inv-details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-dim);
  cursor: pointer;
  user-select: none;
}

.inv-details-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* auto-fill keeps the columns fitting whatever width is available, so the grid
   reflows for portrait vs landscape without any JS. */
.inventory-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  align-items: start;
}

.inventory-list.grid-view #inv-sentinel {
  grid-column: 1 / -1;
}

.inv-grid-tile {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
}

.inv-grid-img {
  width: 100%;
  height: auto;
  aspect-ratio: 63 / 88;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.inv-grid-qty {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
}

.inv-grid-finish {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f7e08a, #d4af37, #f7e08a);
  color: #4a3a00;
}

/* Grid density slider (cards per row), shown to the right of Details in grid mode. */
.grid-density-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.grid-density {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.grid-density::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, var(--ink-dim) 0 1px, transparent 1px var(--tick-period, 20%)),
    var(--line);
}

.grid-density::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, var(--ink-dim) 0 1px, transparent 1px var(--tick-period, 20%)),
    var(--line);
}

.grid-density::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid #7a5713;
}

.grid-density::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid #7a5713;
}

.grid-density-val {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-dim);
  min-width: 12px;
  text-align: center;
}

/* Sealed-product picker. */
.sealed-results .sealed-result::before {
  content: none;
}

.sealed-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 100%;
}

.sealed-upc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.sealed-upc-row input {
  min-width: 0;
}

.sealed-upc-row button {
  min-height: 0;
  padding: 8px 12px;
  font-size: 12px;
}

.sealed-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.sealed-result {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  text-align: left;
  min-height: 66px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  box-shadow: none;
  cursor: pointer;
}

.sealed-result-thumb,
.sealed-active-thumb {
  display: block;
  flex: 0 0 44px;
  width: 44px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.035);
  object-fit: contain;
}

.sealed-result-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: contain;
}

.sealed-result-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.sealed-result:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  filter: none;
}

.sealed-result-name {
  max-width: 100%;
  font-weight: 700;
  font-size: 14px;
}

.sealed-result-meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink-dim);
}

.sealed-hint {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink-dim);
}

.sealed-active-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(201, 162, 75, 0.4);
  border-radius: 10px;
  background: var(--accent-soft);
}

.sealed-active-group {
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
}

.sealed-active-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}

.sealed-active .sealed-add-full,
.sealed-active .sealed-change {
  min-height: 0;
  padding: 3px 12px;
  font-size: 12px;
}

.sealed-active .sealed-add-full {
  border-radius: 999px;
}

.sealed-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid rgba(52, 199, 89, 0.45);
  border-radius: 10px;
  background: rgba(52, 199, 89, 0.12);
  color: var(--ink);
  font-size: 13px;
}

.sealed-summary > strong {
  color: #7fe098;
}

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

.sealed-summary-actions button {
  min-height: 0;
  padding: 3px 12px;
  font-size: 12px;
  border-radius: 999px;
}

.inventory-controls #inventory-search {
  flex: 1 1 160px;
  width: auto;
}

.inventory-controls select {
  flex: 0 0 auto;
  width: auto;
}

.inventory-controls #inventory-sort-dir {
  flex: 0 0 auto;
  padding: 8px 12px;
}

.inventory-controls .inventory-rename-group {
  flex: 0 0 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

[data-device="mobile"] .inventory-controls .inventory-rename-group {
  flex-basis: 44px;
  height: 44px;
  min-height: 44px;
}

.inventory-controls .inventory-remove-group {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
}

.inventory-filterbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.inventory-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

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

.filter-row .filter-field {
  flex: 0 0 auto;
  width: auto;
}

.filter-row .filter-value {
  align-items: center;
  display: inline-flex;
  flex: 1 1 auto;
  gap: 6px;
}

.filter-row .filter-value input[type="text"],
.filter-row .filter-value input[type="number"],
.filter-row .filter-value select {
  width: auto;
  flex: 1 1 120px;
}

.filter-colors {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.filter-color-opt {
  flex: 0 0 auto;
  gap: 3px;
}

.filter-color-opt .mana-icon {
  height: 18px;
  width: 18px;
}

.filter-remove {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
  padding: 4px 10px;
}

.inventory-toolbar {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

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

/* Link styled as a gold button (matches the gold set). */
.btn-link {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #7a5713;
  color: #3a2a05;
  cursor: pointer;
  display: inline-block;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 10px 16px;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 248, 214, 0.7);
  background: linear-gradient(180deg, #fff6cf 0%, #f4d97e 15%, #e7bc45 37%, #c8912a 52%, #a9761d 62%, #f0cf76 82%, #c99a2f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 5px rgba(120, 80, 10, 0.55), 0 8px 18px rgba(0, 0, 0, 0.4);
}

.btn-link:hover {
  filter: brightness(1.06) saturate(1.08);
}

/* Shiny green-gold variant — used for Refresh Prices. */
.btn-green {
  border-color: #1f6b2e;
  color: #06250f;
  text-shadow: 0 1px 0 rgba(220, 255, 214, 0.75);
  background: linear-gradient(180deg, #eaffd0 0%, #b9f47e 15%, #6fe745 37%, #2ec84a 52%, #1da95a 62%, #83f0a4 82%, #2fc96a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 5px rgba(10, 80, 30, 0.55), 0 8px 18px rgba(0, 0, 0, 0.4);
}

/* Analytics charts */
.analytics-breakdown-grid {
  display: grid;
  gap: 20px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.chart-panel {
  min-width: 0;
}

.chart-box {
  height: 280px;
  position: relative;
}

.chart-box.chart-wide {
  height: 340px;
}

[data-device="mobile"] .analytics-layout .panel {
  grid-column: 1 / -1 !important;
}

[data-device="mobile"] .analytics-breakdown-grid {
  grid-template-columns: 1fr;
}

[data-device="mobile"] .chart-box {
  height: 240px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

[data-device="mobile"] .chart-box.chart-wide {
  height: 280px;
}

[data-device="mobile"] .chart-box canvas {
  max-width: 100% !important;
}

.inventory-total {
  color: var(--ink);
  font-weight: 800;
}

.inventory-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Empty state + skeleton loaders */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 18px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}
.empty-state .empty-icon {
  width: 72px;
  height: 72px;
  opacity: 0.9;
  margin-bottom: 10px;
}
.empty-state h3 {
  margin: 4px 0 6px;
}
.empty-state .empty-cta {
  margin-top: 14px;
}
.inv-skeleton {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.14));
}
.sk-lines {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.sk {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 6px;
}
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: sk-shimmer 1.2s infinite;
}
.sk-thumb {
  width: 46px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 6px;
}
.sk-line { height: 12px; width: 100%; }
.sk-line-lg { height: 16px; width: 62%; }
.sk-line-sm { width: 40%; }
@keyframes sk-shimmer {
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .sk::after { animation: none; }
}

.inv-item {
  align-items: stretch;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.16));
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.inv-item:hover {
  border-color: var(--accent);
}

.inv-title {
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.inv-body {
  align-items: flex-start;
  display: flex;
  gap: 12px;
}

.inv-thumb,
.deck-market-art,
.deck-market-image,
.deck-market-image-placeholder,
.deck-owned-thumb,
.deck-owned-thumb-placeholder {
  aspect-ratio: 63 / 88;
  border-radius: 6px;
  height: 150px;
  width: auto;
}

.inv-thumb {
  align-self: flex-start;
  flex: 0 0 auto;
  object-fit: cover;
}

.inv-info {
  align-items: flex-start;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
}

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

.inv-actions button {
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  min-height: 0;
}

.inv-name {
  color: var(--ink);
  font-weight: 800;
}

.inv-qty {
  color: var(--accent);
}

.copy-pill,
.tag-pill {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--ink-dim);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  padding: 1px 8px;
}
.tag-pill {
  background: rgba(91, 208, 255, 0.14);
  border-color: rgba(91, 208, 255, 0.45);
  color: #9be4ff;
}
.tag-empty {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #7d8797;
}

.inv-meta {
  font-size: 12px;
  margin: 2px 0;
}

.inv-links a {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}

.inv-links a:hover {
  text-decoration: underline;
}

button.ghost.inv-remove {
  background:
    linear-gradient(
      180deg,
      #f5d98a 0%,
      #e0a24a 18%,
      #c65a3c 45%,
      #a83428 60%,
      #e0a24a 82%,
      #b64a30 100%
    );
  border-color: #6e2418;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -2px 5px rgba(90, 25, 10, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.32);
  color: #2a0d08;
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.1;
  margin-left: auto;
  padding: 4px 14px;
  text-shadow: 0 1px 0 rgba(255, 235, 200, 0.55);
  width: auto;
}

button.ghost.inv-remove:hover:not(:disabled) {
  border-color: #8f2f27;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -2px 5px rgba(90, 25, 10, 0.6),
    0 0 0 2px rgba(198, 90, 60, 0.22),
    0 5px 12px rgba(0, 0, 0, 0.36);
}

.inv-finishes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.inv-finish-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 6px;
}

.inv-finish-label {
  color: var(--ink);
  font-weight: 700;
}

.foil-word {
  background: linear-gradient(105deg, #fff6cf 0%, #ff67bd 18%, #6ee7ff 36%, #d7ff6e 54%, #b692ff 72%, #fff6cf 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(125, 211, 252, 0.32), 0 0 4px rgba(255, 246, 207, 0.3);
  animation: foil-word-sheen 2.8s ease-in-out infinite;
}

@keyframes foil-word-sheen {
  0% { background-position: 0% 50%; filter: brightness(1); }
  45% { background-position: 100% 50%; filter: brightness(1.35); }
  100% { background-position: 0% 50%; filter: brightness(1); }
}

/* Detailed view auto-fits into columns when there's width (landscape / tablet);
   a narrow portrait phone is under one 300px track so it stays single-column. */
[data-device="mobile"] .inventory-list:not(.grid-view) {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
[data-device="mobile"] .inventory-add {
  grid-template-columns: minmax(0, 1fr) auto;
}

/* Inventory pips, group badge, and generic mana symbol */
.inv-pips {
  margin: 1px 0;
}

.inv-group {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  padding: 1px 8px;
}

.inv-owner {
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 999px;
  color: #b9bcff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 8px;
}

.inv-status {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 8px;
  white-space: nowrap;
}

.inv-status.selling {
  background: rgba(255, 179, 0, 0.16);
  border: 1px solid rgba(255, 179, 0, 0.55);
  color: #ffcf6b;
}

.inv-status.sold {
  background: rgba(52, 199, 89, 0.16);
  border: 1px solid rgba(52, 199, 89, 0.55);
  color: #7fe098;
}

.inv-status.wanted {
  background: rgba(69, 216, 255, 0.16);
  border: 1px solid rgba(69, 216, 255, 0.5);
  color: #8be9ff;
}

.inv-status.ordered {
  background: rgba(182, 146, 255, 0.16);
  border: 1px solid rgba(182, 146, 255, 0.5);
  color: #cdb8ff;
}

.inv-status.target {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ink-dim);
}

.inv-status.deal {
  background: rgba(52, 199, 89, 0.22);
  border: 1px solid rgba(52, 199, 89, 0.7);
  color: #8bf0a4;
}

/* Find-a-card search result: the main add button + a star wishlist button. */
.inv-pick-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.inv-pick-row .inv-pick {
  flex: 1 1 auto;
  min-width: 0;
}

.inv-pick-wish {
  flex: 0 0 auto;
  align-items: center;
  align-self: center;
  appearance: none;
  background: rgba(69, 216, 255, 0.1);
  border: 1px solid rgba(69, 216, 255, 0.4);
  border-radius: 10px;
  color: #8be9ff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  line-height: 1;
  padding: 8px 10px;
}

.wish-star {
  font-size: 20px;
  line-height: 1;
}

.wish-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.inv-pick-wish:hover {
  background: rgba(69, 216, 255, 0.2);
}

/* Searched-card detail drill-down (reuses the card modal shell). */
.ref-finish-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.ref-finish {
  opacity: 0.6;
  padding: 6px 16px;
}

.ref-finish.is-active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--accent-soft), 0 8px 18px rgba(0, 0, 0, 0.4);
}

.ref-add-note {
  font-size: 12px;
  margin: 8px 0 0;
}

.ref-add-controls {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 0 4px;
}

.ref-qty-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ref-qty-stepper {
  align-items: center;
  display: flex;
  gap: 6px;
}

.ref-qty-stepper button {
  min-width: 36px;
  padding: 6px 0;
}

.ref-qty-val {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
}

.ref-target-field {
  display: flex;
  flex: 1 1 140px;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.ref-target-field input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

.ref-noimg {
  align-items: center;
  aspect-ratio: 5 / 7;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  color: var(--ink-dim);
  display: flex;
  justify-content: center;
}

.inv-pick-row.is-adding,
.inv-pick-wish.is-adding {
  opacity: 0.55;
  pointer-events: none;
}

.inv-buy {
  text-decoration: none;
}

.pl-delta {
  font-weight: 800;
}

.pl-up {
  color: #7fe098;
}

.pl-down {
  color: #ff8a8a;
}

.inv-added {
  font-size: 11px;
}

/* Money-spent recorder + ledger (analytics page). */
.spend-recorder {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.spend-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.spend-preset {
  font-size: 13px;
  padding: 8px 12px;
}

.spend-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.spend-form input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

.spend-form #spend-label {
  flex: 1 1 200px;
  min-width: 150px;
}

.spend-form #spend-amount,
.spend-form #spend-qty {
  width: 92px;
}

.spend-ledger {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
}

.spend-total {
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.spend-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 6px 2px;
}

.spend-when {
  color: var(--ink-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.spend-what {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spend-cat {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  margin-left: 8px;
  padding: 1px 8px;
}

.spend-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.spend-del {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  text-shadow: none;
}

.spend-del:hover:not(:disabled) {
  color: #ff8a8a;
}

/* Android opens Analytics from the native app in a browser surface. Keep its
   command controls aligned with the native 30-32dp compact button rhythm. */
[data-platform="android"][data-device="mobile"] body.analytics-page .account-area {
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

[data-platform="android"][data-device="mobile"] body.analytics-page .account-area button,
[data-platform="android"][data-device="mobile"] body.analytics-page .account-area .btn-link,
[data-platform="android"][data-device="mobile"] body.analytics-page .inventory-controls button,
[data-platform="android"][data-device="mobile"] body.analytics-page .spend-presets button,
[data-platform="android"][data-device="mobile"] body.analytics-page .spend-form button {
  align-items: center;
  display: inline-flex;
  flex: 0 1 auto;
  font-size: 12px;
  height: 32px;
  justify-content: center;
  line-height: 1;
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
  width: auto;
}

[data-platform="android"][data-device="mobile"] body.analytics-page .account-area button,
[data-platform="android"][data-device="mobile"] body.analytics-page .account-area .btn-link {
  font-size: 11px;
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
}

[data-platform="android"][data-device="mobile"] body.analytics-page button.ghost {
  background: linear-gradient(180deg, #2f3a49 0%, #232d3a 52%, #151d27 100%);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 -2px 4px rgba(0, 0, 0, 0.38);
  color: var(--ink);
}

[data-platform="android"][data-device="mobile"] body.analytics-page .spend-del {
  background: linear-gradient(180deg, #f5d98a 0%, #c65a3c 45%, #8f2f27 100%);
  border: 1px solid #6e2418;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -2px 4px rgba(90, 25, 10, 0.45);
  color: #2a0d08;
  flex: 0 0 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.inventory-share-filters {
  display: grid;
  gap: 8px;
  margin: 6px 0;
}

.checkbox-dropdown-field {
  position: relative;
}

.checkbox-dropdown-toggle {
  width: 100%;
  min-height: 38px;
  padding: 8px 34px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkbox-dropdown-toggle::after {
  content: "▾";
  position: absolute;
  right: 12px;
  color: var(--muted);
}

.checkbox-dropdown-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1020;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.checkbox-dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.checkbox-dropdown-option:hover {
  background: rgba(99, 102, 241, 0.18);
}

.checkbox-dropdown-empty {
  margin: 4px 6px;
  font-size: 12px;
}

.inventory-share-colors {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.inventory-share-scope {
  font-size: 12px;
}

.mana-generic {
  background: radial-gradient(circle at 30% 25%, #d8d2c4, #a49c88);
  color: #201a12;
}

/* Card detail modal */
.card-detail {
  max-width: 900px;
}

.card-detail-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(220px, 320px) 1fr;
}

.card-faces {
  display: grid;
  gap: 10px;
}

.card-detail-copy-frame {
  position: relative;
  width: 100%;
}

.copy-nav {
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  display: inline-flex;
  font-size: 26px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  line-height: 1;
  min-height: 42px;
  padding: 0;
  position: absolute;
  text-shadow: none;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  z-index: 3;
}
.copy-nav-prev { left: 8px; }
.copy-nav-next { right: 8px; }
.copy-nav:disabled {
  display: none;
}

.copy-tag-editor {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}
.copy-tag-row {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  position: relative;
  width: 100%;
}
.copy-tag-row input {
  flex: 1 1 auto;
  min-width: 0;
}
.detail-copy-tag-menu {
  left: 32px;
  min-width: min(260px, calc(100% - 32px));
}

.card-face-img {
  border-radius: 12px;
  width: 100%;
}

/* Foil view: holographic sheen over the card art. */
.card-detail-art {
  position: relative;
}

.card-detail-art.is-foil::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  mix-blend-mode: color-dodge;
  opacity: 0.5;
  background:
    linear-gradient(115deg, transparent 20%, rgba(255, 120, 180, 0.55) 35%, rgba(120, 220, 255, 0.55) 50%, rgba(180, 255, 140, 0.55) 65%, transparent 80%),
    linear-gradient(245deg, transparent 30%, rgba(255, 235, 130, 0.4) 50%, transparent 70%);
  background-size: 250% 250%, 200% 200%;
  animation: foil-shift 5s ease-in-out infinite;
}

@keyframes foil-shift {
  0% { background-position: 0% 50%, 100% 0%; }
  50% { background-position: 100% 50%, 0% 100%; }
  100% { background-position: 0% 50%, 100% 0%; }
}

/* Foil / Standard toggle under the card art. */
.finish-switch {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.finish-opt {
  background: linear-gradient(180deg, #2f3a49, #232d3a);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  flex: 1 1 0;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  text-shadow: none;
  box-shadow: none;
}

.finish-opt::before {
  content: none;
}

.finish-opt.active {
  background: linear-gradient(180deg, #fff6cf, #e7bc45 52%, #c8912a 63%, #f0cf76 82%, #c99a2f);
  border-color: #7a5713;
  color: #3a2a05;
  text-shadow: 0 1px 0 rgba(255, 248, 214, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -2px 4px rgba(120, 80, 10, 0.5);
}

.card-detail-info h3 {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-family: "Cinzel", Georgia, serif;
  gap: 8px;
  margin: 0 0 4px;
}

.card-type {
  margin: 0 0 10px;
}

.oracle {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--ink);
  line-height: 1.5;
  margin: 0 0 12px;
  padding: 10px 12px;
}

.face-block {
  margin-bottom: 12px;
}

.face-block h4 {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 0 0 4px;
}

.detail-row {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 6px 0;
}

.detail-row > span:first-child {
  color: var(--ink-dim);
  font-weight: 700;
}

.detail-price-history {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  margin: 8px 0 0;
  padding: 10px 0 12px;
}

.price-history-head {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.price-history-head > span:first-child {
  color: var(--ink-dim);
  font-weight: 800;
}

.price-history-summary {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.price-history-summary.is-up { color: #70d89a; }
.price-history-summary.is-down { color: #f08b7c; }

.price-history-status {
  margin: 8px 0 0;
  min-height: 20px;
}

.price-history-chart {
  height: 180px;
  margin-top: 8px;
  position: relative;
  width: 100%;
}

.price-history-chart canvas {
  height: 100% !important;
  width: 100% !important;
}

.price-history-source {
  font-size: 11px;
  line-height: 1.4;
  margin: 7px 0 0;
}

.price-history-source a {
  color: var(--accent);
}

.detail-set-value {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 12px;
  justify-content: flex-end;
  min-width: 0;
}

.detail-set-copy {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.detail-set-value .set-symbol {
  flex: 0 0 auto;
  margin-left: 0;
}

.group-edit {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(220px, 100%);
}

.detail-group-block {
  align-items: start;
}

.detail-group-row {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  max-width: 260px;
  position: relative;
  width: 100%;
}

.detail-group-row input {
  flex: 1 1 auto;
  min-width: 0;
  width: 150px;
}

.detail-group-menu {
  left: 32px;
  min-width: min(260px, calc(100% - 32px));
}

.group-edit > button,
.detail-save-group {
  font-size: 12px;
  padding: 6px 10px;
}

.detail-links {
  margin: 12px 0;
}

.detail-links a {
  color: var(--accent);
  text-decoration: none;
}

button.danger {
  background: linear-gradient(180deg, #c0453a, #8f2f27);
  color: #fff;
}

/* Per-finish quantity steppers in the card detail modal. */
.qty-stepper {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.qty-stepper .qty-val {
  color: var(--ink);
  font-weight: 800;
  min-width: 18px;
  text-align: center;
}

.qty-btn {
  border-radius: 8px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  padding: 4px 10px;
}

/* Smaller red-gold "Remove from inventory" button that matches the gold set. */
button.detail-remove {
  align-self: flex-start;
  background:
    linear-gradient(
      180deg,
      #f5d98a 0%,
      #e0a24a 18%,
      #c65a3c 45%,
      #a83428 60%,
      #e0a24a 82%,
      #b64a30 100%
    );
  border: 1px solid #6e2418;
  color: #2a0d08;
  font-size: 12px;
  margin-top: 12px;
  padding: 7px 16px;
  text-shadow: 0 1px 0 rgba(255, 235, 200, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -2px 5px rgba(90, 25, 10, 0.55),
    0 8px 18px rgba(0, 0, 0, 0.4);
}

/* Detail modal action bar: keep the single Save pinned to the bottom-right. */
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.detail-actions button.detail-remove {
  margin-left: auto;
  margin-top: 0;
}

/* ===== AI condition grading ===== */
.cond-badge {
  display: inline-block;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 6px;
  color: #06210f;
  vertical-align: middle;
}
.cond-badge.cond-nm { background: linear-gradient(180deg, #8affc0, #2ec86a); }
.cond-badge.cond-lp { background: linear-gradient(180deg, #d6f79a, #a7d84a); }
.cond-badge.cond-mp { background: linear-gradient(180deg, #ffe08a, #f4c145); }
.cond-badge.cond-hp { background: linear-gradient(180deg, #ffbe8a, #f08a45); color: #2a1405; }
.cond-badge.cond-dmg { background: linear-gradient(180deg, #ff9a8a, #e0503a); color: #2a0805; }
.cond-badge.cond-cert {
  background: linear-gradient(180deg, #fff6cf, #e7bc45);
  color: #3a2a05;
  border: 1px solid #7a5713;
}

.detail-grade {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.detail-grade-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.detail-grade-head .grade-title {
  font-weight: 800;
  letter-spacing: 0.3px;
}
.grade-cond-label {
  margin: 2px 0 8px;
  font-size: 0.85rem;
}
.grade-bar {
  display: grid;
  grid-template-columns: 84px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.grade-bar-l {
  font-size: 0.78rem;
  color: var(--ink-dim);
}
.grade-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.grade-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f08a45, #ffe08a 55%, #2ec86a);
}
.grade-bar-v {
  font-size: 0.78rem;
  font-weight: 700;
  text-align: right;
}
.grade-defects {
  color: #ffb37a;
  font-size: 0.82rem;
  margin: 6px 0 2px;
}
.grade-notes {
  font-size: 0.82rem;
  margin: 4px 0;
}
.grade-suggest {
  margin: 8px 0 2px;
  font-size: 0.9rem;
}
.grade-review {
  font-size: 0.8rem;
  color: #ffd37a;
}
.grade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.grade-capture {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.grade-file-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--ink-dim);
}
.grade-thumbs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.grade-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 89px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.grade-cert {
  margin-top: 10px;
  font-size: 0.85rem;
}
.grade-cert-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.grade-cert-fields input {
  flex: 1 1 120px;
}

/* Sell channel recommendation */
.reco-chip {
  display: inline-block;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
  padding: 2px 9px;
  border-radius: 999px;
  color: #0b0f14;
}
.reco-chip.reco-tcg { background: linear-gradient(180deg, #8fd0ff, #3a86e0); color: #06182e; }
.reco-chip.reco-ebay { background: linear-gradient(180deg, #ffe08a, #f4c145); color: #2a2005; }
.reco-chip.reco-hold { background: rgba(255, 255, 255, 0.14); color: var(--ink); }
.reco-nets {
  font-size: 0.82rem;
  margin: 6px 0 0;
}

.detail-save-all {
  margin-left: 32px;
  font-weight: 800;
  padding: 8px 22px;
  width: min(228px, calc(100% - 32px));
}

.detail-save-all:disabled {
  opacity: 0.45;
  cursor: default;
}

  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-check {
  align-items: center;
  display: flex;
  gap: 4px;
  text-transform: none;
  font-weight: 700;
}

.color-check input {
  width: auto;
}

.inline-check {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
  text-transform: none;
}

.inline-check input {
  width: auto;
}

.import-destination {
  border: 0;
  margin: 0 0 16px;
  padding: 0;
}

.import-destination legend {
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.import-destination-options {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 420px;
  padding: 3px;
}

.import-destination-options label {
  cursor: pointer;
  display: block;
  min-width: 0;
  position: relative;
}

.import-destination-options input {
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.import-destination-options span {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--ink-dim);
  display: flex;
  font-size: 13px;
  font-weight: 850;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  text-align: center;
  text-transform: none;
}

.import-destination-options input:checked + span {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 72%, white);
  color: #071014;
}

.import-destination-options input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.import-file-source {
  display: grid;
  gap: 6px;
}

.import-file-input {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.import-file-drop {
  align-items: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed color-mix(in srgb, var(--accent) 52%, var(--line));
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  justify-content: center;
  min-height: 70px;
  padding: 13px 16px;
  text-align: center;
  text-transform: none;
}

.import-file-drop strong {
  color: var(--ink);
  font-size: 14px;
}

.import-file-drop span,
.import-file-state {
  color: var(--ink-dim);
  font-size: 11px;
}

.import-file-drop:hover,
.import-file-input:focus-visible + .import-file-drop,
.import-file-drop:focus-visible,
.import-file-drop.is-dragging {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}

.import-file-state {
  min-height: 16px;
  margin: 0;
  overflow-wrap: anywhere;
}

.import-improve {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.import-improve label {
  flex: 1 1 240px;
}

.saved-deck-library {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.saved-deck-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.saved-deck-actions {
  margin-top: 10px;
}

.saved-deck-actions button {
  min-height: 32px;
}

.import-deck-meta,
.deck-inventory-heading,
.deck-owned-line,
.deck-group-move {
  align-items: center;
  display: flex;
}

.import-deck-meta,
.deck-inventory-heading {
  justify-content: space-between;
}

.import-deck-meta {
  border-bottom: 1px solid var(--line);
  gap: 16px;
  padding-bottom: 12px;
}

.import-deck-meta p {
  margin: 0;
}

.import-deck-colors {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}

.import-deck-colors > span:first-child {
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.group-import-destination {
  display: grid;
  gap: 2px;
  min-width: 120px;
  text-align: right;
}

.group-import-destination span {
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.group-import-destination strong {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.group-import-error {
  background: color-mix(in srgb, #d45c55 13%, transparent);
  border-left: 3px solid #d45c55;
  color: var(--ink);
  padding: 10px 12px;
}

.group-import-review {
  border-top: 1px solid var(--line);
  max-height: 420px;
  overflow: auto;
}

.group-import-review-row {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px 16px;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, auto);
  padding: 9px 2px;
}

.group-import-review-row strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.group-import-review-row span {
  color: var(--ink-dim);
  font-size: 12px;
  text-align: right;
}

@media (max-width: 560px) {
  .import-destination-options {
    max-width: none;
  }

  .group-import-review-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .group-import-review-row span {
    text-align: left;
  }
}

.deck-inventory-section {
  margin-top: 18px;
}

.deck-inventory-heading {
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.deck-inventory-heading h3 {
  font-size: 16px;
  margin: 0;
}

.deck-inventory-heading > span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: right;
}

.deck-inventory-filters {
  align-items: end;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto auto;
  padding: 10px 0;
}

.deck-inventory-filter {
  gap: 4px;
  min-width: 0;
}

.deck-inventory-filter > span {
  font-size: 10px;
}

.deck-inventory-filter select {
  min-height: 44px;
  padding: 8px 28px 8px 9px;
}

.deck-inventory-filter-clear {
  min-height: 44px;
  padding: 8px 12px;
}

.deck-inventory-filter-count {
  align-self: center;
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 800;
  min-width: 88px;
  text-align: right;
}

.deck-inventory-list {
  border-top: 1px solid var(--line);
}

.deck-inventory-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(235px, 0.9fr) minmax(180px, 0.7fr) minmax(280px, 1.1fr);
  padding: 12px 0 12px 12px;
}

.deck-inventory-row.is-complete {
  border-left: 3px solid #46d39a;
}

.deck-inventory-row.is-partial {
  border-left: 3px solid #e6b94f;
}

.deck-inventory-row.is-missing {
  border-left: 3px solid #d45c55;
}

.deck-card-requirement,
.deck-owned-place {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.deck-card-requirement strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.deck-card-taxonomy {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.deck-card-taxonomy > span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
}

.deck-inventory-empty {
  margin: 0;
  padding: 18px 2px;
}

.deck-card-name {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  line-height: 1.35;
  min-height: 32px;
  overflow-wrap: anywhere;
  padding: 0;
  text-align: left;
  text-shadow: none;
}

.deck-card-name::before,
.deck-market-art::before,
.deck-owned-view::before {
  content: none;
}

.deck-card-name.deck-card-view:hover,
.deck-card-name.deck-card-view:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.deck-card-name-static {
  display: block;
}

.deck-card-requirement span,
.deck-owned-place span,
.deck-no-owned,
.deck-group-move-state {
  color: var(--ink-dim);
  font-size: 12px;
}

.deck-market-card {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
}

.deck-market-art,
.deck-market-image,
.deck-market-image-placeholder,
.deck-owned-thumb,
.deck-owned-thumb-placeholder {
  display: block;
}

.deck-market-art {
  background: var(--panel-strong);
  border: 1px solid transparent;
  box-shadow: none;
  cursor: zoom-in;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  text-shadow: none;
}

.deck-market-art:hover,
.deck-market-art:focus-visible {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

.deck-market-image,
.deck-owned-thumb {
  object-fit: cover;
}

.deck-owned-thumb-placeholder {
  background: var(--panel-strong);
}

.deck-market-image-placeholder {
  animation: deck-market-loading 1.4s ease-in-out infinite;
  background: linear-gradient(110deg, var(--panel-strong) 25%, var(--line) 42%, var(--panel-strong) 58%);
  background-size: 220% 100%;
}

@keyframes deck-market-loading {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .deck-market-image-placeholder { animation: none; }
}

.deck-market-details {
  align-content: start;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.deck-market-price {
  color: var(--ink);
  font-size: 13px;
}

.deck-market-meta,
.deck-market-stock,
.deck-market-state {
  color: var(--ink-dim);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.deck-market-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: 3px;
}

.deck-buy-link,
.deck-market-link {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.deck-buy-link:hover,
.deck-buy-link:focus-visible,
.deck-market-link:hover,
.deck-market-link:focus-visible {
  text-decoration: underline;
}

.deck-printings-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  justify-self: start;
  text-decoration: none;
}

.deck-printings-link:hover,
.deck-printings-link:focus-visible {
  text-decoration: underline;
}

.deck-owned-lines {
  display: grid;
  gap: 8px;
}

.deck-owned-line {
  align-items: flex-start;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.deck-owned-content {
  display: grid;
  flex: 1 1 auto;
  gap: 8px;
  min-width: 0;
}

.deck-owned-place {
  flex: 1 1 auto;
}

.deck-owned-actions {
  display: grid;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.deck-owned-view {
  align-items: start;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--accent);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 4px;
  justify-items: start;
  justify-self: start;
  min-height: 0;
  padding: 0;
  text-shadow: none;
}

.deck-owned-view-label {
  line-height: 1.35;
}

.deck-owned-view:hover,
.deck-owned-view:focus-visible {
  text-decoration: underline;
}

.deck-group-move {
  flex: 0 1 390px;
  gap: 7px;
  justify-content: flex-end;
  min-width: 0;
}

.deck-group-target {
  height: 36px;
  min-width: 120px;
  padding: 7px 9px;
}

.deck-group-move-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
}

.deck-group-move-state {
  flex: 0 0 auto;
}

.deck-no-owned {
  margin: 0;
}

[data-device="mobile"] .import-deck-meta,
[data-device="mobile"] .deck-group-move {
  align-items: stretch;
  flex-direction: column;
}

[data-device="mobile"] .import-deck-colors {
  align-self: flex-start;
}

[data-device="mobile"] .deck-inventory-row {
  grid-template-columns: minmax(0, 1fr);
}

[data-device="mobile"] .deck-inventory-filters {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

[data-device="mobile"] .deck-inventory-filter-clear,
[data-device="mobile"] .deck-inventory-filter-count {
  width: 100%;
}

[data-device="mobile"] .deck-inventory-filter-clear {
  min-height: 44px;
}

[data-device="mobile"] .deck-inventory-filter-count {
  text-align: right;
}

[data-device="mobile"] .deck-market-card {
  grid-template-columns: auto minmax(0, 1fr);
}

[data-device="mobile"] .deck-group-move {
  flex-basis: auto;
}

[data-device="mobile"] .deck-group-move-button {
  width: 100%;
}

[data-device="mobile"] .deck-card-name,
[data-device="mobile"] .deck-owned-view {
  min-height: 44px;
}

[data-device="mobile"] .deck-buy-link,
[data-device="mobile"] .deck-market-link {
  align-items: center;
  display: inline-flex;
  min-height: 44px;
}

[data-device="mobile"] .deck-owned-actions {
  flex-basis: auto;
  width: 100%;
}

[data-device="mobile"] .deck-owned-view {
  width: auto;
}

/* Remove confirmation dialog */
.confirm-card {
  max-width: 420px;
  text-align: center;
}

.confirm-modal-bottom {
  align-items: flex-end;
}

.confirm-modal-bottom .confirm-card {
  margin-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  width: min(420px, 100%);
}

[data-device="desktop"] .confirm-modal-bottom .confirm-card {
  margin-bottom: 20px;
}

.confirm-skip {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 14px 0;
  text-transform: none;
  font-weight: 600;
}

.confirm-skip input {
  width: auto;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

[data-device="mobile"] .card-detail-grid {
  grid-template-columns: 1fr;
}

/* Full-screen post-scan decision surface. Keep this after device rules so the
   review cannot collapse back into the camera frame on iOS or mobile web. */
html.scan-review-open,
html.scan-review-open body {
  overflow: hidden;
}

html #recognition-output.scan-review-overlay {
  align-items: center;
  background: linear-gradient(180deg, #111925 0%, #060b11 42%, #03070b 100%);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100dvh;
  inset: 0;
  margin: 0;
  max-height: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  position: fixed;
  width: 100vw;
  z-index: 70;
  -webkit-overflow-scrolling: touch;
}

html #recognition-output.scan-review-overlay > .reco-art-zoom {
  flex: 0 0 auto;
  margin: 0 auto 4px;
  max-width: none;
  width: min(82vw, 340px);
}

html #recognition-output.scan-review-overlay .reco-art {
  aspect-ratio: 63 / 88;
  max-width: none;
  object-fit: contain;
  width: 100%;
}

.scan-review-overlay > .reco-top,
.scan-review-overlay > .reco-price,
.scan-review-overlay > .muted,
.scan-review-overlay > .reco-actions,
.scan-review-overlay > .reco-printing-panel,
.scan-review-overlay > .reco-review,
.scan-review-overlay > .manual-scan-row {
  max-width: 620px;
  width: 100%;
}

.scan-review-overlay .reco-top {
  align-items: center;
  margin: 0;
}

.scan-review-overlay .reco-price,
.scan-review-overlay > .muted {
  margin: 0;
}

.scan-review-overlay .reco-finish {
  flex: 0 0 auto;
  margin: 4px auto;
  width: 190px;
}

.scan-review-overlay .reco-finish .finish-opt {
  font-size: 0.72rem;
  min-height: 32px;
  padding: 4px 12px;
}

.scan-review-overlay .reco-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 4px 0 0;
  max-width: 460px;
}

.scan-review-overlay .reco-actions button {
  min-height: 36px;
  padding: 6px 10px;
  width: 100%;
}

.scan-review-overlay .stop-review-camera {
  grid-column: 1 / -1;
}

.scan-review-overlay .reco-printing-panel {
  margin-top: 4px;
}

.scan-candidate-gallery {
  background: linear-gradient(180deg, #101823 0%, #04080d 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: 100dvh;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  position: fixed;
  width: 100vw;
  z-index: 90;
}

.scan-gallery-topbar {
  align-items: center;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  min-height: 40px;
}

.scan-gallery-count {
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 800;
  grid-column: 2;
  justify-self: center;
}

.scan-gallery-close {
  align-items: center;
  background: rgba(10, 15, 22, 0.88);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: none;
  color: var(--ink);
  display: flex;
  font-size: 24px;
  grid-column: 3;
  height: 36px;
  justify-content: center;
  min-width: 36px;
  padding: 0;
  width: 36px;
}

.scan-gallery-stage {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}

.scan-gallery-image {
  aspect-ratio: 63 / 88;
  height: auto;
  justify-self: center;
  max-height: calc(100dvh - 170px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-width: 100%;
  object-fit: contain;
  width: min(100%, 460px);
}

.scan-gallery-nav {
  align-items: center;
  background: rgba(10, 15, 22, 0.88);
  border: 1px solid rgba(201, 162, 75, 0.48);
  border-radius: 50%;
  box-shadow: none;
  color: var(--accent);
  display: flex;
  font-size: 28px;
  height: 36px;
  justify-content: center;
  min-width: 36px;
  padding: 0 0 3px;
  position: absolute;
  top: 0;
  bottom: 0;
  margin-block: auto;
  width: 36px;
  z-index: 1;
}

.scan-gallery-prev {
  left: 4px;
}

.scan-gallery-next {
  right: 4px;
}

.scan-gallery-meta {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  min-height: 42px;
  text-align: center;
}

.scan-gallery-name {
  color: var(--ink);
  font-size: 15px;
}

.scan-gallery-print {
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 800;
}

.scan-gallery-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.45fr);
  justify-self: center;
  max-width: 460px;
  width: 100%;
}

.scan-gallery-actions button {
  min-height: 38px;
  padding: 7px 12px;
}

@supports not (height: 100dvh) {
  html #recognition-output.scan-review-overlay,
  .scan-candidate-gallery {
    height: 100vh;
  }

  .scan-gallery-image {
    max-height: calc(100vh - 170px);
  }
}

