/* 曙光 Holy Beast portal — shared design system */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@600;800&family=Noto+Sans+TC:wght@400;500;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --ink: #3b2c16; --ink-soft: #6d5a3c; --ink-faint: #9c8a6b;
  --paper: rgba(255, 250, 238, .74); --paper-hi: rgba(255, 252, 245, .92); --paper-lo: rgba(255, 246, 226, .55);
  --line: rgba(120, 88, 40, .18); --line-hi: rgba(196, 138, 46, .55);
  --gold: #c8892a; --gold-hi: #f1c66a; --gold-deep: #8a5a14; --ember: #d9663a; --leaf: #3f9a5c; --leaf-hi: #5cc27c;
  --sky: #4a7fc1; --danger: #c84a3a;
  --r-n: #8f8a80; --r-r: #3d8fd1; --r-sr: #9a5cd6; --r-ur: #e08a1e; --r-lr: #e0457b;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 40px -22px rgba(80, 50, 10, .45), 0 2px 6px rgba(80, 50, 10, .08);
  --shadow-hi: 0 1px 0 rgba(255,255,255,.8) inset, 0 26px 50px -20px rgba(150, 90, 10, .5), 0 0 0 1px var(--line-hi);
  --serif: "Noto Serif TC", "Songti TC", serif; --sans: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 15px/1.65 var(--sans); letter-spacing: .02em;
  background-color: #f6ead2;
  background-image:
    radial-gradient(900px 420px at 78% -6%, rgba(255, 214, 140, .95), transparent 62%),
    radial-gradient(1200px 520px at 20% -12%, rgba(240, 160, 150, .55), transparent 60%),
    linear-gradient(180deg, #8fa9d8 0%, #c9b8d6 18%, #f2d3b0 38%, #f6e7cc 58%, #eef0d0 82%, #d9e8b8 100%);
  background-attachment: fixed;
}
body::before { /* paper grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.motes { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.motes i { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: #fff6d8;
  box-shadow: 0 0 10px 3px rgba(255, 210, 120, .7); animation: rise linear infinite; opacity: 0; }
@keyframes rise { 0% { transform: translateY(0) translateX(0); opacity: 0; } 12% { opacity: .9; } 100% { transform: translateY(-105vh) translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .motes { display: none; } * { animation: none !important; transition: none !important; } }

a { color: var(--gold-deep); }
.wrap { position: relative; z-index: 1; width: min(1180px, 100% - 32px); margin: 0 auto; }

/* header */
.topbar { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  background: linear-gradient(180deg, rgba(255, 248, 232, .78), rgba(255, 248, 232, .55)); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 6px rgba(200, 130, 30, .45)); }
.brand b { font: 800 17px/1 var(--serif); letter-spacing: .12em; background: linear-gradient(95deg, var(--gold-deep), var(--gold) 45%, #6d4410);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { display: block; font: 500 9.5px/1.4 var(--mono); letter-spacing: .28em; color: var(--ink-faint); margin-top: 3px; }
.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: nowrap; }
.nav a { position: relative; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink-soft); font-size: 14px; white-space: nowrap; transition: background .2s, color .2s; }
.nav a:hover { background: rgba(200, 137, 42, .1); color: var(--ink); }
.nav a.on { color: var(--gold-deep); font-weight: 700; background: linear-gradient(180deg, rgba(241, 198, 106, .35), rgba(241, 198, 106, .15)); box-shadow: inset 0 0 0 1px var(--line-hi); }
.me { display: flex; align-items: center; gap: 8px; }
.me .pts { font: 500 13px var(--mono); color: var(--gold-deep); background: var(--paper-hi); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; text-decoration: none; }
.me .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 700 14px var(--serif); color: #fff;
  background: linear-gradient(135deg, var(--gold-hi), var(--ember)); box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(150, 90, 10, .35); }
.burger { display: none; margin-left: auto; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-hi); cursor: pointer; font-size: 18px; }
@media (max-width: 1060px) {
  .burger { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; padding: 10px 16px 16px; gap: 4px;
    background: rgba(255, 249, 236, .97); border-bottom: 1px solid var(--line); box-shadow: 0 20px 30px -20px rgba(80, 50, 10, .4); }
  .nav.open { display: flex; }
  .nav a { padding: 11px 14px; border-radius: 12px; }
  .me .pts { display: none; }
}

