/* The binder page's newer pieces: the value pill as a button and its money
   popover (pricepill.js), the view button and its menu (views-menu.js), the
   popovers they share (popover.js), the sheet's More panel (more-panel.js),
   and in Binder settings the cover card, the sleeve colour and the Views tab.
   (The library's binder covers are the binder's own shut cover: shell.css .bcard-binder.) */

/* ================================================== toolbar: value and view */

button.value-pill {
  font-family: inherit; line-height: 1.3; cursor: pointer;
  transition: background var(--t-1) var(--ease-out), border-color var(--t-1) var(--ease-out), transform var(--t-1) var(--ease-out);
}
button.value-pill:hover { background: color-mix(in srgb, var(--gold) 20%, transparent); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }
button.value-pill:active { transform: translateY(1px); }
button.value-pill[aria-expanded="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent); }
button.value-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A zero total's reason, in full; a phone's toolbar says it briefly (mobile.css). */
.value-pill .vp-short { display: none; }

.view-btn {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 30px; padding: 0 10px; max-width: 210px;
  font: inherit; font-size: 12.5px; font-weight: 650; color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--t-1) var(--ease-out), border-color var(--t-1) var(--ease-out), color var(--t-1) var(--ease-out);
}
.view-btn:hover { color: var(--ink); background: var(--bg-3); }
.view-btn[aria-expanded="true"] { color: var(--ink); border-color: var(--accent); }
.view-btn.is-filtered {
  color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}
.view-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-btn-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-btn-caret { flex: none; opacity: .7; }

/* ================================================== popovers */

.popover {
  position: fixed; z-index: 90;
  width: min(340px, calc(100vw - 16px));
  max-height: calc(100dvh - 24px); overflow: auto;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2), inset 0 1px 0 var(--hairline);
  animation: pop-in var(--t-2) var(--ease-out);
}
.popover.is-sheet {
  /* --kb / --vh: the on-screen keyboard's height and what is left above it (popover.js) */
  left: 0; right: 0; bottom: var(--kb, 0px); top: auto; width: 100%;
  max-height: min(80dvh, calc(var(--vh, 100dvh) - 12px));
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0;
  animation: sheet-in var(--t-3) var(--ease-out);
}
.popover:focus { outline: none; }
/* Only a sheet has these: the page dimmed behind it, a grab bar, and a × in its corner. */
.popover-scrim { display: none; }
.popover-sheet-top { display: none; }
.popover-scrim:has(+ .popover.is-sheet) {
  display: block; position: fixed; inset: 0; z-index: 89;
  background: rgba(4, 6, 10, .42);
  animation: scrim-in var(--t-2) var(--ease-out);
}
.popover.is-sheet > .popover-sheet-top {
  display: flex; align-items: center; justify-content: center; position: relative;
  height: 28px; margin: -6px 0 4px;
}
.popover-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.popover-x {
  position: absolute; right: -4px; top: -4px;
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--bg-3); color: var(--ink-2);
}
/* The inbox is a column with no padding of its own: its bar sits inside it. */
.popover.al-pop.is-sheet > .popover-sheet-top { flex: none; margin: 8px 16px 0; }
@keyframes scrim-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
:root:not([data-motion="full"]) .popover { animation: none; }

/* ---- the money popover */
.pp { display: flex; flex-direction: column; gap: 12px; }
.pp-head { display: flex; flex-direction: column; gap: 2px; }
.pp-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.pp-sub { font-size: 12px; color: var(--ink-3); }
.pp-row { display: flex; flex-direction: column; gap: 6px; }
.pp-label { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.pp-row .input { width: 100%; }
.pp-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-inline .pp-adjust { width: 84px; }
.pp-unit { color: var(--ink-3); font-weight: 650; margin-left: -4px; }
.pp-steps { display: flex; gap: 4px; }
.pp-help { margin: 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }
.pp-toggle {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-size: 13px; color: var(--ink);
}
.pp-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pp-switch {
  position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px;
  background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line);
  transition: background var(--t-1) var(--ease-out);
}
.pp-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-2); transition: transform var(--t-2) var(--ease-out), background var(--t-1) var(--ease-out);
}
.pp-toggle input:checked + .pp-switch { background: var(--accent-fill); box-shadow: none; }
.pp-toggle input:checked + .pp-switch::after { transform: translateX(14px); background: var(--accent-ink); }
.pp-toggle input:focus-visible + .pp-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.pp-toggle input:disabled + .pp-switch { opacity: .45; }
.pp-more { align-self: flex-start; }

/* ---- the view menu */
.vm { display: flex; flex-direction: column; gap: 2px; }
.vm-head { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 0 6px 6px; }
.vm-item {
  display: flex; align-items: flex-start; gap: 8px; width: 100%;
  padding: 8px 8px; border: none; border-radius: var(--radius-sm);
  background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer;
}
.vm-item:hover, .vm-item:focus-visible { background: var(--bg-3); outline: none; }
.vm-item.is-on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.vm-check { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--accent); display: grid; place-items: center; }
.vm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vm-name { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; }
.vm-primary { color: var(--gold); display: inline-grid; }
.vm-sub { font-size: 12px; color: var(--ink-3); }
.vm-manage { margin-top: 6px; align-self: flex-start; }

