.gw-library {
  --gw-ink: #422d24;
  --gw-muted: #8b7161;
  --gw-paper: #fff9ef;
  --gw-panel: #fffdf8;
  --gw-line: #f0e3d1;
  --gw-orange: #f07836;
  --gw-orange-deep: #db5e24;
  --gw-gold: #f5c64d;
  --gw-shadow: 0 24px 80px rgba(89, 48, 21, .2);
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  color: var(--gw-ink);
  font-family: "DM Sans", "Trebuchet MS", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.gw-library.gw-library-open { display: block; }
.gw-library--inline {
  position: relative;
  inset: auto;
  z-index: auto;
  display: none;
  width: 100%;
  min-height: 0;
  color: var(--gw-ink);
}
.gw-library--inline.gw-library-open { display: block; }
.gw-library--inline .gw-library__scrim { display: none; }
.gw-library--inline .gw-library__window {
  position: relative;
  inset: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 18px;
  box-shadow: none;
}
.gw-library--inline .gw-library__scroll { overflow: visible; }
.gw-library--inline .gw-library__close { display: none; }
.gw-library--inline .gw-library__featured-actions { grid-template-columns: 1fr; }
.gw-library--inline .gw-game__actions { grid-template-columns: 1fr; }
.gw-library *, .gw-library *::before, .gw-library *::after { box-sizing: border-box; }
.gw-library button, .gw-library input { font: inherit; }
.gw-library button { color: inherit; }

.gw-library__scrim {
  position: absolute;
  inset: 0;
  background: rgba(54, 37, 28, .52);
  backdrop-filter: blur(5px);
  animation: gw-lib-fade .22s ease both;
}

.gw-library__window {
  position: absolute;
  inset: 22px;
  max-width: 1440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 90% 0%, rgba(255, 221, 139, .24), transparent 34%),
    var(--gw-paper);
  box-shadow: var(--gw-shadow);
  animation: gw-lib-rise .3s cubic-bezier(.2,.75,.25,1) both;
}

.gw-library__topbar {
  min-height: 70px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gw-line);
  background: rgba(255,253,248,.88);
}

.gw-library__brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--gw-ink);
  font: 800 19px/1 "Outfit", sans-serif;
  letter-spacing: -.04em;
}

.gw-library__brandmark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 11px 11px 11px 4px;
  background: linear-gradient(145deg, #ffb23f, #ef7533);
  color: #fff9e9;
  box-shadow: 0 4px 12px rgba(225, 102, 40, .22);
}
.gw-library__brandmark svg { width: 18px; height: 18px; }

.gw-library__top-actions { display: flex; align-items: center; gap: 12px; }
.gw-library__hint { color: #a48c7a; font-size: 12px; font-weight: 600; }
.gw-library__close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gw-line);
  border-radius: 12px;
  background: #fffaf2;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.gw-library__close:hover { transform: rotate(5deg); background: #fff0df; }
.gw-library__close svg { width: 17px; height: 17px; }

.gw-library__scroll {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #e9c9a7 transparent;
  scrollbar-width: thin;
}

