/* Palette leans on the three colors most associated with Pokémon at a
   glance: the logo/TCG-card-back blue, the Poké Ball red (matches the
   header icon's fill exactly), and a Pikachu-gold used as the third
   accent — replacing the previous ocean/orange/purple "seal" palette. */
:root{
  --ocean:#2f5fbb;
  --ocean-dark:#1a3a7a;
  --ocean-light:#6f9ceb;
  --sand:#eaf1fc;
  --card:#ffffff;
  --ink:#1c2b33;
  --muted:#6b7d85;
  --accent:#ee1515;
  --accent2:#f4c430;
  --good:#2fa86b;
  --bad:#c0392b;
  --border:#e3ecef;
  --radius:14px;
  --shadow-sm:0 1px 3px rgba(20,50,60,0.06);
  --shadow-md:0 8px 20px rgba(20,50,60,0.12);
  --shadow-lg:0 16px 38px rgba(20,50,60,0.18);
}
*{box-sizing:border-box;}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  /* A Pokémon-sky-blue wash top-to-bottom, not just a cream page with a
     tinted band near the header — the whole page now reads as themed,
     not just its accents. */
  background:linear-gradient(180deg,#cfe0fa 0%, var(--sand) 60vh, var(--sand) 100%);
  color:var(--ink);
  min-height:100vh;
  position:relative;
  overflow-x:hidden;
}
/* A faint, tiled Poké Ball watermark across the entire page — fixed so it
   stays put while scrolling, sitting behind every panel. Subtle on purpose
   (low opacity): a texture, not a pattern anyone has to read around. */
body::after{
  content:"";
  position:fixed;
  inset:0;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Ccircle cx='36' cy='36' r='22' fill='none' stroke='%232f5fbb' stroke-width='3'/%3E%3Cline x1='14' y1='36' x2='58' y2='36' stroke='%232f5fbb' stroke-width='3'/%3E%3Ccircle cx='36' cy='36' r='6' fill='none' stroke='%232f5fbb' stroke-width='3'/%3E%3C/svg%3E");
  background-size:72px 72px;
  opacity:0.05;
  pointer-events:none;
  z-index:0;
}
/* Soft decorative color blobs behind the header — purely visual, keeps the
   top of the page from reading as a flat, empty band. */
body::before{
  content:"";
  position:absolute;
  top:-160px;
  left:50%;
  transform:translateX(-50%);
  width:min(1100px, 160vw);
  height:460px;
  background:
    radial-gradient(closest-side, rgba(47,95,187,0.20), transparent 72%) 25% 30%/55% 100% no-repeat,
    radial-gradient(closest-side, rgba(238,21,21,0.14), transparent 72%) 75% 40%/55% 100% no-repeat,
    radial-gradient(closest-side, rgba(244,196,48,0.18), transparent 72%) 50% 55%/45% 100% no-repeat;
  pointer-events:none;
  z-index:0;
}
header, .wrap{position:relative;z-index:1;}
header{
  padding:28px 24px 18px;
  text-align:center;
}
.brand-row{
  display:inline-flex;
  align-items:center;
  gap:14px;
}
/* The seller's own mascot logo — square source photo, so it's framed as a
   soft rounded badge (white card + shadow) rather than cropped to a circle,
   which would cut into the hat/lettering. */
.brand-logo{
  width:64px;
  height:64px;
  object-fit:cover;
  border-radius:16px;
  background:#fff;
  box-shadow:var(--shadow-md);
  border:2px solid #fff;
  flex-shrink:0;
}
header h1{
  margin:0 0 4px;
  font-size:1.9rem;
  font-weight:800;
  letter-spacing:-0.02em;
  background:linear-gradient(135deg, var(--ocean-dark) 15%, var(--ocean) 55%, var(--accent2) 110%);
  -webkit-background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  color:var(--ocean-dark);
  display:inline-flex;
  align-items:center;
  gap:8px;
}
/* A small Poké Ball mark next to the title — the one unmistakably
   "Pokémon" visual shorthand, so the header reads as themed even before
   the seller's own logo/branding is added. Spins playfully on hover. */
