/* Card layouts (js/views/cards-layouts.js, cards-fx.js binderPages): the inspector and Compare
   mode, the thumbnail strip, the "Card effects" panel, binder chips / numbered ghosts / checklist,
   the showcase shelf, and the fan and coverflow arrangements. Theme tokens come from the app
   (--panel, --line, --text, --accent ...); reduced motion removes rotation, inertia and loops. */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tc-chipbtn { font: inherit; font-size: 13px; font-weight: 600; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; min-height: 30px; }
.tc-chipbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }
.tc-chipbtn:focus-visible, .tb-chip:focus-visible, .tc-thumb:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- Card effects panel ------------------------------------------------------------------- */
.tc-fxset { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 0 12px; }
.tc-fxset > summary { cursor: pointer; padding: 8px 0; font-weight: 700; font-size: 14px; }
.tc-fxset-body { display: flex; flex-direction: column; gap: 8px; padding: 0 0 10px; }
.tc-fxset-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tc-fxset-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.tc-fxset .tc-gyro-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }

/* ---- inspector --------------------------------------------------------------------------------- */
.tc-modal-card .tc-modal-box { max-width: min(1000px, 100%); }
.tc-viewer-main { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1 1 400px; min-width: 0; max-width: min(100%, 640px); }
.tc-stage.tc-stage-3d { cursor: grab; touch-action: pan-y; gap: 14px; align-items: center; border-radius: 14px; max-width: 100%; user-select: none; -webkit-user-select: none;
	background: radial-gradient(70% 60% at 50% 42%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 72%); }
