/* ==========================================================================
   CardsCloud visual fixes (2026-11-24)
   Layout-only overrides from the 2026-11-24 visual bug sweep.
   Loaded last from templates/layout.twig. To undo everything, remove the
   one <link> to this file in layout.twig. Numbers refer to the sweep's list.
   ========================================================================== */

/* ---------- Batch 1: Cards page (/vault) and header ---------- */

/* #1 Tablet landscape (1061-1180px): keep the Sign in link in the header. */
@media (min-width: 1061px) and (max-width: 1180px) {
    .cc-nav-action-link { display: inline-flex; padding: 0 6px; }
}

/* #21 Filter bar: solid background so cards don't show through it. */
.cc-vault-toolbar.cc-vault-glass {
    background: color-mix(in oklab, var(--cc-surface) 96%, transparent);
}

/* #19 #20 Phones and short screens: filter panel scrolls away with the page
   instead of pinning over half the screen. */
@media (max-width: 760px), (max-height: 700px) {
    .cc-vault-toolbar { position: static; top: auto; }
}

/* #22 Year badge: move to the bottom-left of the art so it no longer
   covers the printed card name. */
.cc-vault-year { top: auto; bottom: 8px; }

/* #23 Tablet landscape: keep title and stats side by side so cards show
   on the first screen. */
@media (min-width: 900px) and (max-width: 1180px) {
    .cc-vault-hero { grid-template-columns: minmax(0, 1fr) minmax(300px, .62fr); }
    .cc-vault-title h1 { font-size: clamp(40px, 4.8vw, 58px); }
    .cc-vault-title p { font-size: 17px; }
    .cc-vault-stat { min-height: 84px; padding: 13px 14px; }
    .cc-vault-stat--wide { min-height: 70px; }
    .cc-vault-stat strong { font-size: clamp(22px, 2.4vw, 30px); }
}

/* ---------- Batch 2: Binder, DeckForge, Pack Lab, Battle Lab, Trending, Sets ---------- */

/* #62 #66 Pages using .cc-page-pad (Binder, DeckForge) had no page margin:
   give them the same side and top spacing as the rest of the site. */
.cc-page-pad {
    padding: clamp(18px, 3vw, 36px) clamp(12px, 3vw, 28px) 64px;
}

/* #61 Binder flat grid (shown when 3D isn't available): let the panel
   shrink to the screen so the grid wraps instead of running off the edge. */
.lb-stage { grid-template-columns: minmax(0, 1fr); }
.lb-canvas-wrap, .lb-fallback { min-width: 0; }

/* #64 DeckForge: centre the page on wide screens. */
.df { margin-left: auto; margin-right: auto; }

/* #63 DeckForge on phones: stack the intro above the three stat boxes
   instead of squeezing it into a strip beside them. */
@media (max-width: 760px) {
    .df-hero { grid-template-columns: 1fr; }
    .df-hero-stats { flex-wrap: wrap; }
    .df-hero-stat { flex: 1 1 88px; }
}

/* #70 #71 Pack Lab: the card-text rule was also restyling the price and
   CHASE badges (grey, shifted, cut off). Restore them and stack them on the
   left so they never overlap on narrow cards. */