/* page */
main { position: relative; z-index: 1; padding: 34px 0 60px; }
.hero { margin: 6px 0 26px; }
.eyebrow { font: 500 11px/1 var(--mono); letter-spacing: .34em; text-transform: uppercase; color: var(--gold); display: flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 26px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
h1, .h1 { font: 800 clamp(28px, 4.2vw, 42px)/1.2 var(--serif); margin: 12px 0 8px; letter-spacing: .06em;
  background: linear-gradient(100deg, #7a4a0e 5%, #c8892a 40%, #f0c060 55%, #9a6216 80%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .7)); }
h2 { font: 700 19px/1.3 var(--serif); margin: 0 0 14px; letter-spacing: .06em; color: var(--ink); display: flex; align-items: center; gap: 10px; }
h2 .count { font: 500 12px var(--mono); color: var(--ink-faint); }
.lead { color: var(--ink-soft); max-width: 720px; margin: 0; }
.muted { color: var(--ink-faint); font-size: 13px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 22px; }
.card + .card, .stack > * + * { margin-top: 18px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
hr.fine { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line-hi), transparent); margin: 18px 0; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  font: 700 14px var(--sans); letter-spacing: .04em; text-decoration: none; border: 1px solid transparent; transition: transform .15s, box-shadow .2s, filter .2s; white-space: nowrap; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.4); }
.btn-gold { color: #fff; background: linear-gradient(180deg, #f3c25f, #d08a24 60%, #b8711a); border-color: #b06a14;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 8px 18px -8px rgba(180, 110, 20, .8); text-shadow: 0 1px 1px rgba(110, 60, 0, .5); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 12px 24px -8px rgba(180, 110, 20, .9); }
.btn-green { color: #fff; background: linear-gradient(180deg, #6fd08f, #3f9a5c 60%, #2f7d48); border-color: #2c7444;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 8px 18px -8px rgba(40, 120, 70, .8); text-shadow: 0 1px 1px rgba(0, 60, 20, .5); }
.btn-ghost { color: var(--gold-deep); background: rgba(241, 198, 106, .14); border-color: var(--line-hi); }
.btn-ghost:hover { background: rgba(241, 198, 106, .28); }
.btn-plain { color: var(--ink-soft); background: var(--paper-hi); border-color: var(--line); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
input, select, textarea { font: 15px var(--sans); color: var(--ink); background: var(--paper-hi); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(241, 198, 106, .28); }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.search { position: relative; }
.search input { width: 100%; padding-left: 42px; height: 46px; border-radius: 999px; }
.search::before { content: "⌕"; position: absolute; left: 16px; top: 50%; transform: translateY(-52%); font-size: 20px; color: var(--ink-faint); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); background: var(--paper-hi); color: var(--ink-soft); white-space: nowrap; }
.pill.gold { color: var(--gold-deep); border-color: var(--line-hi); background: rgba(241, 198, 106, .2); }
.pill.live { color: #fff; border: 0; background: linear-gradient(90deg, #e2553a, #ef8a3a); box-shadow: 0 4px 10px -4px rgba(220, 90, 50, .8); }
.pill.soon { color: var(--sky); border-color: rgba(74, 127, 193, .35); background: rgba(74, 127, 193, .1); }
.pill.done { color: var(--ink-faint); }
.mono { font-family: var(--mono); }
.stat { display: grid; gap: 2px; }
.stat b { font: 700 22px var(--mono); color: var(--gold-deep); }
.stat span { font-size: 12px; color: var(--ink-faint); letter-spacing: .1em; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0; overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; border: 0; background: none; padding: 12px 16px; font: 500 14px var(--sans); color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--gold-deep); font-weight: 700; }
.tabs button.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--gold-hi), var(--gold)); box-shadow: 0 0 12px rgba(241, 198, 106, .8); }

