:root {
    --holvi-ink: #173b32;
    --holvi-green: #164f40;
    --holvi-paper: #f6f5f0;
    --holvi-muted: #65735d;
    --holvi-line: #e2e7dc;
    --holvi-gold: #c59750;
}

.card-image-trigger, .card-name-trigger { border: 0; padding: 0; min-height: 0; background: transparent; color: inherit; font: inherit; cursor: zoom-in; }
.card-image-trigger { position: relative; display: inline-block; line-height: 0; }
.card-image-trigger.card-thumbnail { width: 54px; height: 75px; }
.card-image-trigger.catalog-thumbnail { width: 72px; height: 100px; }
.card-image-trigger.catalog-image { width: 100%; max-width: 320px; height: auto; }
.card-image-trigger > img { display: block; width: 100%; height: 100%; max-width: none; margin: 0; float: none; object-fit: contain; }
.card-image-trigger::after { content: '⤢'; position: absolute; right: 1px; bottom: 1px; padding: 3px; border-radius: 3px; background: #173b32df; color: white; font: 16px/1 sans-serif; }
.card-name-trigger { min-height: 24px; text-align: left; font-weight: 600; text-decoration: underline; text-decoration-color: #173b3240; text-underline-offset: 3px; }
html:has(#card-preview[open]) { overflow: hidden; }
.card-preview { width: min(900px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 0; overflow: auto; border: 1px solid var(--holvi-line); border-radius: 16px; background: var(--holvi-paper); color: var(--holvi-ink); font-size: 15px; box-shadow: 0 24px 80px #102f2950; }
.card-preview::backdrop { background: #102f29bd; }
.card-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; position: sticky; top: 0; z-index: 1; background: var(--holvi-paper); }
.card-preview-header h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.card-preview-header button { width: auto; flex-shrink: 0; background: white; color: var(--holvi-ink); }
.card-preview-body { padding: 0 16px 16px; display: grid; gap: 18px; }
.card-preview-art { min-width: 0; text-align: center; }
.card-preview-art img { max-width: 100%; max-height: 58dvh; width: auto; height: auto; object-fit: contain; border-radius: 8px; }
.card-preview-art [role="status"] { margin: 8px 0; }
.card-preview-information { overflow-wrap: anywhere; }
.card-preview-price { font-weight: 600; color: var(--holvi-green); }
.card-preview-information small { margin-bottom: 12px; }
@media (min-width: 650px) {
    .card-preview-body { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
    .card-preview-art img { max-height: 76dvh; }
}

body { background: radial-gradient(ellipse at 90% 0, #e9eee2, transparent 45%), var(--holvi-paper); color: var(--holvi-ink); }
.shell { max-width: 1216px; margin: auto; padding: 26px 32px 110px; }
.shell button, .site-header button { width: auto; margin-bottom: 0; }
.shell input:not([type="checkbox"]):not([type="radio"]), .shell select, .shell textarea { background: white; border: 1px solid #ccd7c8; border-radius: 9px; padding: 11px 13px; min-height: 44px; min-width: 0; width: 100%; margin-bottom: 0; font: inherit; color: inherit; }
.shell select:disabled { background: #e5e7eb; }
.shell input[type="checkbox"], .shell input[type="radio"] { width: 20px; height: 20px; min-width: 20px; min-height: 20px; padding: 0; margin: 0; flex-shrink: 0; }
.remember { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; }
.remember input[type="checkbox"] { margin-top: 2px; }
.remember label { display: inline; margin: 0; font-weight: 400; }
.shell input[type="checkbox"] { border-radius: 4px; }
.shell input[type="radio"] { border-radius: 50%; }
.shell button, .shell a, .site-header a, .site-header summary { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #b27f2d; outline-offset: 4px; }
.site-header { display: block; padding: 0; background: #102f29; color: #f6f4e9; border-top: 3px solid var(--holvi-gold); }
.header-inner { max-width: 1216px; margin: auto; padding: 0 32px; min-height: 80px; display: flex; align-items: center; gap: 52px; }
.brand { display: flex; align-items: center; min-height: 44px; font-size: 24px; font-weight: 600; white-space: nowrap; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 39px; margin-right: 10px; border: 1px solid #cda76580; border-radius: 8px; color: #dcb980; transform: rotate(-5deg); }
.brand-dot { color: var(--holvi-gold); }
.main-nav { display: flex; justify-content: flex-start; align-self: stretch; gap: 30px; flex: 1; }
.main-nav a { display: flex; align-items: center; position: relative; padding: 5px 4px; min-height: 44px; color: #bdcfc0; font-size: 14px; text-decoration: none; }
.main-nav a[aria-current="page"] { color: #fff7e6; font-weight: 600; }
.main-nav a[aria-current="page"]::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #cda76c; border-radius: 4px 4px 0 0; }
.account-menu { position: relative; z-index: 15; min-width: 0; }
.account-menu > .user-toggle { display: flex; align-items: center; gap: 9px; list-style: none; cursor: pointer; min-height: 44px; font-size: 13px; color: #f6f4e9; }
.user-toggle::-webkit-details-marker { display: none; }
.user-toggle > span:nth-child(2) { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #36574b; display: grid; place-items: center; flex-shrink: 0; font-size: 12px; text-transform: uppercase; }
.account-popover { display: block; position: absolute; right: 0; top: 54px; min-width: 230px; background: white; color: var(--holvi-ink); padding: 12px; border: 1px solid var(--holvi-line); border-radius: 12px; box-shadow: 0 16px 45px #102d2926; }
.account-popover a, .account-popover button { display: block; padding: 12px 10px; width: 100%; text-align: left; min-height: 44px; font: inherit; color: inherit; font-size: 13px; border: 0; background: transparent; text-decoration: none; border-radius: 7px; }
.account-popover a:hover, .account-popover button:hover { background: #edf3e8; }
.account-popover form { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--holvi-line); }
.context-bar { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 32px; }
.context-label, .eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 1.7px; color: var(--holvi-muted); }
.series-switch { display: flex; align-items: center; gap: 5px; min-width: 0; }
.series-label { color: var(--holvi-muted); font-size: 11px; margin-right: 8px; letter-spacing: 0; text-transform: none; }
.series-switch a { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 12px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; color: var(--holvi-muted); text-decoration: none; }
.series-switch a.selected { color: var(--holvi-ink); background: white; border-color: #d8e0d1; box-shadow: 0 2px 5px #182b2110; font-weight: 600; }
.game-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.magic { background: #aa7736; }
.pokemon { background: #d0a023; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px 20px; margin-bottom: 26px; }
.jump-save-button { flex-shrink: 0; color: var(--holvi-green); border-color: #bfd0bc; background: #f8faf5; }
.jump-save-button:hover { background: #edf3e8; }
.jump-save-button svg { flex-shrink: 0; }
.page-heading h1 { font: 500 46px/1.15 Georgia, serif; letter-spacing: -1.6px; margin: 6px 0 10px; }
.page-heading h1::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 3px; border-radius: 50%; background: var(--holvi-gold); }
.page-heading p { font-size: 13px; color: var(--holvi-muted); margin-bottom: 0; }
.list-surface { border: 1px solid var(--holvi-line); border-radius: 15px; overflow: hidden; background: white; box-shadow: 0 12px 38px #183c2a08; }
.list-toolbar { display: flex; gap: 16px; align-items: flex-end; padding: 20px 22px 16px; flex-wrap: wrap; }
.list-toolbar .field { margin: 0; }
.list-toolbar label { font-size: 12px; }
.search-field { flex: 1; min-width: 170px; }
.owner-field { max-width: 230px; min-width: 160px; }
.compact-button, .shell .primary, .subtle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid #ccd7c8; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; background: white; color: var(--holvi-ink); }
.shell .primary { background: var(--holvi-green); border-color: var(--holvi-green); color: white; }
.subtle { color: var(--holvi-muted); }
.filter-disclosure { margin: 0 22px 16px; }
.filter-disclosure summary, .additional-details summary { cursor: pointer; padding: 12px 0; min-height: 44px; font-size: 13px; }
.extra-filters { display: flex; flex-wrap: wrap; gap: 16px; padding: 14px; background: #f4f7ef; border-radius: 8px; }
.extra-filters .field { flex: 1; min-width: 140px; margin: 0; }
.list-caption { display: flex; justify-content: space-between; gap: 10px; margin: 0; padding: 12px 22px; color: var(--holvi-muted); font-size: 12px; border-top: 1px solid var(--holvi-line); }
.collection-table, .deck-table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; }
.collection-table th, .deck-table th { padding: 13px 18px; font-size: 11px; font-weight: 500; color: var(--holvi-muted); background: #f8faf5; border-bottom: 1px solid var(--holvi-line); }
.collection-table td, .deck-table td { padding: 17px 18px; border-bottom: 1px solid #edf0e9; font-size: 13px; vertical-align: top; overflow-wrap: anywhere; }
.collection-table th:first-child { width: 65%; }
.deck-table th:first-child { width: 48%; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.collection-table tr.collection-card { display: table-row; border: 0; border-radius: 0; background: transparent; }
.collection-table tr:hover, .deck-table tr:hover { background: #fbfcf8; }
.card-name, .deck-name { font-weight: 600; color: #254c39; }
.row-edit { display: inline-flex; align-items: center; min-height: 44px; }
.card-meta { display: block; color: var(--holvi-muted); font-size: 11px; line-height: 1.6; margin-top: 4px; }
.free-count { display: inline-block; min-width: 28px; padding: 3px 7px; border-radius: 6px; background: #edf5ed; color: #386648; font-size: 12px; }
.row-details { margin-top: 8px; }
.row-details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 12px; color: #687b5d; }
.row-details p { font-size: 12px; margin: 6px 0; }
.row-details a { display: inline-block; min-height: 44px; padding-top: 10px; }
.paging { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 22px; }
.paging a { min-height: 44px; display: inline-flex; align-items: center; }
.empty-state { padding: 32px 22px; font-size: 13px; color: var(--holvi-muted); }
.quiet-note { color: var(--holvi-muted); font-size: 12px; margin: 16px 2px; }
.fab { position: fixed; right: max(24px, calc((100vw - 1216px) / 2 + 24px)); bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 10; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 56px; min-height: 56px; padding: 15px 23px; border: 1px solid #398166; border-radius: 18px; color: #fff9e8; background: var(--holvi-green); box-shadow: 0 8px 25px #174c4033; font-size: 13px; font-weight: 600; text-decoration: none; }
.fab-plus { font-size: 27px; line-height: 1; color: #e0c48a; }
.deck-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 18px; }
.deck-filters .segmented { margin: 0; }
.segmented { display: flex; align-items: center; gap: 4px; padding: 4px; background: #f1f4ed; border-radius: 9px; width: fit-content; margin: 0 0 18px; }
.segmented a { padding: 11px 16px; border-radius: 6px; min-height: 44px; font-size: 13px; color: var(--holvi-muted); text-decoration: none; }
.segmented a[aria-current="true"], .segmented a[aria-current="page"] { background: white; box-shadow: 0 2px 5px #1f382817; color: var(--holvi-green); font-weight: 600; }
.format-tag { display: inline-block; padding: 4px 7px; border: 1px solid #e0e8dd; border-radius: 6px; color: #526b49; background: #f7faf4; font-size: 11px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.editor-meta { display: grid; grid-template-columns: 1fr 220px; gap: 20px; margin-bottom: 24px; }
.editor-meta .field { margin: 0; }
.editor-meta label { font-size: 13px; }
.additional-details { border-bottom: 1px solid var(--holvi-line); margin: 18px 0; }
.additional-details > div { padding: 15px 0; }
.editor-save-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; padding: 16px 0; }
.editor-save-bar > div, .card-actions, .draft-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.editor-save-bar > span { font-size: 12px; color: var(--holvi-muted); }
.sticky-draft-bar { position: sticky; top: 8px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; padding: 14px 16px; background: #fff6dc; border: 1px solid #d8a528; border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06); }
.sticky-draft-bar .quiet-note { margin: 4px 0 0; }
.draft-recovery-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; }
.draft-recovery-bar .draft-actions button { min-height: 44px; }
@media (max-width: 700px) {
    .sticky-draft-bar { top: auto; bottom: 0; z-index: 20; box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12); }
    .sticky-draft-bar .draft-actions button { min-height: 44px; }
}
.save-confirm-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.save-confirm-section ul { margin: 6px 0 0; padding-left: 20px; }
.save-version-choice { border: 1px solid var(--holvi-line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.version-option { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.version-option span { display: flex; flex-direction: column; gap: 2px; }
.card-actions { padding: 16px 20px; }
.editor-tabs { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--holvi-line); }
.editor-tabs > div { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-tabs button { min-height: 44px; border: 1px solid var(--holvi-line); border-radius: 8px; padding: 10px 14px; background: var(--holvi-paper); color: var(--holvi-green); font-size: 13px; cursor: pointer; }
.editor-tabs button[aria-pressed="true"] { background: var(--holvi-green); color: white; font-weight: 600; }
.size-pill { font-size: 12px; color: #526b49; background: #f2f5ed; padding: 5px 9px; border-radius: 6px; }
.editor-card-list { padding: 0 20px; }
.editor-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 0; border-top: 1px solid var(--holvi-line); }
.editor-line.deck-line { margin: 0; padding: 14px 0; border: 0; border-top: 1px solid var(--holvi-line); border-radius: 0; background: transparent; }
.editor-line h3 { flex: 1; margin: 0; font-size: 14px; min-width: 150px; }
.editor-line .field { margin: 0; max-width: 150px; }
.editor-line label { font-size: 11px; }
.editor-line .quantity-field { max-width: 85px; }
.editor-line input, .editor-line select { padding: 8px; font-size: 12px; }
.editor-line .remove-line { font-size: 12px; border: 0; background: none; color: #7c6553; }
.add-cards-panel { background: #f8faf5; border-top: 1px solid var(--holvi-line); border-bottom: 1px solid var(--holvi-line); padding: 20px; }
.add-cards-panel .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.add-cards-panel .panel-heading h2 { font-size: 20px; margin: 0; }
.add-cards-panel .field { margin-bottom: 14px; }
.add-cards-panel .import-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.import-tabs button[aria-pressed="true"] { color: white; background: var(--holvi-green); }
.import-preview { margin: 16px 0; padding: 15px; background: #edf4e7; border-radius: 9px; }
.import-preview ul { margin: 10px 0; padding-left: 20px; }
.precon-results { display: grid; gap: 10px; }
.processing-spinner { display: inline-block; width: 16px; height: 16px; margin-left: 8px; border: 2px solid #c4d4bf; border-top-color: currentColor; border-radius: 50%; vertical-align: middle; animation: precon-spin .8s linear infinite; }
.precon-card-list > summary { justify-content: space-between; gap: 12px; padding: 0 12px; border: 1px solid #ccd7c8; border-radius: 9px; background: rgba(255, 255, 255, 0.55); font-size: 14px; font-weight: 500; color: var(--holvi-ink); }
.precon-card-list > summary:hover { background: white; }
.disclosure-chevron { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; font-size: 14px; line-height: 1; }
.precon-card-list[open] .disclosure-chevron { transform: rotate(180deg); }
.deck-view-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--holvi-line); }
.deck-view-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.deck-heading { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.deck-heading-content { min-width: 0; flex: 1; }
.deck-heading-content h1 { font: 500 38px/1.15 Georgia, serif; letter-spacing: -1.2px; margin: 4px 0 8px; overflow-wrap: anywhere; }
.deck-heading-content .deck-owner { margin: 0; font-size: 13px; color: var(--holvi-muted); }
.deck-view-meta { display: grid; gap: 10px; margin-bottom: 24px; }
.deck-view-meta p { margin: 0; }
.deck-cover, .deck-thumbnail { object-fit: contain; border-radius: 6px; background: #e8eee3; }
.deck-thumbnail { float: left; margin: 0 12px 8px 0; }
.editor-save-error { margin-bottom: 8px; }
@keyframes precon-spin { to { transform: rotate(1turn); } }
.precon-result { padding: 15px; border: 1px solid var(--holvi-line); background: white; border-radius: 9px; }
.precon-result h3 { margin-top: 0; }
.account-content { max-width: 650px; }
.ownership-editor { max-width: 760px; padding: 24px; }
.ownership-editor h2 { margin-top: 0; }
.ownership-editor h3 { margin: 14px 0; font-size: 16px; }
.ownership-editor .variant-selection { display: block; padding: 18px; margin: 20px 0; background: #f4f7ef; border-radius: 8px; }
.ownership-editor .primary { margin: 12px 12px 12px 0; }
.ownership-editor a { display: inline-flex; align-items: center; min-height: 44px; }
.catalog-search { max-width: 980px; }
.catalog-search > form { border: 1px solid var(--holvi-line); border-radius: 12px; padding: 20px; background: white; }
.catalog-search .catalog-fields { gap: 16px; }
.catalog-search .catalog-fields .field { margin: 0 0 14px; }
.catalog-search .catalog-fields .field:has(#catalog-name) { grid-column: 1 / -1; }
.catalog-results li { border-color: var(--holvi-line); border-radius: 10px; }

@media (max-width: 760px) {
    .shell { padding: 22px 20px 110px; }
    .header-inner { padding: 0 20px; gap: 26px; }
    .context-label { display: none; }
    .context-bar { justify-content: flex-end; }
    .user-toggle > span:nth-child(2) { max-width: 100px; }
    .page-heading h1 { font-size: 39px; }
    .deck-owner-column { display: none; }
    .editor-meta { grid-template-columns: 1fr 170px; }
    .editor-save-bar { position: sticky; bottom: 0; background: #f6f5f0f5; backdrop-filter: blur(8px); padding-bottom: calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--holvi-line); z-index: 5; }
}

@media (max-width: 520px) {
    .header-inner { padding: 10px 16px 0; flex-wrap: wrap; gap: 0; justify-content: space-between; }
    .brand { font-size: 21px; }
    .brand-mark { width: 28px; height: 33px; margin-right: 7px; }
    .account-menu { margin-left: auto; }
    .user-toggle { gap: 6px; font-size: 11px; }
    .user-toggle > span:nth-child(2) { max-width: 85px; }
    .avatar { width: 25px; height: 25px; }
    .main-nav { order: 3; flex-basis: 100%; height: 49px; margin-top: 7px; gap: 24px; }
    .main-nav a { font-size: 13px; }
    .shell { padding: 18px 16px 105px; }
    .context-bar { margin-bottom: 24px; }
    .series-switch { gap: 4px; width: 100%; justify-content: flex-end; }
    .series-switch a { flex: 0 1 auto; padding: 7px 10px; font-size: 11px; gap: 5px; line-height: 1.25; white-space: nowrap; }
    .series-label { font-size: 10px; margin-right: 2px; }
    .game-dot { width: 5px; height: 5px; }
    .page-heading h1 { font-size: 35px; }
    .page-heading p { font-size: 12px; }
    .list-toolbar { padding: 14px; gap: 12px; }
    .search-field { min-width: 130px; }
    .owner-field { width: 100%; max-width: 100%; min-width: 0; flex-basis: 100%; }
    .list-toolbar input, .list-toolbar select { font-size: 13px; }
    .filter-disclosure { margin: 0 14px 12px; }
    .list-caption { padding: 12px 14px; font-size: 11px; }
    .collection-table th:first-child { width: 60%; }
    .collection-table th, .collection-table td, .deck-table th, .deck-table td { padding: 13px 11px; font-size: 12px; }
    .collection-table th, .deck-table th { font-size: 10px; }
    .collection-table th:first-child, .collection-table td:first-child, .deck-table th:first-child, .deck-table td:first-child { padding-left: 14px; }
    .card-meta { font-size: 10px; }
    .deck-table th:first-child { width: 54%; }
    .format-tag { font-size: 10px; padding: 4px 5px; }
    .fab { right: 19px; bottom: calc(24px + env(safe-area-inset-bottom)); width: 56px; height: 56px; padding: 0; }
    .fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .segmented a { font-size: 12px; padding: 11px 13px; }
    .editor-meta { grid-template-columns: 1fr 115px; gap: 12px; }
    .editor-meta input, .editor-meta select { font-size: 13px; }
    .editor-meta label { font-size: 12px; }
    .card-actions { padding: 12px; gap: 8px; }
    .card-actions button { font-size: 12px; padding: 10px; }
    .editor-tabs { padding: 12px; }
    .editor-save-bar > span { max-width: 80px; font-size: 10px; }
    .editor-save-bar > div { gap: 8px; }
    .editor-save-bar button { font-size: 12px; padding: 10px; }
    .add-cards-panel { padding: 15px; }
    .editor-line { display: grid; grid-template-columns: minmax(0, 1fr) 65px 44px; gap: 8px; }
    .editor-line h3 { grid-column: 1 / -1; }
    .editor-line .field, .editor-line .quantity-field { min-width: 0; max-width: none; }
    .editor-line .remove-line { align-self: end; padding: 8px 0; min-width: 44px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
.submit-progress { display: inline-flex; align-items: center; gap: 6px; margin: 8px; font-size: 14px; }

.deck-location-tree ul { list-style: none; padding: 0 0 0 16px; margin: 0; border-left: 2px solid var(--holvi-line); }
.deck-location-tree li { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 13px; }
.deck-acquisition, .card-identity-fields { flex-basis: 100%; grid-column: 1 / -1; min-width: 0; }
.identity-fields-grid, .acquisition-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.editor-line .card-identity-fields .field, .editor-line .acquisition-form .field { max-width: none; }
.acquisition-form { padding: 16px; background: #eef2ea; border-radius: 9px; margin-top: 12px; }
.acquisition-form > p, .acquisition-form > .purchase-choice { grid-column: 1 / -1; }
.purchase-choice { display: flex; align-items: center; gap: 10px; font-weight: 400; min-height: 44px; }
.assembly-counts { font-weight: 600; }
@media(min-width: 600px) { .identity-fields-grid, .acquisition-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.editor-meta .deck-stage { grid-column: 1 / -1; }
.deck-stage select { max-width: 340px; }
.card-identity-fields > summary { width: 100%; }

.row-details > summary { gap: 8px; }
.row-details > summary:has(.disclosure-chevron)::after { display: none; }
.row-details > summary .disclosure-chevron { margin-left: auto; flex-shrink: 0; }
.row-details[open] > summary .disclosure-chevron { transform: rotate(180deg); }
@media(max-width: 520px) { .editor-meta { grid-template-columns: minmax(0, 1fr) 135px; } }

.catalog-results li { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.catalog-thumbnail { width: 72px; height: 100px; object-fit: contain; flex: 0 0 72px; }
.catalog-result-info { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.catalog-result-info strong { display: block; font-size: 1.05rem; }
.catalog-result-info small { color: var(--holvi-muted); font-size: .75rem; }
@media (max-width: 480px) {
    .editor-tabs { flex-wrap: wrap; }
    .catalog-results li > button { width: 100%; }
}

.shell button:disabled { background: #e5e7eb; color: #52615c; border-color: #ccd2d0; cursor: not-allowed; }
.action-spinner { display: inline-block; width: .9em; height: .9em; margin-right: .4em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: precon-spin .8s linear infinite; vertical-align: -.1em; }
[aria-busy="true"]:has(.action-spinner, .processing-spinner)::before { content: none; display: none; }
@media (prefers-reduced-motion: reduce) { .action-spinner { animation: none; } }

.card-thumbnail { width: 54px; height: 75px; object-fit: contain; float: left; margin: 0 12px 8px 0; }
.collection-card .row-details { clear: both; }
.deck-card-summary { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.deck-card-summary .card-thumbnail { float: none; flex: 0 0 54px; margin: 0; }
.card-image-credit { clear: both; }
.editor-line > .card-thumbnail { grid-column: 1 / -1; }

.list-toolbar .field { min-width: 0; max-width: 100%; overflow: hidden; }
.list-toolbar select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }

.catalog-image { display: block; width: 240px; max-width: 100%; height: auto; object-fit: contain; }

.sort-link { display: inline-flex; align-items: center; justify-content: inherit; gap: .35rem; min-height: 44px; color: inherit; text-decoration: none; }
.sort-link:hover { text-decoration: underline; }
.list-caption { flex-wrap: wrap; }
.read-only-status { display: inline-block; white-space: nowrap; }
@media (max-width: 480px) {
    .collection-table th, .collection-table td { padding-left: 10px; padding-right: 10px; }
    .sort-link { gap: .15rem; font-size: 12px; }
}

dialog.add-cards-panel { width: min(760px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line, #cdd8cf); border-radius: 18px; color: inherit; background: #fafbf7; overflow-y: auto; }
.add-cards-panel::backdrop { background: rgb(8 29 23 / .6); }
.add-cards-panel .panel-heading { position: sticky; top: 0; z-index: 1; background: #fafbf7; padding: 16px 20px; border-bottom: 1px solid #dce2d8; }
.add-cards-content { padding: 20px; }
.add-cards-feedback { position: sticky; bottom: 0; background: #e8f1e9; border-top: 1px solid #cdd8cf; padding: 14px 20px; font-size: 14px; }
.add-cards-feedback p { margin: 8px 0 0; }
.add-cards-panel .catalog-results > li { gap: 16px; padding: 16px; }
.add-cards-panel .catalog-results .primary { min-height: 48px; padding: 12px 20px; }
.catalog-extra-filters { grid-column: 1 / -1; }
.catalog-extra-filters > summary { padding: 12px 0; cursor: pointer; }
.catalog-extra-filters[open] { display: grid; gap: 12px; }
.deck-stage-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 24px; }
.deck-stage-actions p { flex-basis: 100%; margin: 0; }
@media (max-width: 600px) {
    dialog.add-cards-panel { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
    .add-cards-panel .panel-heading { padding: 12px 14px; gap: 12px; }
    .add-cards-panel .panel-heading h2 { font-size: 20px; }
    .add-cards-content { padding: 16px 14px; }
    .add-cards-feedback { padding: 12px 14px; }
    .add-cards-panel .catalog-results .primary { grid-column: 1 / -1; width: 100%; }
}

.deck-stage { display: flex; flex-direction: column; gap: 6px; }
.collection-table th, .deck-table th { padding-top: 0; padding-bottom: 0; }
.add-cards-panel { overscroll-behavior: contain; }
@media (min-width: 600px) {
    .catalog-extra-filters[open] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .catalog-extra-filters summary { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
    .collection-table th:first-child, .deck-table th:first-child { width: auto; }
    .collection-table th.numeric { width: 88px; }
    .collection-table th.numeric + th.numeric { width: 64px; }
    .deck-table th:nth-child(2) { width: 76px; }
    .deck-table th.numeric { width: 64px; }
    .deck-table th.deck-version-column { width: 46px; }
    .sort-link { font-size: 11px; }
}

.history-version { border: 1px solid var(--holvi-line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.history-version-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.history-version-head h2 { margin: 0 0 4px; font-size: 18px; }
.history-tree > summary { cursor: pointer; font-weight: 500; padding: 6px 0; }
.history-section-tree { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.history-section-tree ul { margin: 4px 0 0; padding-left: 18px; }
.history-section-tree li { margin-bottom: 3px; }
.history-change-group { margin-top: 8px; }
.history-change-heading { display: inline-block; font-size: 13px; font-weight: 600; }
.history-change-in .history-change-heading, .history-delta-in { color: var(--holvi-green); font-weight: 600; }
.history-change-out .history-change-heading, .history-delta-out { color: #8c2f2f; font-weight: 600; }

.tournament-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tournament-actions form, .tournament-actions button { margin: 0; }
.tournament-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.tournament-card,
.tournament-panel { background: var(--surface, #fff); border: 1px solid var(--border, #d8dfd8); border-radius: 10px; padding: 14px; margin-bottom: 14px; min-width: 0; max-width: 100%; }
.tournament-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: flex-start; }
.tournament-card-head h2 { min-width: 0; overflow-wrap: anywhere; }
.tournament-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.tournament-badge.active { background: #e3f2e6; color: #195e2c; }
.tournament-badge.closed { background: #eceeed; color: #555; }
.tournament-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tournament-table { width: 100%; border-collapse: collapse; min-width: 360px; }
.tournament-table th,
.tournament-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border, #e2e7e2); }
.tournament-rounds { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.tournament-rounds > * { min-width: 0; }
.tournament-round-card { border: 1px solid var(--border, #e2e7e2); border-radius: 8px; padding: 10px; }
.tournament-match-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0f2f0; }
.tournament-match-row:last-child { border-bottom: none; }
.tournament-list { display: flex; flex-direction: column; gap: 8px; }
.tournament-list-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eef1ee; }
.quick-qty-controls { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.quick-qty-controls form { margin: 0; display: inline-flex; }
.quick-qty-btn { min-width: 44px; min-height: 44px; padding: 4px 8px; margin: 0; width: auto; font-size: 0.85rem; background: #fff; color: #173b32; border: 1px solid #91a79b; }
.quick-qty-btn:hover:not(:disabled), .quick-qty-btn:focus-visible { background: #e7f1eb; border-color: #176346; }
.quick-qty-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form .field, .inline-form input, .inline-form select, .inline-form button { margin: 0; }
.field-row,
.participant-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border, #d8dfd8); border-radius: 8px; min-height: 40px; }
@media (min-width: 720px) {
    .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .participant-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.deck-price-panel { margin: 20px 0; padding: 16px; background: #fff; border: 1px solid var(--holvi-line); border-radius: 12px; box-shadow: 0 6px 20px rgba(24, 60, 42, 0.05); }
.deck-price-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.deck-price-head h2 { margin: 0; font-size: 18px; }
.deck-price-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.price-metric { padding: 12px 14px; border: 1px solid #e2e8de; border-radius: 10px; background: #f9fbf7; }
.price-metric.missing { border-color: #d8c7a3; background: #fbf7ee; }
.price-metric-label { display: block; font-size: 12px; color: var(--holvi-muted); }
.price-metric-value { display: block; font-size: 24px; font-weight: 700; color: var(--holvi-ink); font-variant-numeric: tabular-nums; margin: 2px 0; }
.price-metric.missing .price-metric-value { color: #8a5a14; }
.price-metric-sub { font-size: 12px; color: var(--holvi-muted); }
.price-meta { margin: 8px 0 0; font-size: 12px; color: var(--holvi-muted); }
.price-error-note { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid #9e2424; background: #fbeaea; color: #7a1c1c; font-size: 13px; }
.price-breakdown { margin-top: 12px; border-top: 1px solid #edf0e9; padding-top: 10px; }
.price-breakdown > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--holvi-green); }
.price-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.price-table th, .price-table td { padding: 8px 6px; border-bottom: 1px solid #edf0e9; text-align: left; overflow-wrap: anywhere; }
.price-table th { font-size: 11px; color: var(--holvi-muted); font-weight: 600; }
.price-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag-missing { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #f5e7c8; color: #7c4f10; font-size: 11px; font-weight: 600; white-space: nowrap; }
.muted-price { color: var(--holvi-muted); font-style: italic; }
