#xipi-games {
  --xpg-paper: #fff9f1;
  --xpg-white: #fffdfb;
  --xpg-ink: #3b2834;
  --xpg-muted: #725c68;
  --xpg-rose: #f26c96;
  --xpg-rose-soft: #fde5ec;
  --xpg-rose-dark: #9d3257;
  --xpg-line: #ecdce1;
  --xpg-error: #a82349;
  --xpg-shadow: 0 5px 20px #643e4e0b;
  color: var(--xpg-ink);
  background: radial-gradient(circle, #d991a629 1.45px, transparent 1.7px) 0 7px / 22px 22px, var(--xpg-paper);
  font: 400 15px/1.6 'Instrument Sans', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  scrollbar-color: #d19daf var(--xpg-paper);
}

body.xpg-page { margin: 0; background: #fff9f1; }
.xpg-startup { max-width: 1200px; margin: 0 auto; padding: 48px 20px; }

#xipi-games *, #xipi-games *::before, #xipi-games *::after { box-sizing: border-box; }
#xipi-games [hidden] { display: none !important; }
#xipi-games h1, #xipi-games h2, #xipi-games h3, #xipi-games p, #xipi-games ul { margin: 0; }
#xipi-games a { color: inherit; text-decoration: none; }
#xipi-games button, #xipi-games input, #xipi-games textarea, #xipi-games select { font: inherit; }
#xipi-games button:disabled { cursor: wait; opacity: .62; }
#xipi-games :focus-visible { outline: 3px solid #a64767; outline-offset: 3px; }
#xipi-games [aria-busy="true"] { cursor: progress; }

.xpg-header {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(100px, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 67px;
  padding: 10px max(28px, calc((100% - 1230px) / 2));
}

.xpg-header::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 -16px;
  content: '';
  background: var(--xpg-rose-soft);
  clip-path: polygon(0 0, 100% 0, 100% 67%, 97% 64%, 94% 60%, 91% 59%, 88% 63%, 85% 73%, 82% 82%, 79% 84%, 76% 79%, 73% 68%, 70% 60%, 67% 60%, 64% 68%, 61% 79%, 58% 85%, 55% 82%, 52% 74%, 49% 66%, 46% 60%, 43% 63%, 40% 73%, 37% 82%, 34% 84%, 31% 79%, 28% 69%, 25% 61%, 22% 61%, 19% 69%, 16% 81%, 13% 85%, 10% 82%, 7% 73%, 4% 65%, 0 65%);
}

.xpg-brand { display: inline-flex; align-items: center; gap: 9px; justify-self: start; font-size: 24px; font-weight: 850; letter-spacing: -.065em; }
.xpg-avatar { display: block; width: 36px; height: 36px; border-radius: 13px; object-fit: cover; }
.xpg-nav { display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid var(--xpg-line); border-radius: 18px; background: var(--xpg-white); box-shadow: var(--xpg-shadow); }
.xpg-nav-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 13px; padding: 0 12px; white-space: nowrap; font-size: 13px; font-weight: 750; }
.xpg-nav-link:hover, .xpg-account:hover { background: #fff1f4; }
.xpg-nav-link[aria-current="page"] { background: #f8789e; box-shadow: 0 2px 8px #e5729a45; color: #3b1326; }
.xpg-icon { display: inline-grid; place-items: center; min-width: 1em; line-height: 1; font-size: 1.1em; }
#xipi-games .xpg-account { display: inline-flex; align-items: center; justify-content: center; gap: 6px; justify-self: end; padding: 0 14px; min-height: 42px; border: 1px solid var(--xpg-line); border-radius: 14px; background: var(--xpg-white); box-shadow: var(--xpg-shadow); color: var(--xpg-ink); font-size: 13px; font-weight: 750; white-space: nowrap; }
.xpg-main { display: block; width: min(100% - 72px, 1200px); min-height: calc(100vh - 132px); margin: 0 auto; padding: 38px 0 64px; scroll-margin-top: 18px; }
.xpg-footer { display: flex; justify-content: center; min-height: 60px; padding: 8px 20px; color: var(--xpg-muted); }
.xpg-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.xpg-footer a:hover { text-decoration: underline !important; }

.xpg-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: center;
  min-height: 335px;
  overflow: hidden;
  padding: 30px 44px 36px;
  border: 1px solid var(--xpg-line);
  border-radius: 27px;
  background: linear-gradient(105deg, #fce3eb 0%, #fff5f6 57%, #fff7f8 100%);
  box-shadow: var(--xpg-shadow);
}
.xpg-hero-label { color: var(--xpg-rose-dark); font-size: 13px; font-weight: 800; letter-spacing: .045em; }
#xipi-games .xpg-hero h1 { margin: 13px 0 13px; font: 900 clamp(35px, 4.15vw, 57px)/1.24 'Noto Serif SC', 'Songti SC', 'SimSun', serif; letter-spacing: -.045em; }
.xpg-hero-description { max-width: 425px; color: var(--xpg-muted); font-size: 15px; }
.xpg-hero-content > .xpg-button { margin-top: 21px; }
.xpg-photos { display: flex; align-items: center; justify-content: flex-start; gap: clamp(10px, 2.4vw, 31px); min-height: 210px; padding: 4px 0 22px 10px; }
#xipi-games .xpg-photo {
  display: grid; min-width: 0; width: clamp(105px, 13.2vw, 166px); padding: 7px 7px 5px;
  border: 1px solid #e8dbe0; border-radius: 13px; background: #fff; box-shadow: 0 8px 16px #66404d12;
  transform: translateY(-9px) rotate(-4.5deg); transition: transform .17s ease;
}
#xipi-games .xpg-photo:nth-child(2) { transform: translateY(22px) rotate(4deg); }
#xipi-games .xpg-photo:hover { transform: translateY(-12px) rotate(-2deg); }
#xipi-games .xpg-photo:nth-child(2):hover { transform: translateY(18px) rotate(2deg); }
.xpg-photo-image, .xpg-photo-placeholder { display: block; width: 100%; aspect-ratio: 4 / 4.8; object-fit: cover; border-radius: 6px; }
.xpg-photo-placeholder { display: grid; place-items: center; padding: 8px; text-align: center; background: linear-gradient(145deg, #b86f89, #4d2d59); color: #fff9ef; font: 800 clamp(14px, 2vw, 22px)/1.3 'Noto Serif SC', 'SimSun', serif; }
.xpg-photo:nth-child(2) .xpg-photo-placeholder { background: linear-gradient(135deg, #d98977, #633a64); }
.xpg-photo-caption { padding: 6px 0 2px; color: var(--xpg-muted); text-align: center; font-size: 11px; font-weight: 650; }

.xpg-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: max-content; max-width: 100%; min-height: 44px; padding: 9px 16px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: var(--xpg-ink); cursor: pointer; text-align: center; font-weight: 750 !important; line-height: 1.3 !important; }
#xipi-games .xpg-primary { background: var(--xpg-rose); color: #42172a; box-shadow: 0 4px 10px #ce3f741c; }
#xipi-games .xpg-primary:hover:not(:disabled) { background: #f280a3; }
#xipi-games .xpg-outline { border-color: var(--xpg-line); background: var(--xpg-white); }
#xipi-games .xpg-outline:hover:not(:disabled), #xipi-games .xpg-ghost:hover:not(:disabled) { background: #fff0f4; }
.xpg-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.xpg-center { display: grid; justify-items: center; }
.xpg-sr, .xpg-skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.xpg-skip:focus { position: fixed; z-index: 10000; top: 12px; left: 12px; padding: 10px; background: var(--xpg-white); }

.xpg-discover-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 32px; }
.xpg-sort-tabs { display: flex; gap: 19px; align-items: center; }
#xipi-games .xpg-sort { position: relative; padding: 0 3px 5px; border-radius: 5px; color: var(--xpg-muted); font-size: 20px; }
#xipi-games .xpg-sort[aria-pressed="true"] { color: var(--xpg-ink); }
.xpg-sort[aria-pressed="true"]::after { content: ''; position: absolute; bottom: 0; left: 50%; width: 23px; height: 3px; transform: translateX(-50%); border-radius: 8px; background: var(--xpg-rose); }
.xpg-search { display: flex; align-items: center; gap: 4px; width: min(100%, 270px); }
.xpg-search .xpg-field { min-width: 0; }
.xpg-search .xpg-button { padding-inline: 8px; flex-shrink: 0; }
.xpg-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 21px 0 17px; }
#xipi-games .xpg-filter { min-height: 42px; padding: 8px 15px; border-color: var(--xpg-line); background: var(--xpg-white); color: var(--xpg-muted); font-size: 13px; }
#xipi-games .xpg-filter:hover, #xipi-games .xpg-filter[aria-pressed="true"] { color: var(--xpg-ink); border-color: #eaa1b9; background: #ffe7ee; }
.xpg-section-heading, .xpg-page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px; margin: 25px 0 16px; }
.xpg-section-heading h2, .xpg-panel h2 { font-size: 19px; font-weight: 850; line-height: 1.4; }
.xpg-discover-heading { margin-top: 0; }
#xpg-discover { scroll-margin-top: 32px; }
.xpg-page-heading { margin-top: 3px; }
#xipi-games .xpg-page-heading h1, #xipi-games .xpg-detail-copy h1 { color: var(--xpg-ink); font: 900 clamp(28px, 4vw, 42px)/1.26 'Noto Serif SC', 'Songti SC', 'SimSun', serif; }
.xpg-page-heading p { margin-top: 5px !important; color: var(--xpg-muted); }

.xpg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 19px; align-items: stretch; }
.xpg-card { min-width: 0; overflow: hidden; background: var(--xpg-white); border: 1px solid var(--xpg-line); border-radius: 18px; box-shadow: var(--xpg-shadow); }
.xpg-card-media { position: relative; aspect-ratio: 1.34; overflow: hidden; background: #e8a7ba; }
.xpg-card:nth-child(2n) .xpg-card-media { background: #9e7aa8; }
.xpg-card:nth-child(3n) .xpg-card-media { background: #bf8972; }
.xpg-cover-image { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .22s ease; }
.xpg-card:focus-within .xpg-cover-image, .xpg-card:hover .xpg-cover-image { transform: scale(1.035); }
.xpg-cover-fallback { display: grid; width: 100%; height: 100%; padding: 18px; place-items: center; background: linear-gradient(145deg, #fbdbc140, #4e254b50); color: #fffaf2; text-shadow: 0 1px 7px #523048; text-align: center; font: 850 clamp(16px, 2.3vw, 28px)/1.35 'Noto Serif SC', 'SimSun', serif; }
.xpg-demo { position: absolute; top: 12px; left: 12px; padding: 3px 8px; border-radius: 8px; background: #fff8f4; color: #6d3850; font-size: 11px; font-weight: 850; }
#xipi-games .xpg-play { position: absolute; right: 11px; bottom: 11px; display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid #fff; border-radius: 50%; background: #fff8f4; color: #67334e; }
#xipi-games .xpg-play:hover { background: #ffc1d4; }
.xpg-card-body { display: grid; gap: 8px; padding: 13px 13px 15px; }
.xpg-card h3 { line-height: 1.35; font-size: 16px; font-weight: 850; overflow-wrap: anywhere; }
.xpg-card h3 a:hover, .xpg-row h3 a:hover { color: var(--xpg-rose-dark); text-decoration: underline; }
#xipi-games .xpg-card-body p { color: var(--xpg-muted); min-height: 3.15em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 13px; overflow-wrap: anywhere; }
.xpg-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 11px; color: var(--xpg-muted); font-size: 12px; }
.xpg-chip { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 7px; background: #faeaf0; color: #793653; font-size: 12px; font-weight: 700; }

.xpg-muted, .xpg-feedback { color: var(--xpg-muted); }
#xipi-games .xpg-feedback { min-height: 1.7em; margin: 6px 0; overflow-wrap: anywhere; }
#xipi-games .xpg-feedback:empty { min-height: 0; margin: 0; }
#xipi-games .xpg-feedback.xpg-error { color: var(--xpg-error); }
.xpg-state, .xpg-panel, .xpg-row, .xpg-balance { padding: 21px; border: 1px solid var(--xpg-line); border-radius: 19px; background: var(--xpg-white); box-shadow: var(--xpg-shadow); overflow-wrap: anywhere; }
.xpg-state { display: grid; justify-items: start; gap: 8px; }
.xpg-state p { color: var(--xpg-muted); }
.xpg-rows { display: grid; gap: 9px; list-style: none; padding: 0; }
.xpg-rows + .xpg-button { margin-top: 9px; }
.xpg-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.xpg-row h3, .xpg-review-row h3 { font-size: 17px; }
.xpg-row p, .xpg-topic-count { font-size: 13px; }
.xpg-coins { color: var(--xpg-rose-dark); }
.xpg-balance { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 8px; max-width: 570px; }
.xpg-balance p { grid-column: 1 / -1; color: var(--xpg-muted); }
.xpg-balance strong { color: var(--xpg-rose-dark); font-size: 42px; line-height: 1.25; }
#xipi-games .xpg-back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 9px; color: var(--xpg-rose-dark); font-weight: 700; }
#xipi-games .xpg-back:hover { text-decoration: underline; }
.xpg-work-detail { display: grid; gap: 14px; }
.xpg-detail-head { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(0, 1.3fr); gap: 26px; align-items: center; padding: 20px; border: 1px solid var(--xpg-line); border-radius: 21px; background: #fff0f4; }
.xpg-detail-text-only { grid-template-columns: 1fr; }
.xpg-detail-cover { display: block; width: 100%; max-height: 360px; aspect-ratio: 5 / 4; object-fit: cover; border-radius: 14px; }
.xpg-detail-copy { display: grid; gap: 10px; }
.xpg-story-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.xpg-panel .xpg-story-text { margin-top: 6px !important; }

.xpg-player { max-width: 900px; margin: 0 auto; }
.xpg-stats, .xpg-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.xpg-stat { display: flex; gap: 8px; padding: 6px 9px; border-radius: 9px; background: #fae4ec; color: #6a3853; font-size: 13px; }
.xpg-turns { display: grid; gap: 9px; }
.xpg-turn { width: fit-content; max-width: min(100%, 700px); padding: 14px 18px; border: 1px solid var(--xpg-line); border-radius: 16px 16px 16px 4px; background: var(--xpg-white); }
.xpg-turn > strong { display: block; margin-bottom: 3px; color: var(--xpg-rose-dark); font-size: 12px; }
.xpg-turn-player { justify-self: end; border-radius: 16px 16px 4px 16px; background: #fce6ee; }
.xpg-turn-form { display: flex; align-items: flex-end; gap: 9px; }
.xpg-turn-form .xpg-field { flex: 1; min-width: 0; }
.xpg-turn-form .xpg-button { flex-shrink: 0; }
.xpg-player-input { padding-top: 9px; }

.xpg-label { display: grid; min-width: 0; gap: 5px; font-weight: 700; }
.xpg-field { min-height: 44px; width: 100%; padding: 10px 12px; border: 1px solid var(--xpg-line); border-radius: 12px; background: var(--xpg-white); color: var(--xpg-ink); font-weight: 400 !important; }
.xpg-field::placeholder { color: #776472; }
.xpg-field[aria-invalid="true"] { border-color: var(--xpg-error); }
textarea.xpg-field { resize: none; field-sizing: content; }
.xpg-form, .xpg-editor-fields, .xpg-editor-advanced, .xpg-review-row { display: grid; gap: 12px; }
.xpg-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.xpg-editor-advanced summary { cursor: pointer; padding: 9px 0; color: var(--xpg-rose-dark); font-weight: 750; }
.xpg-editor-advanced[open] .xpg-label { margin-top: 6px; }
.xpg-import, .xpg-reply-form { margin: 13px 0; }
.xpg-review-row, .xpg-panel { min-width: 0; }
.xpg-reply > .xpg-muted { margin-left: 8px; font-size: 12px; }
.xpg-dialog { width: min(480px, calc(100% - 32px)); max-height: 90dvh; overflow: auto; padding: 22px; border: 1px solid var(--xpg-line); border-radius: 20px; background: var(--xpg-white); color: var(--xpg-ink); box-shadow: 0 20px 90px #492f4547; }
.xpg-dialog::backdrop { background: #38213274; }
.xpg-dialog > h2 { font-size: 22px; }
.xpg-dialog > p, .xpg-dialog .xpg-actions, .xpg-dialog > form { margin-top: 10px !important; }

@media (max-width: 930px) {
  .xpg-main { width: calc(100% - 45px); }
  .xpg-header { padding-inline: 21px; gap: 9px; }
  .xpg-nav-link { padding-inline: 8px; }
  .xpg-hero { padding-inline: 31px; }
  .xpg-grid { gap: 13px; }
}

@media (max-width: 700px) {
  .xpg-main { width: calc(100% - 28px); padding-top: 15px; }
  .xpg-header { grid-template-columns: 1fr auto; min-height: auto; padding: 9px 14px 12px; }
  .xpg-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-around; width: 100%; gap: 1px; }
  .xpg-nav-link { flex: 1; min-width: 0; min-height: 44px; padding-inline: 3px; gap: 4px; font-size: 12px; }
  .xpg-brand { font-size: 21px; }
  .xpg-avatar { width: 32px; height: 32px; }
  .xpg-hero { grid-template-columns: minmax(0, 1fr) minmax(100px, .65fr); min-height: 0; padding: 20px; border-radius: 22px; gap: 8px; }
  #xipi-games .xpg-hero h1 { font-size: clamp(28px, 6.2vw, 44px); margin-block: 8px; }
  .xpg-hero-description { font-size: 13px; }
  .xpg-hero-content > .xpg-button { margin-top: 14px; }
  .xpg-photos { min-height: 155px; justify-content: center; padding: 0; gap: 4px; }
  #xipi-games .xpg-photo { width: min(45%, 119px); min-width: 0; padding: 4px; border-radius: 9px; }
  .xpg-photo-caption { font-size: 10px; padding-top: 3px; }
  .xpg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xpg-filters { margin-top: 14px; }
  #xipi-games .xpg-filter { min-height: 40px; padding-inline: 10px; }
  .xpg-discover-toolbar { margin-top: 20px; }
  .xpg-search { width: min(52%, 260px); }
  #xipi-games .xpg-sort { font-size: 18px; }
  .xpg-sort-tabs { gap: 10px; }
  .xpg-panel, .xpg-row { padding: 14px; }
}

@media (max-width: 470px) {
  #xipi-games .xpg-photo { width: min(86%, 106px); }
  #xipi-games .xpg-photo:nth-child(n + 2) { display: none; }
  .xpg-hero { padding: 16px 14px; }
  .xpg-detail-head { grid-template-columns: 1fr; padding: 13px; gap: 14px; }
  .xpg-detail-cover { max-height: 265px; }
  .xpg-form-grid { grid-template-columns: 1fr; }
  .xpg-nav-link .xpg-icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #xipi-games *, #xipi-games *::before, #xipi-games *::after { transition: none !important; scroll-behavior: auto !important; }
}