/* item tiles */
.icon-frame { position: relative; width: 56px; height: 56px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #fffaf0, #f0dfbd 75%); border: 1px solid var(--line); box-shadow: inset 0 -6px 14px rgba(150, 100, 30, .12), 0 3px 8px rgba(80, 50, 10, .12); }
.icon-frame img { width: 38px; height: 38px; image-rendering: pixelated; filter: drop-shadow(0 2px 2px rgba(60, 30, 0, .35)); }
.icon-frame.big { width: 120px; height: 120px; border-radius: 24px; }
.icon-frame.big img { width: 80px; height: 80px; }
.icon-frame.sm { width: 40px; height: 40px; border-radius: 10px; }
.icon-frame.sm img { width: 30px; height: 30px; }
.goods { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.tile { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px 12px 14px; cursor: pointer; border-radius: 16px;
  background: linear-gradient(180deg, var(--paper-hi), var(--paper-lo)); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .2s, box-shadow .25s, border-color .2s; font: inherit; color: inherit; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); }
.tile:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; }
.tile .name { font-weight: 700; font-size: 14px; line-height: 1.35; min-height: 2.7em; display: grid; place-items: center; }
.tile .qty { font: 500 11px var(--mono); color: var(--ink-faint); }
.price { font: 700 16px var(--mono); color: var(--gold-deep); }
.price small { font-size: 11px; color: var(--ink-faint); margin-left: 2px; }
.ribbon { position: absolute; top: 0; left: 0; padding: 3px 10px; border-radius: 16px 0 12px 0; font: 700 10px var(--mono); letter-spacing: .12em; color: #fff;
  background: linear-gradient(90deg, var(--gold), var(--ember)); box-shadow: 0 3px 8px -2px rgba(200, 100, 30, .6); }
.ribbon.hot { background: linear-gradient(90deg, #e2453a, #f07a3a); }
.slot-tag { font-size: 11px; color: var(--ink-faint); }

/* gacha pool cards */
.pools { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pool { position: relative; display: flex; gap: 16px; align-items: center; padding: 18px; cursor: pointer; text-align: left; border-radius: 18px; font: inherit; color: inherit;
  background: radial-gradient(400px 160px at 0% 0%, rgba(255, 223, 150, .55), transparent 60%), linear-gradient(180deg, var(--paper-hi), var(--paper-lo));
  border: 1px solid var(--line-hi); box-shadow: var(--shadow); transition: transform .2s, box-shadow .25s; }
.pool:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); }
.egg { width: 72px; height: 88px; flex: none; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: radial-gradient(circle at 34% 28%, #fff 0 8%, transparent 22%), radial-gradient(circle at 50% 60%, var(--egg-a, #f6d27a), var(--egg-b, #c27a1a));
  box-shadow: inset -8px -12px 18px rgba(80, 30, 0, .28), 0 10px 18px -8px rgba(120, 70, 10, .6); }
.egg.lg { width: 170px; height: 210px; }
.pool h3 { margin: 0 0 4px; font: 700 17px var(--serif); }

/* rarity */
.r-common { --r: var(--r-n); } .r-rare { --r: var(--r-r); } .r-epic { --r: var(--r-sr); } .r-lr { --r: var(--r-lr); }
.rar { font: 800 11px var(--mono); letter-spacing: .1em; color: #fff; padding: 2px 8px; border-radius: 6px; background: var(--r); box-shadow: 0 2px 8px -2px var(--r); }
.prize { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--paper-hi); border: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--r); }
.prize > div { flex: 1; min-width: 0; line-height: 1.4; font-size: 13px; }
.prize > div b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.prize .p { margin-left: auto; font: 500 12px var(--mono); color: var(--ink-faint); }
.prizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.rates { display: flex; gap: 10px; flex-wrap: wrap; }
.rates .rate { flex: 1 1 90px; text-align: center; padding: 10px; border-radius: 14px; background: var(--paper-hi); border: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--r); }
.rates .rate b { display: block; font: 700 18px var(--mono); color: var(--r); }

/* progress */
.bar { height: 10px; border-radius: 999px; background: rgba(120, 88, 40, .12); overflow: hidden; box-shadow: inset 0 1px 2px rgba(80, 50, 10, .2); }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-hi), var(--gold)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.rainbow i { background: linear-gradient(90deg, #ff6b8a, #ffb347, #ffe066, #6be39a, #5bc8ff, #9a7bff); box-shadow: 0 0 12px rgba(255, 200, 120, .7); }

/* modal */
dialog.modal { width: min(760px, 100% - 24px); max-height: min(88vh, 900px); padding: 0; border: 1px solid var(--line-hi); border-radius: 24px; color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, #f8ecd4); box-shadow: 0 40px 90px -30px rgba(60, 30, 0, .7); overflow: hidden; }
dialog.modal.confirm { width: min(440px, 100% - 24px); }
dialog.modal.wide { width: min(1040px, 100% - 24px); }
dialog.modal::backdrop { background: rgba(40, 24, 6, .45); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: pop .28s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line);
  background: radial-gradient(500px 120px at 0 0, rgba(255, 220, 150, .6), transparent 70%); }
.modal-head h3 { margin: 0; font: 800 20px var(--serif); letter-spacing: .05em; }
.modal-body { padding: 22px; overflow: auto; max-height: calc(min(88vh, 900px) - 70px); }
.x { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-hi); cursor: pointer; font-size: 18px; color: var(--ink-soft); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-hi); overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--gold-deep); }
.stepper input { width: 54px; border: 0; text-align: center; background: none; padding: 0; height: 38px; border-radius: 0; font-family: var(--mono); }
.stepper input:focus { box-shadow: none; }

/* gacha stage */
.stage { position: relative; height: 340px; border-radius: 20px; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(260px 200px at 50% 55%, rgba(255, 236, 190, .95), transparent 70%), radial-gradient(600px 300px at 50% 120%, rgba(140, 190, 110, .55), transparent 60%), linear-gradient(180deg, #f3e3c3, #e9d3a8);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 -30px 60px rgba(120, 80, 20, .15); }
.stage .egg { animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-1.5deg); } }
.stage.shake .egg { animation: shake .5s ease-in-out 3; }
@keyframes shake { 20% { transform: rotate(-10deg); } 40% { transform: rotate(9deg); } 60% { transform: rotate(-7deg); } 80% { transform: rotate(5deg); } }
.stage .burst { position: absolute; inset: 0; background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(255, 220, 140, .4) 30%, transparent 60%); opacity: 0; }
.stage.open .burst { animation: burst .9s ease-out forwards; }
@keyframes burst { 30% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(2); } }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.results .prize { flex-direction: column; text-align: center; animation: pop .4s backwards; }