.pokeball-icon{
  display:inline-flex;
  transition:transform .5s ease;
}
header:hover .pokeball-icon{transform:rotate(360deg);}
.pokeball-icon svg{display:block;filter:drop-shadow(0 2px 4px rgba(20,50,60,0.25));}
header p{
  margin:0;
  color:var(--muted);
  font-size:0.95rem;
}
header p.lede{
  max-width:640px;
  margin:10px auto 0;
  font-size:0.85rem;
  line-height:1.5;
}
.wrap{
  max-width:1100px;
  margin:0 auto;
  padding:0 20px 60px;
}
.rate-limit-banner{
  background:#fff2e2;
  color:#8a5a10;
  border:1px solid #f0cf9a;
  border-radius:9px;
  padding:12px 16px;
  font-size:0.85rem;
  font-weight:600;
  margin:0 0 18px;
}
.rate-limit-banner[hidden]{display:none;}
.tabs-layout{
  display:flex;
  align-items:flex-start;
  gap:20px;
}
.tabs{
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:0 0 170px;
  border-right:1px solid var(--border);
  padding-right:14px;
  position:sticky;
  top:20px;
}
.tab-btn{
  appearance:none;
  border:none;
  background:transparent;
  padding:11px 14px;
  font-size:0.92rem;
  font-weight:600;
  color:var(--muted);
  cursor:pointer;
  text-align:left;
  border-radius:9px;
  border-left:3px solid transparent;
  transition:color .15s, background .15s, border-color .15s;
}
.tab-btn:hover{color:var(--ink);background:#eef4f6;}
.tab-btn.active{
  color:#fff;
  background:linear-gradient(135deg, var(--ocean-light), var(--ocean-dark));
  border-left-color:transparent;
  box-shadow:0 3px 10px rgba(47,95,187,0.35);
}
.tab-content{flex:1;min-width:0;}
.tab-panel[hidden]{display:none;}
@media (max-width:640px){
  .tabs-layout{flex-direction:column;}
  .tabs{flex-direction:row;flex:0 0 auto;border-right:none;border-bottom:1px solid var(--border);padding-right:0;padding-bottom:8px;position:static;width:100%;}
}
.panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px 20px;
  margin-bottom:18px;
  box-shadow:var(--shadow-sm);
}
.panel h2{
  font-size:1rem;
  margin:0 0 12px;
  display:flex;
  align-items:center;
  gap:8px;
}
/* Dashboard tab — a single stat card. */
.dashboard-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:16px;
  margin-bottom:18px;
}
.dashboard-stat{margin-bottom:0;}
/* Clickable Dashboard section title — jumps straight to that tab instead
   of just labeling the stat beneath it. Reset to look exactly like the
   plain heading text it replaces, with only a hover/focus affordance
   added — see the [data-goto] wiring in app.js. */