/* ================================================== the sheet's More panel */

.tabs .tab-more { display: none; }
@media (max-width: 980px) {
  .tabs .tab-more { display: block; }
}
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.more-layout {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer;
}
.more-layout.is-on { color: var(--accent-text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.more-layout:disabled { opacity: .45; }
.more-pockets { color: currentColor; opacity: .8; line-height: 0; }
.more-cmds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.more-cmd {
  display: flex; align-items: center; gap: 10px; min-height: 48px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer;
}
.more-cmd svg { flex: none; width: 18px; height: 18px; color: var(--ink-2); }
.more-cmd.is-on { border-color: var(--accent); color: var(--accent-text); }
.more-cmd:disabled { opacity: .45; }
.more-cmd:active, .more-layout:active { transform: scale(.98); }
#more-panel { overflow-y: auto; }
/* Its first heading sits right under the handle: no band of empty space above it. */
#more-panel > .panel-h:first-child { margin-top: 0; }

/* ================================================== pockets in a view */

/* A card this view leaves out: an empty-looking pocket, quieter than a real one. */
.pocket.is-filtered::after { opacity: .45; }
.page-name.is-view { color: var(--accent-text); font-weight: 650; }

/* ================================================== Binder settings */

/* ---- the cover card */
.cover-pick { display: flex; flex-direction: column; gap: 10px; }
.cover-pick-now { display: flex; align-items: center; gap: 12px; }
.cover-pick-thumb {
  flex: none; width: 46px; aspect-ratio: var(--card-ratio, .714); border-radius: 5px;
  background: var(--bg-3) center / cover no-repeat;
  box-shadow: inset 0 0 0 1px var(--line), 0 4px 10px rgba(0,0,0,.3);
}
.cover-pick-thumb.is-auto {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--gold) 40%, transparent), transparent 60%) !important;
}
.cover-pick-name { font-size: 13px; color: var(--ink-2); }
.cover-pick-search {
  height: min(460px, 60dvh); display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg);
}
.cover-pick-search > * { min-height: 0; }

