:root {
  color-scheme: dark;
  --bg: #101319;
  --surface: #171b23;
  --surface-soft: #1c212b;
  --surface-raised: #202631;
  --border: #2a303b;
  --text: #f3f4f6;
  --muted: #a1a8b5;
  --muted-dim: #78808d;
  --accent: #b8f47a;
  --accent-strong: #a4e65d;
  --accent-ink: #13220d;
  --cyan: #8be0dc;
  --amber: #f0c878;
  --violet: #c1a8ff;
  --rose: #ff9da7;
  --danger: #ff9298;
  --shadow: 0 22px 70px rgba(0, 0, 0, .36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: radial-gradient(ellipse at 18% -10%, rgba(99, 139, 81, .11), transparent 31rem), var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }
.is-hidden { display: none !important; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.boot-screen p { margin: 0; font-size: 13px; }
.boot-mark, .brand-icon { display: grid; place-items: center; border-radius: 13px; background: var(--accent); color: var(--accent-ink); font-weight: 800; letter-spacing: -.1em; }
.boot-mark { width: 48px; height: 48px; font-size: 16px; box-shadow: 0 0 32px rgba(184, 244, 122, .22); }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 10%, rgba(184, 244, 122, .11), transparent 31rem); }
.auth-card { width: min(100%, 440px); padding: 38px; border: 1px solid var(--border); border-radius: 24px; background: rgba(23, 27, 35, .94); box-shadow: var(--shadow); }
.brand-lockup { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: 16px; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.brand-icon { width: 32px; height: 32px; border-radius: 10px; font-size: 11px; }
.auth-kicker, .eyebrow, .stat-label, .filter-label, .panel-kicker { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; }
.auth-kicker { margin-top: 38px; color: var(--accent); font-size: 10px; }
.auth-card h1 { margin: 12px 0 9px; font-size: clamp(25px, 6vw, 34px); line-height: 1.15; letter-spacing: -.06em; }
.auth-copy { margin: 0 0 26px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.stack-form { display: grid; gap: 17px; }
.stack-form label, .full-label, .form-grid label, .manual-code-form label { display: grid; gap: 8px; color: #c3c9d2; font-size: 12px; font-weight: 700; }
.stack-form input, .form-grid input, .form-grid select, .full-label textarea, .filter-control select, .manual-code-form input {
  width: 100%; min-width: 0; border: 1px solid #343b48; border-radius: 10px; background: #11151b; color: var(--text); padding: 12px 13px; transition: border-color .16s, box-shadow .16s;
}
.stack-form input::placeholder, .form-grid input::placeholder, .full-label textarea::placeholder, .manual-code-form input::placeholder { color: #707987; }
.stack-form input:focus, .form-grid input:focus, .form-grid select:focus, .full-label textarea:focus, .filter-control select:focus { border-color: #8cc75c; box-shadow: 0 0 0 3px rgba(184, 244, 122, .1); outline: none; }
.field-hint { margin: -2px 0 0; color: var(--muted-dim); font-size: 11px; line-height: 1.55; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }

.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 0 14px; font-size: 12px; font-weight: 800; transition: background .16s, border-color .16s, transform .16s, color .16s; white-space: nowrap; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button-primary { color: var(--accent-ink); background: var(--accent); }
.button-primary:hover { background: var(--accent-strong); }
.button-secondary { color: var(--text); border-color: #3b4350; background: #202630; }
.button-secondary:hover, .button-quiet:hover { border-color: #586272; background: #272e39; }
.button-quiet { color: #c2c8d2; border-color: transparent; background: transparent; }
.button-danger { color: #ffd3d6; border-color: rgba(255, 146, 152, .32); background: rgba(255, 94, 108, .1); }
.button-danger:hover { background: rgba(255, 94, 108, .18); }
.button-wide { width: 100%; min-height: 46px; margin-top: 3px; }
.button-small { min-height: 32px; padding: 0 10px; font-size: 11px; }
.button-symbol { font-size: 16px; line-height: 1; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; gap: 30px; min-height: 72px; border-bottom: 1px solid rgba(52, 59, 72, .7); padding: 0 max(28px, calc((100vw - 1440px) / 2)); background: rgba(16, 19, 25, .9); backdrop-filter: blur(18px); }
.topbar .brand-lockup { flex: 0 0 190px; }
.topbar-search { position: relative; display: flex; flex: 1; max-width: 540px; height: 40px; align-items: center; border: 1px solid #303744; border-radius: 11px; background: #181d25; color: var(--muted-dim); }
.topbar-search:focus-within { border-color: #627348; box-shadow: 0 0 0 3px rgba(184, 244, 122, .07); }
.search-icon { padding-left: 13px; color: #aab1bb; font-size: 24px; line-height: 1; transform: rotate(-20deg); }
.topbar-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0 9px; color: var(--text); font-size: 12px; }
.topbar-search input::placeholder { color: #838b99; }
.topbar-search kbd { margin-right: 8px; border: 1px solid #353c48; border-radius: 5px; padding: 3px 5px; color: #7e8794; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; border: 1px solid #343b48; border-radius: 10px; background: #1b2029; color: #bfc6d0; font-size: 20px; line-height: 1; }
.icon-button:hover { border-color: #596271; background: #232a34; }
.account-button { position: relative; border-radius: 50%; color: var(--accent); font-size: 8px; }
.account-button::before { position: absolute; width: 19px; height: 19px; border: 1.5px solid currentColor; border-radius: 50%; content: ''; }
.account-button::after { position: absolute; bottom: 7px; width: 9px; height: 4px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 9px 9px 0 0; content: ''; }
.page-content { width: min(1440px, 100%); margin: 0 auto; padding: 44px 32px 60px; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 27px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--muted-dim); font-size: 9px; font-weight: 500; }
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(184, 244, 122, .75); }
.welcome-row h1 { margin: 10px 0 8px; font-size: clamp(30px, 4vw, 43px); line-height: 1.12; letter-spacing: -.075em; }
.welcome-row h1 span { color: var(--accent); }
.welcome-copy { margin: 0; color: var(--muted); font-size: 13px; }
.welcome-actions { display: flex; align-items: center; gap: 8px; }
.menu-wrap { position: relative; }
.popover { position: absolute; top: calc(100% + 9px); right: 0; z-index: 30; width: 218px; padding: 7px; border: 1px solid var(--border); border-radius: 13px; background: #202630; box-shadow: var(--shadow); }
.popover button { display: block; width: 100%; border: 0; border-radius: 8px; background: transparent; padding: 10px; color: #dce0e6; text-align: left; font-size: 11px; }
.popover button:hover { background: #2a313d; }
.popover .danger-menu-item { color: var(--danger); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 48px; }
.stat-card { min-height: 132px; border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(150deg, rgba(31, 37, 47, .94), rgba(23, 27, 35, .96)); padding: 19px 20px 16px; }
.stat-card-featured { border-color: rgba(184, 244, 122, .22); background: linear-gradient(145deg, rgba(63, 86, 45, .39), rgba(23, 27, 35, .98) 80%); }
.stat-label { color: #87909e; font-size: 9px; font-weight: 500; }
.stat-main { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; }
.stat-main strong { overflow: hidden; max-width: 90%; color: var(--text); font-size: clamp(24px, 3vw, 31px); line-height: 1; letter-spacing: -.06em; text-overflow: ellipsis; white-space: nowrap; }
.stat-card-featured .stat-main strong { color: var(--accent); }
.stat-icon { color: #d3d9e1; font-size: 17px; }
.stat-icon-amber { color: var(--amber); }
.stat-icon-violet { color: var(--violet); }
.stat-icon-rose { color: var(--rose); font-size: 20px; }
.stat-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; color: #818a98; font-size: 10px; }
.stat-live { color: #a8d780; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .07em; }
.stat-platform-name { font-size: clamp(16px, 2vw, 23px) !important; letter-spacing: -.05em !important; }
.library-section { min-height: 300px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.section-heading h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 21px; letter-spacing: -.055em; }
.section-heading p { margin: 7px 0 0; color: var(--muted-dim); font-size: 11px; }
.count-pill { display: inline-flex; min-width: 22px; height: 22px; align-items: center; justify-content: center; border: 1px solid #38404d; border-radius: 7px; padding: 0 6px; color: #b2bac6; background: #212731; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; vertical-align: middle; }
.view-switch { display: flex; gap: 3px; border: 1px solid #303744; border-radius: 10px; background: #191e26; padding: 3px; }
.view-button { display: grid; width: 32px; height: 29px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #8993a1; font-size: 15px; }
.view-button.is-active { color: var(--accent); background: #2a3328; }
.filter-row { display: flex; align-items: flex-end; gap: 11px; margin-bottom: 20px; border-bottom: 1px solid #252b35; padding-bottom: 19px; }
.filter-control { display: grid; gap: 7px; min-width: 150px; }
.filter-control.sort-control { margin-left: auto; }
.filter-label { color: #737c89; font-size: 8px; }
.filter-control select { height: 37px; border-radius: 9px; padding: 0 30px 0 11px; color: #c9ced6; font-size: 11px; }
.clear-filters { border: 0; background: transparent; padding: 0 8px 10px; color: var(--accent); font-size: 10px; font-weight: 700; white-space: nowrap; }
.clear-filters span { font-size: 15px; }
.bulk-covers-trigger { flex: 0 0 auto; }

.games-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; }
.game-card { min-width: 0; overflow: hidden; border: 1px solid #2b323d; border-radius: 14px; background: #191e26; transition: transform .18s, border-color .18s, box-shadow .18s; cursor: pointer; }
.game-card:hover { transform: translateY(-3px); border-color: #596848; box-shadow: 0 13px 35px rgba(0, 0, 0, .22); }
.cover-art { position: relative; display: grid; overflow: hidden; aspect-ratio: 1 / 1.1; place-items: center; background: linear-gradient(145deg, #202e36, #29313e 57%, #3c3b42); }
.cover-art img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.cover-art-search-button { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; padding: 0; cursor: pointer; }
.cover-art-search-button .cover-fallback { position: absolute; inset: 0; }
.cover-art-search-button:hover .cover-fallback-mark, .cover-art-search-button:focus-visible .cover-fallback-mark { border-color: var(--accent); color: #d8ffb4; }
.cover-art-search-hint { position: absolute; right: 8px; bottom: 8px; left: 8px; z-index: 1; border: 1px solid #b8f47a44; border-radius: 7px; background: #10151de8; padding: 7px; color: #d8ffb4; font-size: 10px; font-weight: 800; text-align: center; }
.cover-fallback { display: grid; width: 100%; height: 100%; place-items: center; padding: 18px; text-align: center; }
.cover-fallback-mark { display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid rgba(255, 255, 255, .21); border-radius: 17px; background: rgba(16, 19, 25, .18); color: rgba(255, 255, 255, .82); font-size: 25px; font-weight: 800; letter-spacing: -.1em; }
.game-card-body { padding: 10px 12px 12px; }
.game-card-topline { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 7px; }
.game-status-tag { display: inline-flex; align-items: center; gap: 5px; overflow: hidden; color: #a8d780; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.game-status-tag::before { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: currentColor; content: ''; }
.game-status-tag.is-wanted { color: var(--amber); }
.game-status-tag.is-sale { color: var(--rose); }
.game-status-tag.is-loaned { color: var(--violet); }
.game-price { color: #d9dfd0; font-size: 10px; font-weight: 800; white-space: nowrap; }
.game-title { display: -webkit-box; min-height: 36px; overflow: hidden; margin: 0; color: #eef0f3; font-size: 12px; font-weight: 800; line-height: 1.45; letter-spacing: -.025em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.game-description-preview { display: -webkit-box; overflow: hidden; margin: 7px 0 0; color: #9aa3af; font-size: 9px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.game-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; color: #7f8997; font-size: 9px; }
.game-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state, .no-results { min-height: 330px; display: grid; align-content: center; justify-items: center; border: 1px dashed #343c49; border-radius: 18px; background: rgba(26, 31, 40, .5); text-align: center; }
.empty-art { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 17px; color: var(--accent); font-size: 23px; }
.empty-art span:nth-child(2) { display: grid; width: 48px; height: 54px; place-items: center; border: 1px solid #485343; border-radius: 10px; background: #262f25; color: #d5f3ba; font-size: 20px; }
.empty-art span:first-child { position: relative; top: -17px; color: var(--amber); font-size: 12px; }
.empty-art span:last-child { position: relative; top: 14px; color: var(--violet); font-size: 12px; }
.empty-state h3, .no-results h3 { margin: 0; font-size: 18px; letter-spacing: -.04em; }
.empty-state p, .no-results p { max-width: 340px; margin: 8px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.empty-actions { display: flex; gap: 8px; }
.no-results { min-height: 250px; }
.no-results-mark { display: grid; width: 44px; height: 44px; place-items: center; margin-bottom: 12px; border-radius: 14px; background: #252b36; color: #adb5c0; font-size: 24px; }
.games-list { overflow-x: auto; border: 1px solid var(--border); border-radius: 13px; background: #171b23; }
.games-list table { width: 100%; border-collapse: collapse; min-width: 680px; }
.games-list th { border-bottom: 1px solid var(--border); padding: 11px 13px; color: #8993a0; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-align: left; }
.games-list td { border-bottom: 1px solid #262c35; padding: 10px 13px; color: #d9dde4; font-size: 11px; }
.games-list tr:last-child td { border-bottom: 0; }
.games-list tbody tr { cursor: pointer; }
.games-list tbody tr:hover { background: #202631; }
.list-title { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.list-thumb { width: 31px; height: 39px; overflow: hidden; border-radius: 5px; background: #2b3441; object-fit: cover; }
.list-thumb-fallback { display: grid; place-items: center; color: var(--accent); font-size: 13px; }
.list-thumb-search { position: relative; flex: 0 0 31px; border: 1px solid #424d5c; padding: 0; cursor: pointer; }
.list-thumb-search::after { position: absolute; right: 1px; bottom: 1px; left: 1px; border-radius: 2px; background: #10151de8; padding: 2px 0; color: #d8ffb4; content: 'Buscar'; font-size: 6px; font-weight: 800; line-height: 1; }
.list-thumb-search:hover, .list-thumb-search:focus-visible { border-color: var(--accent); outline: 2px solid #b8f47a55; outline-offset: 1px; }
.list-cover-search-action { margin-left: 9px; font-size: 9px; white-space: nowrap; }
.app-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #242a34; padding: 17px max(32px, calc((100vw - 1376px) / 2)); color: #6f7886; font-size: 10px; }
.rawg-attribution { color: #a6bd92; font-size: 9px; text-decoration: underline; text-underline-offset: 2px; }
.footer-separator { padding: 0 5px; color: #454d59; }
.footer-status { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.footer-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(184,244,122,.5); }

.app-dialog { width: min(720px, calc(100vw - 28px)); max-height: min(92vh, 900px); overflow: auto; border: 1px solid #39414e; border-radius: 19px; background: #171c24; color: var(--text); padding: 24px; box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(4, 6, 9, .74); backdrop-filter: blur(5px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.dialog-header h2 { margin: 7px 0 0; font-size: 23px; letter-spacing: -.06em; }
.dialog-close { flex: 0 0 auto; font-size: 23px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 13px; }
.span-2 { grid-column: span 2; }
.form-grid input, .form-grid select, .full-label textarea { border-radius: 9px; padding: 10px 11px; font-size: 12px; }
.form-grid input[type="file"] { min-width: 0; padding: 8px; color: #aeb6c2; font-size: 11px; }
.form-grid select { min-height: 40px; }
.inline-field { display: flex; gap: 7px; }
.inline-field input { flex: 1; }
.inline-field select { width: 90px; flex: 0 0 90px; padding-right: 7px; }
.price-panel { margin: 22px 0 17px; border: 1px solid #354034; border-radius: 14px; background: linear-gradient(125deg, rgba(45, 62, 35, .35), rgba(24, 29, 36, .7) 60%); padding: 15px; }
.price-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-kicker { color: #9aba7c; font-size: 8px; }
.price-panel-heading h3 { margin: 4px 0 0; font-size: 14px; letter-spacing: -.03em; }
.text-button { border: 0; background: transparent; padding: 5px 0; color: var(--accent); font-size: 10px; font-weight: 800; }
.text-button:hover { color: #d0ffa8; }
.price-panel-copy { margin: 9px 0 13px; color: #9ba69a; font-size: 10px; line-height: 1.6; }
.price-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.price-grid label { font-size: 10px; }
.price-grid input, .price-grid select { background: #151a20; font-size: 11px; }
.full-label { margin: 16px 0; }
.full-label textarea { resize: vertical; line-height: 1.55; }
.game-cover-remove-button { justify-self: start; margin-top: -8px; }
.metadata-lookup-field { display: grid; align-content: start; justify-items: start; gap: 7px; color: #c3c9d2; font-size: 12px; font-weight: 700; }
.metadata-lookup-field .field-hint { font-weight: 400; }
.catalog-key-status { margin: 0 0 12px; border: 1px solid #343b48; border-radius: 9px; background: #11151b; padding: 10px 12px; color: #c3c9d2; font-size: 11px; line-height: 1.5; }
.catalog-setup-steps { display: grid; gap: 9px; margin: 0 0 14px; padding-left: 22px; color: #c3c9d2; font-size: 11px; line-height: 1.6; }
.catalog-setup-steps code { color: #d7efc2; }
.settings-dialog { width: min(600px, calc(100vw - 28px)); }
.metadata-dialog { width: min(760px, calc(100vw - 28px)); }
.metadata-search-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; }
.metadata-search-form label { display: grid; gap: 7px; color: #c3c9d2; font-size: 11px; font-weight: 700; }
.metadata-search-form input { min-width: 0; border: 1px solid #343b48; border-radius: 9px; background: #11151b; color: var(--text); padding: 10px 11px; font-size: 12px; }
.metadata-search-form input:focus { border-color: #8cc75c; box-shadow: 0 0 0 3px rgba(184, 244, 122, .1); outline: none; }
.metadata-search-form > button { min-height: 38px; }
.metadata-dialog > .field-hint { min-height: 17px; margin: 13px 0 9px; }
.metadata-results { display: grid; max-height: 52vh; overflow: auto; gap: 9px; }
.metadata-result { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid #303845; border-radius: 11px; background: #1b212a; padding: 9px; }
.metadata-result > img, .metadata-result-placeholder { width: 54px; height: 70px; border-radius: 6px; object-fit: cover; background: #252e38; }
.metadata-result-placeholder { display: grid; place-items: center; color: #8993a1; font-size: 19px; }
.metadata-result-copy { min-width: 0; }
.metadata-result-copy strong, .metadata-result-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metadata-result-copy strong { color: #eef0f3; font-size: 12px; }
.metadata-result-copy span { margin-top: 4px; color: #9ca6b3; font-size: 10px; }
.metadata-result-copy p { display: -webkit-box; overflow: hidden; margin: 6px 0 0; color: #8e98a6; font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.metadata-apply-button { min-height: 34px; padding: 0 10px; }
.bulk-covers-dialog { width: min(560px, calc(100vw - 28px)); }
.bulk-covers-scope { display: grid; gap: 7px; color: #c3c9d2; font-size: 11px; font-weight: 700; }
.bulk-covers-scope select { min-height: 40px; border: 1px solid #343b48; border-radius: 9px; background: #11151b; padding: 0 11px; color: var(--text); }
.bulk-covers-progress-panel { margin-top: 16px; }
.bulk-covers-progress-panel progress { display: block; width: 100%; height: 9px; accent-color: var(--accent); }
.bulk-covers-progress-panel .field-hint { margin: 9px 0 0; min-height: 18px; }
.bulk-covers-footnote { margin: 14px 0 0; color: #8993a1; font-size: 10px; line-height: 1.55; }
.custom-fields { border-top: 1px solid #2e3540; padding-top: 14px; }
.custom-fields summary { display: flex; align-items: center; gap: 9px; color: #d3d8e0; font-size: 11px; font-weight: 800; cursor: pointer; }
.custom-fields > .field-hint { margin: 8px 0 11px; }
.custom-fields-list { display: grid; gap: 7px; margin-bottom: 9px; }
.custom-field-row { display: grid; grid-template-columns: 1fr 1.4fr 32px; gap: 7px; }
.custom-field-row input { min-width: 0; border: 1px solid #343b48; border-radius: 8px; background: #11151b; padding: 8px 9px; color: var(--text); font-size: 10px; }
.custom-field-row button { border: 1px solid #3a424e; border-radius: 8px; background: #202630; color: #b5bec9; font-size: 14px; }
.custom-field-row button:hover { color: var(--danger); }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.action-spacer { flex: 1; }
.import-dialog, .restore-dialog { width: min(620px, calc(100vw - 28px)); }
.dialog-intro { margin: -8px 0 19px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.file-drop { position: relative; display: grid; min-height: 142px; align-content: center; justify-items: center; gap: 7px; overflow: hidden; border: 1px dashed #536047; border-radius: 14px; background: rgba(184, 244, 122, .035); color: #d9e7ca; cursor: pointer; text-align: center; }
.file-drop:hover { border-color: var(--accent); background: rgba(184, 244, 122, .065); }
.file-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-drop-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: #2b3728; color: var(--accent); font-size: 17px; }
.file-drop strong { font-size: 12px; }
.file-drop span:last-child { color: var(--muted); font-size: 10px; }
.import-preview { margin-top: 17px; }
.preview-summary { display: flex; justify-content: space-between; gap: 12px; color: #aab2bf; font-size: 10px; }
.preview-summary strong { color: var(--accent); }
.preview-table { overflow: auto; max-height: 180px; margin-top: 11px; border: 1px solid #303743; border-radius: 9px; }
.preview-table table { width: 100%; border-collapse: collapse; font-size: 9px; white-space: nowrap; }
.preview-table th, .preview-table td { max-width: 180px; overflow: hidden; border-bottom: 1px solid #2d333d; padding: 7px 9px; text-overflow: ellipsis; text-align: left; }
.preview-table th { position: sticky; top: 0; background: #202630; color: #aeb8c5; }
.preview-table td { color: #d0d5dd; }
.import-warning { margin: 12px 0 0; border-left: 2px solid var(--amber); padding-left: 9px; color: #b8ad93; font-size: 10px; line-height: 1.5; }

.scan-dialog { width: min(500px, calc(100vw - 24px)); padding: 21px; }
.scan-dialog .dialog-header { margin-bottom: 14px; }
.scan-area { position: relative; display: grid; overflow: hidden; min-height: 245px; place-items: center; border: 1px solid #303844; border-radius: 14px; background: radial-gradient(ellipse at center, #212a33, #10141a 75%); }
.scan-area video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #10141a; }
.scan-frame { position: relative; z-index: 1; width: min(74%, 310px); height: 100px; border: 1px solid rgba(184, 244, 122, .8); border-radius: 10px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.24); }
.scan-frame::before, .scan-frame::after, .scan-frame span::before, .scan-frame span::after { position: absolute; width: 17px; height: 17px; border-color: var(--accent); content: ''; }
.scan-frame::before { top: -2px; left: -2px; border-top: 3px solid; border-left: 3px solid; border-radius: 7px 0 0; }
.scan-frame::after { top: -2px; right: -2px; border-top: 3px solid; border-right: 3px solid; border-radius: 0 7px 0 0; }
.scan-frame span::before { bottom: -2px; left: -2px; border-bottom: 3px solid; border-left: 3px solid; border-radius: 0 0 0 7px; }
.scan-frame span::after { right: -2px; bottom: -2px; border-right: 3px solid; border-bottom: 3px solid; border-radius: 0 0 7px; }
.scan-caption { position: absolute; z-index: 2; bottom: 12px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: rgba(12, 15, 19, .76); padding: 6px 10px; color: #e1e5eb; font-size: 9px; backdrop-filter: blur(8px); }
.scan-caption i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.scan-message { min-height: 32px; margin: 10px 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.scanner-controls { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }
.manual-code-form { border-top: 1px solid #2d333d; padding-top: 14px; }
.manual-code-form > label { margin-bottom: 7px; }
.scan-not-found { display: grid; grid-template-columns: 36px 1fr; gap: 10px; margin-top: 15px; border: 1px solid #3a424c; border-radius: 12px; background: #202630; padding: 12px; }
.scan-result-icon { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #475142; border-radius: 10px; color: var(--amber); font-weight: 800; }
.scan-not-found strong { font-size: 11px; }
.scan-not-found p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.scan-not-found button { grid-column: span 2; }
.scan-collection-matches { grid-column: span 2; display: grid; gap: 6px; }
.scan-match-button { width: 100%; text-align: left; justify-content: flex-start; }

.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 9px; border: 1px solid #414a56; border-radius: 12px; background: #242b35; padding: 12px 14px; color: #e6e9ee; box-shadow: var(--shadow); font-size: 11px; line-height: 1.5; animation: toast-in .22s ease both; }
.toast::before { width: 7px; height: 7px; flex: 0 0 auto; margin-top: 4px; border-radius: 50%; background: var(--accent); content: ''; }
.toast.is-error::before { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) {
  .games-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topbar { gap: 18px; }
  .topbar .brand-lockup { flex-basis: 158px; }
}
@media (max-width: 840px) {
  .topbar { min-height: 64px; flex-wrap: wrap; gap: 11px; padding: 10px 18px; }
  .topbar .brand-lockup { flex-basis: auto; margin-right: auto; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
  .topbar-actions { margin-left: 0; }
  .topbar-actions .button { min-height: 36px; padding: 0 10px; }
  .page-content { padding: 34px 20px 44px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 36px; }
  .games-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .filter-row { flex-wrap: wrap; }
  .filter-control { min-width: calc(50% - 8px); }
  .filter-control.sort-control { margin-left: 0; }
  .clear-filters { padding-bottom: 11px; }
}
@media (max-width: 560px) {
  .auth-card { padding: 28px 22px; border-radius: 19px; }
  .topbar { padding: 10px 13px; }
  .topbar .brand-lockup { font-size: 14px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .button { min-height: 34px; border-radius: 9px; padding: 0 9px; font-size: 10px; }
  .scan-button .button-symbol { font-size: 14px; }
  .account-button { width: 33px; height: 33px; }
  .page-content { padding: 28px 13px 38px; }
  .welcome-row { align-items: flex-start; flex-direction: column; gap: 15px; margin-bottom: 20px; }
  .welcome-row h1 { font-size: 31px; }
  .welcome-actions { width: 100%; }
  .welcome-actions > .button { flex: 1; }
  .stats-grid { gap: 8px; margin-bottom: 31px; }
  .stat-card { min-height: 111px; padding: 14px 13px 12px; }
  .stat-label { font-size: 8px; letter-spacing: .08em; }
  .stat-main { margin-top: 12px; }
  .stat-main strong { font-size: 25px; }
  .stat-note { margin-top: 10px; font-size: 9px; }
  .stat-live { font-size: 7px; }
  .section-heading { align-items: center; }
  .section-heading h2 { font-size: 18px; }
  .section-heading p { max-width: 240px; line-height: 1.5; }
  .filter-row { gap: 8px; padding-bottom: 14px; }
  .filter-control { min-width: calc(50% - 4px); gap: 5px; }
  .filter-control select { height: 35px; padding-left: 8px; font-size: 10px; }
  .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .game-card { border-radius: 12px; }
  .cover-art { aspect-ratio: 1 / 1.03; }
  .cover-platform { bottom: 7px; left: 7px; max-width: calc(100% - 14px); padding: 3px 5px; font-size: 7px; }
  .game-card-body { padding: 10px 9px 9px; }
  .game-status-tag { font-size: 7px; }
  .game-price { font-size: 9px; }
  .game-title { min-height: 34px; font-size: 11px; }
  .game-meta { margin-top: 6px; font-size: 8px; }
  .app-footer { align-items: flex-start; flex-direction: column; padding: 15px 13px; font-size: 9px; }
  .empty-state { min-height: 300px; padding: 20px; }
  .empty-state h3, .no-results h3 { font-size: 16px; }
  .app-dialog { max-height: 94vh; padding: 18px 15px; border-radius: 16px; }
  .dialog-header h2 { font-size: 21px; }
  .form-grid { gap: 12px 9px; }
  .metadata-search-form { grid-template-columns: 1fr; }
  .metadata-search-form > button { width: 100%; }
  .form-grid label, .full-label { gap: 6px; font-size: 10px; }
  .form-grid input, .form-grid select { padding: 9px; font-size: 11px; }
  .price-panel { padding: 12px 10px; }
  .price-panel-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .action-spacer { display: none; }
  .dialog-actions > button { flex: 1; }
  .metadata-result { grid-template-columns: 44px minmax(0, 1fr); gap: 9px; }
  .metadata-result > img, .metadata-result-placeholder { width: 44px; height: 60px; }
  .metadata-apply-button { grid-column: 2; justify-self: start; }
  .custom-field-row { grid-template-columns: .9fr 1.2fr 30px; }
  .scan-area { min-height: 230px; }
}

.scan-batch-panel { display: grid; gap: 9px; margin-top: 15px; border: 1px solid #303845; border-radius: 12px; background: #171c23; padding: 12px; }
.scan-batch-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scan-batch-heading > div { display: flex; align-items: baseline; gap: 8px; }
.scan-batch-heading strong { font-size: 12px; }
.scan-batch-heading span { color: var(--muted); font-size: 10px; }
.scan-batch-list { display: grid; max-height: 34vh; overflow: auto; gap: 7px; }
.scan-batch-empty { margin: 0; padding: 12px 6px; color: var(--muted); font-size: 11px; text-align: center; }
.scan-batch-item { display: grid; gap: 8px; border: 1px solid #303845; border-radius: 10px; background: #202630; padding: 9px; }
.scan-batch-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.scan-batch-item-copy { min-width: 0; }
.scan-batch-item-copy strong, .scan-batch-item-copy small { display: block; overflow-wrap: anywhere; }
.scan-batch-item-copy strong { color: #eef0f3; font-size: 11px; }
.scan-batch-item-copy small { margin-top: 3px; color: #9099a6; font-size: 9px; }
.scan-batch-status { flex: none; border: 1px solid #3c4652; border-radius: 20px; padding: 3px 7px; color: #b6c0cc; font-size: 9px; }
.scan-batch-status-ready { border-color: #526c3c; color: #c7f49b; }
.scan-batch-status-missing { border-color: #725c32; color: #f0d08a; }
.scan-batch-status-owned { border-color: #42665d; color: #a8dbc8; }
.scan-batch-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.scan-batch-unknown-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.scan-batch-title-input { min-width: 0; border: 1px solid #343b48; border-radius: 8px; background: #11151b; color: var(--text); padding: 8px; font-size: 11px; }
.scan-batch-title-input:focus { border-color: #8cc75c; outline: none; }
.scan-batch-unknown-controls .button { min-height: 32px; padding: 0 8px; font-size: 10px; }
.scan-batch-item-actions { display: flex; justify-content: flex-end; }
.scan-batch-item-actions button { min-height: 28px; }
.scan-batch-progress { min-height: 15px; margin: 0; }
@media (max-width: 620px) {
  .scan-batch-unknown-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .scan-batch-unknown-controls .scan-batch-use-title { grid-column: 1 / -1; }
}@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Herramientas, claves del catálogo y densidad de la cuadrícula. */
.settings-menu-button { min-width: 142px; }
.popover { width: 250px; }
.popover-section-label { padding: 8px 10px 4px; color: #818a98; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.popover-divider { height: 1px; margin: 5px 6px; background: #343b48; }
.collection-display-controls { display: flex; align-items: center; gap: 12px; }
.cover-density-control { display: grid; min-width: 142px; gap: 5px; }
.cover-density-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #a1a8b5; font-size: 9px; }
.cover-density-label strong { color: #dce1e8; font-weight: 700; }
.cover-density-control input[type="range"] { width: 100%; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.settings-dialog form { margin: 0; }
.token-field { display: grid; gap: 7px; margin: 0 0 14px; color: #c3c9d2; font-size: 11px; font-weight: 700; }
.token-field input { width: 100%; min-width: 0; border: 1px solid #343b48; border-radius: 9px; background: #11151b; padding: 11px 12px; color: var(--text); font-size: 12px; }
.token-field input::placeholder { color: #707987; }
.settings-dialog h3 { margin-top: 17px; }
.settings-dialog h3:first-of-type { margin-top: 0; }
.settings-dialog .dialog-actions { flex-wrap: wrap; }
.settings-dialog .dialog-actions .action-spacer { flex: 1 1 auto; }
.settings-dialog #catalog-save-message { min-height: 17px; margin: 7px 0 0; }
.games-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--cover-card-min, 170px)), 1fr)); }

@media (max-width: 560px) {
  .welcome-actions, .menu-wrap { width: 100%; }
  .settings-menu-button { width: 100%; }
  .section-heading { align-items: flex-start; flex-wrap: wrap; gap: 11px; }
  .collection-display-controls { width: 100%; justify-content: space-between; }
  .cover-density-control { min-width: 0; width: min(190px, 60%); }
  .popover { width: min(280px, calc(100vw - 26px)); }
}
.share-dialog-actions { flex-wrap: wrap; }
.share-dialog-actions .action-spacer { flex: 1 1 auto; }

.section-tabs { display: flex; gap: 6px; margin: 0 0 22px; border-bottom: 1px solid #2a303b; }
.section-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 10px 12px 11px; color: #8b95a3; font-size: 11px; font-weight: 700; }
.section-tab:hover { color: #e5e9ee; }
.section-tab.is-active { border-bottom-color: var(--accent); color: var(--accent); }
.played-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 2px 0 22px; }
.played-section-heading h2 { display: flex; align-items: center; gap: 10px; margin: 9px 0 0; font-size: 23px; letter-spacing: -.055em; }
.played-section-heading p { max-width: 600px; margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.played-section-actions { display: flex; flex: none; gap: 8px; }
.played-section-actions .button { white-space: nowrap; }
.played-years-list { display: grid; gap: 23px; }
.played-year-group { min-width: 0; }
.played-year-heading { display: flex; align-items: baseline; gap: 9px; margin: 0 0 10px; }
.played-year-heading h3 { margin: 0; color: #edf0f3; font-size: 17px; letter-spacing: -.04em; }
.played-year-heading span { color: #858f9c; font-size: 9px; }
.played-game-list { display: grid; gap: 7px; }
.played-game-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; border: 1px solid #2b323d; border-radius: 10px; background: #191e26; padding: 8px 11px; }
.played-game-cover { display: block; width: 48px; height: 64px; overflow: hidden; border: 1px solid #343d49; border-radius: 6px; background: #252e38; object-fit: cover; }
.played-game-cover-fallback { display: grid; place-items: center; background: linear-gradient(145deg, #253a43, #3c414d); color: #e6eaf0; font-size: 18px; font-weight: 800; }
.played-game-cover-button { position: relative; padding: 0; cursor: pointer; color: inherit; }
.played-game-cover-button .played-game-cover-fallback { width: 100%; height: 100%; }
.played-game-cover-button:hover, .played-game-cover-button:focus-visible { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.played-cover-search-hint { position: absolute; right: 2px; bottom: 2px; left: 2px; border-radius: 3px; background: #111820e8; padding: 3px 1px; color: #d8ffb4; font-size: 8px; font-weight: 800; line-height: 1; text-align: center; }
.played-game-copy { min-width: 0; }
.played-game-copy h4 { overflow-wrap: anywhere; margin: 0 0 9px; color: #edf0f3; font-size: 12px; font-weight: 800; line-height: 1.45; }
.played-game-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.played-platform-tag, .played-rating-tag { display: inline-flex; align-items: center; min-height: 21px; border: 1px solid #38414c; border-radius: 20px; background: #202630; padding: 3px 8px; color: #b9c1cc; font-size: 9px; }
.played-rating-tag { border-color: #4a6338; background: #25301f; color: #c9eda8; font-weight: 800; }
.played-game-actions { display: flex; justify-content: flex-end; gap: 12px; }
.played-game-actions .text-button { font-size: 9px; }
.played-cover-search-button { color: #c6ef9e; }
.played-cover-search-button:hover { color: #e0ffc2; }
.played-delete-button { color: #d29198; }
.played-delete-button:hover { color: #ff9da7; }
.played-game-dialog { width: min(560px, calc(100vw - 28px)); }
.played-game-fields { margin-bottom: 20px; }
.played-game-fields input { min-width: 0; }
.played-game-fields label { display: grid; align-content: start; gap: 7px; color: #c3c9d2; font-size: 11px; font-weight: 700; }
.played-game-fields .field-optional { color: #828b98; font-size: 9px; font-weight: 400; }
@media (max-width: 560px) {
  .played-section-heading { align-items: flex-start; flex-direction: column; }
  .played-section-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .played-section-actions .button { min-width: 0; justify-content: center; padding-inline: 8px; white-space: normal; }
  .played-game-row { grid-template-columns: 42px minmax(0, 1fr); gap: 9px; padding: 8px; }
  .played-game-cover { width: 42px; height: 56px; }
  .played-game-actions { grid-column: 2; justify-content: flex-start; gap: 14px; border-top: 1px solid #282f39; padding-top: 6px; }
  .section-tabs { margin-bottom: 17px; }
}
