/* The original paper palette and components live in the app and module stylesheets. */
:root:where(:not([data-theme="warm-journal"])) {
  --paper-0: var(--surface);
  --paper-1: var(--canvas);
  --paper-2: var(--raised);
  --paper-3: var(--line);
  --ink-1: var(--text);
  --ink-2: var(--secondary);
  --ink-3: var(--muted);
  --ink-4: #94a2b4;
  --indigo: var(--blue);
  --mustard: var(--gold);
  --vermilion: var(--gold);
  --vermilion-deep: #f6dba8;
  --matcha: #7bc9a6;
  --shadow-xs: none;
  --shadow-s: 0 2px 6px #0002;
  --shadow-m: 0 10px 28px #080b1140;
  --shadow-l: 0 18px 54px #05070c70;
  --font-display: var(--font-body);
  --sidebar-w: 204px;
}
:where(html:not([data-theme="warm-journal"])) {
body { background: var(--canvas); }
body::before { background: radial-gradient(ellipse at 86% 0%, #22314666, transparent 52%); }
::selection { color: #101318; background: var(--gold); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; box-shadow: none; }
button, input, select, textarea { accent-color: var(--blue); }
option, optgroup { color: var(--text); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

/* Shared chrome */
.app-sidebar, .context-header, .language-menu, .game-workspace-menu, .landing-topbar {
  background: #171d26;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px #ffffff0c, 0 4px 18px #06091033;
}
@supports (backdrop-filter: blur(1px)) {
  .app-sidebar, .context-header, .language-menu, .game-workspace-menu, .landing-topbar {
    background: var(--glass);
    backdrop-filter: blur(22px) saturate(140%);
  }
}
.app-sidebar { border-width: 0 1px 0 0; }
.context-header { border-width: 0 0 1px; }
.context-main-row { min-height: 56px; padding-block: 8px; gap: 12px; }
.context-copy { min-width: 0; }
.context-title { font-size: 16px; font-weight: 700; }
.context-eyebrow { font-weight: 500; }
.brand { min-height: 75px; border-bottom: 1px solid var(--line); }
.brand-mark, .landing-brand-mark, .my-brand b {
  border: 1px solid #d4b579; border-radius: 9px; color: #192027; background: var(--gold);
  transform: none; box-shadow: none; font-weight: 800;
}
.brand-name, .landing-brand strong { font-weight: 740; letter-spacing: .04em; }
.brand-sub { color: var(--muted); letter-spacing: .07em; }
.brand-mark { width: 36px; height: 36px; flex-basis: 36px; font-size: 21px; }
.sidebar-section-label { padding-top: 22px; }
.module-nav { gap: 3px; padding-inline: 10px; }
.module-nav-button { min-height: 40px; border-radius: 7px; }
.module-nav-button:hover, .module-nav-button.active {
  transform: none; color: var(--text); background: var(--raised); border-color: var(--line); box-shadow: none;
}
.module-nav-button.active { background: #2b2a25; border-color: #685a40; color: var(--gold); }
.module-nav-button.active::after { content: none; }
.module-nav-icon, .module-nav-button.active .module-nav-icon {
  width: 24px; flex-basis: 24px; color: inherit; background: none; border: none;
}
.sidebar-footer { border-top: 1px solid var(--line); }
.sidebar-overlay { background: #06090f9e; }
.sidebar-home-button, .icon-button, .action-button, .my-entry, .language-button,
.game-workspace-button, .select-control select {
  border: 1px solid var(--line); background: var(--surface); box-shadow: none;
}
.global-controls :is(.my-entry,.language-button,.game-workspace-button,.select-control select) {
  min-height: 35px; height: 35px; border-radius: 7px; font-size: 12px;
}
.select-control > svg { pointer-events: none; }
.season-control { display: flex; align-items: center; }
.season-control > svg { position: absolute; left: 10px; z-index: 1; width: 14px; color: var(--gold); }
.season-control select { color: var(--gold); border-color: #655840; background: #2a2925; }
.icon-button:hover, .sidebar-home-button:hover, .language-button:hover, .game-workspace-button:hover,
.language-button[aria-expanded=true], .game-workspace-button[aria-expanded=true] {
  transform: none; color: var(--text); background: var(--raised); border-color: #566479;
}
.game-workspace-option { border: 1px solid var(--line); background: var(--surface); }
.game-workspace-option.active, .language-option.active { color: var(--text); background: #29394e; border-color: #557296; }
.game-workspace-option:hover, .language-option:hover { transform: none; background: var(--raised); }
.game-workspace-option-mark, .game-workspace-option[data-game-option=jcc] .game-workspace-option-mark { color: var(--gold); background: #383326; border: 0; }
.category-strip { align-items: stretch; min-height: 38px; border-color: var(--line); }
.category-button { min-height: 38px; padding: 7px 12px; font-weight: 600; }
.category-button:hover { background: #ffffff08; }
.category-button.active { color: var(--gold); }
.category-button.active::after { bottom: 0; height: 2px; background: var(--gold); transform: none; }
.sidebar-library-links a, .jcc-library-seasons a { color: var(--secondary); font-weight: 600; background: var(--surface); }
.sidebar-library-links a:hover, .jcc-library-seasons a:hover { border-color: var(--gold); color: var(--gold); }
@media (min-width: 901px) { .mobile-menu { display: none; } }
@media (max-width: 900px) {
  .app-sidebar { visibility: hidden; }
  .sidebar-open .app-sidebar { visibility: visible; }
}
@media (max-width: 760px) {
  .context-header:has(.game-workspace-menu.is-open) { backdrop-filter: none; background: #171d26; }
}

/* Season catalogue, filters and unit sheets */
.module-view.jcc-library { width: 100%; max-width: 1440px; }
.jcc-library-header {
  position: relative; isolation: isolate; overflow: hidden; align-items: center;
  min-height: 104px; margin-bottom: 12px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: 10px; background: #1b2430;
}
.jcc-season-art { display: block; position: absolute; z-index: -1; inset: 0 0 0 30%; pointer-events: none; }
.jcc-season-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 34%; opacity: .75; }
.jcc-season-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg,#1b2430, #1b243020 56%, #141c28ba); }
.jcc-library-header h1 { font: 700 clamp(22px,2.4vw,34px)/1.24 var(--font-display); letter-spacing: -.025em; text-shadow: 0 2px 9px #111822; }
.jcc-library-header p { color: #c0cad9; font-size: 12px; }
.jcc-library-seasons { gap: 3px; padding: 3px; background: #10151de8; border: 1px solid #526071; border-radius: 8px; }
.jcc-library-seasons a { min-height: 29px; padding-inline: 10px; border: none; background: transparent; }
.jcc-library-seasons a[aria-current=page] { background: var(--gold); color: #1b2027; }
.jcc-library-tools { align-items: center; gap: 6px; padding: 8px; }
.library-search input, .library-select, .library-clear, .library-view-toggle, .library-search input[type=search] {
  border: 1px solid var(--line); border-radius: 5px; box-shadow: none;
}
.library-search input, .library-select { background: var(--canvas); color: var(--text); }
.jcc-library-tools :is(input,select,.library-clear) { min-height: 32px; height: 32px; }
.jcc-library .library-status { gap: 8px; padding: 7px 0; color: var(--muted); }
.library-view-button.active, .library-view-button.active:hover { background: #354457; border-color: #52667e; color: var(--text); }
.library-view-button:hover { background: var(--raised); }
.jcc-library-group { padding: 0; border: 0; background: transparent; }
.jcc-library-groups { gap: 22px; }
.jcc-library-group-head { margin: 3px 0 8px; align-items: center; }
.jcc-library-group-head::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.jcc-library-group-head h2 { border-color: var(--cost-border,var(--blue)); color: var(--text); font-size: 14px; }
.jcc-poster-grid { grid-template-columns: repeat(auto-fill,minmax(min(270px,100%),1fr)); gap: 12px; }
.jcc-unit-poster-link {
  border: 1px solid var(--cost-border,var(--line)); border-radius: 8px; background: var(--surface); box-shadow: none;
  transition: background .15s, box-shadow .15s;
}
.jcc-unit-poster-link:hover, .jcc-unit-tile:hover {
  background: var(--raised); box-shadow: 0 0 0 1px var(--cost-border,var(--blue));
}
.jcc-unit-poster, .jcc-unit-poster.is-missing { background: var(--raised); }
.jcc-unit-poster-link .jcc-unit-poster { aspect-ratio: 2.25; border-bottom: 1px solid var(--cost-edge,var(--line)); }
.jcc-unit-card-body { gap: 5px; padding: 9px 11px 10px; }
.jcc-unit-card-title { font-size: 18px; font-weight: 700; }
.jcc-unit-card-cost { color: var(--cost-border,var(--text)); border-color: var(--cost-edge,var(--line)); }
.jcc-unit-traits { gap: 4px; }
.jcc-unit-traits li { min-height: 20px; background: var(--raised); }
.jcc-unit-traits img, .jcc-dossier-trait h2 img,
.library-workspace[data-library-category=traits] .jcc-library-tile-media img {
  filter: brightness(0) invert(.9);
}
.jcc-unit-card-ability { border-top-style: solid; padding-top: 6px; }
.jcc-unit-card-stats { gap: 3px 10px; padding-top: 5px; }
.jcc-unit-card-stats dd, .jcc-dossier-stat-value, .library-status strong { font-variant-numeric: tabular-nums; }
.jcc-unit-poster-link .library-unit-key-value, .jcc-unit-dossier .library-unit-key-value {
  background: #212d3c; border-left-color: #6987ae; font-weight: 600;
}
.jcc-unlock-task { border-color: #405771; background: #202c3b; }
.jcc-unit-dossier .jcc-dossier-profile { border: 1px solid var(--cost-border,var(--line)); box-shadow: none; }
.jcc-dossier-profile h1 { font-weight: 700; font-size: 27px; }
.jcc-dossier-panel { border-radius: 8px; }
.jcc-library-tile:not(.jcc-unit-tile) { background: var(--surface); }
.jcc-library-tile:not(.jcc-unit-tile):is(:hover,:focus-visible) { background: var(--raised); }
.jcc-unit-tile { border-width: 1px; box-shadow: none; background: var(--surface); }
.jcc-unit-tile:focus-visible { background: var(--raised); }
@media (max-width: 700px) {
  .jcc-library-header { gap: 7px; padding: 12px; min-height: 0; }
  .jcc-library-header h1 { font-size: 21px; }
  .jcc-library-seasons a { min-height: 30px; }
  .jcc-library-filters { gap: 5px; }
  .jcc-library-tools :is(input,select,.library-clear) { min-height: 36px; }
  .jcc-library-tools .library-search { flex-basis: 100%; }
  .category-strip .category-button { min-height: 40px; }
  .jcc-library-filters { display: grid; width: 100%; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .jcc-library-filters .library-select { width: 100%; padding-inline: 5px; }
  .jcc-library-tools .library-clear { padding: 0 5px; }
  .jcc-catalog-open .game-workspace-button-copy strong { font-size: 11px; }

}

/* Catalogue controls, diagrams, and saved lineups */
.select-control.game-select-control { position: absolute; width: 1px; }
.jcc-season-art { left: 40%; }
.jcc-season-art img { object-position: 50% 22%; }
.jcc-season-art::after { background: linear-gradient(90deg,#1b2430, #1b243030 50%, #151c2990); }
.library-check { color: var(--secondary); border: 1px solid var(--line); background: var(--surface); }
.library-check:has(input:checked) { color: var(--text); border-color: #506682; background: #242f3f; }
.library-unit-skill-icon { border: 1px solid #596578; background: var(--raised); }
.library-toolbar, .module-band, .library-role-guide, .library-unit-page-guide, .library-detail-section,
.library-empty, .works-empty, .reserved-view, .aram-leaderboard, .outline-panel.dashed,
.aram-update-toolbar, .builder-status, .pool-empty, .pool-error, .my-empty { background: var(--surface); border-color: var(--line); }
.module-band { border: 1px solid var(--line); border-radius: 10px; }
.frame-slot, .outline-panel, .visual-canvas, .layout-index, .library-card, .library-workspace, .library-detail-panel,
.library-role-card, .board-shell, .asset-pool, .builder-header, .builder-name-input, .pool-search input,
.main-carry, .synergy-select, .filter-chip, .confirm-dialog, .toast, .search-control input, .work-card,
.unit-sheet, .dx-dialog, .dx-structure, .my-card { border-width: 1px; border-color: var(--line); }
.unit-sheet, .my-card, .library-card, .library-role-card { background: var(--surface); }
.frame-slot:hover, .library-card:hover, .main-carry:hover, .main-carry.has-unit, .leaderboard-row:hover,
.aram-update-trigger:hover, .aram-update-entry.open .aram-update-trigger { background: var(--raised); border-color: #536276; }
.library-unit-portrait-caption h3 { color: #fff; }
.library-unit-portrait-note { background: #1a212be6; }
.index-no, .filter-chip.active, .builder-counter, .dx-page .dx-toggle>input:checked+span:before { color: #1b2027; }
.main-carry::before, .board-shell::before, .item-pool::before, .builder-header::before { content: none; }
.board-shell { background: #171e27; }
.hex-cell { background: #485767; }
.hex-cell::before { background: #25303d; }
.hex-cell:hover::before, .hex-cell.selected::before { background: #344356; }
.hex-cell.selected { color: var(--gold); }
.item-card .item-label { color: #f3f6fa; background: #121922db; }
.my-btn.my-primary, .my-btn.my-primary:hover { color: #1b2027; background: var(--gold); border-color: var(--gold); }
.my-btn.my-copied { color: white; background: #286c53; }
.my-btn.my-danger { color: #ffa698; }
.my-card[data-game=jcc] .my-game-badge { background: #302c25; border-color: #5e5341; color: var(--gold); }
.my-card-cover, .my-preview-figure img { background: var(--raised); }
.dx-page :is(input[type=search],select), .dx-page button:not(.dx-row-detail), .dx-dialog button { border-color: var(--line); }
.dx-hero, .module-intro, .dx-table td, .dx-table th { border-bottom-style: solid; }
.dx-results, .dx-data-foot { border-top-style: solid; }
.dx-data-foot, .dx-table tbody tr:nth-child(even) { background: #1c232c; }
.dx-table tbody tr:hover td { background: var(--raised); }
.dx-table th, .dx-table td { padding-block: 8px; }
.dx-data-foot { color: var(--muted); }
.library-detail-backdrop, .confirm-backdrop, .dx-dialog::backdrop { background: #06090ec2; }

/* Announcement list and its native reading dialog */
.upd-journal .upd-page-head, .upd-journal .upd-announcement, .upd-journal .upd-announcement.featured,
.upd-journal .upd-awaiting, .upd-journal .upd-search, .upd-journal .upd-refresh, .upd-reader,
.upd-reader .upd-detail-index, .upd-reader .upd-change, .upd-reader .upd-close {
  color: var(--text); background: var(--surface); border: 1px solid var(--line); box-shadow: none;
}
.upd-journal .upd-page-head, .upd-journal .upd-announcement.featured { background: linear-gradient(110deg, #19202a 40%, #263143); }
.upd-journal .upd-page-head h2 { font-size: clamp(27px,3.2vw,44px); }
.upd-journal :is(.upd-eyebrow,.upd-page-head p,.upd-archive-label>span,.upd-art-label,.upd-list-count,.upd-scope-pill,
.upd-awaiting p,.upd-awaiting-categories small,.upd-empty-rule,.upd-history-heading>span,.upd-open-card footer,
.upd-open-card footer>span b,.upd-journal-foot,.upd-announcement p,.upd-announcement time,.upd-feature-art-label,
.upd-group-tags span,.upd-art-caption,.upd-version>span), .upd-reader :is(.upd-eyebrow,.upd-group-total,.upd-filter-label,
.upd-index-eyebrow,.upd-change-name small,.upd-detail-index>strong,.upd-comparison small) { color: var(--muted); border-color: var(--line); }
.upd-journal :is(.upd-archive-label strong,.upd-history-heading h3,.upd-awaiting h3,.upd-announcement h3,.upd-wait-label,.upd-refresh,.upd-awaiting-categories strong),
.upd-reader :is(.upd-change-name h4,.upd-group-heading h3,.upd-detail-index>button,.upd-dialog-head h2,.upd-comparison p) { color: var(--text); }
.upd-journal :is(.upd-hero-art,.upd-version,.upd-kind,.upd-title-dot,.upd-open-card footer>strong),
.upd-reader :is(.upd-dialog-head h2>b,.upd-group-heading:before) { color: var(--blue); }
.upd-journal :is(.upd-hero-art,.upd-art-orbit,.upd-art-orbit::after,.upd-history-heading,.upd-empty-rule,.upd-awaiting-categories,.upd-awaiting-categories>div,.upd-open-card footer) { border-color: var(--line); }
.upd-journal .upd-art-orbit::after { border-color: var(--line); }
.upd-journal :is(.upd-topic-icon,.upd-art-directions>span,.upd-feature-glyph,.upd-thumb,.upd-count,.upd-kind,.upd-empty-rule b,.upd-version>span,.upd-cover),
.upd-reader :is(.upd-topic-icon,.upd-change-image,.upd-detail-cover,.upd-summary,.upd-group-total,.upd-comparison>div,.upd-detail-filters button,.upd-detail-filters button span) {
  color: var(--secondary); background: var(--raised); border-color: var(--line);
}
.upd-reader .upd-dialog-head, .upd-reader .upd-detail-filters, .upd-reader .upd-detail-layout { background: var(--surface); border-color: var(--line); }
.upd-reader .upd-summary { color: var(--secondary); border-left-color: var(--blue); }
.upd-reader .upd-detail-index>button:is(:hover,.active), .upd-reader .upd-detail-filters button.active,
.upd-reader .upd-comparison .upd-after { color: var(--blue); background: #28374a; border-color: #485d78; }
.upd-reader .buff .upd-after, .upd-journal .upd-count.buff { color: #a4dfb7; background: #23382f; border-color: #3b5746; }
.upd-reader .nerf .upd-after, .upd-journal .upd-count.nerf { color: #ffb4a6; background: #3b2929; border-color: #69443e; }
.upd-reader .fix .upd-after, .upd-journal .upd-count.fix { color: #d6b5f8; background: #342b43; border-color: #554263; }
.upd-reader .buff .upd-after p, .upd-reader .nerf .upd-after p { color: inherit; }
.upd-journal .upd-art-directions .buff, .upd-journal-foot .buff { color: #a4dfb7; }
.upd-journal .upd-art-directions .nerf, .upd-journal-foot .nerf { color: #ffb4a6; }
.upd-journal .upd-art-directions .adjust, .upd-journal-foot .adjust { color: var(--blue); }
.upd-journal .upd-red-dot { background: var(--gold); }
.upd-journal .upd-awaiting::after { opacity: .15; }
.upd-journal .upd-awaiting-categories > div { color: var(--secondary); }
.library-detail-dialog { border: 1px solid var(--line); }
.library-detail-dialog::before, .unit-pool::before { content: none; }

}

/* Keep all seven hex columns and both pools reachable at the available width. */
.tft-builder { width: 100%; min-width: 0; container: builder / inline-size; }
.builder-header { flex-wrap: wrap; min-height: 0; padding: 14px; }
.builder-header-actions { flex-wrap: wrap; }
.builder-layout { width: 100%; grid-template-columns: minmax(142px,.7fr) minmax(0,4fr); gap: 12px; }
.builder-main { display: grid; width: 100%; min-width: 0; grid-template-columns: minmax(0,2.8fr) minmax(190px,1fr); gap: 12px; }
.builder-center, .board-shell, .unit-pool, .item-pool, .main-carry, .augment-list { width: 100%; min-width: 0; }
.board-shell { container-type: inline-size; height: auto; min-height: 0; padding: 16px 6px; }
.hex-board { --step: min(82px,12cqw); width: auto; min-width: 0; height: auto; padding: 0; gap: 0; }
.hex-row { width: auto; height: var(--step); flex-basis: var(--step); margin: 0; gap: 0; }
.hex-row.offset { margin-left: calc(var(--step) / 2); }
.hex-wrapper { flex: 0 0 var(--step); width: var(--step); height: var(--step); }
.hex-cell { width: 96%; height: 100%; }
.hex-cell .unit-token { width: calc(var(--step) * .66); height: calc(var(--step) * .66); }
.builder-status { margin-left: 0; }
.unit-pool, .item-pool { min-height: 0; height: auto; padding: 12px; }
.unit-grid { grid-template-columns: repeat(auto-fill,minmax(46px,1fr)); max-height: 52vh; overflow: auto; }
.item-grid { height: auto; max-height: 48vh; grid-template-columns: repeat(auto-fill,minmax(40px,1fr)); grid-auto-rows: max-content; }
.item-grid .item-card { width: 100%; min-height: 0; }
.item-card .item-type-tag { color: #cedcf2; background: #263a54; }
.augment-button { border: 1px solid var(--line); }
.augment-list { height: 180px; }
@container builder (max-width: 855px) {
  .builder-layout { grid-template-columns: minmax(126px,.62fr) minmax(0,2fr); }
  .builder-main { grid-template-columns: minmax(0,1fr); }
  .board-watermark { display: none; }
}
@container builder (max-width: 570px) {
  .builder-layout { grid-template-columns: minmax(0,1fr); }
  .builder-side { position: static; order: 1; }
  .builder-header-actions { gap: 5px; }
  .builder-header-actions .action-button { padding: 6px 8px; min-height: 36px; }
  .builder-name-input { width: 100%; }
  .main-carry { height: 94px; }
  .builder-title-row { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .module-band { margin-inline: 0; }
  .band-inner { padding-inline: 12px; }
  .jcc-season-art { left: 12%; }
  .jcc-season-art img { opacity: .38; }
}
@media (prefers-reduced-transparency: reduce) {
  .app-sidebar, .context-header, .language-menu, .game-workspace-menu, .landing-topbar { backdrop-filter: none; background: #171d26; }
}

/* All appearances share the same native keyboard, pointer and touch controls. */
site-theme-picker { display: inline-block; flex: none; }
site-theme-picker label {
  display: inline-flex; align-items: center; gap: 5px; min-height: 35px;
  padding-left: 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--muted); cursor: pointer;
}
site-theme-picker label > span { font-size: 11px; }
site-theme-picker select {
  height: 34px; max-width: 100%; margin: 0; padding: 0 3px; border: 0;
  background: transparent; color: var(--text); font: 600 12px var(--font-body); cursor: pointer;
}
site-theme-picker label:hover { border-color: var(--blue); }
site-theme-picker label:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
site-theme-picker select:focus-visible { outline: none; box-shadow: none; }
.my-top site-theme-picker { margin-inline-start: auto; }
@media (min-width: 701px) and (max-width: 1200px) {
  .context-main-row { gap: 8px; }
  .global-controls {
    display: grid; grid-template-columns: auto auto minmax(0,1fr) minmax(0,1.1fr);
    flex: 1 1 390px; min-width: 0; max-width: 500px; gap: 5px;
  }
  .context-copy { flex: 1 1 70px; }
  .global-controls .game-workspace-control,.global-controls .season-control { min-width: 0; }
  .context-main-row site-theme-picker label > span { display: none; }
  .global-controls .game-workspace-button { width: 100%; min-width: 0; }
  .global-controls .language-button { min-width: 64px; }
  .global-controls .season-control select { width: 100%; min-width: 0; padding-inline: 26px 4px; text-overflow: ellipsis; }
}
@media (max-width: 720px) {
  .landing-topbar site-theme-picker { margin-left: auto; }
  .landing-topbar .my-entry-cover { margin-left: 0; }
  .my-top { flex-wrap: wrap; gap: 6px; }
  .context-main-row site-theme-picker { align-self: center; }
}
@media (max-width: 480px) {
  .context-main-row { align-items: center; }
  .context-copy { padding-top: 0; }
  .context-eyebrow { display: none; } /* Game and season are in the controls directly below. */
}
