.library { min-width: 0; padding-bottom: 4rem; }
.library button, .library input, .library select { font: inherit; }
.library button, .library select, .library input, .library-login {
  min-width: 44px;
  min-height: 44px;
}
.library button, .library select { cursor: pointer; }
.library button:disabled { cursor: not-allowed; opacity: .55; }
.library :is(button, input, select):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
.library-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  border-radius: 1rem;
  background: linear-gradient(115deg, #3f3bbd, #5856d6);
  color: #fff;
  box-shadow: 0 4px 16px #5856d620;
}
.library-hero::after {
  position: absolute;
  right: -.25rem;
  top: -1rem;
  content: "✧";
  font-size: 9rem;
  opacity: .12;
  pointer-events: none;
}
.library-kicker { padding: .25rem .6rem; border-radius: 999px; background: #ffffff25; font-size: .75rem; font-weight: 700; }
.library-hero h2 { position: relative; margin: .75rem 0 .5rem; font-size: clamp(1.3rem, 2.5vw, 1.9rem); }
.library-hero p { position: relative; margin: 0; font-size: .875rem; }
.library-search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.library-search input {
  width: 100%;
  min-width: 0;
  padding: .7rem .9rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: #fff;
}
.library-button {
  padding: .55rem 1rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: #fff;
  color: #3631a9;
  font-weight: 700 !important;
}
.library-search .library-button { flex-shrink: 0; background: var(--primary); color: #fff; border-color: var(--primary); }
.library-filters {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  padding: .9rem .2rem;
  scrollbar-width: thin;
}
.library-filter { display: flex; flex: 0 0 auto; flex-direction: column; gap: .3rem; font-size: .75rem; color: var(--muted); }
.library-filter select, .library-filter input {
  width: 135px;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}
.library-filter input { width: 100px; }
.library-filter select[data-active="true"], .library-filter input[data-active="true"],
.library-favorites[aria-pressed="true"] { border-color: var(--primary); background: #e7e6ff; color: #3631a9; }
.library-favorites { align-self: flex-end; white-space: nowrap; border-radius: 999px; }
.library-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin: .5rem 0 1rem; font-size: .875rem; }
.library-toolbar p { margin: 0; color: var(--muted); }
.library-sort { display: flex; align-items: center; gap: .5rem; }
.library-sort select { border: 1px solid var(--border); border-radius: .65rem; padding: .4rem .6rem; background: #fff; color: #3631a9; }
.library-login { display: inline-flex; align-items: center; color: #3631a9; font-weight: 700; }
.library-notice { margin: .75rem 0; padding: .75rem 1rem; border-radius: .75rem; background: #e7e6ff; overflow-wrap: anywhere; }
.library-notice[role="alert"] { background: #ffdad6; color: #93000a; }
.library-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.game-card { min-width: 0; overflow: hidden; border-radius: 1rem; background: #fff; box-shadow: 0 2px 10px #171c2310; }
.game-cover { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 190px; overflow: hidden; background: linear-gradient(125deg, #e2dfff, #b3ebff); }
.game-cover img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.game-cover::after { position: absolute; inset: 0; content: ""; background: linear-gradient(transparent 25%, #171c23d9); }
.game-no-cover { position: absolute; top: 35%; width: 100%; text-align: center; color: #3631a9; font-weight: 700; }
.game-title { position: relative; z-index: 1; padding: .8rem 1rem; color: #fff; }
.game-title h3 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.game-title a { color: inherit; text-decoration: none; }
.game-title a:hover { text-decoration: underline; }
.game-title p { margin: .15rem 0 0; font-size: .75rem; overflow-wrap: anywhere; }
.game-type { position: absolute; z-index: 1; top: .75rem; left: .75rem; padding: .25rem .6rem; border-radius: 999px; background: #9a4600; color: #fff; font-size: .75rem; font-weight: 700; }
.game-type.is-video { background: #00576a; }
.game-content { padding: .6rem .75rem .75rem; }
.game-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem; margin: 0 0 .45rem; padding: .35rem .5rem; border-radius: .5rem; background: #f0f4fd; text-align: center; font-size: .75rem; }
.game-facts > div { display: flex; justify-content: center; gap: .3rem; min-width: 0; }
.game-facts dt { color: var(--muted); }
.game-facts dd { margin: 0; font-weight: 700; }
.game-inventory { display: grid; gap: .35rem; max-height: 160px; overflow-y: auto; margin: 0; padding: 0; list-style: none; font-size: .75rem; }
.game-inventory li { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; }
.game-location { color: #3f3bbd; overflow-wrap: anywhere; }
.game-status { padding: .2rem .55rem; border-radius: 999px; background: #eaeef8; color: var(--muted); font-size: .75rem; font-weight: 700; }
.game-status.is-owned { background: #d5f5ec; color: #006650; }
.game-status.is-lent { background: #fff0cd; color: #744700; }
.game-status.is-preorder { background: #e7e6ff; color: #3631a9; }
.game-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.game-actions button { flex: 1; padding: .25rem .4rem; border: 1px solid var(--border); border-radius: .6rem; background: #fff; color: var(--muted); font-size: .75rem; }
.game-actions button[aria-pressed="true"] { background: #e7e6ff; color: #3631a9; border-color: var(--primary); }
.library-state { padding: 2rem 1rem; border: 1px dashed var(--border); border-radius: 1rem; background: #fff; text-align: center; }
.library-state h3 { margin-top: 0; }
.library-state p { color: var(--muted); }
.library-skeleton { height: 350px; border-radius: 1rem; background: linear-gradient(#e4e8f2 190px, #fff 190px); }
.library-pagination { display: flex; justify-content: center; align-items: center; gap: .75rem; margin-top: 1.5rem; }
@media (min-width: 640px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .library-hero { padding: 1.75rem; }
}
