/* ============================================================
   packrip — page chrome shared by the public and admin apps
   ============================================================ */

* { box-sizing: border-box; }

/* The hidden attribute ALWAYS wins — a class's display: value must never
   resurrect a hidden element (this bug class has bitten three times). */
[hidden] { display: none !important; }

body {
  margin: 0; min-height: 100vh; color: #e8ebf2;
  background: radial-gradient(120% 85% at 50% 0%, #141824, #05060a 70%);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar { display: flex; align-items: center; gap: 26px; padding: 14px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid rgba(255,255,255,.07); position: sticky; top: 0; z-index: 30;
  background: rgba(8,10,17,.86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.topbar__brand { font-weight: 800; font-size: 19px; letter-spacing: -.01em;
  background: linear-gradient(180deg, #fff, #9fc7ff); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.topbar__nav { display: flex; gap: 4px; }
.topbar__nav a { color: rgba(232,235,242,.65); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; }
.topbar__nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.topbar__nav a.is-active { background: rgba(125,211,252,.14); color: #bfe6ff; }
.navbadge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 6px; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1; color: #05070c;
  background: linear-gradient(180deg, #b8ecff, #4bbef0); vertical-align: middle; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.page { padding: 26px clamp(16px, 4vw, 42px) 80px; }
.page h1 { font-size: 24px; margin: 4px 0 18px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; }
.pagehead h1 { margin: 0 0 6px; }
.pagehead .hint { max-width: 520px; line-height: 1.5; }
.pagehead__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quickrow { display: flex; gap: 10px; margin-top: 22px; }
a.stat { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.stat:hover { border-color: rgba(125,211,252,.4); transform: translateY(-2px); }
.rawmark { color: #ffd9a0; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: rgba(2,3,6,.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal__box { background: #12161f; border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  padding: 22px; width: min(92vw, 420px); box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.modal__box h2 { margin: 0 0 14px; }
.modal__box form { display: flex; flex-direction: column; gap: 10px; }
.modal__box label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: rgba(232,235,242,.6); }
.modal__box .row { display: flex; gap: 8px; margin-top: 8px; }
.page h2 { font-size: 17px; margin: 0 0 10px; }
.hint { color: rgba(232,235,242,.5); font-size: 13px; }

.btn { appearance: none; border: none; cursor: pointer; padding: 9px 18px; border-radius: 9px;
  font-size: 14px; font-weight: 700; color: #05070c;
  background: linear-gradient(180deg, #b8ecff, #4bbef0); }
.btn:hover { filter: brightness(1.08); }
.btn--ghost { background: rgba(255,255,255,.1); color: #e8ebf2; }
.btn--danger { background: linear-gradient(180deg, #ffb1b1, #f06a6a); }
.btn--small { padding: 5px 10px; font-size: 12.5px; }

input, select, textarea {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 8px;
  color: #e8ebf2; padding: 8px 10px; font-size: 14px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(125,211,252,.5); }
select option { background: #141824; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 20px; }
.uploadbtn { display: inline-block; cursor: pointer; padding: 9px 18px; border-radius: 9px;
  font-size: 14px; font-weight: 700; color: #05070c;
  background: linear-gradient(180deg, #c6ffd9, #4bf08f); }
.uploadbtn:hover { filter: brightness(1.05); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(232,235,242,.45); padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.1); }
.table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
.table tr:hover td { background: rgba(255,255,255,.03); }
.table a { color: #7dd3fc; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.stat { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 12px;
  padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 28px; }
.stat span { color: rgba(232,235,242,.5); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- admin image gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.gtile { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column; }
.gtile__img { aspect-ratio: 1; width: 100%; object-fit: cover; background: #0a0e18; display: block; }
.gtile__meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.gtile__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.gtile__row { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: rgba(232,235,242,.5); }
.badge { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  background: rgba(255,255,255,.09); }
.badge--used { background: rgba(52,211,153,.18); color: #7fe0a0; }
.badge--unused { background: rgba(255,177,177,.14); color: #ffb1b1; }
.gtile__pickwrap { position: relative; display: block; cursor: pointer; }
.gtile__pick { position: absolute; top: 8px; left: 8px; z-index: 2; width: 18px; height: 18px; accent-color: #4bbef0; }
.gtile.is-picked { outline: 2px solid #4bbef0; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: rgba(232,235,242,.7); }

/* card editor crop controls */
.crop-hint { margin: -8px 0 8px; }
.crop-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.crop-row input[type="range"] { flex: 1; accent-color: #4bbef0; }

/* ---------- admin binder management ---------- */
.bhead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; }
.bhead h1 { margin: 0 0 10px; }
.bhead__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.statbar { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { --chip: #94a3b8; display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--chip) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--chip) 30%, transparent);
  color: color-mix(in srgb, var(--chip) 75%, #fff); }
.chip b { font-size: 13px; }
.chip--total { --chip: #7dd3fc; }
.chip--todo { --chip: #f59e0b; font-weight: 700; }
.chip--shiny { --chip: #e6ebf2; }

.bulkbar { position: sticky; top: 58px; z-index: 25; display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px; padding: 10px 14px; margin: 0 0 18px;
  background: rgba(14,18,30,.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(125,211,252,.25); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.bulkbar[hidden] { display: none; }
.bulkbar__count { font-weight: 800; color: #bfe6ff; font-size: 13.5px; }
.bulkbar__sep { width: 1px; height: 22px; background: rgba(255,255,255,.12); }
.btn--todo { background: linear-gradient(180deg, #ffd9a0, #f59e0b); }

.binder-editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 26px; align-items: start; }
/* reclaim the editor column while it is closed */
.binder-editor:has(.card-editor[hidden]) { grid-template-columns: 1fr; }
@media (max-width: 1100px) { .binder-editor { grid-template-columns: 1fr; } }

/* rarity sections */
.rsec { --sec: #94a3b8; margin-bottom: 26px; border: 1px solid rgba(255,255,255,.07);
  border-left: 3px solid var(--sec); border-radius: 12px; overflow: hidden;
  background: rgba(255,255,255,.025); }
.rsec__head { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--sec) 14%, transparent), transparent 70%); }
.rsec__head h2 { margin: 0; font-size: 14.5px; letter-spacing: .04em; text-transform: uppercase;
  color: color-mix(in srgb, var(--sec) 80%, #fff); }
.rsec__count { font-size: 12px; font-weight: 800; padding: 1px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--sec) 22%, transparent);
  color: color-mix(in srgb, var(--sec) 85%, #fff); }
.rsec__pickall input { width: 15px; height: 15px; accent-color: #4bbef0; }
.rsec--todo { border-style: dashed; border-color: rgba(245,158,11,.5); }
.rsec--rainbow .rsec__head h2 {
  background: linear-gradient(90deg, #ff6b8b, #ffd36b, #6bffa3, #6bd4ff, #b06bff);
  -webkit-background-clip: text; background-clip: text; color: transparent; }

.rsec__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px; padding: 14px; }

/* card tiles */
.ctile { position: relative; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  transition: transform .15s ease, border-color .15s, box-shadow .15s; }
.ctile:hover { transform: translateY(-3px); border-color: rgba(125,211,252,.45);
  box-shadow: 0 10px 26px rgba(0,0,0,.45); }
.ctile.is-picked { border-color: #4bbef0; box-shadow: 0 0 0 1px #4bbef0; }
.ctile__pick { position: absolute; top: 7px; left: 7px; z-index: 2; width: 17px; height: 17px;
  accent-color: #4bbef0; }
.ctile__art { aspect-ratio: 3 / 4; overflow: hidden; background: #0a0e18; }
.ctile__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ctile__noart { display: grid; place-items: center; height: 100%;
  color: rgba(232,235,242,.25); font-size: 11.5px; letter-spacing: .08em; }
.ctile__meta { padding: 7px 9px 8px; display: flex; flex-direction: column; gap: 2px; }
.ctile__name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.ctile__sub { font-size: 11px; color: rgba(232,235,242,.45); }

/* editor panel */
.card-editor { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px; padding: 18px; position: sticky; top: 74px;
  max-height: calc(100vh - 96px); overflow-y: auto; }
.card-editor form { display: flex; flex-direction: column; gap: 10px; }
.card-editor label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: rgba(232,235,242,.6); }
.card-editor label.check { flex-direction: row; align-items: center; gap: 8px; }
.card-editor .row { display: flex; gap: 8px; margin-top: 6px; }
.card-editor .frow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preview-well { display: grid; place-items: center; padding: 14px 0 20px; --card-w: 190px; --card-h: 281px; }
.todo-note { font-size: 12.5px; color: #ffd9a0; background: rgba(245,158,11,.12);
  border: 1px dashed rgba(245,158,11,.45); border-radius: 8px; padding: 8px 10px; margin: 0 0 6px; }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; background: #0a0e18; display: block; }
.rarity-chip { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.09); }

/* ---------- admin pack editor ---------- */
.packcard { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09); border-radius: 12px;
  padding: 18px; margin-bottom: 18px; max-width: 760px; }
.packcard h2 { display: flex; align-items: center; gap: 10px; }
.packcard form { display: flex; flex-direction: column; gap: 12px; }
.packcard .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.packcard label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: rgba(232,235,242,.6); }
.packcard input[type="number"] { width: 90px; }
.oddsgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }

/* ---------- public binder ---------- */
.binder-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.binder-head h1 { margin: 0; }
.progress { color: #7dd3fc; font-weight: 700; }
.binder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--card-w) + 12px), 1fr));
  gap: 44px 18px; justify-items: center; --card-w: 164px; --card-h: 243px; }
.binder-grid .card { --card-w: 164px; --card-h: 243px; }
.slot-empty { width: var(--card-w); height: var(--card-h); border-radius: var(--card-radius);
  border: 2px dashed rgba(255,255,255,.12); display: grid; place-items: center;
  color: rgba(232,235,242,.25); font-weight: 800; font-size: 22px;
  background: rgba(255,255,255,.02); }

/* segmented control (grouping toggles) */
.seg { display: inline-flex; border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
  overflow: hidden; background: rgba(255,255,255,.04); }
.seg__opt { appearance: none; border: none; background: transparent; color: rgba(232,235,242,.6);
  font-size: 13px; font-weight: 700; padding: 7px 14px; cursor: pointer; }
.seg__opt:hover { color: #fff; }
.seg__opt.is-active { background: rgba(125,211,252,.16); color: #bfe6ff; }

/* public binder tag section headers — the .page h2 selector (0,1,1) outranks a
   bare .tagsec, so this must carry equal-or-greater specificity to land. */
.page h2.tagsec { margin: 48px 0 16px; font-size: 16px; letter-spacing: .06em; text-transform: uppercase;
  color: rgba(232,235,242,.75); border-bottom: 1px solid rgba(255,255,255,.1);
  padding-bottom: 8px; }
/* top-bar credit counter: diamond amount (uncapped) + progress-to-next bar */
.wallet { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.wallet__amount { font-size: 14px; color: #bfe6ff; font-weight: 800; }
.wallet__bar { width: 62px; height: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.12); }
.wallet__fill { display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #4bbef0, #b8ecff);
  transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.iconbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  color: rgba(232,235,242,.7); text-decoration: none; font-size: 16px; line-height: 1;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); }
.iconbtn:hover { color: #fff; background: rgba(255,255,255,.1); }

/* settings page */
.settings { max-width: 460px; }
.settings__field { display: flex; flex-direction: column; gap: 8px; }
.settings__label { font-size: 13px; color: rgba(232,235,242,.75); }
.settings__label em { font-style: normal; color: rgba(232,235,242,.45); }
.settings__row { display: flex; gap: 8px; }
.settings__row input { flex: 1; }
.binder-cell { position: relative; }
.shredbtn { position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%);
  appearance: none; border: 1px solid rgba(245,158,11,.4); border-radius: 999px;
  background: rgba(245,158,11,.12); color: #ffd9a0; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.shredbtn:hover { background: rgba(245,158,11,.28); }

/* ---------- public binder overview tiles ---------- */
.btiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.btile { --back-a: #1b2447; --back-b: #0a0f22; --back-glow: #7dd3fc;
  display: block; text-decoration: none; color: inherit; border-radius: 16px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--back-glow) 25%, transparent);
  background: linear-gradient(160deg, var(--back-a), var(--back-b));
  transition: transform .18s ease, box-shadow .18s; }
.btile:hover { transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,.5), 0 0 30px color-mix(in srgb, var(--back-glow) 25%, transparent); }
.btile__grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 5px; padding: 12px; aspect-ratio: 1; }
.btile__cell { border-radius: 7px; overflow: hidden; background: rgba(255,255,255,.05); }
.btile__cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.btile__cell--hidden { display: grid; place-items: center; color: rgba(255,255,255,.22);
  font-weight: 800; font-size: 18px; background: rgba(0,0,0,.3);
  border: 1px dashed rgba(255,255,255,.1); }
.btile__cell--void { background: transparent; border: 1px dashed rgba(255,255,255,.05); }
.btile__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px 12px; background: rgba(0,0,0,.28); }
.btile__meta b { font-size: 15px; }
.btile__progress { font-size: 13px; font-weight: 700; color: color-mix(in srgb, var(--back-glow) 85%, #fff); }

/* ---------- store ---------- */
.store-head { max-width: 680px; margin-bottom: 22px; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.store-pack { --back-a: #1b2447; --back-b: #0a0f22; --back-glow: #7dd3fc;
  border-radius: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.03); display: flex; flex-direction: column; }
.store-pack__art { aspect-ratio: 4 / 5; display: grid; align-content: center; justify-items: center;
  gap: 8px; text-align: center; position: relative;
  background: linear-gradient(152deg, var(--back-a), var(--back-b) 70%); }
.store-pack__art::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 45% at 50% 38%, color-mix(in srgb, var(--back-glow) 22%, transparent), transparent 75%); }
.store-pack__set { font-size: 11px; letter-spacing: .34em; text-transform: uppercase;
  color: color-mix(in srgb, var(--back-glow) 80%, #fff); opacity: .85; z-index: 1; }
.store-pack__name { font-size: 26px; font-weight: 800; z-index: 1;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--back-glow) 60%, #fff));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.store-pack__cards { font-size: 11.5px; letter-spacing: .2em; color: rgba(255,255,255,.5); z-index: 1; }
.store-pack__foot { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; }
.store-pack__price { font-weight: 800; font-size: 16px; color: #bfe6ff; }
.store-pack__count { position: absolute; top: 10px; right: 12px; z-index: 2; min-width: 26px; text-align: center;
  padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 800; color: #05070c;
  background: linear-gradient(180deg, #b8ecff, #4bbef0); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.pprompt__link { color: #7dd3fc; }

/* transient purchase confirmation */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); z-index: 90;
  background: rgba(18,22,31,.96); border: 1px solid rgba(125,211,252,.3); color: #e8ebf2;
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 12px 32px rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- admin distribution panel ---------- */
.distpanel { border: 1px solid rgba(255,255,255,.09); border-radius: 12px;
  background: rgba(255,255,255,.03); padding: 16px 18px; margin-bottom: 20px; }
.distgrid { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.distrow { display: grid; grid-template-columns: 140px 1fr 190px; align-items: center; gap: 12px; }
.distrow__label { font-size: 12.5px; color: color-mix(in srgb, var(--sec, #94a3b8) 80%, #fff); }
.distrow__bars { position: relative; height: 16px; }
.distrow__bar { position: absolute; left: 0; top: 0; height: 100%; border-radius: 4px; }
.distrow__bar--actual { background: color-mix(in srgb, var(--sec, #94a3b8) 55%, transparent); }
.distrow__bar--rec { border: 1.5px dashed color-mix(in srgb, var(--sec, #94a3b8) 80%, #fff);
  background: transparent; }
.distrow__nums { font-size: 12.5px; color: rgba(232,235,242,.75); }
.distrow__nums em { font-style: normal; font-size: 11.5px; margin-left: 4px; }
.distrow__nums em.ok { color: #7fe0a0; }
.distrow__nums em.over { color: #ffd9a0; }
.distrow__nums em.short { color: #ffb1b1; }
.backcell { white-space: nowrap; }
.backcell input[type="color"] { width: 26px; height: 26px; padding: 1px; border-radius: 6px; cursor: pointer; vertical-align: middle; }
.backdot { display: inline-block; width: 22px; height: 22px; border-radius: 50%; vertical-align: middle;
  margin-right: 4px; border: 1px solid rgba(255,255,255,.2); }