/* ---- the sleeve colour */
.swatch-clear {
  background:
    linear-gradient(135deg, transparent 46%, var(--danger) 47%, var(--danger) 53%, transparent 54%),
    repeating-conic-gradient(var(--bg-3) 0 25%, var(--bg) 0 50%) 0 0 / 10px 10px !important;
}
.swatch-custom {
  padding: 0; cursor: pointer; appearance: none; -webkit-appearance: none;
  background: conic-gradient(from 0deg, #f87171, #fbbf24, #4ade80, #38bdf8, #a78bfa, #f472b6, #f87171);
}
.swatch-custom::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-custom::-webkit-color-swatch { border: none; border-radius: 3px; opacity: 0; }
.swatch-custom.is-on::-webkit-color-swatch { opacity: 1; }
.swatch-custom::-moz-color-swatch { border: none; opacity: 0; }
.swatch-custom.is-on::-moz-color-swatch { opacity: 1; }
.swatch-custom.is-on { border-color: var(--ink); }

/* ---- Views */
.views-list { display: flex; flex-direction: column; gap: 10px; }
.view-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg);
}
.view-card.is-builtin { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.view-card-head { display: flex; align-items: center; gap: 8px; }
.view-card.is-builtin .view-card-head { flex-direction: column; align-items: flex-start; gap: 2px; }
.view-name { flex: 1; min-width: 0; font-weight: 650; }
.view-name-static { font-size: 13.5px; font-weight: 650; }
.view-sub { font-size: 12px; color: var(--ink-3); }
.view-controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-start; }
.view-control { display: flex; flex-direction: column; gap: 6px; }
.view-pack {
  display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; cursor: pointer;
  font-size: 13px; max-width: 260px;
}
.view-pack .form-help { grid-column: 2; }
.view-primary { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.view-primary input { accent-color: var(--accent); }
.views-add { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

/* ---- a share link's viewer: nothing that only its owner can use. The Sets
   tab builds and fills the binder, and a card's padlock only says the owner
   has kept it from being moved. */
body.is-shared #sidebar .tab[data-tab="sets"],
body.is-shared .slot-lock { display: none; }

/* ================================================== the game picker
   game-picker.js: a button in the place of a game <select> (which stays,
   out of sight, as the source of truth), and its list in a popover — A → Z,
   a Popular badge on the big games, a box to find one by typing. */
.gp-wrap { display: contents; }
.gp-native {
  position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important;
  margin: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; overflow: hidden;
  clip-path: inset(50%); border: 0 !important;
}
.gp-btn {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%;
  text-align: left; cursor: pointer; font: inherit; color: var(--ink);
}
.gp-btn.input { padding: 0 10px; }
.gp-btn:disabled { cursor: default; opacity: .6; }
.gp-ico { flex: none; display: grid; place-items: center; color: var(--accent-text); }
.gp-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-btn.is-blank .gp-label { color: var(--ink-3); }
.gp-caret { flex: none; display: grid; place-items: center; color: var(--ink-3); transition: rotate var(--t-1) var(--ease-out); }
.gp-btn[aria-expanded="true"] .gp-caret { rotate: 180deg; }
.gp-pop {
  flex: none; padding: 1px 7px; border-radius: 999px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; line-height: 1.5;
  color: var(--gold-text);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 32%, transparent);
}

.popover.gp-pop-panel { padding: 8px; }
/* Beside its button, as wide as it (at least 260px); on a phone the full-width sheet popovers are. */
.popover.gp-pop-panel:not(.is-sheet) { width: min(var(--gp-w, 300px), calc(100vw - 16px)); }
.popover.gp-pop-panel.is-sheet { padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
.gp-panel { display: flex; flex-direction: column; gap: 6px; }
.gp-find { height: 36px; border-radius: 10px; }
.gp-list {
  list-style: none; margin: 0; padding: 0; outline: none;
  max-height: min(380px, 52vh); overflow-y: auto; overscroll-behavior: contain;
}
.popover.is-sheet .gp-list { max-height: 56dvh; }
/* Held at the height it opened at while it is filtered (game-picker.js holdHeight): the
   list scrolls inside it, and on a phone it still fits over the keyboard (what else the
   sheet holds — its top, the box, a foot — is --gp-chrome). */
.gp-hold { display: flex; flex-direction: column; min-height: 0; }
.gp-hold.is-held { height: var(--gp-hold); }
.gp-hold.is-held > .gp-list { max-height: none; flex: 0 1 auto; min-height: 0; }
.popover.is-sheet .gp-hold { --gp-chrome: 120px; }
.popover.is-sheet .mp-panel .gp-hold { --gp-chrome: 176px; }
.popover.is-sheet .gp-hold.is-held { max-height: calc(var(--vh, 100dvh) - var(--gp-chrome)); }
.gp-opt {
  display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 10px; border-radius: 9px;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.gp-opt.is-active { background: var(--bg-3); color: var(--ink); }
.gp-opt.is-on { color: var(--ink); font-weight: 650; }
.gp-opt.is-blank { color: var(--ink-3); }
.gp-opt[aria-disabled="true"] { opacity: .5; cursor: default; }
.gp-opt-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-tag { flex: none; font-size: 11px; color: var(--ink-3); }
.gp-check { flex: none; width: 14px; display: grid; place-items: center; color: var(--accent-text); }
.gp-none { margin: 6px 10px 8px; font-size: 13px; color: var(--ink-3); }
@media (hover: none), (pointer: coarse) {
  .gp-opt { min-height: 42px; font-size: 15px; }
  .gp-find { font-size: 16px; height: 40px; }
}

/* The dropdown that picks several (multi-picker.js): a checkbox on each, Clear at the foot. */
.mp-btn { width: 100%; }
.mp-box {
  flex: none; width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 35%, transparent);
  display: grid; place-items: center;
  transition: background var(--t-1) var(--ease-out), border-color var(--t-1) var(--ease-out);
}
.mp-opt.is-on .mp-box { background: var(--accent-fill); border-color: var(--accent-fill); }
.mp-opt.is-on .mp-box::after {
  content: ""; width: 8px; height: 4.5px; margin-top: -2px;
  border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink);
  rotate: -45deg;
}
.mp-opt.is-on { font-weight: 600; }
.mp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 4px 0; border-top: 1px solid var(--line-soft, var(--line));
}
.mp-summary { font-size: 12px; color: var(--ink-3); }

/* ---- Insert between cards (binder.js openInsertMenu): a card from search there, or an empty pocket. */
.popover.insert-pop { padding: 6px; }
.popover.insert-pop:not(.is-sheet) { width: min(280px, calc(100vw - 24px)); }
.insert-menu { display: grid; gap: 2px; }
.insert-menu-head { margin: 4px 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.insert-menu-item {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 8px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.insert-menu-item:hover, .insert-menu-item:focus-visible { background: color-mix(in srgb, var(--ink) 7%, transparent); outline: none; }
.insert-menu-ico {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  color: var(--accent-text, var(--accent)); background: color-mix(in srgb, var(--accent) 15%, transparent);
}
.insert-menu-ico svg { width: 16px; height: 16px; }
.insert-menu-item > span:last-child { display: grid; gap: 1px; min-width: 0; }
.insert-menu-item b { font-size: 13.5px; }
.insert-menu-item > span:last-child > span { font-size: 12px; color: var(--ink-3); }