.tc-stage.tc-stage-3d.is-zoomed { overflow: clip; }
.tc-stage.tc-stage-3d:active { cursor: grabbing; }
.tc-stage.is-compare { flex-wrap: wrap; }
.tc-stage.is-compare .tc-lg { --tcw: min(270px, calc(50vw - 36px)); }
.tc-stage .tc-cmp-b { outline-offset: 4px; }
.tc-insp-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: center; max-width: 100%; }
.tc-insp-tools .tc-zoom { min-width: 34px; }
.tc-insp-tools .tc-cmp-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }
.tc-insp-hint { flex: 1 1 100%; text-align: center; margin: 0; }
.tc-cmp-pick { display: inline-flex; gap: 6px; align-items: center; }
.tc-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 4px 8px; width: 100%; max-width: 100%; min-width: 0; scroll-snap-type: x proximity; align-items: flex-end; }
.tc-thumbs[hidden] { display: none; }
.tc-thumb { flex: 0 0 auto; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 3px 2px; border-radius: 8px; border: 2px solid transparent; background: none; color: var(--text); cursor: pointer; font: inherit; }
.tc-thumb .tc { --tcw: 58px; pointer-events: none; }
.tc-thumb[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tc-thumb.is-b { border-style: dashed; }
.tc-thumb.is-a.is-b { border-style: solid; }
.tc-thumb-cap { font-size: 10px; font-weight: 700; color: var(--dim); white-space: nowrap; }
.tc-thumb-more { align-self: center; white-space: nowrap; padding: 0 6px; }
/* compare table: the winner carries a ▲ marker as well as a bold weight (never colour alone) */
.tc-cmp-panel { border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 8px; background: var(--panel-2); }
.tc-cmp-h { margin: 0 0 6px; font-size: 14px; }
.tc-cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tc-cmp-table th, .tc-cmp-table td { padding: 4px 4px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tc-cmp-table thead th { font-size: 12px; }
.tc-cmp-table td.v { text-align: right; white-space: nowrap; }
.tc-cmp-table td.win { font-weight: 800; }
.tc-cmp-table .tc-up { color: var(--good, #1c8f4a); font-size: 10px; }
.tc-cmp-table td.d { color: var(--dim); }
.tc-cmp-tag { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 4px; font-size: 10px; font-weight: 900; text-align: center; background: var(--accent); color: var(--accent-ink, #fff); }
.tc-cmp-tag.b { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text); }
.tc-cmp-find { position: relative; margin-top: 6px; }
.tc-cmp-search { width: 100%; }
.tc-cmp-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin: 2px 0 0; padding: 4px; list-style: none; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 20px rgba(0, 0, 0, .25); }
.tc-cmp-results button { width: 100%; text-align: left; font: inherit; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); cursor: pointer; }
.tc-cmp-results button:hover, .tc-cmp-results button:focus-visible { background: var(--panel-2); outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
@media (max-width: 560px) {
	.tc-stage.tc-stage-3d { gap: 6px; padding-left: 2px; padding-right: 2px; }
	.tc-stage.is-compare .tc-lg { --tcw: min(190px, calc(50vw - 34px)); }
	.tc-viewer-side { max-width: none; flex-basis: 100%; }
}

/* ---- binder: chips, numbered ghosts, checklist ---------------------------------------------- */
.tb-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 0 0 10px; }
.tb-chip { font: inherit; font-size: 13px; font-weight: 700; padding: 3px 12px; min-height: 30px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.tb-chips .tb-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink, #fff); border-color: transparent; }
.tb-pocket.tb-missing .tc-ghost { background: transparent; }
.tb-pocket.tb-missing { background: none; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .22); }
.tb-pocket.tb-missing::after { display: none; }
.tb-num { font-size: 26px !important; letter-spacing: -.02em; opacity: .5 !important; font-variant-numeric: tabular-nums; }
.tb-binder .tc-ghost { --tcw: 100%; }
.tb-check { position: relative; display: flex; gap: 1px; height: 14px; margin: 12px auto 4px; max-width: 760px; padding: 2px; border-radius: 7px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; touch-action: manipulation; }
.tb-check i { flex: 1 1 0; min-width: 0; border-radius: 2px; background: rgba(128, 128, 128, .28); }
.tb-check.tb-dense { gap: 0; }
.tb-check i.own { background: var(--c, var(--accent)); }
.tb-check i.own[style*="--f"] { background: linear-gradient(90deg, var(--accent) var(--f), rgba(128, 128, 128, .28) var(--f)); }
.tb-check-win { position: absolute; top: -2px; bottom: -2px; border-radius: 5px; box-shadow: 0 0 0 2px var(--text); pointer-events: none; transition: left .3s, width .3s; }
.tb-check-cap { text-align: center; }
.tb-book { touch-action: pan-y; }
@media (prefers-reduced-motion: reduce) { .tb-check-win { transition: none; } }

/* ---- showcase shelf --------------------------------------------------------------------------- */
.tc-wall { display: flex; flex-direction: column; gap: 6px; padding: 16px 8px 4px; margin: 8px 0 14px; border-radius: 16px;
	background: radial-gradient(60% 80% at 50% -10%, rgba(255, 235, 180, .3), transparent 60%), linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 80%, #d9cdb0), var(--panel-2)); box-shadow: inset 0 0 0 1px var(--line); }
.tc-shelf { position: relative; margin: 0 0 30px; }
.tc-shelf-row { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0 10px; display: flex; gap: 18px; justify-content: center; align-items: flex-end; perspective: 1200px; }
.tc-slabbox { flex: 0 1 190px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; transform: rotateX(-4deg); transform-origin: 50% 100%; transition: transform .25s; }
.tc-slabbox:hover, .tc-slabbox:focus-within { transform: rotateX(0) translateZ(26px) translateY(-8px); }
.tc-slabcase { position: relative; width: 100%; padding: 6px 6px 0; border-radius: 10px; background: linear-gradient(160deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, .12) 40%, rgba(255, 255, 255, .28)); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5), 0 6px 14px rgba(0, 0, 0, .25); }
.tc-slabcase::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, .22) 48%, transparent 58%); z-index: 4; }
.tc-slabwin .tc { --tcw: 100%; max-width: none; }
.tc-slablab { display: flex; justify-content: space-between; gap: 6px; margin: 5px -6px 0; padding: 3px 8px; border-radius: 0 0 9px 9px; background: #f5f3ec; color: #111; font: 700 10px/1.3 system-ui, sans-serif; letter-spacing: .05em; text-transform: uppercase; }
.tc-slab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tc-slab-val { white-space: nowrap; }
.tc-plank { position: absolute; left: -1%; right: -1%; bottom: -14px; height: 18px; z-index: 0; border-radius: 3px; background: linear-gradient(180deg, #dcb27a, #b98b55); box-shadow: 0 10px 14px rgba(0, 0, 0, .3); transform: perspective(500px) rotateX(35deg); transform-origin: 50% 0; }
:root[data-theme="dark"] .tc-plank { background: linear-gradient(180deg, #82603a, #5b4326); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tc-plank { background: linear-gradient(180deg, #82603a, #5b4326); } }
.tc-slabbox.is-empty .tc-empty-slot { --tcw: 100%; }
.tc-slabbox .tc-empty-slot { width: 100%; max-width: 190px; }
.tc-unpin { margin-top: 2px; }
@media (max-width: 640px) {
	.tc-shelf-row { justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 10px; padding-bottom: 20px; gap: 12px; -webkit-overflow-scrolling: touch; perspective: none; }
	.tc-slabbox { flex: 0 0 min(44vw, 200px); scroll-snap-align: center; transform: none; }
	.tc-slabbox:hover, .tc-slabbox:focus-within { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .tc-slabbox { transform: none !important; transition: none; } .tc-shelf-row { scroll-behavior: auto; } }

/* ---- fan and coverflow (Starting five, the pack summary) ---------------------------------------- */
.tc-arr-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: center; margin: 4px 0 10px; }
/* Fan: cards in an arc from --i / --n / --mid; the hovered or focused one steps forward. */
.tc-arr-fan { --w: clamp(104px, 17vw, 170px); --step: calc(min(6.5, 55 / var(--n, 5)) * 1deg); position: relative; display: block !important; height: calc(var(--w) * 1.4 + 90px); margin: 0 auto 6px; container-type: inline-size; overflow: visible; }
.tc-arr-fan > * { position: absolute !important; left: 50%; bottom: 14px; top: auto !important; width: var(--w) !important; margin: 0 0 0 calc(var(--w) / -2) !important; transform-origin: 50% 170%;
	--gap: clamp(12px, calc((100cqw - var(--w)) / max(1, var(--n) - 1) * .78), 64px);
	transform: translateX(calc((var(--i) - var(--mid)) * var(--gap))) rotate(calc((var(--i) - var(--mid)) * var(--step))); transition: transform .3s cubic-bezier(.3, .7, .2, 1); z-index: calc(var(--i) + 1); animation: none !important; }
.tc-arr-fan > *:hover, .tc-arr-fan > *:focus-within { transform: translateX(calc((var(--i) - var(--mid)) * var(--gap))) rotate(0deg) translateY(-12%) scale(1.1); z-index: 40; }
.tc-arr-fan > * .tc, .tc-arr-fan > * .pk-flip { --tcw: 100%; }
.tc-arr-fan > .pk-card { --pkw: var(--w); aspect-ratio: 5 / 7; height: auto; }
.tc-arr-fan > .tc-five-slot { gap: 4px; }
.tc-arr-fan > .tc-five-slot > .btn { position: absolute; bottom: -34px; left: 50%; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; }
.tc-arr-fan > .tc-five-slot:hover > .btn, .tc-arr-fan > .tc-five-slot:focus-within > .btn { opacity: 1; pointer-events: auto; }
.tc-arr-fan > .tc-five-slot > .tc-five-pos { position: absolute; top: -22px; left: 0; right: 0; text-align: center; }
@media (max-width: 560px) { .tc-arr-fan { --w: clamp(86px, 27vw, 120px); height: calc(var(--w) * 1.4 + 80px); overflow-x: clip; } .tc-arr-fan > * { --gap: clamp(10px, calc((100cqw - var(--w)) / max(1, var(--n) - 1) * .55), 64px); } }
/* Coverflow: scroll-snap, centred; off-centre cards turn away where scroll-driven animation exists. */
.tc-arr-flow { display: flex !important; flex-wrap: nowrap !important; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; perspective: 900px; padding: 20px max(12px, calc(50% - 100px)); justify-content: flex-start !important; -webkit-overflow-scrolling: touch; border-radius: 14px; }
.tc-arr-flow > * { flex: 0 0 min(52vw, 200px); scroll-snap-align: center; --pkw: min(52vw, 200px); }
.tc-arr-flow > .pk-card { width: min(52vw, 200px); }
.tc-arr-flow > * .tc { --tcw: 100%; }
@supports (animation-timeline: view()) { @media (prefers-reduced-motion: no-preference) {
	.tc-arr-flow > * { animation: tc-cover linear both !important; animation-timeline: view(inline); animation-range: entry 0% exit 100%; }
	@keyframes tc-cover { 0% { transform: scale(.78) rotateY(40deg); opacity: .55; } 50% { transform: none; opacity: 1; } 100% { transform: scale(.78) rotateY(-40deg); opacity: .55; } } } }
.tc-arr-flow:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .tc-arr-fan > * { transition: none; } .tc-arr-flow { scroll-behavior: auto; } }

/* ---- pack opening: the card that morphs into its slot (View Transitions) --------------------------- */
::view-transition-group(*) { animation-duration: .55s; animation-timing-function: cubic-bezier(.3, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }
