.lively-home, .lively-library {
  --grape: #351753;
  --berry: #9c185b;
  --paper: #fffafd;
  --lift: 0 12px 28px #4e26501c;
}

.welcome-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54%;
  min-height: 410px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid #dac4ee;
  border-radius: 30px;
  color: var(--grape);
  background: radial-gradient(ellipse at 0 100%, #fbd4ea, transparent 60%), #faf0ff;
  box-shadow: 0 16px 38px #4e26501a;
}
.welcome-copy {
  z-index: 1;
  align-self: center;
  padding: clamp(26px, 5vw, 62px);
  padding-right: 0;
}
.welcome-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  color: #6e245f;
  background: #fff9fd;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
}
.welcome-kicker span { color: #b5216a; }
.welcome-copy h1 {
  margin: 13px 0;
  font-size: clamp(2.25rem, 5.3vw, 4.7rem);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: -.045em;
}
.welcome-copy h1 span { color: var(--berry); }
.welcome-copy p { margin: 0 0 22px; color: #5b3e68; }
.welcome-art {
  background: linear-gradient(90deg, #faf0ff 0%, #faf0ff00 22%),
    url("wallpaper.jpg") 79% center / cover no-repeat;
}
.welcome-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.welcome-actions .btn { gap: 9px; min-height: 48px; padding-inline: 16px; }
.welcome-actions .btn:not(.secondary) { background: #a11b61; color: white; }
.welcome-actions .btn.secondary { background: #fff9fd; border: 1px solid #d9b6df; color: #54297a; }

.lively-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 12px;
  margin: 16px 0 34px;
}
.lively-shortcuts a {
  --shortcut-ink: #58278e;
  --shortcut-bg: #f2e9ff;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 12px 15px;
  border: 1px solid #dac8ee;
  border-radius: 17px;
  background: var(--shortcut-bg);
  color: var(--shortcut-ink);
  text-decoration: none;
}
.lively-shortcuts .shortcut-vip { --shortcut-ink: #744300; --shortcut-bg: #fff3d9; border-color: #e8cf9d; }
.lively-shortcuts .shortcut-credits { --shortcut-ink: #005957; --shortcut-bg: #e6f7f5; border-color: #b1dcd6; }
.shortcut-icon {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: var(--shortcut-ink);
  font-size: 1.28rem;
  line-height: 1;
}
.lively-shortcuts b, .lively-shortcuts small { display: block; }
.lively-shortcuts small { line-height: 1.45; }
.shortcut-arrow { font-size: 1.3rem; }

.lively-shelf, .lively-ranking {
  padding: clamp(15px, 3vw, 29px);
  border: 1px solid #e6d4ea;
  border-radius: 23px;
  background: #fffafd;
}
.lively-shelf .section-head { margin-top: 0; }
.lively-shelf .game-grid { margin-top: 16px; }
.lively-ranking { margin-top: 20px; }
.home-library-guide { margin: 24px 0; }
.home-library-guide-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(230px,100%),1fr)); gap: 14px; }
.home-library-guide-grid > div { padding: 14px; border-radius: 13px; background: #f9eff9; }
.home-library-guide-grid h3 { margin: 0; }
.home-library-guide-grid p { font-size: .9rem; margin: 6px 0 8px; }
.download-quota-note { color: #694b76; font-size: .82rem; margin-block: 12px 6px; }
.lively-library .page-head {
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid #e3c9ed;
  border-radius: 23px;
  background: radial-gradient(ellipse at 100% 0%, #f0d8fc, transparent 62%), #fff5fb;
  color: var(--grape);
}
.lively-library .toolbar { padding: 9px; border: 1px solid #e6d4ea; border-radius: 16px; background: white; }
.lively-library #game-search { min-height: 46px; }
.lively-library .library-filters select { min-height: 44px; }
.lively-library .chips, .lively-shelf .chips { gap: 7px; }
.lively-library .chip, .lively-shelf .chip { min-height: 36px; }
.lively-library .chip.active, .lively-shelf .chip.active { color: white; background: #592c8d; border-color: #592c8d; }
.lively-library #result-count { color: #634875; font-size: .86rem; font-weight: 800; }
.lively-library #clear-game-filters[hidden] { display: none; }
:is(.lively-home, .lively-library) .game-card { min-width: 0; border-color: #e3cfe8; }
:is(.lively-home, .lively-library) .game-card h3 { color: var(--grape); overflow-wrap: anywhere; }
:is(.lively-home, .lively-library) .game-card .card-category {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  color: #64225f;
  background: #f8e4f4;
}
.card-action {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #54297a;
  background: #f1e7fa;
  font-size: .82rem;
  font-weight: 800;
}
.game-card-link { display: block; min-width: 0; }
.game-card-link:focus-visible { outline-offset: -4px; }
.game-card-link:focus-visible .game-detail-overlay { opacity: 1; }
.game-social { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.game-social-card { padding: 0 12px 12px; }
.game-social-detail { margin-block: 13px; }
.game-social button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 5px;
  border: 1px solid #e3c9dd;
  border-radius: 10px;
  background: #fff5fa;
  color: #88164f;
  font-size: .8rem;
  font-weight: 800;
  line-height: 1.25;
}
.game-social button svg, .header-search-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.game-social button[aria-pressed="true"] { border-color: #9c185b; background: #9c185b; color: #fff; }
.game-social button[aria-pressed="true"] svg { fill: currentColor; }
.game-social button[data-game-social="follow"] { border-color: #dbc7ed; background: #f6efff; color: #532881; }
.game-social button[data-game-social="follow"][aria-pressed="true"] { border-color: #55258e; background: #55258e; color: #fff; }
.game-social button:hover:not(:disabled) { box-shadow: inset 0 0 0 1px currentColor; }
.game-social button strong { font-variant-numeric: tabular-nums; }
.following-empty { padding: 32px 14px; }
.following-empty p { margin: 6px 0 12px; }

.header-search-button, .account-menu-toggle, .account-menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 5px 10px;
  border: 1px solid #ddc9eb;
  border-radius: 12px;
  background: #fff9ff;
  color: #512a72;
  font-size: .84rem;
  font-weight: 800;
}
.header-search-button, .account-menu-close { min-width: 44px; }
.account-menu-toggle { max-width: min(220px, 55vw); }
.account-menu-toggle b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-toggle[aria-expanded="true"] { background: #f1e6ff; border-color: #6a3d96; }
.account-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 10px;
  color: white;
  background: #64308e;
  font-weight: 800;
}
.member-popover {
  position: fixed;
  inset: var(--menu-top, 68px) var(--menu-right, 12px) auto auto;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--menu-top, 68px) - 12px);
  margin: 0;
  padding: 11px;
  overflow: auto;
  border: 1px solid #d7bce7;
  border-radius: 20px;
  background: #fffafd;
  color: #351753;
  box-shadow: 0 16px 48px #35175335;
}
.member-popover-head {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border-radius: 12px;
  background: linear-gradient(125deg, #f0e3ff, #fce2f0);
}
.member-popover-head .account-avatar { width: 43px; height: 43px; }
.member-popover-head strong, .member-popover-head small { display: block; overflow-wrap: anywhere; }
.member-popover-head small, .member-balances small { color: #664775; }
.account-menu-close { font-size: 1.3rem; line-height: 1; }
.member-balances {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 7px;
  margin-block: 9px;
}
.member-balances div { min-width: 0; padding: 7px 10px; border-radius: 10px; background: #f0e5fb; }
.member-balances div + div { background: #fff0d8; }
.member-balances strong, .member-balances small { display: block; overflow-wrap: anywhere; }
.member-menu-links { display: grid; gap: 2px; }
.member-menu-links a, .member-menu-help > *, .member-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font-size: .87rem;
  font-weight: 800;
  text-align: start;
}
.member-menu-links a:hover, .member-menu-help > *:hover, .member-logout:hover { background: #f1e7f8; }
.member-menu-links a > span { width: 18px; text-align: center; color: #794a9e; font-size: 1rem; }
.member-menu-links strong { margin-inline-start: auto; padding: 0 8px; border-radius: 999px; background: #ebdaf7; }
.member-menu-help { display: grid; grid-template-columns: 1fr auto; border-block: 1px solid #e9dced; }
.member-logout { width: 100%; color: #9a2053; }

.lively-game .detail-title { padding: 4px 0 10px; }
.lively-game .detail-title h1 {
  margin-block: 8px 2px;
  color: #351753;
  font-size: clamp(1.9rem, 4.4vw, 3.4rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.lively-game .detail-title .pill { background: #f2e6fc; color: #593181; }
.lively-game .detail-cover { border: 1px solid #d9bfeb; }
.lively-game aside.panel { border-color: #d8bce9; background: linear-gradient(#fbf1ff, #fff 180px); }
.lively-game .download-group { padding: 12px; border-radius: 14px; background: #f5effa; }
.lively-game .download-group:has(.pill.free) { background: #eaf7ef; }
.lively-game .download-group:has(.pill.vip) { background: #fff4dc; }

.game-wizard .game-wizard-header {
  padding: clamp(13px, 2.5vw, 23px);
  border: 1px solid #e6d3ee;
  border-radius: 17px;
  background: linear-gradient(125deg, #fff2f9, #f3ebff);
}
.game-wizard .game-progress button[aria-current="step"] { box-shadow: 0 5px 12px #5429a035; }
.game-wizard .game-wizard-actions {
  padding-top: 13px;
  border-top: 1px solid #e4d6ed;
}

@media (prefers-reduced-motion: no-preference) {
  .welcome-copy { animation: welcome-enter .36s ease-out both; }
  .lively-shortcuts a, :is(.lively-home, .lively-library) .game-card, .welcome-actions .btn {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  }
  .welcome-actions .btn:active, .lively-shortcuts a:active { transform: scale(.98); }
  .member-popover:popover-open { animation: welcome-enter .17s ease-out both; }
}
@media (hover: hover) {
  .lively-shortcuts a:hover, :is(.lively-home, .lively-library) .game-card:hover {
    border-color: #9b6cba;
    box-shadow: var(--lift);
  }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .lively-shortcuts a:hover, :is(.lively-home, .lively-library) .game-card:hover { transform: translateY(-3px); }
}
@keyframes welcome-enter {
  from { opacity: .75; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :is(.lively-home, .lively-library) .game-card:hover { transform: none; }
  :is(.lively-home, .lively-library) .game-detail-overlay { transition: none; }
}
@media (max-width: 760px) {
  .welcome-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; margin-top: 12px; border-radius: 23px; }
  .welcome-copy { padding: 21px 18px 13px; }
  .welcome-copy h1 { font-size: clamp(2rem, 8.5vw, 3rem); }
  .welcome-copy p { margin-bottom: 14px; font-size: .9rem; }
  .welcome-art { min-height: clamp(136px, 38vw, 236px); background-position: center, 76% 37%; background-image: linear-gradient(#faf0ff 0%, #faf0ff00 24%), url("wallpaper.jpg"); }
  .welcome-actions .btn { min-height: 44px; padding-inline: 11px; font-size: .83rem; }
  .lively-shortcuts { gap: 7px; margin: 12px 0 20px; }
  .lively-shortcuts a { min-height: 62px; padding: 7px 11px; }
  .shortcut-icon { width: 36px; height: 36px; }
  .lively-shelf .game-grid, .lively-library .game-grid { gap: 10px; }
  .lively-shelf .card-body, .lively-library .card-body { padding: 9px; }
  .lively-shelf .card-foot, .lively-library .card-foot { flex-wrap: wrap; gap: 3px; }
  .lively-game .download-row { flex-wrap: wrap; }
  .game-social-card { padding: 0 8px 8px; gap: 5px; }
}
@media (max-width: 520px) {
  .member-popover {
    inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px;
    width: auto;
    max-width: none;
    max-height: min(85dvh, 570px);
  }
  .member-popover::backdrop { background: #29133c38; }
  .account-menu-toggle { max-width: min(166px, 48vw); }
  .game-social-card button { font-size: .72rem; }
  .game-social-card button svg { width: 14px; height: 14px; flex-basis: 14px; }
}
