/* base */
:root {
  color-scheme: light;
  --bg: #f5f5f7; --panel: #fff; --panel2: #ececef; --text: #1d1d1f;
  --muted: #65656d; --line: #dcdce1; --hover: #f0f0f3;
  --nav: rgba(245,245,247,.9); --accent: #0066cc;
  --grandprix: #d7b5ff; --titanium: #67e8f9; --gold: #f5c84b;
  --silver: #d8dee7; --bronze: #c37a43; --green: #258353; --danger: #be2535;
  --shadow: 0 14px 48px rgba(0,0,0,.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101012; --panel: #1c1c1f; --panel2: #28282d; --text: #f5f5f7;
  --muted: #a0a0a9; --line: #36363c; --hover: #303036;
  --nav: rgba(16,16,18,.91); --accent: #8bc1ff; --green: #69c895;
  --danger: #ff898f; --shadow: 0 16px 50px rgba(0,0,0,.4);
}
* { box-sizing: border-box; letter-spacing: 0; }
html { min-height: 100%; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
a { color: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button, a { touch-action: manipulation; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button .icon { pointer-events: none; }

/* layout */
.device-toolbar { position: sticky; top: 0; z-index: 100; background: var(--nav); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--line); }
.toolbar-inner { max-width: 1440px; margin: auto; padding: 10px 40px; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toolbar-brand { font-size: 12px; font-weight: 500; color: var(--muted); }
.toolbar-divider { margin: 0 14px; opacity: .5; }
.toolbar-actions { display: flex; gap: 14px; flex: none; }
.segmented { display: flex; background: var(--panel2); border-radius: 8px; padding: 3px; gap: 2px; }
.icon-button { width: 36px; height: 32px; display: inline-grid; place-items: center; border-radius: 6px; color: var(--muted); flex: none; }
.icon-button:hover { color: var(--text); }
.segmented button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.device-shell { width: 100%; max-width: 1440px; padding: 0 40px 32px; margin: auto; }
.app { min-width: 0; }
.empty { display: none; padding: 80px 16px; text-align: center; color: var(--muted); border-block: 1px solid var(--line); }
.empty.show { display: block; }
.notice { margin: 36px 0 0; padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.6; }
.collection-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 18px; }
.collection-heading h2 { margin: 0; font-size: 20px; font-weight: 600; }
.collection-heading span { font-size: 12px; color: var(--muted); }

/* header */
.topbar { position: relative; z-index: 10; padding-top: 42px; }
.brandrow { margin-bottom: 30px; }
.brand h1 { margin: 0; font-size: 44px; font-weight: 650; line-height: 1.1; overflow-wrap: anywhere; }
.brand-dot { color: var(--accent); }
.brand p { margin: 10px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* filtres */
.controls { display: grid; grid-template-columns: minmax(220px,1.6fr) minmax(110px,.7fr) minmax(116px,.7fr) minmax(144px,1fr) minmax(154px,.9fr) 42px; gap: 10px; align-items: start; }
.search-field { height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); min-width: 0; }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb,var(--accent) 15%,transparent); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; height: 100%; }
input::placeholder { color: var(--muted); opacity: 1; }
.multi-filter { position: relative; min-width: 0; }
.multi-filter-button { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-height: 42px; padding: 9px 12px; font-size: 13px; font-weight: 500; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.multi-filter-button > span:first-child { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.multi-filter-button:hover, .multi-filter.open .multi-filter-button { background: var(--hover); }
.multi-filter-caret { width: 14px; height: 14px; color: var(--muted); }
.multi-filter-menu { display: none; position: absolute; top: calc(100% - 1px); left: 0; width: max(100%,210px); max-width: calc(100vw - 40px); z-index: 90; max-height: min(340px,60vh); overflow: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
#categoryFilter .multi-filter-menu { width: 320px; }
#statusFilter .multi-filter-menu { left: auto; right: 0; }
.multi-filter.open .multi-filter-menu { display: block; }
@media (hover: hover) and (pointer: fine) { .multi-filter:hover .multi-filter-menu { display: block; } }
.multi-filter-all { display: block; width: 100%; padding: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--accent); text-align: left; font-size: 12px; font-weight: 600; }
.multi-filter-options { display: grid; gap: 2px; }
.multi-filter-option { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 8px; border-radius: 5px; font-size: 12px; line-height: 1.4; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.multi-filter-option:hover, .single-filter-option.selected { background: var(--hover); }
.multi-filter-option input { width: 15px; height: 15px; flex: none; margin: 0; accent-color: var(--accent); }
.single-filter-option { width: 100%; }
.single-check { width: 16px; flex: none; color: var(--accent); }
.trophy-swatch { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--swatch); border: 1px solid rgba(0,0,0,.15); }
.ghost { height: 42px; width: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.ghost:hover { background: var(--hover); color: var(--danger); }
.mobile-filter-toggle { display: none; min-height: 42px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 0 14px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin: 26px 0 0; padding: 22px 0; border-block: 1px solid var(--line); }
.stat { padding: 0 24px; min-width: 0; border-left: 1px solid var(--line); position: relative; }
.stat:first-child { border: 0; padding-left: 0; }
.stat .num { font-size: 28px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.stats.trophy-filtered .num { text-shadow: 0 0 24px color-mix(in srgb,var(--stat-accent) 35%,transparent); }
.stats.trophy-filtered .stat::after { content: ""; display: block; width: 26px; height: 3px; margin-top: 10px; border-radius: 2px; background: var(--stat-accent); box-shadow: 0 0 12px color-mix(in srgb,var(--stat-accent) 32%,transparent); }
.progress-track { height: 3px; background: var(--panel2); max-width: 140px; margin-top: 10px; border-radius: 2px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--accent); width: var(--progress); }

/* cartes */
.cards.vertical { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; align-items: stretch; }
.card { min-width: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; transition: box-shadow .2s ease,border-color .2s ease; }
.card:hover { border-color: color-mix(in srgb,var(--metal) 70%,var(--line)); box-shadow: 0 8px 28px rgba(0,0,0,.08); }
.preview { display: block; width: 100%; aspect-ratio: 16/10; overflow: hidden; flex: none; background: var(--panel2); text-decoration: none; }
.preview img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease,filter .2s ease; }
.preview:hover img { transform: scale(1.025); }
.card.seen .preview img { filter: saturate(.4) brightness(.48); }
.card.seen .body { background: color-mix(in srgb,var(--panel) 90%,#000); }
.card.seen .title, .card.seen .idea { opacity: .6; }
.card.seen:hover .title, .card.seen:hover .idea { opacity: .85; }
.seen-pill { display: none; position: absolute; top: 12px; left: 12px; z-index: 2; background: rgba(0,0,0,.64); color: #fff; padding: 6px 9px; font-size: 10px; border-radius: 5px; }
.card.seen .seen-pill { display: block; }
.favorite-btn { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: rgba(0,0,0,.52); backdrop-filter: blur(8px); }
.favorite-btn:hover { background: rgba(0,0,0,.76); }
.card.favorite .favorite-btn { color: #ff6685; }
.card.favorite .favorite-btn .icon { fill: currentColor; }
.body { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 20px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin-bottom: 12px; }
.pill { font-size: 10px; font-weight: 500; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.pill.metal { display: inline; color: var(--text); font-weight: 650; }
.pill.metal::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--metal); box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.pill.category { flex-basis: 100%; }
.title { margin: 0 0 10px; font-size: 20px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.idea-wrap { width: 100%; padding: 0; margin: 0 0 14px; text-align: left; }
.idea { display: block; font-size: 13px; line-height: 1.65; color: var(--muted); overflow-wrap: anywhere; transition: opacity .18s ease; }
.idea-cta { display: inline-block; font-size: 11px; color: var(--accent); margin-top: 8px; line-height: 1.5; opacity: 0; transition: opacity .18s ease; }
.idea-wrap:hover .idea { opacity: .55; }
.idea-wrap:hover .idea-cta, .idea-wrap:focus-visible .idea-cta { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.links { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.linkrow { display: grid; grid-template-columns: 47px minmax(0,1fr); align-items: baseline; gap: 10px; padding: 6px 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.entity, .credits-link { text-align: right; padding: 0; font-weight: 500; font-size: inherit; line-height: inherit; color: var(--text); overflow-wrap: anywhere; }
.entity:hover, .credits-link:hover, .credit-person:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.credits-empty { color: var(--muted); }
.actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.primary { min-width: 66px; min-height: 32px; border-radius: 6px; padding: 6px 12px; font-size: 12px; font-weight: 500; background: var(--panel2); border: 1px solid transparent; }
.primary:hover { border-color: var(--line); background: var(--hover); }
.card.seen .primary { color: var(--green); background: color-mix(in srgb,var(--green) 10%,var(--panel)); }

/* modales */
body:has(.modal.show) { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.48); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; padding: 24px; }
.modal.show { display: flex; }
.modal-card { width: min(760px,100%); max-height: 85dvh; overflow: auto; overscroll-behavior: contain; padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); position: relative; }
.modal-card-small { width: min(430px,100%); }
.summary-detail-card { width: min(660px,100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; padding-bottom: 18px; }
.modal-head > div { min-width: 0; }
.modal-head h2 { font-size: 25px; font-weight: 600; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.modal-head p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 10px 0 0; overflow-wrap: anywhere; }
.summary-detail-card .modal-head { padding-right: 36px; }
.close, .summary-x { flex: none; width: 32px; height: 32px; display: grid; place-items: center; background: var(--panel2); color: var(--muted); border-radius: 50%; }
.summary-x { position: absolute; right: 20px; top: 20px; }
.close:hover, .summary-x:hover { color: var(--text); background: var(--hover); }
.confirm-copy { color: var(--muted); line-height: 1.7; font-size: 14px; }
.summary-text { white-space: pre-line; color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.cancel-btn, .danger-btn { padding: 11px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; }
.cancel-btn { background: var(--panel2); }
.danger-btn { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .danger-btn { color: #290609; }
.mini-list { display: grid; }
.mini-item { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.mini-item:first-child { padding-top: 0; }
.mini-item:last-child { border-bottom: 0; }
.mini-item strong { font-size: 14px; font-weight: 600; }
.mini-item span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.credit-person { padding: 0; text-align: left; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.mini-item .credit-name-static { font-size: 14px; color: var(--text); }

/* comptes */
[hidden] { display: none !important; }
.account-button { min-height: 36px; max-width: 150px; padding: 8px 12px; border-radius: 6px; background: var(--panel2); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-button:hover { background: var(--hover); }
.account-card { width: min(460px,100%); }
.account-tabs { width: 100%; margin-bottom: 22px; }
.account-tabs button { flex: 1; padding: 10px 6px; font-size: 13px; }
.account-tabs button.active { background: var(--panel); border-radius: 5px; box-shadow: 0 1px 4px #0001; }
.account-form { display: grid; gap: 16px; }
.account-form label, .account-file { display: grid; gap: 8px; font-size: 13px; font-weight: 500; }
.account-form input { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel2); color: var(--text); padding: 10px 12px; font: inherit; }
.account-form input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-primary, .account-secondary { min-height: 42px; padding: 10px 14px; border-radius: 6px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.account-primary { background: var(--accent); color: #fff; font-weight: 600; }
.account-secondary { background: var(--panel2); border: 1px solid var(--line); }
#exportLocalBtn { width: 100%; margin-top: 16px; }
.account-help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.account-error { color: var(--danger); font-size: 13px; line-height: 1.5; margin: 0; }
.account-error:empty, #passwordResult:empty { display: none; }
.account-profile-actions { display: grid; gap: 14px; margin-top: 20px; }
.account-file input { width: 100%; min-width: 0; font-size: 12px; color: var(--muted); }
.password-form { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 24px; }
.password-form h3 { margin: 0; font-size: 16px; font-weight: 600; }
.account-card button:disabled, .account-card input:disabled { opacity: .5; cursor: not-allowed; }
.account-status { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 250; width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; pointer-events: none; }
.account-status:empty { display: none; }

/* mobile */
@media (max-width: 1120px) {
  .controls { grid-template-columns: repeat(4,minmax(0,1fr)) 42px; }
  .search-field { grid-column: 1/-1; }
  .cards.vertical { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.device-mobile .device-shell { max-width: 460px; padding-inline: 20px; }
.device-mobile .brand h1 { font-size: 32px; }
.device-mobile .cards.vertical { grid-template-columns: minmax(0,1fr); }
.device-mobile .controls { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 12px; }
.device-mobile .search-field { grid-column: 1/-1; }
.device-mobile .stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 0; }
.device-mobile .stat:nth-child(3) { border-left: 0; padding-left: 0; }
.device-mobile .stat .num { font-size: 25px; }
.device-mobile .mobile-filter-toggle { display: block; width: 100%; }
.device-mobile:not(.filters-open) .controls { display: none; }
.device-mobile .multi-filter-menu, .device-mobile #categoryFilter .multi-filter-menu { width: 100%; max-width: 100%; }
@media (max-width: 640px) {
  .toolbar-inner { padding: 9px 16px; min-height: 60px; gap: 8px; flex-wrap: wrap; }
  .toolbar-brand { font-size: 11px; max-width: 100px; line-height: 1.5; }
  .toolbar-divider { margin: 0 5px; }
  .toolbar-actions { gap: 6px; width: 100%; justify-content: space-between; }
  .account-button { max-width: 125px; flex: 1; text-align: left; }
  .icon-button { width: 33px; height: 34px; }
  .device-shell { padding: 0 16px 24px; }
  .topbar { padding-top: 28px; }
  .brandrow { margin-bottom: 24px; }
  .brand h1 { font-size: 32px; }
  .brand p { font-size: 13px; }
  .controls { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .search-field { grid-column: 1/-1; }
  .ghost { width: 100%; height: 38px; grid-column: 1/-1; }
  .multi-filter-menu, #categoryFilter .multi-filter-menu { width: 100%; max-width: 100%; }
  .multi-filter-option { min-height: 42px; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 0; padding-block: 20px; }
  .stat { padding-inline: 20px; }
  .stat:nth-child(3) { padding-left: 0; border: 0; }
  .stat .num { font-size: 25px; }
  .cards.vertical { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .body { padding: 18px; }
  .collection-heading { margin-top: 24px; }
  .collection-heading h2 { font-size: 18px; }
  .modal { padding: 12px; }
  .modal-card { padding: 22px; max-height: 90dvh; }
  .modal-head h2 { font-size: 22px; }
  .favorite-btn { width: 40px; height: 40px; }
  .primary { min-height: 40px; }
}
@media (hover: none) { .idea-cta { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