.dashboard-link{
  appearance:none;
  border:none;
  background:none;
  padding:0;
  margin:0;
  font:inherit;
  color:inherit;
  cursor:pointer;
  text-align:left;
}
.dashboard-link:hover{color:var(--ocean);text-decoration:underline;}
.dashboard-link:focus-visible{outline:2px solid var(--ocean);outline-offset:3px;border-radius:4px;}
.dashboard-stat-value{
  font-size:2rem;
  font-weight:800;
  letter-spacing:-0.02em;
  color:var(--ink);
  line-height:1.15;
}
.btn{
  appearance:none;
  border:none;
  padding:10px 16px;
  border-radius:9px;
  font-size:0.9rem;
  font-weight:600;
  cursor:pointer;
  transition:filter .15s, transform .15s, box-shadow .15s;
}
.btn:hover{filter:brightness(1.05);transform:translateY(-1px);}
.btn:active{filter:brightness(0.95);transform:translateY(0);}
.btn-primary{
  background:linear-gradient(135deg, var(--ocean-light), var(--ocean-dark));
  color:#fff;
  box-shadow:0 3px 10px rgba(47,95,187,0.35);
}
.btn-accent{
  background:linear-gradient(135deg, #ff5a4a, var(--accent));
  color:#fff;
  box-shadow:0 3px 10px rgba(238,21,21,0.35);
}
.btn-ghost{background:#eef4f6;color:var(--ink);}
.btn:disabled{opacity:0.5;cursor:not-allowed;transform:none;}
/* Claim Sale Ready's test/live send-target toggle — live is deliberately
   loud (red) since it's a one-click switch away from posting for real. */
/* Claim Sale Ready's test/live send-target switch — live is deliberately
   loud (red track) since it's one flip away from posting for real. */
.target-switch{display:inline-flex;align-items:center;gap:8px;}
/* Without this the display above beats the hidden attribute, so with no test
   channel configured the switch still showed, parked on 🧪 Test, while every
   send actually went to the LIVE channel. */
.target-switch[hidden]{display:none;}
.target-switch-label{font-size:0.85rem;font-weight:600;color:var(--muted);}
.target-switch.target-switch-live .target-switch-label-live,
.target-switch:not(.target-switch-live) .target-switch-label-test{color:var(--ink);}
.switch{position:relative;display:inline-block;width:44px;height:24px;flex:0 0 auto;}
.switch input{opacity:0;width:0;height:0;position:absolute;}
.switch-track{
  position:absolute;inset:0;cursor:pointer;
  background:#8fd6a8;
  border-radius:24px;
  transition:background .2s;
}
.switch-track::before{
  content:"";
  position:absolute;
  height:18px;width:18px;left:3px;top:3px;
  background:#fff;
  border-radius:50%;
  box-shadow:0 1px 3px rgba(0,0,0,0.3);
  transition:transform .2s;
}
.switch input:checked + .switch-track{background:var(--bad);}
.switch input:checked + .switch-track::before{transform:translateX(20px);}
.switch input:focus-visible + .switch-track{outline:2px solid var(--ocean);outline-offset:2px;}
.hint{font-size:0.78rem;color:var(--muted);margin-top:6px;}
.dropzone{
  border:2px dashed #b9d7e0;
  border-radius:var(--radius);
  padding:34px 20px;
  text-align:center;
  color:var(--muted);
  cursor:pointer;
  background:#f4fafc;
  transition:background .15s, border-color .15s;
}
.dropzone.drag{background:#e4f4f8;border-color:var(--ocean);}
.dropzone strong{color:var(--ocean-dark);}
#fileInput{display:none;}
.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  margin:18px 0 12px;
}
.toolbar[hidden]{display:none;}
.toolbar .btn-group{display:flex;gap:8px;flex-wrap:wrap;}
/* Sits directly above the regular Claim Sale Ready toolbar, so its own
   bottom margin is trimmed to read as one connected block instead of two
   separately-spaced rows. */
.claim-sale-queue-row{margin-bottom:6px;}
.claim-sale-queue-select{min-width:180px;}
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(310px,1fr));
  gap:16px;
}
@keyframes fadeInUp{
  from{opacity:0;transform:translateY(8px);}
  to{opacity:1;transform:translateY(0);}
}
.card{
  position:relative;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  box-shadow:var(--shadow-sm);
  transition:transform .15s, box-shadow .15s;
  /* Deliberately NO fadeInUp entrance animation (unlike .history-entry
     below) — renderOneCard rebuilds this element from scratch on every
     status change (a detect completing, a name/price edit, quick "Detect
     all" swapping through a batch), so the same card would replay its
     fade-in over and over, reading as lag rather than polish. */
  /* A slim gold inner frame — the visual signature of a real Pokémon TCG
     card border — around every scanned-card tile. */
  outline:2px solid var(--accent2);
  outline-offset:-2px;
}
.card:hover{transform:translateY(-3px);box-shadow:var(--shadow-lg);}
.card.card-error, .card.card-claimsale-error{
  border-color:var(--bad);
  border-width:2px;
  box-shadow:0 0 0 1px var(--bad);
}
.card-claimsale-error-banner{
  background:#fdeceb;
  color:var(--bad);
  font-size:0.78rem;
  font-weight:600;
  padding:6px 8px;
  border-radius:6px;
  margin:4px 0;
}
.card-img{
  width:100%;
  height:190px;
  object-fit:contain;
  background:#eef4f6;
  display:block;
}
.back-thumb-row{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 0;
}
.back-thumb-row .hint{flex:1;}
.back-thumb-row .btn{padding:4px 9px;font-size:0.78rem;}
.back-thumb{
  width:32px;
  height:44px;
  object-fit:cover;
  border-radius:4px;
  flex-shrink:0;
  border:1px solid var(--border);
}
.card-body{
  padding:14px 14px 16px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.status-line{
  font-size:0.78rem;
  font-weight:600;
  display:flex;
  align-items:center;
  gap:6px;
}
.status-line.detecting{color:var(--accent);}
.status-line.done{color:var(--good);}
.status-line.error{color:var(--ink);}
.spinner{
  width:11px;height:11px;
  border:2px solid #f0d9cc;
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin .7s linear infinite;
  display:inline-block;
}
@keyframes spin{to{transform:rotate(360deg);}}
.card-details-list{display:flex;flex-direction:column;gap:4px;margin-top:2px;font-size:0.82rem;}
.card-details-list strong{color:var(--muted);font-weight:600;margin-right:4px;}
.card-actions{display:flex;gap:8px;flex-wrap:wrap;}
.card-actions .btn{flex:1;padding:8px 10px;font-size:0.82rem;}
.badge{
  display:inline-block;
  background:#eaf6ee;
  color:var(--good);
  font-size:0.72rem;
  font-weight:700;
  padding:2px 8px;
  border-radius:20px;
}
/* select.badge-select beats the generic `select{}` input styling further
   down purely on specificity (element+class > element), regardless of
   source order, so this stays a green pill instead of a bulky text-input
   box even though it's a real <select>. */
select.badge-select{
  background:#eaf6ee;
  color:var(--good);
  font-size:0.72rem;
  font-weight:700;
  padding:2px 6px;
  border-radius:20px;
  border:1px solid transparent;
  cursor:pointer;
  font-family:inherit;
}
select.badge-select:focus{
  outline:2px solid var(--ocean);
  outline-offset:1px;
}

.row{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  align-items:flex-end;
}
.field{
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:1;
  min-width:150px;
}
.field label{
  font-size:0.78rem;
  color:var(--muted);
  font-weight:600;
}
input[type=text], input[type=number], input[type=password], select, textarea{
  padding:9px 11px;
  border:1px solid var(--border);
  border-radius:9px;
  font-size:0.92rem;
  font-family:inherit;
  background:#fbfdfe;
  /* Fixed, not var(--ink): these fields keep a light background in both
     themes, but --ink flips to a near-white value in dark mode — leaving
     that in place made typed text unreadable against the still-light box. */
  color:#1c2b33;
}
textarea{
  display:block;
  width:100%;
  box-sizing:border-box;
  resize:vertical;
}
/* Matches rows="4" on the element itself — the floor autoResizeComment's
   JS-driven height can't shrink below, so a short (or empty) comment still
   shows the full box instead of squeezing down to fit one line. Growing
   past this for a longer comment still works fine: min-height only sets a
   floor, not a ceiling. */
.card-comment-input{min-height:100px;}
input:focus, select:focus, textarea:focus{
  outline:2px solid var(--ocean);
  outline-offset:-1px;
}
input.input-required-empty{
  border-color:var(--bad);
}
input.input-required-empty:focus{
  outline-color:var(--bad);
}
/* Border is red for a scan-through glance; this text is what actually says
   why, next to the empty name/price field it belongs to. */
.field-error{color:var(--bad);font-size:0.75rem;margin:3px 0 0;}
summary{cursor:pointer;}
summary::marker{color:var(--muted);}

.card-details{margin-bottom:2px;border:1px solid var(--border);border-radius:8px;padding:8px 10px;}
.card-details summary{font-size:0.8rem;color:var(--ocean-dark);font-weight:600;}

/* The manual "search a card database and pick a specific printing" picker
   grid this fed (search box, language-group buttons, result tiles) was
   removed — the app only auto-matches by Pokémon name now (see
   verifyAgainstCatalogue in app.js). This row layout is kept because
   capRow (the card description field) still reuses it. */
.lctg-search-row{display:flex;gap:6px;flex-wrap:wrap;}
.lctg-search-row input{flex:1;}

.two-col{display:flex;gap:8px;}
.two-col .field{flex:1;min-width:0;}

.preview{
  background:#0b141a;
  color:#e7f1f5;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:0.82rem;
  border-radius:9px;
  padding:12px;
  white-space:pre-wrap;
  line-height:1.5;
  min-height:60px;
}
/* Claim Sale Ready's editable version of .preview (see buildClaimSaleEntryElement)
   — same look, reset to actually behave like a plain text box instead of a
   default-styled <textarea>, and auto-grows with its content via JS. */
.claim-sale-message-input{
  display:block;
  width:100%;
  box-sizing:border-box;
  border:none;
  outline:none;
  resize:vertical;
  overflow:hidden;
}
.claim-sale-message-input:focus{
  outline:2px solid var(--ocean);
  outline-offset:-2px;
}

.empty{
  text-align:center;
  color:var(--muted);
  padding:44px 20px;
  font-size:0.9rem;
  border:1.5px dashed var(--border);
  border-radius:var(--radius);
  background:linear-gradient(180deg, rgba(47,95,187,0.05), transparent);
}
.empty::before{
  content:"🎴";
  display:block;
  font-size:2rem;
  margin-bottom:10px;
  opacity:0.7;
}

.history-list{display:flex;flex-direction:column;gap:16px;}
.history-folder{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px 16px;
  box-shadow:var(--shadow-sm);
  transition:box-shadow .15s;
}
.history-folder:hover{box-shadow:var(--shadow-md);}
.history-folder-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding-bottom:10px;
  border-bottom:1px solid var(--border);
  flex-wrap:wrap;
  cursor:pointer;
  list-style:none;
}
.history-folder-header::-webkit-details-marker{display:none;}
.history-folder[open] .history-folder-header{margin-bottom:12px;}
.history-folder-header .chevron{display:inline-block;margin-right:4px;color:var(--muted);}
.history-folder-header strong{font-size:1rem;}
.history-folder-header span{font-size:0.78rem;color:var(--muted);flex:1;min-width:120px;}
.history-folder-header .btn{padding:6px 12px;font-size:0.78rem;}
.history-entries{display:flex;flex-direction:column;gap:10px;}
.history-entry{
  display:flex;
  gap:12px;
  background:#fbfdfe;
  border:1px solid var(--border);
  border-left:4px solid var(--border);
  border-radius:9px;
  padding:10px;
  transition:transform .15s, box-shadow .15s, border-color .15s;
  animation:fadeInUp .2s ease both;
}
.history-entry:hover{transform:translateY(-2px);box-shadow:var(--shadow-md);}
/* Claim Sale Ready entries cycle through an accent palette on their left
   edge, purely so a long send queue reads as a lively, scannable list
   instead of a uniform gray stack. */
