:root {
  color-scheme: light dark;
  --canvas: light-dark(#f8f9f6, #171d19);
  --rail: light-dark(#eef1eb, #1b2420);
  --ink: light-dark(#172820, #edf5ef);
  --muted: light-dark(#536259, #b1c1b6);
  --line: light-dark(#dce2d9, #3c4b42);
  --green: light-dark(#244a3e, #b7deca);
  --wash: light-dark(#dce9df, #304b3e);
  --surface: light-dark(#fff, #222c26);
  --hover: light-dark(#e4ebe3, #2c3932);
  --wash-hover: light-dark(#cbded0, #395947);
  --primary: light-dark(#244a3e, #bddfc9);
  --primary-ink: light-dark(#fff, #1a3429);
  --primary-hover: light-dark(#173e31, #d3ecd9);
  --focus: light-dark(#357a63, #95cdb0);
  --focus-halo: light-dark(#d5e8dc, #426651);
  --dialog: light-dark(#f8faf6, #202a24);
  --danger: light-dark(#f3e5e3, #492e2b);
  --danger-ink: light-dark(#802d27, #ffccc4);
  --danger-hover: light-dark(#eed7d3, #583733);
  --serif: Georgia, 'Times New Roman', serif;
  font: 100%/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button:active { scale: .97; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
::selection { background: #c6e3d1; color: #143428; }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 20; background: var(--surface); color: var(--green); padding: 10px; }
.ico { width: 20px; height: 20px; display: block; flex: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 6; display: flex; flex-direction: column; width: 226px; background: var(--rail); padding: 31px 16px 18px; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px; font-weight: 720; font-size: 1.13rem; line-height: 1.2; letter-spacing: -.025em; }
.brand small { display: block; margin-top: 4px; font-size: .69rem; font-weight: 650; letter-spacing: .12em; color: var(--muted); }
.sidebar nav { margin-top: 41px; min-height: 0; overflow: auto; }
.sidebar h2 { margin: 0 10px 9px; font-size: .75rem; letter-spacing: .105em; text-transform: uppercase; color: var(--muted); font-weight: 670; }
.nav-item, .sidebar-foot { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 43px; background: transparent; border: 0; border-radius: 9px; text-align: left; padding: 8px 10px; font-size: .9rem; }
.nav-item:hover, .sidebar-foot:hover, .icon-button:hover { background: var(--hover); }
.nav-item[aria-current] { background: var(--wash); color: var(--green); font-weight: 690; }
.nav-item .nav-label { flex: 1; overflow-wrap: anywhere; }
.nav-item .nav-count { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.list-heading { display: flex; align-items: center; justify-content: space-between; margin: 28px 1px 4px 0; }
.list-heading h2 { margin-bottom: 0; }
.list-heading .ico { width: 16px; height: 16px; }
.sidebar-bottom { margin-top: auto; }
.sidebar-foot { color: var(--muted); }
.workspace { margin-left: 226px; }
.toolbar { min-height: 76px; padding: 14px clamp(24px, 3.4vw, 54px); display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 4; background: color-mix(in srgb, var(--canvas) 90%, transparent); backdrop-filter: blur(18px) saturate(140%); border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.toolbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.toolbar .theme-button { min-width: 42px; min-height: 42px; }
.search { width: min(100%, 414px); min-width: 0; display: flex; align-items: center; min-height: 43px; gap: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 11px; color: var(--muted); }
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus-halo); }
.search .ico { width: 17px; height: 17px; }
.search input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; padding: 9px 0; font-size: .9rem; }
.search input::placeholder { color: var(--muted); opacity: 1; }
kbd { font: 600 .72rem/1.5 system-ui; white-space: nowrap; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.primary, .secondary, .hero-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9px; padding: 9px 15px; min-height: 42px; white-space: nowrap; font-size: .88rem; font-weight: 650; }
.primary { background: var(--primary); color: var(--primary-ink); }
.primary:hover { background: var(--primary-hover); }
.primary .ico { width: 17px; height: 17px; }
.secondary { background: var(--wash); color: var(--green); }
.secondary:hover { background: var(--wash-hover); }
.icon-button { min-width: 34px; min-height: 34px; display: inline-grid; place-items: center; flex: none; padding: 0; background: transparent; border: 0; border-radius: 7px; color: var(--muted); }
.mobile-menu { display: none; }
main { max-width: 1600px; margin: 0 auto; padding: 32px clamp(24px, 3.4vw, 54px) 54px; }
.page-title { margin-bottom: 25px; }
h1, h2, h3, p { margin: 0; }
h1 { font: 400 clamp(2.65rem, 4.2vw, 4.3rem)/1.02 var(--serif); letter-spacing: -.04em; overflow-wrap: anywhere; }
.page-title p { color: var(--muted); margin-top: 9px; }
.hero { min-height: 267px; position: relative; isolation: isolate; display: flex; align-items: center; overflow: hidden; border-radius: 16px; background: #1a3029; color: #fff; box-shadow: 0 9px 22px #1b32251c; }
.hero-art, .hero::after { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-art { object-fit: cover; object-position: center 43%; }
.hero::after { content: ''; background: linear-gradient(90deg, #142720 0%, #142720f5 25%, #14272089 58%, #14272014 100%); }
.hero-text { padding: 29px clamp(20px, 3.35vw, 48px); max-width: 600px; }
.hero-text h2 { font: 400 clamp(1.9rem, 3.3vw, 3.3rem)/1.05 var(--serif); letter-spacing: -.032em; text-wrap: balance; margin: 8px 0; }
.hero-status { display: flex; align-items: center; gap: 8px; color: #e3eedf; font-size: .77rem; letter-spacing: .085em; font-weight: 690; text-transform: uppercase; }
.hero-status::before, .badge::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hero-text p { color: #e1ebe3; font-size: .88rem; margin-bottom: 17px; }
.hero-button { background: #f0f5ed; color: #244237; }
.hero-button:hover { background: #dfeee1; }
.hero-button .ico { width: 15px; height: 15px; }
.shelf { margin-top: 32px; }
.shelf-bar, .shelf-bar > div, .controls { display: flex; align-items: center; gap: 13px; }
.shelf-bar { justify-content: space-between; margin-bottom: 15px; flex-wrap: wrap; }
.shelf-bar > div:first-child { flex-wrap: wrap; }
.shelf-bar h2 { font-size: 1.28rem; letter-spacing: -.028em; }
#count { font-size: .82rem; color: var(--muted); }
.select, .segmented { min-height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; }
.select select { border: 0; background: transparent; padding: 8px 9px; font-size: .82rem; cursor: pointer; }
.segmented { padding: 2px; display: flex; align-items: center; }
.segmented .icon-button { min-height: 32px; }
.segmented .ico { width: 16px; height: 16px; }
.segmented [aria-pressed="true"] { background: var(--wash); color: var(--green); }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 158px), 1fr)); gap: 22px 18px; }
.game { min-width: 0; border: 0; background: transparent; text-align: left; padding: 0; border-radius: 12px; display: block; width: 100%; align-self: start; }
.cover { display: grid; position: relative; isolation: isolate; place-items: center; overflow: hidden; aspect-ratio: 2 / 2.75; border-radius: 12px; background: radial-gradient(ellipse at 15% 20%, #608173, #253c34 70%); color: #edf6ea; box-shadow: 0 4px 9px #1d302321; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 250ms cubic-bezier(.2,.75,.25,1); }
.cover .fallback { font: 400 1.25rem/1.1 var(--serif); text-align: center; padding: 12px; overflow-wrap: anywhere; max-width: 100%; }
.game:hover img { transform: scale(1.045); }
.game-title { display: block; margin-top: 9px; font-size: .94rem; font-weight: 680; line-height: 1.3; overflow-wrap: anywhere; }
.meta { display: block; margin-top: 4px; color: var(--muted); font-size: .79rem; overflow-wrap: anywhere; }
.game-meta { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.personal-rating { display: inline-flex; margin-top: 4px; }
.stars { display: inline-flex; color: light-dark(#99640e, #ffce7a); }
.star { display: inline-block; position: relative; pointer-events: none; }
.star > .ico { color: var(--muted); fill: none; }
.star-fill { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--fill)) 0 0); }
.star-fill .ico { fill: currentColor; }
.personal-rating .ico { width: 13px; height: 13px; }
.rating-field { padding: 7px 10px; }
.rating-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0 10px; }
.rating-picker { margin-left: -3px; }
.star-choice { width: 38px; height: 44px; position: relative; display: grid; place-items: center; }
.star-choice .ico { width: 27px; height: 27px; }
.star-target { position: absolute; inset: 0 50% 0 0; cursor: pointer; border-radius: 5px; }
.star-target:last-child { inset: 0 0 0 50%; }
.star-target:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.rating-controls output { color: var(--muted); font-variant-numeric: tabular-nums; }
.text-button { border: 0; padding: 8px 0; background: none; color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.platform-line { display: block; margin-top: 3px; color: var(--muted); font-size: .79rem; overflow-wrap: anywhere; }
.detail-top .platform-line { margin-block: 5px; }
.platform-line strong { color: var(--ink); font-weight: 650; }
.badge, .status-choice { --status-fill: #f3f4ef; --status-ink: #3e5045; }
.badge { position: absolute; left: 9px; bottom: 9px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; background: var(--status-fill); color: var(--status-ink); font-size: .75rem; font-weight: 680; }
:is(.badge, .status-choice).playing { --status-fill: #dcece1; --status-ink: #20533a; }
:is(.badge, .status-choice).played { --status-fill: #e7ecfb; --status-ink: #304474; }
:is(.badge, .status-choice).wishlist { --status-fill: #f6e9d6; --status-ink: #69502c; }
.rows { grid-template-columns: 1fr; gap: 0; }
.rows .game, .result-game { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 13px; padding: 8px; border-bottom: 1px solid var(--line); }
.rows .game:hover, .result-game:hover { background: var(--hover); }
.rows .cover, .result-game .cover { border-radius: 6px; }
.rows .badge { position: static; justify-self: end; }
.rows .game-title, .result-game .game-title { margin: 0; }
.result-game { grid-template-columns: 46px minmax(0, 1fr) auto; }
.result-game .fallback, .rows .fallback { font: 700 .64rem/1 system-ui; padding: 2px; }
.empty { grid-column: 1 / -1; padding: 27px 0; color: var(--muted); }
.empty button { margin-top: 12px; }
#results h3 { margin: 0 0 5px; }
.catalog-note { color: var(--muted); font-size: .88rem; margin-bottom: 12px; }
.catalog-note a { color: var(--green); text-underline-offset: .18em; }
.catalog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.connection-message { margin-top: 13px; color: var(--muted); font-size: .88rem; }
.account-providers { display: grid; gap: 8px; }
.account-providers .secondary { justify-content: center; }
.dialog-actions button:disabled { opacity: .6; cursor: wait; }
dialog { width: min(calc(100% - 26px), 520px); max-height: calc(100% - 28px); padding: 0; background: var(--dialog); color: var(--ink); border: none; border-radius: 18px; box-shadow: 0 22px 65px #10191480; }
dialog::backdrop { background: #101e1880; backdrop-filter: blur(4px); }
dialog[open] { animation: materialize 230ms cubic-bezier(.17,.72,.28,1) both; }
@keyframes materialize { from { opacity: 0; transform: translateY(9px) scale(.986); } }
#sheet-body { padding: 21px 23px 23px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.dialog-head h2 { font-size: 1.35rem; line-height: 1.2; overflow-wrap: anywhere; }
.detail-top { display: grid; grid-template-columns: 85px minmax(0, 1fr); gap: 15px; align-items: start; margin-bottom: 17px; }
.detail-top p { font-size: .9rem; color: var(--muted); margin-top: 7px; }
.form-field { display: grid; gap: 5px; margin-top: 12px; font-weight: 600; font-size: .88rem; }
.form-field > :is(input,select,textarea) { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 10px; font-weight: 400; min-width: 0; }
.form-field > :is(input,textarea)::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; }
fieldset { margin: 14px 0 0; border: 1px solid var(--line); padding: 9px 12px; border-radius: 8px; font-size: .88rem; }
fieldset label { display: block; padding: 3px 0; overflow-wrap: anywhere; }
fieldset input { accent-color: var(--green); margin-right: 7px; }
.status-field { border: 0; padding: 0; }
.status-field legend { font-weight: 600; margin: 0 0 5px; padding: 0; }
.status-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.status-options .status-choice { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 7px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; transition: background-color 200ms ease-out, border-color 200ms ease-out, color 200ms ease-out; }
.status-choice::before { content: ''; flex: none; width: 8px; height: 8px; border: 1px solid currentColor; border-radius: 50%; }
.status-options .status-choice:hover { background: var(--hover); }
.status-options .status-choice:has(:checked) { background: var(--status-fill); border-color: var(--status-fill); color: var(--status-ink); }
.status-choice:has(:checked)::before { background: currentColor; }
.status-choice:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 480px) {
  .status-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.danger { background: var(--danger); color: var(--danger-ink); }
.danger:hover { background: var(--danger-hover); }
.settings-row { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 13px; font-size: .9rem; }
.toast { position: fixed; z-index: 10; bottom: 17px; right: 20px; max-width: calc(100% - 40px); display: flex; align-items: center; gap: 12px; background: #23483c; color: white; padding: 10px 13px; border-radius: 9px; box-shadow: 0 6px 22px #182f2360; }
.toast button { border: 0; background: none; color: white; text-decoration: underline; }
@media (min-width: 1250px) { .games:not(.rows) { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .sidebar { display: none; top: 65px; width: min(285px, 90vw); border: 0; box-shadow: 10px 12px 34px #1a33222a; }
  .sidebar.open { display: flex; }
  .sidebar nav { margin-top: 22px; }
  .workspace { margin: 0; }
  .toolbar { min-height: 65px; padding: 10px 15px; gap: 8px; }
  .toolbar-actions { gap: 3px; }
  .toolbar .theme-button { min-width: 36px; }
  .mobile-menu { display: inline-grid; }
  .search { width: 100%; }
  kbd { display: none; }
  main { padding: 25px 16px 42px; }
  .hero { min-height: 246px; }
  .hero::after { background: linear-gradient(90deg, #142720fa, #14272087); }
  .games { grid-template-columns: repeat(auto-fill, minmax(min(100%, 136px), 1fr)); gap: 17px 13px; }
  .games.rows { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .add { min-width: 42px; padding-inline: 10px; }
  .add > span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .toolbar { background: var(--canvas); backdrop-filter: none; }
}
