/* The building blocks of the personal part of the site (`/app`): panels,
 * buttons, fields, tables, overlays, the toast. The frame is the site's own
 * header (`site.css`); the site's look over these blocks is the last section
 * of this file.
 *
 * There is no build step and no CDN. Everything the browser loads is in this
 * folder, which is the same bargain `research/charts.py` already makes for the
 * HTML report: a file you can open in ten years is worth more than a toolchain.
 */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-app);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
}

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

/* Links are underlined accent only inside prose. Everywhere else in this
   application an anchor is a *surface* - a shelf tile, a result row, a button -
   and those carry their own colour, so the browser default would paint the card
   name inside every tile a hyperlink blue. */
a { color: inherit; text-decoration: none; }
 .body a, .hint a { color: var(--accent); }
 .body a:hover, .hint a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(246, 242, 236, 0.13);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(246, 242, 236, 0.26);
  background-clip: content-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(246,242,236,.16) transparent; }

/* ---------------------------------------------------------------- shell --- */

#app { min-width: 0; }

kbd {
  font-family: var(--sans);
  font-size: var(--fs-caption);
  color: var(--fg-faint);
  background: rgba(246, 242, 236, 0.06);
  border-radius: 5px;
  padding: 2px 6px;
  white-space: nowrap;
}

.progress {
  height: 2px;
  flex: none;
  overflow: hidden;
  background: transparent;
}
.progress.on::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent);
  animation: slide 1.4s var(--ease-soft) infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* The page: a lighter, rounded slab inset from the window edge. */
.page {
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 2px 14px 14px;
  background: var(--bg-page);
  border-radius: var(--r-xl);
  overflow: hidden;
  position: relative;
}