#claimSaleList .history-entry:nth-child(4n+1){border-left-color:var(--ocean);}
#claimSaleList .history-entry:nth-child(4n+2){border-left-color:var(--accent);}
#claimSaleList .history-entry:nth-child(4n+3){border-left-color:var(--accent2);}
#claimSaleList .history-entry:nth-child(4n+4){border-left-color:var(--good);}
/* Already sent this run (see sentClaimSaleIds in app.js): greyed out with a
   big ✓ over the middle. The fade goes on the children, not the entry itself,
   so the tick stays at full strength. */
#claimSaleList .history-entry.claim-sale-sent{position:relative;border-left-color:var(--good);}
#claimSaleList .history-entry.claim-sale-sent > *{opacity:0.4;filter:grayscale(1);}
#claimSaleList .history-entry.claim-sale-sent::after{
  content:"✓";
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  width:44px;
  height:44px;
  border-radius:50%;
  background:var(--good);
  color:#fff;
  font-size:1.6rem;
  font-weight:700;
  line-height:44px;
  text-align:center;
  box-shadow:var(--shadow-md);
  pointer-events:none;
}
.history-entry-image{
  width:60px;
  height:84px;
  object-fit:contain;
  border-radius:6px;
  background:#eef4f6;
  flex-shrink:0;
  box-shadow:0 2px 6px rgba(20,50,60,0.15);
}
/* Sized placeholder standing in for .history-entry-image until the folder
   is expanded and its real photo is lazy-fetched (see renderHistory) — same
   dimensions so nothing jumps around once the real image swaps in. */