.cc-pack-card .cc-pack-price,
.cc-pack-card .cc-pack-hit {
    display: inline-flex;
    margin-top: 0;
    max-width: calc(100% - 16px);
    white-space: nowrap;
    line-height: 1;
}
.cc-pack-card .cc-pack-price { color: var(--cc-accent); font-size: 11px; left: 8px; top: 8px; }
.cc-pack-card .cc-pack-hit   { color: #fff; font-size: 10px; left: 8px; right: auto; top: 38px; }

/* #68 Battle Lab on phones and small tablets: put each HP box beside its
   Pokemon, not on it. */
@media (max-width: 860px) {
    .cc-battle-side--enemy .cc-battle-hud  { left: auto; right: calc(100% + 10px); top: 0; }
    .cc-battle-side--player .cc-battle-hud { right: auto; left: calc(100% + 10px); bottom: 0; }
}

/* #39 Trending: keep big numbers on one line in the stat boxes. */
.cc-lab-stat strong { white-space: nowrap; font-size: clamp(24px, 2.3vw, 36px); }

/* #40 Trending: keep the filter, sort and Cards/Table toggle on one row. */
@media (min-width: 681px) {
    .cc-lab-tools { flex-wrap: nowrap; }
    .cc-lab-input { min-width: 140px; flex: 1 1 200px; }
    .cc-view-btn { white-space: nowrap; }
}

/* #13 Sets on phones: room for the "PRICED" label in the small boxes. */
@media (max-width: 640px) {
    .cc-set-tile-market span { padding: 7px 6px; letter-spacing: .03em; }
}

/* ---------- Batch 3: phone menu, header, Home, Sets, Cards date ---------- */

/* #2 Phone menu: section headings in the site font, not the typewriter one. */
.cc-drawer-section { font-family: inherit; letter-spacing: .1em; }

/* #3 Phone menu: arrows always at the far right (the Browse & collect rows
   also got icons in layout.twig, like the other groups). */
.cc-drawer-item::after { margin-left: auto; }

/* #4 Menu button: don't stay highlighted after the menu closes on touch screens. */
@media (hover: none) {
    .cc-burger:hover, .cc-theme-toggle:hover {
        border-color: var(--cc-line);
        background: color-mix(in oklab, var(--cc-surface) 84%, transparent);
        color: var(--cc-ink-2);
        transform: none;
    }
}
.cc-burger:focus:not(:focus-visible) { outline: none; }

/* #10 Header: nearly solid, so page colours don't smear through it. */
.cc-header { background: color-mix(in oklab, var(--cc-bg) 92%, transparent); }

/* #6 #11 Home and Sets: the set-code badge image had no style, so it sat
   under the logo, got cropped and was hidden by the card art. Pin it to the
   corner of the logo box like the design intended. */
.cc-set-tile-symbol-pip {
    position: absolute;
    top: 8px; right: 8px;
    width: auto; height: auto;
    max-width: 44px; max-height: 22px;
    object-fit: contain;
    z-index: 2;
}

/* #9 Home on phones: keep the magnifier icon in the search box. */
@media (max-width: 520px) {
    .cc-home-search > svg { display: block; flex: 0 0 18px; }
}

/* #14 Sets: drop the separator bullets so none dangle at line ends when the
   line wraps; spacing alone separates code, date and series. */
.cc-set-tile-meta > span:nth-child(even) { display: none; }
.cc-set-tile-meta { column-gap: 10px; row-gap: 2px; }

/* #15 Sets intro: breathing room under it and no lone last word. */
.cc-sets-head { padding-bottom: 24px; }
.cc-sets-head .cc-lede { text-wrap: balance; }

/* #16 Sets toolbar on landscape phones and tablets: search box gets its own
   full row so its hint text isn't cut off. */
@media (min-width: 721px) and (max-width: 900px) {
    .cc-sets-toolbar .cc-search { flex: 1 1 100%; max-width: none; }
}

/* #17 Sets on phones: era filters scroll sideways in one row instead of
   stacking four rows deep. */
@media (max-width: 540px) {
    .cc-era-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
    .cc-era-chips::-webkit-scrollbar { display: none; }
    .cc-era-chips .cc-chip { flex: 0 0 auto; }
}

/* #18 Footer: the Install / Tinyblue buttons use the same row height as the
   links (phones already match). */
@media (min-width: 701px) {
    .cc-footer .cc-footer-button { min-height: 36px; }
}

/* #24 Cards page: snapshot date without the odd gaps around the hyphens. */
.cc-vault-stat strong { font-variant-numeric: lining-nums; }

/* ---------- Batch 4: Search page and card page ---------- */

/* #27 "Colorless" type chip and pill: dark text so it reads on the light grey. */
.cc-energy--colorless { color: #34322a; }

/* #28 Search results: move the number and price badges off the top of the
   card art (where the printed name is) to the bottom corners; the year badge
   sits just above the price. */
.cc-card-tile-num   { top: auto; bottom: 8px; }
.cc-card-tile-value { top: auto; bottom: 8px; }
.cc-card-tile-value ~ .cc-card-tile-year { bottom: 36px; }

/* #29 Search results: drop the separator bullets so none start or end a line. */
.cc-card-tile-meta > span:nth-child(even) { display: none; }
.cc-card-tile-meta { column-gap: 10px; row-gap: 2px; }

/* #32 Card page: the type badge ("Fighting") stays inside the sprite box. */
.cc-sprite-lab-meta { flex-wrap: wrap; }
.cc-sprite-lab-meta > div { min-width: 0; flex: 1 1 0; }
.cc-sprite-lab-meta .cc-type-pill { flex: 0 0 auto; }

/* #35 Card page on phones: room at the bottom so the "Sign in to collect"
   bar doesn't cover the end of the page. */
@media (max-width: 900px) {
    body:has(.cc-mobile-bar) .cc-footer { padding-bottom: 110px; }
}

/* #36 Card page: space above the "Card profile" heading. */
.cc-card-info > .cc-card-profile-section { margin-top: 18px; }

/* #37 Card page: "Generation VII" fits on one line in its box. */
.cc-card-profile-fact strong { font-size: clamp(17px, 1.25vw, 22px); line-height: 1.1; }

/* ---------- Batch 5: Price changes (Trending) and Rankings ---------- */

/* #42 #46 Card names in the Trending and Rankings tables: full size and full
   colour (the grey small style was meant only for the set line under them). */
.cc-card-line > span { color: var(--cc-ink); font-size: 14px; margin-top: 0; }
.cc-card-line > span > strong { color: var(--cc-ink); font-size: 14px; }
.cc-card-line > span > span { color: var(--cc-ink-3); font-size: 12px; margin-top: 2px; }

/* #41 Trending on phones: the card table stacks into rows, so label each value. */
@media (max-width: 680px) {
    .cc-mover-table--cards td:nth-child(n+2)::before {
        display: inline-block; min-width: 76px; margin-right: 8px;
        color: var(--cc-ink-3); font-size: 11px; font-weight: 700;
        letter-spacing: .06em; text-transform: uppercase;
    }
    .cc-mover-table--cards td:nth-child(2)::before { content: "Variant"; }
    .cc-mover-table--cards td:nth-child(3)::before { content: "Previous"; }
    .cc-mover-table--cards td:nth-child(4)::before { content: "Current"; }
    .cc-mover-table--cards td:nth-child(5)::before { content: "Move"; }
    .cc-mover-table--cards td:nth-child(6)::before { content: "Snapshot"; }
}

/* #44 Rankings: wider filter boxes so "Quoted and no-quote" isn't cut off. */
@media (min-width: 1121px) {
    .cc-board-filters { grid-template-columns: 1.5fr repeat(4, minmax(165px, 1fr)); }
}

/* #45 Rankings: space between the view buttons and the table header. */
.cc-board-view-controls { margin-bottom: 14px; }

/* #47 Rankings: "First edition" and other variants stay on one line. */
.cc-board-table td:nth-child(7) { white-space: nowrap; }

/* ---------- Batch 6: Daily brief, Insights, Coach, Sprite Studio, Pack Lab ---------- */

/* #56 Collector Coach (while its analysis is being prepared): the page wrapper
   class had no style, so everything sat against the window edge. */
.cc-container {
    max-width: var(--cc-max);
    margin-left: auto; margin-right: auto;
    padding-left: 22px; padding-right: 22px;
}

/* #50 Daily brief: the JSON button gets a border like the Data Pulse button. */
.cc-brief-actions .cc-btn--ghost { border: 1px solid var(--cc-line); }

/* #51 #55 Daily brief and Insights on phones: stat boxes fit their content
   instead of standing tall and mostly empty. */
@media (max-width: 640px) {
    .cc-brief-kpi { min-height: 0; }
    .cc-brief-kpi strong { font-size: 30px; }
    .cc-insights-stat { min-height: 0; }
}

/* #53 Insights in dark mode: a light backing behind set logos so dark logos
   (like Pitch Black) stay visible. */
:root.dark .cc-heat-row img,
:root[data-theme="dark"] .cc-heat-row img {
    background: color-mix(in oklab, #fff 88%, transparent);
    border-radius: 8px;
    padding: 3px 5px;
}

/* #74 Sprite Studio: the big numbers fit inside their boxes. */
.cc-sprite-hero-stat strong { font-size: clamp(20px, 2.1vw, 32px); }

/* #72 Pack Lab: the best-pull summary line wraps instead of being cut off. */
.cc-pack-orb span { white-space: normal; text-overflow: clip; }

/* #65 #67 DeckForge: the search panel was pushed 88px down and out of line
   (its "sticky" setting was overridden, leaving only the offset). Sticky on
   wide screens, normal flow below that. */
@media (min-width: 1101px) { .df .df-rail { position: sticky; top: 88px; } }
@media (max-width: 1100px) { .df .df-rail { position: relative; top: 0; } }

/* #69 Battle Lab below desktop width: move your small card picture to the top
   left corner so the HP box no longer sits on it. */
@media (max-width: 1180px) {
    .cc-battle-card-art--player { left: 2%; top: 4%; bottom: auto; }
}

/* #73 Pack Lab: the card strip scrolls sideways only, no second vertical
   scrollbar inside it. */
@media (max-width: 1080px) {
    .cc-pack-fan { overflow-y: hidden; padding-top: 6px; }
}

/* ---- batch 7 (2026-11-24): small leftovers ---- */
/* 26 Market: the three chips are now real links, styled to match */
.cc-market-signals a{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:0 12px;border-radius:999px;background:color-mix(in oklab,var(--cc-accent) 9%,var(--cc-surface));border:1px solid color-mix(in oklab,var(--cc-accent) 18%,var(--cc-line-soft));color:var(--cc-ink-2);font-size:13px;font-weight:650;text-decoration:none;transition:background .2s ease,color .2s ease}
.cc-market-signals a:hover{background:color-mix(in oklab,var(--cc-accent) 16%,var(--cc-surface));color:var(--cc-ink)}
/* 34 Card page: hide Capture and Clip when the 3D view can't run, instead of showing dead buttons */
.holoforge-bar--degraded .holoforge-pill[data-hf="capture"],
.holoforge-bar--degraded .holoforge-pill[data-hf="clip"]{display:none}
/* 58 Collector Coach: a busy check reads as busy, not greyed out */
.cc-coach-refresh button:disabled{opacity:1;cursor:progress}
