:root {
  --bg: #0c0d1c; --panel: #15172e; --line: rgba(255, 255, 255, .1); --ink: #eceeff; --dim: #9aa0c8; --gold: #ffd36e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(120% 80% at 50% 0%, #1d2046, var(--bg)); color: var(--ink); font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
button, a.ghost {
  font: inherit; color: var(--ink); background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 12px; cursor: pointer; text-decoration: none;
}
button:hover, a.ghost:hover { background: rgba(255, 255, 255, .12); }
button.primary { background: linear-gradient(180deg, #ffe38a, #f4b63e); color: #3a2600; border: 0; font-weight: 700; }

.top { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); }
.brand strong { font-size: 18px; margin-right: 10px; }
.brand span { color: var(--dim); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions b { color: var(--gold); }

.lab { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100% - 56px); }
body.favs-open .lab { grid-template-columns: 300px minmax(0, 1fr) 320px; }

/* Options: one row per dimension; the active row takes the arrow keys. */
.dims { overflow-y: auto; padding: 10px; border-right: 1px solid var(--line); background: rgba(0, 0, 0, .18); }
.dim { padding: 7px 10px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; }
.dim + .dim { margin-top: 3px; }
.dim.active { background: rgba(255, 211, 110, .1); border-color: rgba(255, 211, 110, .55); }
.dim-label { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.dim.active .dim-label { color: var(--gold); }
.dim-ctl { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 6px; margin-top: 2px; }
.dim-val { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dim-n { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.dim-ctl .arrow { padding: 2px 8px; font-size: 11px; border-radius: 7px; }
.dim-ctl .arrow:last-child { order: 4; }

.stage { overflow-y: auto; padding: 14px 24px 40px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 12px; }
.row-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.hint { color: var(--dim); font-size: 12px; }
.spread { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; align-items: start; }
.spread.compare { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 84%; }

.favs { border-left: 1px solid var(--line); overflow-y: auto; padding: 12px; background: rgba(0, 0, 0, .25); }
.favs-head { display: flex; justify-content: space-between; align-items: center; }
.favs-head h2 { font-size: 15px; margin: 0; }
.favs ol { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.favs li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.fav-text b { display: block; font-size: 13px; }
.fav-text span { color: var(--dim); font-size: 12px; }
.fav-btns { grid-column: 2; display: flex; gap: 6px; }
.fav-btns button { padding: 3px 10px; font-size: 12px; }
.fav-mini { grid-row: span 2; }
.favs-empty { color: var(--dim); }

/* ===========================================================================
   The card. Layers, bottom to top: fill, border, aura, character / pips,
   corner indices, finish. Everything inside is sized in cqw (card widths).
   =========================================================================== */
.card {
  --accent: #ffd36e; --rx: 0deg; --ry: 0deg; --mx: 50%;
  position: relative; aspect-ratio: var(--ar, 2 / 3); container-type: inline-size;
  border-radius: var(--radius, 2.2% / 1.5%); overflow: hidden; isolation: isolate;
  transition: translate .2s ease, transform .25s ease, box-shadow .25s ease;
  background: #1a1408;
}
.card > * { position: absolute; }
.c-fill { inset: 0; z-index: 1; }
.c-border { inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: 2; }
.c-aura { z-index: 3; left: 50%; top: 50%; width: 70cqw; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; }
.c-hero { inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 4; scale: var(--hero-scale); transform-origin: 50% 58%; filter: drop-shadow(0 1.2cqw 1.4cqw rgba(0, 0, 0, .35)); }
.c-big { z-index: 4; left: 50%; top: 50%; width: 46cqw; translate: -50% -50%; filter: drop-shadow(0 1cqw 1.6cqw rgba(0, 0, 0, .35)); }
.c-pips { z-index: 4; inset: 19% 21%; }
.c-pips .pip { position: absolute; width: var(--pip, 14cqw); translate: -50% -50%; filter: drop-shadow(0 .5cqw .6cqw rgba(0, 0, 0, .3)); }
.c-pips .pip.flip { rotate: 180deg; }
.c-numeral { z-index: 4; left: 0; right: 0; top: 30%; text-align: center; font: 700 44cqw/1 var(--font); }
.c-numeral-icon { z-index: 4; left: 50%; top: 66%; width: 16cqw; translate: -50% 0; }
.c-finish { inset: 0; z-index: 6; pointer-events: none; border-radius: inherit; }

/* Borrowed frames (an affinity the set has no art for) are recoloured toward it. */
.borrowed.aff-lightning .c-border { filter: hue-rotate(185deg) saturate(1.15) brightness(1.05); }

/* Inside the frame: shown behind a transparent window; a soft tint over painted parchment. */
.fill-0 .c-fill { background: linear-gradient(180deg, #fbf5e6, #efe3c6); }
.fill-1 .c-fill { background: radial-gradient(ellipse at 50% 40%, #f3e2b8, #d5b47a 90%); }
.fill-2 .c-fill { background: radial-gradient(ellipse at 50% 35%, #2b2d55, #0b0b1c 85%); }
.fill-3 .c-fill { background: radial-gradient(ellipse at 50% 40%, #fff8ea 10%, color-mix(in srgb, var(--accent) 45%, #f6ecd4) 95%); }
.fill-4 .c-fill { background: radial-gradient(1px 1px at 20% 30%, #fff 50%, transparent), radial-gradient(1px 1px at 70% 20%, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 40% 70%, #fff 50%, transparent), radial-gradient(1px 1px at 85% 75%, #fff 50%, transparent), radial-gradient(ellipse at 50% 30%, #2d2a6a, #0a0a1e 85%); }
.fill-5 .c-fill { background: linear-gradient(115deg, transparent 40%, rgba(120, 110, 100, .15) 45%, transparent 52%), linear-gradient(60deg, transparent 60%, rgba(120, 110, 100, .12) 64%, transparent 70%), linear-gradient(180deg, #f7f4ef, #e6e0d6); }
.win-art .c-fill { display: none; }
.win-css .c-fill { inset: 6% 7%; border-radius: 4cqw; }
.win-css.fill-2 .c-rank, .win-css.fill-4 .c-rank { --dark-bg: 1; }

/* Behind the character: still light, no motion. */
.aura-none .c-aura { display: none; }
.aura-faint .c-aura { width: 80cqw; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 32%, transparent), transparent); }
.aura-soft .c-aura { width: 84cqw; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 70%, transparent), transparent); }
/* Wider: the light spreads to the frame instead of hugging the character. */
.aura-wide .c-aura { width: 120cqw; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--accent) 22%, transparent) 55%, transparent); }
.aura-faintwide .c-aura { width: 124cqw; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--accent) 10%, transparent) 60%, transparent); }
.aura-rays .c-aura { width: 100cqw; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 70%, transparent) 0 6deg, transparent 6deg 18deg); -webkit-mask: radial-gradient(closest-side, #000 20%, transparent); mask: radial-gradient(closest-side, #000 20%, transparent); }
.aura-starburst .c-aura { width: 104cqw; background:
    repeating-conic-gradient(from 3deg, color-mix(in srgb, var(--accent) 85%, transparent) 0 1.6deg, transparent 1.6deg 7.5deg),
    repeating-conic-gradient(from 0deg, rgba(214, 150, 40, .7) 0 1deg, transparent 1deg 15deg),
    radial-gradient(closest-side, color-mix(in srgb, var(--accent) 45%, transparent), transparent 60%);
  -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 96%); mask: radial-gradient(closest-side, #000 10%, transparent 96%); }
.aura-mist .c-aura { width: 104cqw; background:
    radial-gradient(circle at 28% 62%, color-mix(in srgb, var(--accent) 70%, transparent), transparent 34%),
    radial-gradient(circle at 72% 44%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 36%),
    radial-gradient(circle at 50% 78%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 34%),
    radial-gradient(circle at 56% 28%, rgba(220, 160, 60, .5), transparent 30%); filter: blur(2.4cqw); }
.aura-shadow .c-aura { top: auto; bottom: 14%; width: 60cqw; aspect-ratio: 4 / 1; translate: -50% 0; background: radial-gradient(closest-side, rgba(0, 0, 0, .45), transparent); }
.number .c-aura, .ace.aura-shadow .c-aura { display: none; }
.ace .c-aura { width: 84cqw; }

/* Corner indices. */
.c-idx { z-index: 5; left: 12.5%; top: 10.5%; display: flex; flex-direction: column; align-items: center; gap: .6cqw; }
.c-idx.br { left: auto; top: auto; right: 12.5%; bottom: 10.5%; rotate: 180deg; }
.c-rank { font-family: var(--font); font-weight: 700; line-height: .9; font-size: var(--rank, 12cqw); }
.c-ico { width: var(--ico, 10cqw); height: auto; filter: drop-shadow(0 .3cqw .4cqw rgba(0, 0, 0, .35)); }
.rs-0 { --rank: 9cqw; } .rs-1 { --rank: 12cqw; } .rs-2 { --rank: 15.5cqw; } .rs-3 { --rank: 20cqw; }
.is-0 { --ico: 7cqw; } .is-1 { --ico: 10cqw; } .is-2 { --ico: 13cqw; } .is-3 { --ico: 17cqw; }
.ps-0 { --pip: 11cqw; } .ps-1 { --pip: 14cqw; } .ps-2 { --pip: 18cqw; }
.corner-2 .c-rank { display: grid; place-items: center; width: calc(var(--rank) * 1.55); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 60%, #fff), color-mix(in srgb, var(--accent) 70%, #000)); border: .8cqw solid #f6d27a; font-size: calc(var(--rank) * .9); }
.corner-3 .c-idx { flex-direction: row; gap: 1cqw; }

/* Rank colour. */
.ink-0 .c-rank { color: color-mix(in srgb, var(--accent) 80%, #000); text-shadow: 0 .2cqw 0 rgba(255, 255, 255, .5); }
.ink-1 .c-rank { background: linear-gradient(180deg, #fff3c4 5%, #f2c14e 45%, #a8680f 90%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: .25cqw #5a3606; }
.ink-2 .c-rank { color: #1b1410; }
.ink-3 .c-rank { background: linear-gradient(180deg, #ffffff 5%, #c9d1dc 50%, #6d7787 90%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: .25cqw #2c3340; }
.ink-4 .c-rank { color: #fff; -webkit-text-stroke: .5cqw #1b1410; paint-order: stroke fill; }
.corner-2.ink-1 .c-rank, .corner-2.ink-3 .c-rank { -webkit-text-fill-color: transparent; }

/* Finish. */
.finish-shadow { box-shadow: 0 4px 12px rgba(0, 0, 0, .55); }
.finish-sheen .c-finish { background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .5) 42%, transparent 50%, transparent 62%, rgba(255, 255, 255, .3) 68%, transparent 74%); mix-blend-mode: soft-light; }
.finish-glow { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, #fff), 0 0 16px color-mix(in srgb, var(--accent) 70%, transparent); }
/* The same edge glow, tighter and quieter. */
.finish-softglow { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, #fff), 0 0 7px color-mix(in srgb, var(--accent) 40%, transparent); }

/* Hover. */
.hover-0:hover { translate: 0 -8px; }
.hover-1 { transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry)); }
.hover-1:hover { transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry)) scale(1.04); transition: transform .06s linear; }
.hover-1:hover .c-finish { background-image: radial-gradient(circle at var(--mx) var(--my, 30%), rgba(255, 255, 255, .35), transparent 45%); mix-blend-mode: soft-light; }

@media (max-width: 1100px) {
  .spread { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .spread.compare { max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .card *, .card { animation: none !important; transition: none !important; } }

/* Card corners: the art's own square edge, or a light trim. (Percentages: the card is not its own container.) */
.radius-0 { --radius: 0; }
.radius-1 { --radius: 2.2% / 1.5%; }
.radius-2 { --radius: 5% / 3.4%; }

/* Verdicts: ✕ get rid of it, ✓ keep it, ↻ try again, for the value showing in each row. */
.verdicts { display: flex; gap: 4px; margin-top: 5px; }
button.vd { width: 28px; height: 24px; padding: 0; font-size: 13px; font-weight: 800; line-height: 1; border-radius: 7px; color: var(--dim); }
button.vd-cancel.on { background: #c8322a; border-color: #ff8a80; color: #fff; }
button.vd-keep.on { background: #1f9d4f; border-color: #6ff0a0; color: #fff; }
button.vd-retry.on { background: #c48a12; border-color: #ffd36e; color: #fff; }
.dim.v-cancel { box-shadow: inset 3px 0 0 #e0473a; }
.dim.v-keep { box-shadow: inset 3px 0 0 #46d66f; }
.dim.v-retry { box-shadow: inset 3px 0 0 #ffd36e; }
.dim.v-cancel .dim-val { text-decoration: line-through; color: #ff9b93; }
.verdict-tools { display: flex; align-items: center; gap: 6px; padding-left: 8px; border-left: 1px solid var(--line); color: var(--dim); }
.verdict-tools b { color: var(--gold); }
button.subtle { color: var(--dim); }

/* Each card's own bar: version dots, verdicts and a note. */
.slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.slot-bar { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.dots { display: flex; gap: 6px; }
button.dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .45); background: transparent; }
button.dot.on { background: var(--gold); border-color: var(--gold); }
.slot-btns { display: flex; gap: 4px; }
button.vd-edit.on { background: #3a6fd8; border-color: #9ec2ff; color: #fff; }
.slot-note { margin: 0; font-size: 12px; color: #c9d4ff; background: rgba(58, 111, 216, .15); border-radius: 8px; padding: 4px 8px; }
.card.cycle { cursor: pointer; }
/* The frame's mark rings the card; the character's mark lights the art inside. */
.card.frame-v-keep { outline: 3px solid #46d66f; outline-offset: 2px; }
.card.frame-v-cancel { outline: 3px dashed #e0473a; outline-offset: 2px; }
.card.frame-v-retry { outline: 3px solid #ffd36e; outline-offset: 2px; }
.card.art-v-cancel .c-hero, .card.art-v-cancel .c-big, .card.art-v-cancel .c-pips { opacity: .35; filter: grayscale(1); }
.card.art-v-keep::after, .card.art-v-retry::after, .card.art-v-cancel::after {
  position: absolute; z-index: 7; left: 50%; bottom: 3%; translate: -50% 0; padding: 1px 7px; border-radius: 999px; font: 800 11px/1.4 system-ui; color: #fff;
}
.card.art-v-keep::after { content: "✓ art"; background: #1f9d4f; }
.card.art-v-retry::after { content: "↻ art"; background: #c48a12; }
.card.art-v-cancel::after { content: "✕ art"; background: #c8322a; }
.card.number.art-v-keep::after, .card.ace.art-v-keep::after { content: "✓ icon"; }
.card.number.art-v-retry::after, .card.ace.art-v-retry::after { content: "↻ icon"; }
.card.number.art-v-cancel::after, .card.ace.art-v-cancel::after { content: "✕ icon"; }
.more-adders { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--dim); margin: -8px 0 20px; }
#more .row-head button { padding: 3px 10px; font-size: 12px; }

.slot-line { display: flex; align-items: center; gap: 3px; flex-wrap: nowrap; }
.slot-line button.vd { width: 24px; }
.slot-label { width: 40px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); text-align: right; padding-right: 4px; }

/* Rows that would change nothing with the current choices. */
.dim.na { opacity: .4; }
.dim.na .dim-label em { font-style: normal; text-transform: none; letter-spacing: 0; }