/* list rows */
.list { display: grid; gap: 10px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--paper-hi); border: 1px solid var(--line); }
.rank { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 800 15px var(--mono); color: #fff;
  background: linear-gradient(135deg, #c8b89a, #9c8a6b); box-shadow: 0 4px 10px -4px rgba(80, 50, 10, .6); }
.rank.r1 { background: linear-gradient(135deg, #ffe07a, #d89a1a); } .rank.r2 { background: linear-gradient(135deg, #eef2f6, #a3adb8); } .rank.r3 { background: linear-gradient(135deg, #f1b98a, #b86a34); }

/* empty / toast / footer */
.empty { text-align: center; padding: 40px 16px; color: var(--ink-faint); border: 1px dashed var(--line-hi); border-radius: 16px; background: var(--paper-lo); }
.empty b { display: block; font: 700 16px var(--serif); color: var(--ink-soft); margin-bottom: 4px; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; padding: 12px 20px; border-radius: 999px; color: #fff; font-weight: 700;
  background: rgba(50, 32, 10, .92); box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .5); transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: rgba(170, 50, 40, .94); }
footer.foot { position: relative; z-index: 1; text-align: center; padding: 28px 0 40px; font: 500 11px var(--mono); letter-spacing: .24em; color: var(--ink-faint); }
footer.foot a { color: var(--ink-soft); }
.skeleton { background: linear-gradient(90deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .8), rgba(255, 255, 255, .3)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 14px; min-height: 120px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 640px) { .card { padding: 16px; } .modal-body { padding: 16px; } .goods { grid-template-columns: repeat(2, 1fr); } .stage { height: 260px; } }
.results .prize.r-lr, .results .prize.r-epic { box-shadow: inset 3px 0 0 var(--r), 0 0 0 1px var(--r), 0 0 24px -4px var(--r); animation: pop .4s backwards, shine 1.6s ease-in-out infinite alternate; }
@keyframes shine { to { box-shadow: inset 3px 0 0 var(--r), 0 0 0 1px var(--r), 0 0 34px 2px var(--r); } }

/* 3D costume preview */
.p3 { display: grid; grid-template-columns: 230px 1fr; gap: 14px; min-height: 560px; }
@media (max-width: 760px) { .p3 { grid-template-columns: 1fr; } .p3-list { max-height: 160px; } }
.p3-list { display: grid; align-content: start; gap: 6px; overflow: auto; padding-right: 4px; }
.p3-item { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--paper-hi); border: 1px solid var(--line); cursor: pointer; }
.p3-item small { grid-column: 2; color: var(--ink-faint); font-size: 11px; }
.p3-item input { accent-color: var(--gold); width: 16px; height: 16px; grid-row: span 2; }
.p3-main { display: grid; grid-template-rows: 1fr auto; gap: 10px; min-height: 0; }
.p3-stage { position: relative; min-height: 460px; border-radius: 20px; overflow: hidden; cursor: grab; border: 1px solid var(--line-hi);
  background: radial-gradient(420px 300px at 50% 72%, rgba(255, 236, 190, .95), transparent 70%), radial-gradient(900px 400px at 50% 120%, rgba(150, 200, 120, .6), transparent 60%),
    linear-gradient(180deg, #8fa9d8 0%, #d7b8c8 38%, #f6dcae 70%, #e8e3b8 100%); box-shadow: inset 0 0 80px rgba(80, 50, 10, .18); }
.p3-stage:active { cursor: grabbing; }
.p3-stage canvas { display: block; width: 100% !important; height: 100% !important; }
.p3-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.p3-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-hi); border: 1px solid var(--line); }
.p3-seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font: 500 13px var(--sans); color: var(--ink-soft); cursor: pointer; }
.p3-seg button.on { color: #fff; background: linear-gradient(180deg, #f3c25f, #c8892a); box-shadow: 0 4px 10px -4px rgba(180, 110, 20, .8); }
.p3-shot { margin-left: auto; border: 1px solid var(--line-hi); background: rgba(241, 198, 106, .18); color: var(--gold-deep); border-radius: 999px; padding: 8px 16px; font-weight: 700; cursor: pointer; }

.cube { flex: none; font: 800 10px var(--mono); letter-spacing: .08em; color: var(--gold-deep); padding: 4px 7px; border-radius: 8px;
  background: linear-gradient(180deg, #fff8e6, #f3dca8); border: 1px solid var(--line-hi); box-shadow: 0 3px 8px -3px rgba(150, 90, 10, .6); cursor: pointer; transition: transform .15s; }
.cube:hover, .cube:focus-visible { transform: scale(1.1); }
.tile .cube { position: absolute; top: 8px; right: 8px; }
dialog.modal.wide .modal-body .p3 { min-height: 600px; }

.lr-btn { color: #fff; border-color: #c4356a; background: linear-gradient(100deg, #ff6b8a, #c65cff 50%, #5bc8ff); box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 10px 22px -10px rgba(200, 60, 140, .9); text-shadow: 0 1px 1px rgba(80, 0, 40, .5); }
.lr-btn:disabled { background: #cbbd9f; border-color: #b8a888; box-shadow: none; }

.emblem { position: relative; display: inline-block; flex: none; width: var(--s); height: var(--s); border-radius: 10px; background: radial-gradient(circle, #fffaf0, #f1e3c4); box-shadow: 0 0 0 1px var(--line-hi), 0 6px 14px -8px rgba(150, 90, 10, .7); }
.emblem img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.emblem.none { display: inline-grid; place-items: center; font: 800 calc(var(--s) * .45) var(--serif); color: #fff; background: linear-gradient(135deg, var(--gold-hi), var(--ember)); }
a.list-row, a.row { color: inherit; text-decoration: none; }
.p3-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0; padding: 12px 14px; border-radius: 14px; background: var(--paper-hi); border: 1px solid var(--line); }
.p3-stats dt { color: var(--ink-faint); font-size: 13px; } .p3-stats dd { margin: 0; font-weight: 700; color: var(--gold-deep); }
.p3-stats:empty { display: none; }