.history-entry-image-slot{
  width:60px;
  height:84px;
  border-radius:6px;
  background:#eef4f6;
  flex-shrink:0;
}
.history-entry-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px;}
.history-entry-body strong{font-size:0.88rem;}
.history-entry-actions{display:flex;gap:8px;flex-wrap:wrap;}
.history-entry-actions .btn{padding:5px 10px;font-size:0.78rem;}
/* Claim Sale Ready's send-position control — bigger and easier to hit than
   the ↑/↓ buttons it replaced, and scroll-to-nudge (see renderClaimSale)
   makes repositioning something in a long list fast without needing to
   drag across (or past) the visible screen. */
.claim-sale-position{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:1px;
  border:none;
  border-radius:20px;
  padding:6px 12px 6px 10px;
  background:linear-gradient(135deg, var(--ocean-light), var(--ocean-dark));
  color:#fff;
  font-size:0.85rem;
  font-weight:700;
  cursor:ns-resize;
  box-shadow:0 2px 6px rgba(47,95,187,0.4);
  transition:transform .15s, box-shadow .15s;
}
.claim-sale-position:hover{transform:scale(1.06);box-shadow:0 3px 10px rgba(47,95,187,0.5);}
.claim-sale-position span{opacity:0.85;}
.claim-sale-position input{
  width:2.4em;
  border:none;
  padding:0;
  font:inherit;
  font-weight:700;
  color:#fff;
  background:transparent;
  text-align:center;
  -moz-appearance:textfield;
}
.claim-sale-position input::-webkit-outer-spin-button,
.claim-sale-position input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}
/* A standalone "➕ Add message" queue entry — no photo, so it needs its own
   visual cue (a left accent bar + tinted background) to read as distinct
   from a card at a glance. Extra specificity (id + two classes) beats the
   nth-child accent-cycling above so it stays consistently ocean-colored. */