.gw-library__intro {
  padding: 37px 42px 28px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 22px;
  align-items: end;
}
.gw-library__eyebrow {
  margin: 0 0 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c56b32;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.gw-library__eyebrow::before {
  content: "";
  width: 20px;
  height: 2px;
  background: var(--gw-orange);
}
.gw-library__title {
  max-width: 650px;
  margin: 0;
  font: 700 clamp(34px, 4vw, 52px)/.99 "Outfit", sans-serif;
  letter-spacing: -.055em;
}
.gw-library__title em { color: var(--gw-orange); font-style: normal; }
.gw-library__subtitle {
  max-width: 560px;
  margin: 13px 0 0;
  color: var(--gw-muted);
  font-size: 14px;
  line-height: 1.55;
}
.gw-library__create {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 14px;
  background: var(--gw-orange);
  color: #fffaf2 !important;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(217, 98, 43, .19);
  transition: transform .18s ease, background .18s ease;
}
.gw-library__create:hover { transform: translateY(-2px); background: var(--gw-orange-deep); }
.gw-library__create svg { width: 16px; height: 16px; }

.gw-library__tools {
  padding: 0 42px 21px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.gw-library__search-wrap { position: relative; width: min(380px, 40vw); flex: 0 0 auto; }
.gw-library__search-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 17px;
  height: 17px;
  color: #a88c78;
  transform: translateY(-50%);
  pointer-events: none;
}
.gw-library__search {
  width: 100%;
  height: 45px;
  padding: 0 42px;
  outline: 0;
  border: 1px solid #eadbc7;
  border-radius: 13px;
  background: #fffdf9;
  color: var(--gw-ink);
  font-size: 13px;
  transition: border .18s ease, box-shadow .18s ease;
}
.gw-library__search::placeholder { color: #b19d8c; }
.gw-library__search:focus { border-color: #e79a5d; box-shadow: 0 0 0 3px rgba(240,120,54,.12); }
.gw-library__clear-search {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 26px;
  height: 26px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b7161;
  cursor: pointer;
  transform: translateY(-50%);
}
.gw-library__clear-search.is-visible { display: grid; }
.gw-library__clear-search:hover { background: #f9ecdc; }
.gw-library__filters {
  min-width: 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}
.gw-library__filters::-webkit-scrollbar { display: none; }
.gw-library__filter {
  min-height: 35px;
  padding: 0 13px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f6eddf;
  color: #806958;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.gw-library__filter:hover { transform: translateY(-1px); background: #f2e3cf; }
.gw-library__filter[aria-pressed="true"] {
  border-color: #edc18e;
  background: #fff0d9;
  color: #a75022;
}

.gw-library__results-head {
  margin: 0 42px 15px;
  padding-top: 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--gw-line);
}
.gw-library__section-label {
  margin: 0;
  font: 700 18px/1.2 "Outfit", sans-serif;
  letter-spacing: -.025em;
}
.gw-library__count { color: #a28a78; font-size: 12px; font-weight: 600; }

.gw-library__grid {
  padding: 0 42px 40px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}
.gw-game {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #eddfcd;
  border-radius: 17px;
  background: var(--gw-panel);
  box-shadow: 0 3px 9px rgba(92, 58, 32, .035);
  animation: gw-lib-card-in .36s ease both;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.gw-game:hover {
  transform: translateY(-3px);
  border-color: #e8c8a4;
  box-shadow: 0 10px 24px rgba(92, 58, 32, .1);
}
.gw-game__art {
  height: 128px;
  position: relative;
  overflow: hidden;
  background: var(--game-sky, #ffd27d);
  isolation: isolate;
}
.gw-game__art::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 180px;
  right: -21px;
  top: -100px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(255,255,255,.12), 0 0 0 38px rgba(255,255,255,.1);
}
.gw-game__art::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -7%;
  right: -7%;
  bottom: -49px;
  height: 104px;
  border-radius: 50% 50% 0 0;
  background: var(--game-land, #e88945);
  transform: rotate(-4deg);
}
.gw-game__art-orbit {
  position: absolute;
  top: 22px;
  right: 42px;
  width: 76px;
  height: 76px;
  border: 1px solid rgba(255,255,255,.54);
  border-radius: 50%;
  transform: rotate(-22deg) scaleY(.42);
}
.gw-game__art-orbit::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 49px;
  height: 49px;
  border-radius: 16px;
  background: var(--game-pop, #fff1bd);
  box-shadow: 11px 12px 0 -5px rgba(255,255,255,.5);
  transform: translate(-50%,-50%) rotate(23deg) scaleY(2.1);
}
.gw-game__art-dots {
  position: absolute;
  left: 20px;
  top: 21px;
  width: 62px;
  height: 44px;
  background-image: radial-gradient(rgba(255,255,255,.72) 1.4px, transparent 1.6px);
  background-size: 12px 12px;
  opacity: .8;
}
.gw-game__art-label {
  position: absolute;
  left: 17px;
  bottom: 16px;
  max-width: calc(100% - 34px);
  overflow: hidden;
  color: rgba(79,47,30,.82);
  font: 800 11px/1 "Outfit", sans-serif;
  letter-spacing: .13em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.gw-game__body { padding: 14px 15px 15px; }
.gw-game__meta { min-height: 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gw-game__category {
  padding: 4px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #fbf0df;
  color: #a66335;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-game__author {
  overflow: hidden;
  color: #a58d7b;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-game__title {
  margin: 9px 0 5px;
  overflow: hidden;
  font: 700 17px/1.2 "Outfit", sans-serif;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-game__description {
  height: 34px;
  margin: 0;
  overflow: hidden;
  color: #927b69;
  font-size: 11.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.gw-game__actions { margin-top: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gw-game__action {
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #eddfcd;
  border-radius: 10px;
  background: #fffaf2;
  color: #805f48 !important;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.gw-game__action:hover { transform: translateY(-1px); border-color: #e9bc8b; background: #fff2df; }
.gw-game__action--play {
  border-color: var(--gw-orange);
  background: var(--gw-orange);
  color: #fffaf2 !important;
}
.gw-game__action--play:hover { border-color: var(--gw-orange-deep); background: var(--gw-orange-deep); }
.gw-game__action svg { width: 14px; height: 14px; flex: 0 0 auto; }

.gw-library__empty {
  grid-column: 1 / -1;
  min-height: 250px;
  padding: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed #e7cdb0;
  border-radius: 18px;
  background: rgba(255,253,248,.6);
  text-align: center;
}
.gw-library__empty-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #ffedcf;
  color: #cb6b33;
}
.gw-library__empty h3 { margin: 0; font: 700 20px "Outfit", sans-serif; }
.gw-library__empty p { margin: 7px 0 15px; color: var(--gw-muted); font-size: 13px; }
.gw-library__empty button {
  border: 0;
  background: none;
  color: #bf5d29;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.gw-library__sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.gw-library button:focus-visible, .gw-library input:focus-visible {
  outline: 3px solid rgba(217, 104, 49, .42);
  outline-offset: 3px;
}

@keyframes gw-lib-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gw-lib-rise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes gw-lib-card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 960px) {
  .gw-library__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gw-library__intro, .gw-library__tools { padding-left: 28px; padding-right: 28px; }
  .gw-library__results-head { margin-left: 28px; margin-right: 28px; }
  .gw-library__grid { padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 640px) {
  .gw-library__window { inset: 0; border: 0; border-radius: 0; }
  .gw-library__topbar { min-height: 60px; padding: 0 17px; }
  .gw-library__brand { font-size: 17px; }
  .gw-library__hint { display: none; }
  .gw-library__intro { padding: 27px 18px 21px; grid-template-columns: 1fr; gap: 19px; align-items: start; }
  .gw-library__title { font-size: 39px; max-width: 400px; }
  .gw-library__subtitle { font-size: 13px; }
  .gw-library__create { width: 100%; }
  .gw-library__tools { padding: 0 18px 17px; flex-direction: column; align-items: stretch; gap: 11px; }
  .gw-library__search-wrap { width: 100%; }
  .gw-library__filters { margin-right: -18px; padding-right: 18px; }
  .gw-library__results-head { margin: 0 18px 12px; padding-top: 15px; }
  .gw-library__grid { grid-template-columns: 1fr; padding: 0 18px 28px; gap: 12px; }
  .gw-game { display: grid; grid-template-columns: 112px minmax(0,1fr); min-height: 157px; }
  .gw-game__art { height: 100%; min-height: 157px; }
  .gw-game__art::before { right: -80px; }
  .gw-game__art-orbit { right: 3px; top: 31px; transform: rotate(-22deg) scale(.72,.3); }
  .gw-game__art-dots { left: 13px; top: 16px; transform: scale(.8); transform-origin: top left; }
  .gw-game__art-label { left: 11px; bottom: 11px; max-width: 90px; font-size: 9px; }
  .gw-game__body { padding: 12px; display: flex; min-width: 0; flex-direction: column; }
  .gw-game__title { font-size: 15px; }
  .gw-game__description { height: 31px; font-size: 10.5px; }
  .gw-game__actions { margin-top: auto; padding-top: 9px; gap: 6px; }
  .gw-game__action { height: 33px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .gw-library *, .gw-library *::before, .gw-library *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* Public game-library hooks. Kept separate from the existing modal skin so
   this sheet can be paired with the library view without changing its markup. */
#pgGameLibrary,
.pg-game-library {
  --pg-ink: #422d24;
  --pg-muted: #806d60;
  --pg-paper: #fff9ef;
  --pg-panel: #fffdf8;
  --pg-line: #eddfcd;
  --pg-orange: #f07836;
  --pg-orange-strong: #c9511d;
  --pg-orange-soft: #fff0dd;
  color: var(--pg-ink);
  font-family: "DM Sans", "Trebuchet MS", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#pgGameLibrary *,
.pg-game-library * {
  box-sizing: border-box;
}

#pgGameLibrary,
.pg-game-library {
  min-width: 0;
  padding: clamp(18px, 3vw, 38px);
  border: 1px solid var(--pg-line);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 96% 0%, rgba(245, 198, 77, .18), transparent 32rem),
    var(--pg-paper);
}

.pg-library-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin: 0 0 24px;
}

.pg-library-header h1,
.pg-library-header h2,
.pg-library-header h3 {
  margin: 0;
  color: var(--pg-ink);
  font: 750 clamp(28px, 4vw, 46px)/1 "Outfit", "Trebuchet MS", sans-serif;
  letter-spacing: -.055em;
  text-wrap: balance;
}

.pg-library-header p {
  max-width: 58ch;
  margin: 11px 0 0;
  color: var(--pg-muted);
  font-size: 14px;
  line-height: 1.55;
}

.pg-library-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 22px;
}

.pg-library-controls :is(input, select, button, [role="button"]) {
  min-height: 40px;
  border: 1px solid var(--pg-line);
  border-radius: 12px;
  background: var(--pg-panel);
  color: var(--pg-ink);
  font: inherit;
}

.pg-library-controls :is(input, select) {
  padding: 0 12px;
}

.pg-library-controls input {
  min-width: min(100%, 180px);
  flex: 1 1 220px;
}

.pg-library-controls input::placeholder { color: #a48c7a; }

.pg-library-controls :is(button, [role="button"]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease;
}

.pg-library-controls :is(button, [role="button"]):hover {
  transform: translateY(-1px);
  border-color: #e5ad7d;
  background: var(--pg-orange-soft);
}

.pg-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr));
  gap: clamp(12px, 1.7vw, 18px);
}

.pg-game-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--pg-line);
  border-radius: 17px;
  background: var(--pg-panel);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(92, 58, 32, .045);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

button.pg-game-card,
[role="button"].pg-game-card {
  width: 100%;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.pg-game-card:hover {
  transform: translateY(-3px);
  border-color: #e6bb94;
  box-shadow: 0 12px 28px rgba(92, 58, 32, .12);
}

.pg-game-card-art {
  position: relative;
  display: grid;
  min-height: 142px;
  aspect-ratio: 1.65 / 1;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 26%, rgba(255, 248, 220, .88) 0 6%, transparent 6.5%),
    linear-gradient(145deg, #f8ca7e 0%, #ed9a5b 53%, #da7042 100%);
  color: #fffaf0;
}

.pg-game-card-art::before,
.pg-game-card-art::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.pg-game-card-art::before {
  right: -8%;
  bottom: -51%;
  width: 92%;
  height: 96%;
  border: 1px solid rgba(255, 250, 240, .43);
  border-radius: 50% 50% 0 0;
  background: rgba(255, 244, 218, .2);
  transform: rotate(-8deg);
}

.pg-game-card-art::after {
  top: 16%;
  left: 11%;
  width: 22%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 250, 240, .5);
  border-radius: 50%;
  box-shadow: 15px 14px 0 -7px rgba(255, 250, 240, .36);
}

.pg-game-card-art :is(img, video, canvas, picture) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pg-game-card-art :is(img, video, canvas) { z-index: 1; }
.pg-game-card-art > :not(img):not(video):not(canvas):not(picture) { z-index: 2; }
.pg-game-card-art:has(img)::before,
.pg-game-card-art:has(img)::after,
.pg-game-card-art:has(video)::before,
.pg-game-card-art:has(video)::after,
.pg-game-card-art:has(canvas)::before,
.pg-game-card-art:has(canvas)::after { display: none; }

.pg-game-card-meta {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  padding: 14px 15px 16px;
}

.pg-game-card-meta :is(h2, h3, h4, [data-game-title]) {
  overflow: hidden;
  margin: 0;
  color: var(--pg-ink);
  font: 700 16px/1.25 "Outfit", "Trebuchet MS", sans-serif;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
}

.pg-game-card-meta p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--pg-muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pg-game-card-meta :is(small, [data-game-creator], [data-game-stats]) {
  color: #9a8371;
  font-size: 11px;
  line-height: 1.4;
}

.pg-game-badges {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  display: flex;
  max-width: calc(100% - 20px);
  flex-wrap: wrap;
  gap: 5px;
  pointer-events: none;
}

.pg-game-badges > * {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 999px;
  background: rgba(255, 250, 241, .94);
  color: #754322;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(49, 30, 17, .14);
  backdrop-filter: blur(7px);
}

.pg-game-viewer {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--pg-line);
  border-radius: 20px;
  background: #f1e6d7;
  box-shadow: 0 12px 30px rgba(92, 58, 32, .1);
}

.pg-game-viewer > :is(img, video, canvas, iframe) {
  display: block;
  width: 100%;
  min-height: 230px;
  aspect-ratio: 16 / 9;
  border: 0;
  object-fit: cover;
}

.pg-game-viewer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 13px;
  border-top: 1px solid var(--pg-line);
  background: var(--pg-panel);
}

.pg-game-viewer-actions :is(button, a, [role="button"]) {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid var(--pg-line);
  border-radius: 11px;
  background: var(--pg-paper);
  color: var(--pg-ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease;
}

.pg-game-viewer-actions :is(button, a, [role="button"]):first-child,
.pg-game-viewer-actions .primary,
.pg-game-viewer-actions [data-primary] {
  border-color: var(--pg-orange);
  background: var(--pg-orange);
  color: #fffaf2;
}

.pg-game-viewer-actions :is(button, a, [role="button"]):hover {
  transform: translateY(-1px);
  border-color: var(--pg-orange-strong);
  background: var(--pg-orange-soft);
  color: var(--pg-orange-strong);
}

.pg-game-viewer-actions :is(button, a, [role="button"]):first-child:hover,
.pg-game-viewer-actions .primary:hover,
.pg-game-viewer-actions [data-primary]:hover {
  background: var(--pg-orange-strong);
  color: #fffaf2;
}

.pg-library-empty {
  display: grid;
  min-height: 220px;
  grid-column: 1 / -1;
  place-content: center;
  justify-items: center;
  gap: 9px;
  padding: 28px;
  border: 1px dashed #e2c5a4;
  border-radius: 18px;
  background: rgba(255, 253, 248, .72);
  text-align: center;
}

.pg-library-empty :is(h2, h3, strong) {
  margin: 0;
  color: var(--pg-ink);
  font: 700 19px/1.2 "Outfit", "Trebuchet MS", sans-serif;
}

.pg-library-empty p {
  max-width: 48ch;
  margin: 0;
  color: var(--pg-muted);
  font-size: 13px;
  line-height: 1.55;
}

#pgGameLibrary :is(button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])),
.pg-game-library :is(button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])) {
  outline: none;
}

#pgGameLibrary :is(button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible,
.pg-game-library :is(button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid #d95c16;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(255, 240, 226, .95);
}

@media (prefers-color-scheme: dark) {
  #pgGameLibrary,
  .pg-game-library {
    --pg-ink: #f4eee8;
    --pg-muted: #b8aaa0;
    --pg-paper: #11100f;
    --pg-panel: #191715;
    --pg-line: #38312c;
    --pg-orange: #f07836;
    --pg-orange-strong: #ff9a5f;
    --pg-orange-soft: #332117;
  }

  .pg-game-badges > * {
    border-color: rgba(255, 255, 255, .14);
    background: rgba(28, 25, 22, .93);
    color: #ffe4c7;
  }

  .pg-game-viewer { background: #201d1a; }
  .pg-game-viewer-actions { background: var(--pg-panel); }
  .pg-game-viewer-actions :is(button, a, [role="button"]) { background: #211e1b; }
  .pg-library-empty { background: rgba(25, 23, 21, .82); }
}

:is(.dark, [data-theme="dark"], [data-color-scheme="dark"]) #pgGameLibrary,
:is(.dark, [data-theme="dark"], [data-color-scheme="dark"]) .pg-game-library {
  --pg-ink: #f4eee8;
  --pg-muted: #b8aaa0;
  --pg-paper: #11100f;
  --pg-panel: #191715;
  --pg-line: #38312c;
  --pg-orange: #f07836;
  --pg-orange-strong: #ff9a5f;
  --pg-orange-soft: #332117;
}

@media (max-width: 700px) {
  #pgGameLibrary,
  .pg-game-library { padding: 17px; border-radius: 19px; }
  .pg-library-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .pg-library-controls { align-items: stretch; gap: 8px; }
  .pg-library-controls input { flex-basis: 100%; }
  .pg-library-controls :is(select, button, [role="button"]) { flex: 1 1 auto; }
  .pg-game-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
}

@media (max-width: 480px) {
  #pgGameLibrary,
  .pg-game-library { padding: 13px; border-radius: 16px; }
  .pg-game-grid { grid-template-columns: minmax(0, 1fr); }
  .pg-game-card { display: grid; grid-template-columns: minmax(105px, 35%) minmax(0, 1fr); }
  .pg-game-card-art { height: 100%; min-height: 126px; aspect-ratio: auto; }
  .pg-game-card-meta { justify-content: center; padding: 12px; }
  .pg-game-badges { top: 7px; left: 7px; gap: 4px; }
  .pg-game-badges > * { min-height: 20px; padding: 3px 7px; font-size: 9px; }
  .pg-game-viewer { border-radius: 16px; }
  .pg-game-viewer > :is(img, video, canvas, iframe) { min-height: 185px; }
  .pg-game-viewer-actions { padding: 10px; }
  .pg-game-viewer-actions :is(button, a, [role="button"]) { flex: 1 1 calc(50% - 5px); padding-inline: 10px; }
  .pg-library-empty { min-height: 185px; padding: 21px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  #pgGameLibrary *,
  .pg-game-library *,
  #pgGameLibrary *::before,
  .pg-game-library *::before,
  #pgGameLibrary *::after,
  .pg-game-library *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.pg-library-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  place-items: center;
  padding: clamp(10px, 2vw, 28px);
  overflow: auto;
  background: rgba(44, 31, 24, .62);
  backdrop-filter: blur(5px);
}

.pg-library-overlay.is-open { display: grid; }
.pg-library-overlay[hidden] { display: none !important; }
.pg-library-overlay > .pg-game-library {
  width: min(1440px, 100%);
  max-height: min(94vh, 1100px);
  overflow: auto;
  box-shadow: 0 24px 80px rgba(26, 17, 12, .34);
}
.pg-library-header { align-items: center; }
.pg-library-heading { min-width: 0; }
.pg-library-count { margin-left: auto; color: var(--pg-muted); font-size: 12px; font-weight: 700; }
.pg-library-controls [data-genre][aria-pressed="true"] {
  border-color: #e5ad7d;
  background: var(--pg-orange-soft);
  color: var(--pg-orange-strong);
}
.pg-game-card-art[data-genre="Obby"] { background: linear-gradient(145deg,#9de4bc,#3d9d69); }
.pg-game-card-art[data-genre="Tycoon"] { background: linear-gradient(145deg,#ffe19b,#ec9b48); }
.pg-game-card-art[data-genre="Horror"] { background: linear-gradient(145deg,#77729a,#292b43); }
.pg-game-card-art[data-genre="Fashion"] { background: linear-gradient(145deg,#ffc3d7,#b86ca5); }
.pg-game-card-art[data-genre="PvP"] { background: linear-gradient(145deg,#ffb777,#d95746); }
.pg-game-card-art[data-genre="Racing"] { background: linear-gradient(145deg,#92d9ff,#4382bb); }
.pg-game-card-art[data-genre="Puzzle"] { background: linear-gradient(145deg,#c4b2ff,#7164b9); }
.pg-game-card-art[data-genre="Social"] { background: linear-gradient(145deg,#ffe598,#66b98a); }
.pg-game-card-art > span {
  position: relative;
  z-index: 2;
  color: rgba(255,255,255,.94);
  font: 800 clamp(16px,2vw,24px)/1 "Outfit",sans-serif;
  letter-spacing: .11em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(27,20,14,.25);
}
.pg-game-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 8px; }
.pg-game-card-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--pg-line);
  border-radius: 10px;
  background: var(--pg-paper);
  color: var(--pg-ink);
  font: 700 11px/1 inherit;
  cursor: pointer;
}
.pg-game-card-actions button:first-child {
  border-color: var(--pg-orange);
  background: var(--pg-orange);
  color: #fffaf2;
}
.pg-game-card-actions button:hover { border-color: var(--pg-orange-strong); }
.pg-library-close {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--pg-line);
  border-radius: 12px;
  background: var(--pg-panel);
  color: var(--pg-ink);
  font-size: 20px;
  cursor: pointer;
}
@media (max-width: 700px) {
  .pg-library-overlay { padding: 0; }
  .pg-library-overlay > .pg-game-library { max-height: 100vh; min-height: 100vh; border-radius: 0; }
  .pg-library-count { margin: 0; }
}

/* The Playground landing overlay should read as a game storefront, not a
   generic world picker: lead with one featured game, then browse the catalog. */
.gw-library__featured {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, .9fr) minmax(0, 1.1fr);
  min-height: 232px;
  margin: 0 42px 25px;
  overflow: hidden;
  border: 1px solid rgba(221, 161, 103, .55);
  border-radius: 21px;
  background: #fffdf8;
  box-shadow: 0 10px 28px rgba(92, 58, 32, .09);
}
.gw-library__featured[hidden] { display: none !important; }
.gw-library__featured-art {
  position: relative;
  min-height: 232px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(145deg, #9bd9ee 0%, #61b4c9 54%, #407e70 100%);
}
.gw-library__featured-art::before {
  position: absolute;
  z-index: -1;
  right: -9%;
  bottom: -45%;
  width: 120%;
  height: 85%;
  border: 1px solid rgba(255,255,255,.48);
  border-radius: 50% 50% 0 0;
  background: linear-gradient(160deg, rgba(255,255,255,.3), rgba(255,255,255,.06));
  content: "";
  transform: rotate(-7deg);
}
.gw-library__featured-art::after {
  position: absolute;
  z-index: -1;
  right: 12%;
  bottom: 17%;
  width: 34%;
  height: 23%;
  border: 2px solid rgba(255,255,255,.7);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  content: "";
}
.gw-library__featured-sun {
  position: absolute;
  top: 15%;
  right: 19%;
  width: clamp(54px, 8vw, 92px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff0bb;
  box-shadow: 0 0 0 14px rgba(255,255,255,.11), 0 0 48px rgba(255,240,187,.6);
}
.gw-library__featured-island {
  position: absolute;
  left: 12%;
  bottom: 15%;
  width: 42%;
  height: 30%;
  border: 2px solid rgba(255,255,255,.76);
  border-radius: 48% 48% 14px 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.38), rgba(255,255,255,.12));
  transform: rotate(-9deg);
}
.gw-library__featured-art[data-category="obby"] { background: linear-gradient(145deg,#9de4bc,#51a979 58%,#32614e); }
.gw-library__featured-art[data-category="tycoon"] { background: linear-gradient(145deg,#ffe19b,#ec9b48 58%,#a95035); }
.gw-library__featured-art[data-category="horror-mystery"] { background: linear-gradient(145deg,#77729a,#38364f 58%,#211f35); }
.gw-library__featured-art[data-category="fashion"] { background: linear-gradient(145deg,#ffc3d7,#c87ca9 58%,#805095); }
.gw-library__featured-art[data-category="pvp"],
.gw-library__featured-art[data-category="survival"] { background: linear-gradient(145deg,#ffb777,#df684f 58%,#863f55); }
.gw-library__featured-art[data-category="racing"] { background: linear-gradient(145deg,#92d9ff,#4382bb 58%,#36456f); }
.gw-library__featured-art[data-category="adventure"],
.gw-library__featured-art[data-category="exploration"] { background: linear-gradient(145deg,#c4b2ff,#7164b9 58%,#433f77); }
.gw-library__featured-art[data-category="social"] { background: linear-gradient(145deg,#ffe598,#66b98a 58%,#47795f); }
.gw-library__featured-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(22px, 3vw, 38px);
}
.gw-library__featured-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff0dd;
  color: #a95120;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.gw-library__featured-title {
  margin: 13px 0 7px;
  color: var(--gw-ink);
  font: 750 clamp(22px, 2.7vw, 32px)/1.1 "Outfit", sans-serif;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.gw-library__featured-description {
  max-width: 52ch;
  margin: 0;
  color: var(--gw-muted);
  font-size: 13px;
  line-height: 1.55;
}
.gw-library__featured-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.gw-library__action {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--gw-line);
  border-radius: 11px;
  background: #fffaf2;
  color: #805f48 !important;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.gw-library__action:hover { transform: translateY(-1px); border-color: #e9bc8b; background: #fff2df; }
.gw-library__action--play { border-color: var(--gw-orange); background: var(--gw-orange); color: #fffaf2 !important; }
.gw-library__action--play:hover { border-color: var(--gw-orange-deep); background: var(--gw-orange-deep); }
.gw-library__action svg { width: 15px; height: 15px; }

@media (max-width: 960px) {
  .gw-library__featured { margin-left: 28px; margin-right: 28px; }
}
@media (max-width: 640px) {
  .gw-library__featured { grid-template-columns: 1fr; margin: 0 18px 19px; }
  .gw-library__featured-art { min-height: 148px; }
  .gw-library__featured-copy { padding: 19px; }
  .gw-library__featured-title { margin-top: 10px; }
  .gw-library__featured-actions { width: 100%; }
  .gw-library__action { flex: 1 1 auto; }
}