.view { height: 100%; overflow: auto; display: none; min-width: 0; }
.view.active { display: block; animation: fade var(--dur-base) var(--ease-soft); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.scroll-page { padding: 26px 30px 34px; }

/* ------------------------------------------------------------- typography - */

.display { font-size: var(--fs-display); font-weight: 600; letter-spacing: -0.8px; }
.title { font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.4px; margin: 0; }
.heading { font-size: var(--fs-heading); font-weight: 600; letter-spacing: -0.1px; margin: 0; }
.subtitle { color: var(--fg-dim); font-size: var(--fs-body); margin: 0; }
.body { color: var(--fg-dim); font-size: var(--fs-small); }
.muted { color: var(--fg-muted); font-size: var(--fs-small); }

.overline {
  color: var(--fg-faint); font-size: var(--fs-caption); font-weight: 700;
  letter-spacing: 0.7px; text-transform: uppercase;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.measure { max-width: 900px; }

.section-header { margin: 10px 0 4px; }
.section-header .heading { margin-bottom: 3px; }
.section-header .subtitle { font-size: var(--fs-small); color: var(--fg-muted); }
.section-header-row { display: flex; align-items: flex-end; gap: var(--s3); }
.section-header-row .section-header { flex: 1; }

hr.rule { border: none; border-top: 1px solid var(--grid); margin: var(--s5) 0; }

.hint {
  color: var(--fg-muted);
  font-size: var(--fs-small);
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  padding: 13px 15px;
  line-height: 1.55;
}

/* A panel is a lit surface: slightly brighter at the top than the bottom, with
   a hairline that catches the light. That is what separates "raised" from
   "merely a different grey" - a flat fill ten levels lighter than the page is
   invisible at a glance, and a 1px outline on a flat fill is the developer-tool
   look this design exists to leave behind. */
.panel {
  background: linear-gradient(180deg, #2b2522, #221e1b);
  border: 1px solid rgba(246, 242, 236, 0.055);
  border-radius: var(--r-lg);
}
.tile { border-radius: var(--r-md); }
.quiet {
  background: var(--bg-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
}

/* --------------------------------------------------------------- buttons -- */

.btn {
  background: linear-gradient(180deg, #322b27, #292320);
  border: 1px solid rgba(246, 242, 236, 0.07);
  border-radius: var(--r-md);
  padding: 7px 14px;
  color: var(--fg-dim);
  font-size: var(--fs-small);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover {
  background: linear-gradient(180deg, #3d3530, #332c28);
  border-color: rgba(246, 242, 236, 0.12);
  color: var(--fg);
}
.btn:active { background: var(--bg-panel); }
.btn:disabled { color: var(--fg-faint); background: rgba(45, 39, 36, 0.5);
  cursor: default; }
.btn[aria-pressed="true"] {
  background: var(--accent-wash); color: var(--fg);
  border-color: rgba(57, 135, 229, 0.5);
}

.btn.primary {
  background: linear-gradient(180deg, var(--pos-strong), var(--accent));
  color: #fff;
  border: 1px solid rgba(246, 242, 236, 0.22);
  font-weight: 600;
  padding: 8px 16px;
}
.btn.primary:hover {
  background: linear-gradient(180deg, #8dbbf1, var(--pos-strong));
  border-color: rgba(246, 242, 236, 0.34);
}
.btn.ghost {
  background: transparent; border: none; color: var(--fg-muted);
  padding: 5px 8px;
}
.btn.ghost:hover { color: var(--accent); background: rgba(57, 135, 229, 0.1); }

/* A chip is a filter you can toggle, so it looks like a switch, not a button. */
.chip {
  padding: 6px 14px;
  font-size: var(--fs-small);
  border-radius: var(--r-pill);
  background: rgba(246, 242, 236, 0.05);
  border: 1px solid transparent;
  color: var(--fg-dim);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { background: rgba(246, 242, 236, 0.09); color: var(--fg); }
.chip[aria-pressed="true"] {
  background: var(--accent); color: #fff; border-color: var(--accent);
  font-weight: 600;
}

/* ---------------------------------------------------------------- badges -- */

.badge {
  display: inline-flex; align-items: center;
  border-radius: var(--r-pill);
  padding: 2px 9px;
  font-size: var(--fs-micro);
  font-weight: 600;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 13%, transparent);
  white-space: nowrap;
}

/* Filled, not outlined. The border appears on focus, where it means something. */
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 7px 11px;
  color: var(--fg);
  outline: none;
  width: 100%;
}
input:hover, select:hover { background: var(--bg-hover); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--fg-faint); }
textarea { resize: vertical; line-height: 1.5; font-family: var(--sans); }

.search-field {
  font-size: 14px; padding: 10px 15px; border-radius: var(--r-pill);
}

label.check {
  display: flex; align-items: flex-start; gap: 9px;
  color: var(--fg-dim); padding: 3px 0; cursor: pointer;
  font-size: var(--fs-small);
}
label.check:hover { color: var(--fg); }
input[type="checkbox"] {
  appearance: none; width: 16px; height: 16px; margin: 1px 0 0;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg-elevated); cursor: pointer; flex: none;
}
input[type="checkbox"]:checked {
  background: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
  background-size: contain;
}

input[type="range"] {
  appearance: none; width: 100%; height: 4px; padding: 0; margin: 10px 0;
  background: var(--bg-elevated); border-radius: 2px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--fg); border: none; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--fg); border: none; cursor: pointer;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%238e867b' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 10px;
  padding-right: 30px;
}
select option { background: var(--bg-elevated); }

/* Fields default to `width: 100%`, which inside a flex row makes every one of
   them fight for the whole line. In a row they size to their content unless a
   `.grow` wrapper says otherwise. */
.row { display: flex; align-items: center; gap: var(--s2); }
.row > select, .row > input:not(.grow) { width: auto; flex: none; }
.row > .grow > input, .row > .grow > select { width: 100%; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }

.stack-8 > * + * { margin-top: var(--s2); }
.stack-12 > * + * { margin-top: var(--s3); }
.stack-16 > * + * { margin-top: var(--s4); }

/* ------------------------------------------------------------ empty state - */

.empty {
  display: grid; place-items: center; text-align: center;
  padding: 60px 30px; gap: var(--s3); height: 100%;
  align-content: center;
}
.empty svg { width: 46px; height: 46px; color: var(--fg-faint); }
.empty h3 { margin: 0; font-size: var(--fs-heading); font-weight: 600; }
.empty p { margin: 0; max-width: 460px; color: var(--fg-muted);
  font-size: var(--fs-small); line-height: 1.6; }

/* ------------------------------------------------------------- card art --- */

.art {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
  flex: none;
  background: linear-gradient(135deg, #2f2925, #211c19);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  aspect-ratio: 5 / 7;
}
/* The image is in the plate from the start but only shown once it has decoded,
   so a half-loaded or broken picture never flashes over the placeholder. */
.art img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  opacity: 1; transition: opacity var(--dur-base) var(--ease-soft);
}
.art.placeholder img { opacity: 0; }

/* A card-shaped plate with a ball watermark, not a grey slab with a dot in it.
   Several of the highest-scoring printings in this dataset genuinely have no
   artwork at TCGplayer, so this stands in at hero size fairly often - a blank
   rectangle there reads as a failed image rather than as a card we have no
   picture of. */
.art.placeholder::after {
  content: "";
  position: absolute; inset: 9%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  background: no-repeat center / 34% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.12)' stroke-width='1.6'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3Cpath d='M3 12h5.8M15.2 12H21'/%3E%3C/svg%3E");
}

/* ----------------------------------------------------------- rarity pips -- */

.pip { width: 11px; height: 11px; flex: none; display: inline-block; }

/* ----------------------------------------------------------------- toast -- */

.toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translate(-50%, 14px);
  background: var(--bg-floating);
  border: 1px solid rgba(246, 242, 236, 0.09);
  border-radius: var(--r-md);
  padding: 11px 17px;
  font-size: var(--fs-small);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-soft),
              transform var(--dur-base) var(--ease-soft);
  z-index: 90;
  max-width: min(680px, 88vw);
  display: flex; align-items: center; gap: 9px;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.toast span { color: var(--fg-dim); }

/* --------------------------------------------------------------- overlay -- */

.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 5, 4, 0.62);
  backdrop-filter: blur(2px);
  display: none;
  animation: fade var(--dur-fast) var(--ease-soft);
}
.overlay.on { display: block; }

.dialog {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: 84px;
  width: min(880px, 92vw);
  max-height: calc(100vh - 150px);
  background: var(--bg-floating);
  border: 1px solid rgba(246, 242, 236, 0.09);
  border-radius: var(--r-lg);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* Horizontal separation only. A full grid makes every cell look equally
   load-bearing, which is exactly the spreadsheet feel to avoid. */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body);
  background: var(--bg-panel);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.data-table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-panel);
  color: var(--fg-muted);
  font-size: var(--fs-micro);
  font-weight: 600;
  text-align: right;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.data-table th.left, .data-table td.left { text-align: left; }
.data-table th:hover { background: var(--bg-hover); color: var(--fg-dim); }
.data-table td {
  padding: 0 10px;
  height: var(--compact-row);
  border-bottom: 1px solid var(--grid);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table tbody tr[aria-selected="true"] td { background: var(--bg-select); }
.data-table td.name { font-weight: 600; }
.data-table td.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.table-wrap { overflow: auto; border-radius: var(--r-lg); height: 100%; }

/* ======================================================= the site's look == */
/* Since 2026-09-26 the app is the personal part of the site, under the site's
   own header (`site.css`): the document scrolls like any page, the content
   sits on the site's 1120px measure, and the building blocks every view is
   made of - panels, headings, buttons, fields, tables, the overlays - wear the
   same materials as the public pages: Sora for display type, parchment
   headlines, framed panels with a gilt hairline. Gilt stays chrome; the data
   colours are untouched (theme.css). Restyling the blocks rather than each
   view is the point: a view built from them cannot drift from the site. */

body { height: auto; min-height: 100%; }
.page { margin: 0; background: none; border-radius: 0; overflow: visible; }
.view { height: auto; overflow: visible; }
.scroll-page { max-width: 1120px; margin: 0 auto; padding: 22px 16px 72px; }
.boot { top: 63px; }

/* The tabs of "My cards", under the site header. */
.pv-subnav { border-bottom: 1px solid var(--hairline); }
.pv-subnav-in {
  max-width: 1120px; margin: 0 auto; padding: 18px 16px 12px;
  display: flex; align-items: center; gap: 18px; min-width: 0;
}
.pv-subnav-title {
  font-family: var(--display); font-weight: 700; font-size: 22px;
  color: var(--parchment); letter-spacing: -.01em; white-space: nowrap;
}
.pv-subtabs { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.pv-subtabs::-webkit-scrollbar { display: none; }
.pv-subtab {
  padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--fg-muted);
  border: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.pv-subtab:hover { color: var(--parchment); }
.pv-subtab[aria-current="page"] {
  color: var(--parchment); border-color: var(--gilt-soft);
  background: linear-gradient(180deg, rgba(200, 170, 110, .15), rgba(200, 170, 110, .05));
}
.pv-subtab[data-view="admin"] { color: var(--gilt); }
.progress { max-width: 1120px; margin: 0 auto; }

/* Type. */
.display,
.title,
.heading,
.section-header .heading,
.empty h3 {
  font-family: var(--display); color: var(--parchment); letter-spacing: -.01em;
}
.section-header { margin: 4px 0 6px; }
.section-header .heading { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.section-header .subtitle { font-size: 14px; color: var(--fg-dim); max-width: 72ch; }
.scroll-page h3 { font-family: var(--display); }
.overline, .cap {
  font-family: var(--display); color: var(--gilt); letter-spacing: .1em;
}

/* Panels: the site's framed panel. */
.panel {
  background: var(--panel-grad), var(--bg-panel);
  border: 1px solid var(--gilt-line); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 18px 40px -30px #000;
}
.quiet { background: var(--bg-sunken); border-color: var(--border); border-radius: 14px; }
.hint { border-left: 2px solid var(--gilt-soft); border-radius: 0 10px 10px 0; }

/* Buttons: the site's. */
.btn {
  min-height: 36px; padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--fg-dim); background: var(--bg-panel); border: 1px solid var(--gilt-line);
}
.btn:hover { color: var(--parchment); background: var(--bg-elevated); border-color: var(--gilt-soft); }
.btn[aria-pressed="true"] {
  color: var(--parchment); border-color: var(--gilt); background: rgba(200, 170, 110, .12);
}
.btn.primary { color: #fff; background: var(--accent); border: 0; padding: 8px 18px; }
.btn.primary:hover { background: var(--pos-strong); }
.btn.ghost { border: 0; background: none; border-radius: 10px; }
.btn.ghost:hover { color: var(--parchment); background: var(--bg-hover); }
.chip[aria-pressed="true"] { color: var(--parchment); background: rgba(200, 170, 110, .14);
  border-color: var(--gilt); }

/* Fields. */
input[type="text"], input[type="number"], input[type="search"], input[type="email"],
input[type="password"], input[type="date"], select, textarea {
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 10px;
}
input:hover, select:hover { background: var(--bg-sunken); border-color: var(--gilt-line); }
input:focus, select:focus, textarea:focus {
  border-color: var(--gilt-soft); box-shadow: 0 0 0 3px rgba(200, 170, 110, .1);
}
input[type="checkbox"] { border-color: var(--gilt-soft); background-color: var(--bg-sunken); }
input[type="checkbox"]:checked { background-color: var(--gilt); border-color: var(--gilt); }

/* Tables. */
.table-wrap { height: auto; border: 1px solid var(--gilt-line); border-radius: 14px; }
.data-table, .data-table th { background: var(--bg-panel); }
.data-table th {
  font-family: var(--display); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gilt);
}

/* Overlays, the popover and the toast: the site's. */
.overlay { background: rgba(8, 6, 5, .74); backdrop-filter: blur(3px); }
.dialog {
  background: var(--panel-grad), var(--bg-floating); border: 1px solid var(--gilt-soft);
  border-radius: 18px; box-shadow: 0 40px 120px -20px #000;
}
.toast {
  background: var(--bg-floating); border: 1px solid var(--gilt-soft); border-radius: 12px;
}
/* The password-reset view's form (`views/reset-password.js`): the account
   panel's fields (`site.css` .pv-dfield), under the classes it was built with. */
.auth-form { max-width: 420px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label { font-size: 12.5px; color: var(--fg-dim); }
.auth-field input { width: 100%; min-height: 44px; padding: 9px 12px; font-size: 15px; }
.auth-error { margin: 0; font-size: 13px; color: var(--neg-strong); line-height: 1.5; }
.auth-error:empty { display: none; }

/* Tabs inside a view (the admin panel): the tab row's own material. */
.tabs { border-bottom: 1px solid var(--gilt-line); gap: 4px; }
.tab {
  font-family: var(--display); font-size: 12.5px; font-weight: 600; color: var(--fg-muted);
  border-radius: 10px 10px 0 0; padding: 9px 15px;
}
.tab:hover { color: var(--parchment); background: rgba(200, 170, 110, .06); }
.tab[aria-selected="true"] {
  color: var(--parchment); background: rgba(200, 170, 110, .1);
  box-shadow: inset 0 -2px 0 var(--gilt);
}
.empty svg { color: var(--gilt-soft); }
.empty h3 { font-size: 22px; margin: 0; }
.empty p { max-width: 54ch; color: var(--fg-dim); line-height: 1.55; margin: 0; }

@media (max-width: 640px) {
  .boot { top: 94px; }
  .pv-subnav-in { flex-wrap: wrap; gap: 10px; padding: 14px 16px 10px; }
  .pv-subtabs { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 12px; }
  .scroll-page { padding: 16px 16px 56px; }
  .section-header .heading { font-size: 22px; }
}