#claimSaleList .history-entry.claim-sale-message{
  border-left-color:var(--ocean);
  background:linear-gradient(135deg, #eef3fd, #e1eaf9);
}
/* Claim Sale Ready entries are draggable to reorder (see reorderClaimSaleEntry
   in app.js) — grab cursor as the affordance, a fading-out ghost while
   dragging, and a line on whichever side of the hovered entry the drop
   would land on. */
#claimSaleList .history-entry{cursor:grab;}
#claimSaleList .history-entry:active{cursor:grabbing;}
.history-entry.dragging{opacity:0.4;}
/* Briefly highlights an entry right after it's repositioned (⤒/⤓, the
   position field, or a drop) — see scrollClaimSaleEntryIntoView in app.js.
   The scroll alone gets it on screen; this is what actually draws the eye
   to WHICH one just moved, in a list where several entries can look alike. */
@keyframes justMovedFlash{
  0%{box-shadow:0 0 0 2px var(--accent2);}
  100%{box-shadow:0 0 0 2px transparent;}
}
.history-entry.just-moved{animation:justMovedFlash 1.4s ease-out;}
.history-entry.drag-over-before{box-shadow:inset 0 3px 0 0 var(--ocean);}
.history-entry.drag-over-after{box-shadow:inset 0 -3px 0 0 var(--ocean);}
.translated-hint{font-size:0.72rem;color:var(--muted);font-style:italic;margin:-2px 0 0;}
/* Thin top-of-page progress bar — visible whenever any request is in
   flight (see the fetch-wrapping IIFE at the top of app.js). Not inside
   .wrap/header, so it isn't hidden pre-login by the html:not(.unlocked)
   rule above — it's just as useful while the login check itself is
   running. */
#loadingBar{
  position:fixed;
  top:0;left:0;right:0;
  height:3px;
  z-index:4000;
  overflow:hidden;
  pointer-events:none;
}
#loadingBar::before{
  content:"";
  position:absolute;
  top:0;bottom:0;
  width:40%;
  background:linear-gradient(90deg, var(--ocean-light), var(--accent2));
  opacity:0;
  transform:translateX(-100%);
}
#loadingBar.active::before{
  opacity:1;
  animation:loadingBarSlide 1.1s ease-in-out infinite;
}
@keyframes loadingBarSlide{
  0%{transform:translateX(-100%);}
  50%{transform:translateX(150%);}
  100%{transform:translateX(350%);}
}

.toast{
  position:fixed;
  bottom:22px;
  left:50%;
  transform:translateX(-50%);
  /* Fixed, not var(--ink): --ink flips to near-white in dark mode, which
     made this white text on a near-white background — unreadable. A toast
     is a floating overlay, not part of the themed page, so it stays a
     constant dark chip with white text in both themes. */
  background:#1c2b33;
  color:#fff;
  padding:10px 18px;
  border-radius:20px;
  font-size:0.85rem;
  opacity:0;
  pointer-events:none;
  transition:opacity .25s, transform .25s;
  /* .wrap is its own stacking layer (z-index:1, above), so without this the
     cards on Scan Cards painted over the toast and hid error messages. */
  z-index:1100;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(-6px);}
