/* design/SKILL.md §2.3 / §4.3 — 浅纸纹桌面、暗色包架和金色文字围绕中央实体卡包。 */
:root {
  color-scheme: light;
  --ink: #271f29;
  --soft: #675e67;
  --gold: #946126;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: #eeece5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; background: radial-gradient(ellipse at 50% 0%, #fffefa, #f3f1eb 54%, #e3dfd6); }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: linear-gradient(#5344320b 1px, transparent 1px) center / 36px 36px,
              linear-gradient(90deg, #5344320b 1px, transparent 1px) center / 36px 36px;
  mask-image: radial-gradient(ellipse at 50% 44%, #000 22%, #0002 90%);
}
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; background: var(--paper-grain); opacity: .13; }
button, a { color: inherit; font: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #946126; outline-offset: 4px; }
.pack-room {
  position: relative; z-index: 1; width: min(100%, 640px); margin: 0 auto;
  min-height: 100vh; min-height: 100dvh; padding: max(10px, env(safe-area-inset-top)) 18px max(8px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.room-bar { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-bar a, .room-bar button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px;
  padding: 0 10px; border: 0; background: transparent; color: var(--soft); font-size: 12px; text-decoration: none;
}
.room-bar a span { font: 24px/1 Georgia,serif; }
#wallet-identity { min-width: 0; max-width: 46%; color: #735128; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
#wallet-identity-dialog { width: min(340px, 86vw); text-align: center; }
#wallet-identity-dialog h2 { margin: 0; font: 700 22px "SimSun", serif; }
#wallet-identity-note { font-size: 13px; color: var(--soft); }
#wallet-identity-options { display: grid; gap: 7px; }
#wallet-identity-options button, #wallet-cancel { padding: 9px 12px; color: var(--ink); border: 1px solid #bba787; border-radius: 5px; background: #faf5e9; overflow-wrap: anywhere; }
#wallet-cancel { margin-top: 12px; border: 0; background: transparent; }
.room-bar a:hover, .room-bar button:hover { color: var(--ink); background: #fff8; border-radius: 16px; }
body[data-phase="result"] .room-bar { position: relative; z-index: 2; }
body[data-phase="result"] .room-bar :is(a, button) { background: #fffdf2e6; border-radius: 18px; color: #453b42; }
.pack-room main, #pack-home { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.room-title { text-align: center; }
.room-title h1, .gallery-title h1 {
  margin: 0; font: 800 clamp(34px, 5.6vh, 56px)/1.16 "STSong", "SimSun", "Songti SC", serif; letter-spacing: .04em;
}
.room-title em { color: var(--gold); font-style: normal; background: linear-gradient(120deg,#946322,#b48031 58%,#96631d); background-clip: text; -webkit-text-fill-color: transparent; }
.room-title p { margin: 6px 0 0; font-size: 11px; color: var(--soft); letter-spacing: .26em; }
#pack-stage { width: 100%; flex: 1 0 auto; position: relative; min-height: clamp(315px, 47vh, 550px); }
.room-shelf { align-self: center; max-width: 100%; text-align: center; }
.shelf-current { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 5px; }
.shelf-current strong { font: 700 17px "STSong", "SimSun", serif; }
#sect-picker {
  min-height: 38px; max-width: 55vw; padding: 2px 7px;
  border: 1px solid #bca98a; border-radius: 7px; background: #faf6ed; color: var(--ink);
  font: 700 16px "STSong", "SimSun", serif; cursor: pointer;
}
#sect-picker:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.shelf-current span { color: var(--soft); font-size: 11px; }
.shelf-current button {
  width: 26px; height: 26px; border: 0; border-radius: 50%; color: var(--soft); background: transparent; font: bold 14px Georgia, serif;
  box-shadow: inset 0 0 0 1px #7c705238; transform: scale(.84);
}
#pack-choices {
  display: flex; align-items: flex-end; justify-content: space-around; gap: 4px; padding: 7px 10px; border-radius: 17px;
  background: linear-gradient(#ded7cb,#ece6db 65%); box-shadow: inset 0 3px 7px #74634a33, inset 0 0 0 1px #b4a8916b, 0 1px 0 #fffd;
}
.shelf-pack { min-width: 0; padding: 4px 5px; display: grid; justify-items: center; gap: 3px; border: 0; background: transparent; border-radius: 9px; }
.shelf-pack[aria-pressed="true"] { background: #fff9; box-shadow: inset 0 0 0 1px #a58647a1; }
.shelf-art { display: block; width: clamp(32px,7vw,44px); height: clamp(46px,10.1vw,63px); margin: 1px 0 2px; filter: drop-shadow(1px 3px 2px #392c3570); transition: transform .2s; }
.shelf-art canvas { display: block; width: 100%; height: 100%; }
.shelf-pack:hover .shelf-art { transform: translateY(-3px); }
.shelf-label { font: 600 10px/1.4 "Microsoft YaHei", sans-serif; white-space: nowrap; }
.room-foot { text-align: center; padding-top: 9px; }
.room-nav {
  display: flex; margin: 0 auto; max-width: 380px; padding: 3px 5px;
  border-radius: 16px; border: 1px solid #594b53;
  background: linear-gradient(175deg, #463c46, #302832 45%, #271f29);
  box-shadow: inset 0 1px 0 #fff2, 0 5px 11px -8px #2a202c;
}
.room-nav button { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 0; border-radius: 12px; background: none; color: #e8dfd1; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.room-nav button + button::before { content: ""; position: absolute; left: -1px; height: 20px; width: 1px; background: linear-gradient(transparent,#a38d6e88,transparent); }
.room-nav button[aria-current="page"] { color: #ffe3a2; background: #f7e5b50b; }
.room-nav i { color: #e7c789; display: inline-block; position: relative; width: 16px; height: 18px; }
.nav-pouch { border: 1.5px solid currentColor; border-width: 3px 1.5px; border-radius: 2px; transform: rotate(-8deg); }
.nav-pouch::after { content: "✦"; display: block; font: normal 10px/12px Georgia, serif; }
.nav-book { border: 1.5px solid currentColor; border-radius: 2px; box-shadow: inset 3px 0 0 #443943,inset 4px 0 0 currentColor; }
.nav-book::after { content: ""; position: absolute; height: 1px; background: currentColor; left: 7px; right: 2px; top: 5px; }
.nav-foil { font: normal 26px/18px Georgia, serif; }
#pack-count { margin: 7px 0 0; color: var(--soft); font-size: 10px; letter-spacing: .06em; }
body[data-phase="opening"] .room-shelf { pointer-events: none; }
body[data-view="home"][data-phase="result"] :is(.room-title,.room-shelf,.room-foot) { display: none; }
body[data-view="home"][data-phase="result"] #pack-stage {
  width: 100vw; align-self: center;
  min-height: calc(100vh - 65px); min-height: calc(100dvh - 65px);
}
.gallery { padding: 22px 0 24px; }
body:not([data-view="home"]) .pack-room { width: min(100%, 940px); }
body:not([data-view="home"]) .room-foot { position: sticky; bottom: 0; z-index: 2; padding-bottom: 6px; background: linear-gradient(transparent, #eeebe3 32%); }
.gallery-title { text-align: center; margin-bottom: 22px; }
.gallery-title h1 { font-size: clamp(32px, 5vw, 42px); }
.gallery-title p, .empty-collection { color: var(--soft); font-size: 12px; line-height: 1.65; }
.sample-grid, .owned-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
@media (min-width: 720px) {
  .sample-grid, .owned-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .gallery { padding-top: clamp(26px, 7vh, 68px); }
  .gallery-title { padding-bottom: 16px; }
}
.sample-tile, .owned-tile { display: grid; align-content: start; justify-items: stretch; gap: 7px; padding: 7px; border: 1px solid #ab9e8a4d; border-radius: 11px; background: #fff9; text-align: center; }
.tile-art { display: block; width: 100%; min-width: 0; pointer-events: none; }
.sample-tile strong, .owned-tile strong { font-size: 13px; }
.sample-tile small, .owned-tile small { color: var(--soft); font-size: 11px; }
.sample-tile:hover, .owned-tile:hover { border-color: #ab8a52; background: #fffc; }
.tier-filters { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }
.tier-filters button { font-size: 12px; font-weight: 650; padding: 6px 11px; background: #fff9; border: 1px solid #bfb6a7; border-radius: 20px; }
.tier-filters button[aria-pressed="true"] { background: #382e38; color: #fce5b2; border-color: #382e38; }
.empty-collection { margin: 48px 0; text-align: center; }
.pack-room + dialog, #detail-dialog { color: var(--ink); }
dialog { padding: 20px; border: 1px solid #baa98b; border-radius: 18px; background: #f9f6ef; box-shadow: 0 18px 60px #221b254d; }
dialog::backdrop { background: #251e2a79; backdrop-filter: blur(4px); }
#odds-dialog { width: min(320px, 88vw); }
.dialog-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.dialog-head h2 { margin: 0; font: bold 20px "SimSun",serif; }
.dialog-head button,.detail-close button { width: 36px; height: 36px; border: 1px solid #ada48f; border-radius: 50%; background: #fff9; font-size: 22px; line-height: 1; }
#odds-list { display: grid; grid-template-columns: 1fr auto; gap: 0; margin: 14px 0 0; }
#odds-list dt, #odds-list dd { padding: 9px 0; border-top: 1px solid #d8d0c1; margin: 0; font-size: 13px; }
#odds-list dd { text-align: right; font-variant-numeric: tabular-nums; }
#detail-dialog { width: min(86vw, 338px, calc((100vh - 135px) / 1.85 + 26px)); padding: 12px; }
.detail-close { position: relative; display: flex; justify-content: flex-end; padding-bottom: 4px; }
.detail-close button { width: 29px; height: 29px; font-size: 18px; }
#try-reveal { display: block; width: 100%; padding: 10px; margin-top: 10px; border-radius: 9px; background: #332a34; border: 1px solid #8d785a; color: #ffe2a1; font-weight: bold; }
@media (max-width: 440px) {
  .pack-room { padding-inline: 12px; }
  .sample-grid,.owned-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-height: 570px) and (min-width: 650px) {
  .pack-room { width: min(100%, 760px); }
  body[data-view="home"]:not([data-phase="result"]) #pack-home { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
  .room-title { grid-column: 2; grid-row: 1; align-self: end; padding-bottom: 12px; }
  #pack-stage { grid-column: 1; grid-row: 1 / 3; height: 100%; min-height: 265px; }
  .room-shelf { grid-column: 2; grid-row: 2; align-self: start; }
}
@media (prefers-reduced-motion: reduce) { .shelf-art { transition: none; } }

/* design/SKILL.md §4.1 / §4.2 — 角色数量较多，关键词和分类共同缩短查阅路径。 */
.profile-search { display: flex; gap: 8px; }
.profile-search input, .profile-search select {
  min-width: 0; padding: 9px 12px; border: 1px solid #bcb1a1; border-radius: 8px;
  background: #fffaf1; color: var(--ink); font: inherit; font-size: 14px; min-height: 42px;
}
.profile-search input { flex: 1; }
#profiles-count { font-size: 12px; color: var(--soft); }
#profiles-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(205px,100%),1fr)); gap: 7px; }
.profile-row {
  display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px;
  border: 1px solid #c6bdaa; border-radius: 7px; background: #fffaf2;
}
.profile-row:hover { border-color: #9a7948; }
.profile-row img { width: 35px; height: 48px; object-fit: cover; border-radius: 2px; }
.profile-row small, .profile-row strong { display: block; }
.profile-row strong { font-size: 14px; }
.profile-row small { color: var(--soft); font-size: 11px; line-height: 1.5; }
@media (max-width: 440px) {
  .room-nav button { gap: 4px; letter-spacing: 0; }
  #profiles-list { grid-template-columns: 1fr 1fr; }
}

/* §4.1 / §4.3 — 宝箱角标显示待领物，包架的小签显示已领库存。 */
.supply-bar,.duplicate-tools,.craft-row { display:flex; align-items:center; justify-content:center; gap:12px; flex-wrap:wrap; }
.supply-bar { margin:15px 0 0; gap:10px; }
.supply-bar button,.duplicate-tools button,#confirm-dismantle,#craft-pack { display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:0 15px;border:1px solid #bcab8c;border-radius:9px;background:#fffaf1;color:#473b32;font-size:13px;font-weight:700; }
.supply-bar #claim-chest,#confirm-dismantle { background:linear-gradient(#716045,#443526);color:#ffebba;border-color:#6f5533; }
#chest-count { background:#ffe1a1;color:#513728;border-radius:12px;min-width:20px;padding:2px 4px; }
.chest-icon { position:relative;width:25px;height:20px;border:2px solid #e5bb6c;border-radius:7px 7px 3px 3px; background:linear-gradient(90deg,transparent 9%,#f1ca78 10% 21%,transparent 22% 77%,#e2ae62 78% 90%,transparent 91%),linear-gradient(#a67045 43%,#352a21 44% 53%,#b67c49 55%);box-shadow:0 2px 3px #24180a55; }
.chest-icon::after { content:'';position:absolute;left:8px;top:7px;width:5px;height:6px;background:#ffe5a0;border-radius:1px; }
.shard-icon { width:11px;height:15px;display:inline-block;clip-path:polygon(50% 0,100% 47%,48% 100%,0 52%);background:linear-gradient(110deg,#9ea1b9 45%,#57647f 46%); }
#reward-clock,#pack-description,.duplicate-tools span,#fragment-rates {font-size:12px;color:#6b5d50;line-height:1.6;}
.supply-bar button:disabled,.craft-row button:disabled,.duplicate-tools button:disabled { opacity:.62;cursor:default; }
.empty-pack { position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:15px; }
.empty-pack-cover { height:clamp(145px,28vh,270px); aspect-ratio:312/450;filter:saturate(.63) drop-shadow(3px 10px 8px #48382035);transform:rotate(-4deg); }
.empty-pack p { font-size:12px;color:#6b5d50;margin:0; }
.room-shelf { width:min(100%,520px); }
#pack-groups { display:flex;justify-content:center;gap:3px;margin:1px auto 6px; }
#pack-groups button { border:0;border-bottom:2px solid transparent;background:transparent;color:#776b60;padding:6px 11px;min-height:33px;font-size:12px; }
#pack-groups button[aria-pressed=true] { border-color:#916b33;color:#533a1f;font-weight:700; }
.shelf-pack { position:relative; flex:1; }
/* §4.1 / §4.2 — 二十门派横向排布，完整保留每个包名和触屏选择区域。 */
#pack-choices[data-group="sect"] {
  justify-content: flex-start; align-items: stretch; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-color: #ac9775 #e8e0d2; scrollbar-width: thin;
}
#pack-choices[data-group="sect"] .shelf-pack { flex: 0 0 70px; }
#pack-choices[data-group="sect"] .shelf-label { font-size: 11px; }
.pack-stock { position:absolute;top:2px;left:calc(50% + 7px);padding:1px 5px;border:1px solid #dac798;border-radius:9px;background:#403735;color:#ffe6b2;font:600 10px/1.35 system-ui; }
.craft-row { gap:9px;margin:8px 0 3px; }
.craft-row p { margin:0;flex:1;text-align:left; }
.duplicate-tools { margin:0 auto 14px; }
#dismantle-dialog { width:min(370px,92vw); } #dismantle-dialog>p { font-size:13px;line-height:1.6; }
#wallet-message { position:fixed;z-index:4;bottom:75px;left:50%;transform:translateX(-50%);width:max-content;max-width:90vw;margin:0;padding:10px 16px;border-radius:10px;background:#382f2d;color:#fff1d0;box-shadow:0 3px 12px #21171f33;font-size:13px;pointer-events:none; }
body[data-view=home][data-phase=result] .supply-bar {display:none;}
@media (max-width:525px) {
  .supply-bar {display:grid;grid-template-columns:auto auto;justify-content:space-between;row-gap:2px;}
  #reward-clock {grid-row:2;grid-column:1/-1;text-align:left;font-size:11px;}
  #wallet-link {grid-column:2;grid-row:1;}
  #pack-stage {min-height:clamp(235px,37vh,390px);}
}
@media (max-height:570px) and (min-width:650px) {
  .supply-bar {grid-column:2;grid-row:2;margin:0;}
  .room-shelf {grid-column:2;grid-row:3;}
  #pack-stage {grid-row:1/4;}
}

@media (min-width:526px) and (min-height:571px) {
  body[data-phase=sealed] #pack-stage {min-height:clamp(215px,calc(100dvh - 515px),510px);}
}
#pool-details {margin-top:14px;border-top:1px solid #d8d0c1;padding-top:12px;font-size:13px;}
#pool-details summary {cursor:pointer;font-weight:bold;}
#pool-cards h3 {margin:12px 0 3px;color:var(--gold);font-size:13px;}
#pool-cards p {margin:0;color:var(--soft);line-height:1.7;}