.toast.toast-error{background:#8a1f1f;}

/* Styled replacement for window.confirm/prompt — see customConfirm/
   customPrompt in app.js. Theme-aware (var(--card)/var(--ink) already flip
   for dark mode), unlike native dialogs which just render as OS chrome. */
.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(10,20,25,0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:1000;
}
.modal-overlay[hidden]{display:none;}

/* Login page (see auth-gate.js). Until the <html> element gets the
   "unlocked" class the whole app is hidden — the header, tabs, every panel,
   toasts — leaving only the site's background and the login screen, so
   nothing about what's inside is visible before someone has logged in.
   Hidden by default (not by a script) so nothing flashes before it runs. */
html:not(.unlocked) header,
html:not(.unlocked) .wrap,
html:not(.unlocked) .toast{display:none;}
.login-screen{
  position:fixed;
  inset:0;
  z-index:3000;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:24px;
  padding:20px;
}
.login-logo{
  width:120px;
  height:120px;
  object-fit:cover;
  border-radius:26px;
  background:#fff;
  border:3px solid #fff;
  box-shadow:var(--shadow-md);
}
.login-screen .modal-box{max-width:340px;box-shadow:var(--shadow-lg);}
.modal-box{
  position:relative;
  background:var(--card);
  color:var(--ink);
  border-radius:var(--radius);
  padding:22px;
  max-width:380px;
  width:100%;
  box-shadow:0 20px 50px rgba(0,0,0,0.35);
}
.modal-close{position:absolute;top:8px;right:8px;width:32px;height:32px;border:0;border-radius:50%;background:transparent;color:var(--muted);font-size:1rem;cursor:pointer;}
.modal-close:hover{background:rgba(127,127,127,0.15);color:var(--ink);}
.modal-close[hidden]{display:none;}
.modal-box:has(.modal-close:not([hidden])) .modal-message{padding-right:28px;}
.modal-message{margin:0 0 14px;font-size:0.95rem;line-height:1.4;white-space:pre-line;}
.modal-input{width:100%;margin-bottom:6px;}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:14px;}

.lightbox-overlay{cursor:zoom-out;}
.lightbox-img{
  max-width:90vw;
  max-height:90vh;
  border-radius:8px;
  box-shadow:0 20px 50px rgba(0,0,0,0.5);
  cursor:default;
}
/* Any clickable thumbnail that opens the lightbox — card photo, back photo,
   history/claim-sale entry image. A hover affordance so it reads as
   "click to enlarge" rather than looking like a dead image. */
.zoomable-img{cursor:zoom-in;}

@media (prefers-color-scheme: dark){
  :root{
    /* Navy-tinted, not neutral slate — echoes the same TCG-card-back blue
       as the light theme's page wash instead of going generic dark-gray. */
    --sand:#0e1626;
    --card:#182338;
    --ink:#eaf1f3;
    --muted:#8ba0a8;
    --border:#28324a;
  }
  body{background:linear-gradient(180deg,#0a1220 0%, var(--sand) 60vh, var(--sand) 100%);}
  body::after{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Ccircle cx='36' cy='36' r='22' fill='none' stroke='%236f9ceb' stroke-width='3'/%3E%3Cline x1='14' y1='36' x2='58' y2='36' stroke='%236f9ceb' stroke-width='3'/%3E%3Ccircle cx='36' cy='36' r='6' fill='none' stroke='%236f9ceb' stroke-width='3'/%3E%3C/svg%3E");
    opacity:0.06;
  }
  body::before{
    background:
      radial-gradient(closest-side, rgba(111,156,235,0.20), transparent 72%) 25% 30%/55% 100% no-repeat,
      radial-gradient(closest-side, rgba(238,21,21,0.14), transparent 72%) 75% 40%/55% 100% no-repeat,
      radial-gradient(closest-side, rgba(244,196,48,0.16), transparent 72%) 50% 55%/45% 100% no-repeat;
  }
  header h1{background:linear-gradient(135deg, var(--ocean-light) 15%, #7fd3ec 55%, var(--accent2) 110%);background-clip:text;-webkit-background-clip:text;}
  .dropzone{background:#182226;}
  .btn-ghost{background:#263136;}
  .card-img{background:#263136;}
  .tab-btn:hover{background:#1c262b;}
  .tab-btn.active{background:linear-gradient(135deg, var(--ocean), var(--ocean-dark));}
  .history-entry{background:#22292d;}
  #claimSaleList .history-entry.claim-sale-message{background:linear-gradient(135deg, #182747, #121d38);}
  .history-entry-image{background:#263136;}
  .provider-compare{background:#20282c;}
  .rate-limit-banner{background:#3a2a10;color:#f0c98a;border-color:#5a4420;}
  .card-claimsale-error-banner{background:#3a1414;}
}
