/* Alliance Wars - design tokens and shared UI kit (panels, tabs, modals, toasts, buttons, chips, bars). Portrait-first. */
:root {
  --bg: #121826; --bg2: #1a2233; --card: #222c41; --card2: #2b3752; --line: #3a4867; --ink: #f3ecd9; --ink2: #b9b3a3; --mute: #a9b2c6;
  --gold: #f5c63c; --gold2: #c98f1c; --sapph: #5fb4ff; --red: #e0574d; --green: #4fcf6e; --orange: #f0923a; --purple: #b36bff;
  --parch: #efe2c2; --parch2: #d9c79e; --parch-ink: #3b2a1a;
  --r: 12px; --r2: 18px; --shadow: 0 6px 18px rgba(0,0,0,.45); --pix: 'Nunito', system-ui, sans-serif; --txt: 'Nunito', system-ui, sans-serif;
  /* phones: notch / status bar. In the Android app Capacitor injects --safe-area-inset-* (SystemBars insetsHandling "css"); browsers use env() */
  --safe-t: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px)); --safe-b: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { font-variant-ligatures: none; margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 600 14px/1.3 var(--txt); touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--bg2); border: 2px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; user-select: text; -webkit-user-select: text; }
h1, h2, h3, h4 { font-family: var(--pix); font-weight: 800; margin: 0; letter-spacing: .2px; }
.ic { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: middle; flex: none; }
.ic.hd { image-rendering: auto; }
.ic.lg { width: 32px; height: 32px; } .ic.xl { width: 48px; height: 48px; } .ic.sm { width: 14px; height: 14px; }
.dot { position: absolute; top: 2px; right: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.dot[hidden] { display: none; }
[hidden] { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 12px; background: var(--card2); border: 2px solid #11161f; box-shadow: inset 0 -4px 0 rgba(0,0,0,.28), inset 0 2px 0 rgba(255,255,255,.12); font-family: var(--pix); font-size: 15px; }
.btn:active { transform: translateY(1px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.28); }
.btn.primary { background: linear-gradient(#2e9a43, #1b6a2e); color: #fff; text-shadow: 0 1px 0 #1f5e2b; }
.btn.gold { background: linear-gradient(#ffd75f, #e09a1f); color: #3b2a1a; }
.btn.blue { background: linear-gradient(#2f7fd6, #1d56a6); color: #fff; }
.btn.danger { background: linear-gradient(#c94436, #962a20); color: #fff; }
.btn.small { min-height: 40px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn:disabled, .btn.off { filter: grayscale(.85) brightness(.75); pointer-events: none; }

/* chips, bars */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 4px; border-radius: 999px; background: rgba(0,0,0,.35); font-weight: 800; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chips.big .chip { font-size: 18px; padding: 6px 12px 6px 6px; } .chips.big .ic { width: 32px; height: 32px; }
.bar { display: block; height: 10px; border-radius: 6px; background: rgba(0,0,0,.45); overflow: hidden; border: 1px solid rgba(0,0,0,.5); }
.bar > i { display: block; height: 100%; background: linear-gradient(#ffe27a, #e9a521); border-radius: 6px; }
.bar.green > i { background: linear-gradient(#8af09a, #2f9c45); } .bar.blue > i { background: linear-gradient(#9fd6ff, #2f7fe0); }

/* panels: full-screen sheet with header, optional tab strip, scrolling body */
#panel { position: fixed; inset: 0; z-index: 50; background: rgba(6,8,14,.55); display: flex; }
.pn-sheet { flex: 1; display: flex; flex-direction: column; background: var(--bg); max-width: 560px; margin: 0 auto; width: 100%; padding-top: var(--safe-t); }
.pn-head { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px; background: linear-gradient(#2b3752, #1f2840); border-bottom: 3px solid #0d111a; }
.pn-head h2 { flex: 1; font-size: 20px; text-align: center; margin-right: 40px; }
.pn-back { width: 40px; height: 40px; border-radius: 10px; background: var(--card); display: grid; place-items: center; }
.pn-back .ic { width: 24px; height: 24px; }
.pn-tabs { display: flex; gap: 4px; padding: 6px 8px 0; background: #161d2c; overflow-x: auto; scrollbar-width: none; }
.pn-tabs button { position: relative; flex: 1 0 auto; min-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px 7px; border-radius: 10px 10px 0 0; background: #222b3e; color: var(--ink2); font-size: 12px; font-weight: 800; }
.pn-tabs button.on { background: var(--bg); color: var(--ink); box-shadow: inset 0 3px 0 var(--gold); }
.pn-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px calc(20px + var(--safe-b)); touch-action: pan-y; -webkit-overflow-scrolling: touch; }

/* generic list rows and cards inside panels */
.card { background: var(--card); border-radius: var(--r); padding: 12px; border: 2px solid #11161f; box-shadow: inset 0 2px 0 rgba(255,255,255,.05); }
.card + .card { margin-top: 10px; }
.parch { background: linear-gradient(var(--parch), var(--parch2)); color: var(--parch-ink); border-color: #8b6a3e; }
.row { display: flex; align-items: center; gap: 10px; }
.row.sp { justify-content: space-between; }
.list > * + * { margin-top: 8px; }
.muted { color: var(--mute); } .gold-t { color: var(--gold); } .sapph-t { color: var(--sapph); } .red-t { color: var(--red); } .green-t { color: var(--green); }
.sec-title { font-family: var(--pix); font-size: 16px; margin: 16px 2px 8px; color: var(--ink2); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg { display: flex; background: rgba(0,0,0,.3); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; padding: 7px 4px; border-radius: 8px; font-weight: 800; color: var(--ink2); font-size: 13px; }
.seg button.on { background: var(--card2); color: var(--ink); }
.empty { text-align: center; color: var(--mute); padding: 30px 10px; }

/* modals */
#modals { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.md-wrap { position: absolute; inset: 0; background: rgba(4,6,10,.66); display: grid; place-items: center; padding: 16px; pointer-events: auto; animation: fade .15s; }
.md { width: 100%; max-width: 400px; max-height: 86vh; overflow-y: auto; background: var(--bg2); border: 3px solid #0d111a; border-radius: var(--r2); box-shadow: var(--shadow), inset 0 3px 0 rgba(255,255,255,.06); padding: 16px; touch-action: pan-y; }
.md h3 { text-align: center; font-size: 20px; margin-bottom: 10px; }
.md-body p { margin: 6px 0; color: var(--ink2); text-align: center; }
.md-btns { display: flex; gap: 8px; margin-top: 14px; } .md-btns .btn { flex: 1; }
.md.reward .chips { justify-content: center; padding: 12px 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* toasts */
#toasts { position: fixed; left: 50%; top: calc(118px + var(--safe-t)); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: rgba(20,26,38,.94); border: 2px solid var(--line); border-radius: 12px; padding: 8px 14px; box-shadow: var(--shadow); text-align: center; animation: pop .18s; transition: opacity .4s; }
.toast.err { border-color: var(--red); color: #ffd6d1; } .toast.out { opacity: 0; }

/* banners and portraits */
.banner { display: inline-block; vertical-align: middle; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.avatar { position: relative; display: inline-grid; place-items: center; border-radius: 12px; background: linear-gradient(#3a4a6b, #222c41); border: 3px solid #e9c76a; box-shadow: 0 2px 0 #0d111a; flex: none; overflow: visible; }
.avatar .av { width: 86%; height: 86%; }
/* equipped portrait frame (clan shop / season champion): the PNG sits over the portrait's edge and replaces its gold rim */
.avatar.framed { border-color: transparent; }
.avatar.framed .av-lvl { z-index: 1; }
.avatar .av-frame { position: absolute; inset: -17%; width: 134%; height: 134%; pointer-events: none; image-rendering: pixelated; } /* crest: its opening covers the portrait's rim */
.avatar.fr-champion .av-frame { inset: -22%; width: 144%; height: 144%; }
.avatar.fr-warlord .av-frame { inset: -22%; width: 144%; height: 144%; }
.avatar.fr-banner .av-frame { inset: -22%; width: 144%; height: 144%; }
.av-lvl { position: absolute; bottom: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px; background: linear-gradient(#ffd75f, #e09a1f); color: #3b2a1a; font: 700 12px/18px var(--pix); text-align: center; border: 2px solid #3b2a1a; }

/* ---- premium pass: framed cards, gold-trim headers, bigger tab icons ---- */
.card { background: linear-gradient(175deg, #283450 0%, #1f283d 100%); border: 2px solid #0c1019; box-shadow: inset 0 1px 0 rgba(255,255,255,.09), inset 0 0 0 1px rgba(233,199,106,.07), 0 3px 0 rgba(0,0,0,.32); }
.card.parch, .parch { background: linear-gradient(var(--parch), var(--parch2)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 3px 0 rgba(0,0,0,.35); }
.sec-title { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 18px 2px 10px; color: #f0d68a; text-shadow: 0 2px 0 #0b0f18; letter-spacing: .5px; }
.sec-title::after { content: ''; flex: 1; height: 2px; border-radius: 1px; background: linear-gradient(90deg, rgba(233,199,106,.55), rgba(233,199,106,0)); }
.pn-head { height: 58px; background: linear-gradient(#34425f, #1f2840 70%, #1a2236); border-bottom: 3px solid #0d111a; box-shadow: inset 0 -2px 0 rgba(233,199,106,.55), 0 4px 10px rgba(0,0,0,.35); position: relative; z-index: 1; }
.pn-head h2 { font-size: 22px; color: #ffe7a8; text-shadow: 0 2px 0 #0b0f18, 0 0 12px rgba(245,198,60,.25); }
.pn-back { background: linear-gradient(#3a4a6b, #26314b); border: 2px solid #0c1019; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 0 rgba(0,0,0,.35); }
.pn-tabs { padding: 8px 8px 0; background: linear-gradient(#141b29, #182031); border-bottom: 2px solid #0d111a; }
.pn-tabs button { gap: 3px; padding: 7px 6px 8px; background: linear-gradient(#26304a, #1e2638); border: 2px solid #0d111a; border-bottom: 0; }
.pn-tabs button .ic { width: 28px; height: 28px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.45)); opacity: .8; }
.pn-tabs button.on { background: linear-gradient(#2f3b58, var(--bg)); color: #ffe7a8; box-shadow: inset 0 3px 0 var(--gold); }
.pn-tabs button.on .ic { opacity: 1; }
.pn-body { background: radial-gradient(120% 60% at 50% 0%, #1b2438 0%, var(--bg) 70%); }
.chip .ic { width: 22px; height: 22px; }
.chip { background: rgba(0,0,0,.38); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.chips.big .ic { width: 44px; height: 44px; } .chips.big .chip { padding: 6px 14px 6px 6px; }
.md { border-color: #0d111a; background: linear-gradient(175deg, #243049, #182033); box-shadow: var(--shadow), inset 0 0 0 2px rgba(233,199,106,.35), inset 0 3px 0 rgba(255,255,255,.06); }
.md h3 { color: #ffe7a8; text-shadow: 0 2px 0 #0b0f18; font-size: 22px; }
.md.reward h3 { font-size: 26px; color: var(--gold); }
.seg { box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.seg button.on { background: linear-gradient(#3a4a6b, #2b3752); color: #ffe7a8; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 0 rgba(0,0,0,.4); }
.btn { text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn.gold { text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.empty { padding: 34px 14px; border-radius: var(--r); border: 2px dashed #2f3b56; background: rgba(0,0,0,.15); font-weight: 700; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; padding: 0; margin: 0; flex: none; accent-color: var(--gold); vertical-align: middle; }

/* ---- accessibility: keyboard focus, reduced motion ---- */
:focus { outline: none; }
:focus-visible { outline: 3px solid #ffd34d; outline-offset: 2px; border-radius: 10px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 0; border-color: #ffd34d; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
.parch .btn:not(.primary):not(.gold):not(.blue):not(.danger) { color: var(--ink); }

/* no copying: long-press, right-click, drag and text selection are off everywhere except where you type
   (levi 2026-11-25). Images cannot be dragged out or saved through the long-press menu (main.js blocks the menu). */
html, body { -webkit-touch-callout: none; }
img, canvas, svg { -webkit-touch-callout: none; -webkit-user-drag: none; user-drag: none; -webkit-user-select: none; user-select: none; }
.cv-txt, .so-msg-txt { user-select: none; -webkit-user-select: none; }
input, textarea, [contenteditable="true"] { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
/* phone status bar (clock, signal, battery): a solid strip so the map never shows behind it. Its height is the
   safe-area inset, so it is 0 in a desktop browser and only appears where the system bar sits over the game. */
body::before { content: ''; position: fixed; left: 0; right: 0; top: 0; height: var(--safe-t); background: #0b0f18; z-index: 9999; pointer-events: none; }
/* and the same under the phone's navigation bar (back / home buttons) */
body::after { content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: var(--safe-b); background: #0b0f18; z-index: 9999; pointer-events: none; }

/* staff rank: the GM's name in orange with a dark red glow, wherever a lord name is shown */
.gm-name { color: #ff9a1f !important; text-shadow: 0 0 6px rgba(150,12,12,.95), 0 0 12px rgba(120,0,0,.8), 0 1px 0 #3a0a00; font-weight: 800; }
a.btn { color: inherit; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; } /* link buttons (Settings: terms, privacy, support) look like buttons */
/* big reward tiles (ui.js rewardTiles) and the item details popup (showItem) */
.rw-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; width: 100%; }
.rw-tile { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-height: 64px; padding: 4px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.08), rgba(0,0,0,.35)); border: 2px solid #11161f; box-shadow: inset 0 2px 0 rgba(255,255,255,.06); cursor: pointer; }
.rw-tile .ic { width: 88%; height: 88%; max-width: 96px; max-height: 96px; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(0,0,0,.45)); }
.rw-tile b { position: absolute; right: 4px; bottom: 2px; font-size: 14px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 #000, 0 0 4px #000; }
.rw-tile:active { transform: scale(.96); }
.chip[data-rw] { cursor: pointer; }
.md.item-info .md-body, .md.item-info { text-align: center; }
.ii-art { display: grid; place-items: center; margin: 6px auto 4px; width: 140px; height: 140px; border-radius: 20px; background: radial-gradient(circle, rgba(245,198,60,.22), rgba(0,0,0,.3) 70%); border: 2px solid var(--gold2); }
.ii-art .ic { width: 120px; height: 120px; }
.ii-n { font-size: 22px; font-weight: 800; color: var(--gold); }
.ii-desc { margin: 8px 0 4px; line-height: 1.4; }

/* ---- Phase 1: forged iron, gilded leather and painted paper ----
   Small nine-slice WebP assets keep corners crisp at every card aspect ratio. */
:root {
  --ui-frame: url('../assets/ui/frame-steel.webp');
  --ui-body: url('../assets/ui/body.webp');
  --ui-title: url('../assets/ui/title.webp');
  --ui-rim: #99764c; --ui-light: #f7d994;
}
#panel { background: #08090ce6; }
.pn-sheet { position: relative; isolation: isolate; background: radial-gradient(ellipse at 50% 0, #68503c38, transparent 62%), var(--ui-body) center/400px, #17191e; animation: panel-arrive .22s cubic-bezier(.2,.8,.2,1); }
.pn-sheet::after { content: ''; position: absolute; z-index: 5; inset: 0; border: 9px solid transparent; border-image: var(--ui-frame) 14% / 9px stretch; pointer-events: none; }
.pn-head { position: relative; flex-shrink: 0; min-height: 70px; height: auto; padding: 10px 16px; background: linear-gradient(#18191ee6, #0e0f13b3); border-bottom: 1px solid #88643c; gap: 8px; }
.pn-head h2 { min-width: 0; margin: 0; padding: 14px 24px; background: var(--ui-title) center/100% 100% no-repeat; color: #ffe6ad; font-size: 20px; line-height: 1.2; text-shadow: 0 2px 2px #000; }
.pn-head .pn-extra { flex: 0 0 auto; }
.pn-head .pn-extra:empty { width: 40px; }
.pn-back { flex: 0 0 40px; border: 1px solid #b08a51; border-radius: 50%; background: radial-gradient(circle at 35% 20%, #52606a, #20262b 65%); box-shadow: inset 0 0 0 3px #101419, 0 3px 5px #0008; transition: transform .12s; }
.pn-back:active { transform: translateY(2px) scale(.95); }
.pn-tabs { flex-shrink: 0; flex-wrap: wrap; gap: 4px; padding: 8px 16px 0; background: #101116b3; overflow: visible; border-bottom: 1px solid #7e603b; }
.pn-tabs button { flex: 1 1 0; min-width: 0; padding: 9px 2px 8px; border: 1px solid #61503b; border-bottom: 0; border-radius: 9px 9px 0 0; background: linear-gradient(#44454a, #23252c 45%, #17191f); color: #c7c0b3; box-shadow: inset 0 1px #c0b49d38, inset 0 0 0 3px #10111666; font-size: 11px; transition: transform .12s, color .12s; overflow-wrap: anywhere; }
.pn-tabs button.on { color: #ffe2a3; border-color: #ddad58; background: radial-gradient(ellipse at 50% 0, #b181394f, transparent 80%), linear-gradient(#4c4540, #29272b); box-shadow: inset 0 2px #ffdda0, inset 0 0 10px #e4b65c26; }
.pn-tabs button:active { transform: translateY(2px); }
.pn-tabs .ic { width: 28px; height: 28px; filter: drop-shadow(0 2px 2px #0008); }
.pn-body { padding: 16px 16px calc(24px + var(--safe-b)); background: radial-gradient(ellipse at 50% 0, #ae804a0d, #080a0e44 85%); scrollbar-width: thin; scrollbar-color: #8d7047 #14161a; }
#panel.closing { pointer-events: none; }
#panel.closing .pn-sheet { animation: panel-leave .17s ease-in forwards; }
@keyframes panel-arrive { from { opacity: 0; transform: translateY(18px); } }
@keyframes panel-leave { to { opacity: 0; transform: translateY(18px); } }

.card, .md { border: 8px solid transparent; border-image: var(--ui-frame) 14% fill / 8px stretch; border-radius: 10px; background: linear-gradient(#37333438, #10111655), var(--ui-body) center/360px, #202126; box-shadow: 0 5px 12px #0005; }
.card { padding: 10px; min-width: 0; }
.card[data-material="parchment"], .card.parch { border-image-source: url('../assets/ui/card-parchment.webp'); border-image-slice: 12% fill; background: #e8d2a2; color: #38291d; }
.card[data-material="royal"], .card.royal { border-image-source: url('../assets/ui/card-royal.webp'); border-image-slice: 12% fill; background: #322437; }
.card[data-material="event"], .card.event-gold { border-image-source: url('../assets/ui/card-event.webp'); border-image-slice: 12% fill; background: #342a1d; }
.card.parch .muted { color: #67513a; }
.card .row > :is(span, div), .md .row > :is(span, div) { min-width: 0; }
.card .row > :is(span, div):has(+ .btn) { flex: 1; }
.card .row > .btn { flex: 0 1 auto; }
.card .btn, .md .btn { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.btn { position: relative; isolation: isolate; min-width: 0; border: 1px solid #91a2b5; border-bottom: 3px solid #111923; border-radius: 9px; background: linear-gradient(#496a89, #27425b 46%, #20354c 52%, #36516a); box-shadow: inset 0 1px #ffffff65, inset 0 0 0 3px #09111c55, 0 3px 5px #0005; padding: 9px 14px; font-weight: 800; color: #f3efe5; text-shadow: 0 1px 2px #0009; transition: transform .1s; }
.btn.primary { border-color: #96b35f; border-bottom-color: #142514; background: linear-gradient(#638c3d, #365c27 46%, #28491e 52%, #42672b); }
.btn.gold { border-color: #ffe0a1; border-bottom-color: #56330d; background: linear-gradient(#f7d48a, #d49a42 46%, #b97d29 52%, #e3ad55); color: #34200e; text-shadow: 0 1px #ffe7aa8c; }
.btn.blue { border-color: #7eaccc; border-bottom-color: #122535; background: linear-gradient(#4f87af, #2c597d 46%, #234868 52%, #3a6c92); }
.btn.danger { border-color: #df9679; border-bottom-color: #3c1614; background: linear-gradient(#a85243, #7c302b 46%, #652622 52%, #913e32); }
.btn:active:not(:disabled):not(.off) { transform: translateY(2px) scale(.98); box-shadow: inset 0 2px 5px #0006; }
.btn:disabled, .btn.off { opacity: .62; filter: saturate(.25); box-shadow: inset 0 1px #ffffff22; }
.btn::after { border-radius: inherit; pointer-events: none; }
.btn.aw-main { overflow: hidden; }
.btn.aw-main::after { content: ''; position: absolute; inset: 1px; background: linear-gradient(110deg, transparent 20%, #fff6 45%, transparent 70%); opacity: 0; transform: scaleX(.25) translateX(-200%); animation: button-shine 6s ease-in-out infinite paused; }
.btn.claimable::before { content: ''; position: absolute; inset: -2px; border: 1px solid #ffe1a1; border-radius: inherit; opacity: 0; pointer-events: none; animation: claim-pulse 2.8s ease-in-out infinite paused; }
.btn.in-view::before, .btn.in-view::after { animation-play-state: running; }
@keyframes button-shine { 0%, 68% { opacity: 0; transform: scaleX(.25) translateX(-200%); } 72% { opacity: .6; } 88%, 100% { opacity: 0; transform: scaleX(.25) translateX(200%); } }
@keyframes claim-pulse { 0%, 100% { opacity: .1; } 50% { opacity: .8; } }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #ffe2a3; outline-offset: 3px; }
.sec-title { display: flex; align-items: center; gap: 10px; color: #d9c59e; letter-spacing: .02em; }
.sec-title::before { content: ''; flex: 0 0 6px; width: 6px; height: 6px; transform: rotate(45deg); background: #c5a165; border: 1px solid #ffe3a3; }
.sec-title::after { content: ''; flex: 1; height: 5px; min-width: 14px; background: linear-gradient(90deg, #a08149, transparent) center/100% 1px no-repeat; border-left: 3px double #bd9a5c; }
details > summary { padding: 10px 4px; border-top: 1px solid #9c7a484f; border-bottom: 1px solid #9c7a482e; color: #e1c896; cursor: pointer; }

/* Shared rarity frame. Existing Uncommon items retain their green tier. */
[data-rarity="common"] { --rarity: #b8bec4; --rarity-dark: #34393f; }
[data-rarity="uncommon"] { --rarity: #84c578; --rarity-dark: #263b2a; }
[data-rarity="rare"] { --rarity: #75b8ee; --rarity-dark: #20364c; }
[data-rarity="epic"] { --rarity: #c092ee; --rarity-dark: #3a2852; }
[data-rarity="legendary"] { --rarity: #efbf60; --rarity-dark: #4a331d; }
[data-rarity="mythic"] { --rarity: #fa8198; --rarity-dark: #4d2335; }
.rarity-surface { position: relative; isolation: isolate; border: 2px solid var(--rarity, #9fa7b4); background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--rarity, #9fa7b4) 33%, transparent), transparent 72%), linear-gradient(145deg, var(--rarity-dark, #34393f), #101419); box-shadow: inset 0 0 0 2px #0b0d12, inset 0 0 0 3px color-mix(in srgb, var(--rarity, #9fa7b4) 45%, transparent), 0 2px 5px #0006; }
.rarity-gem { position: absolute; z-index: 2; top: 4px; right: 4px; width: 7px; height: 7px; transform: rotate(45deg); background: linear-gradient(135deg, #fff, var(--rarity) 45%, var(--rarity-dark)); border: 1px solid #20181e; box-shadow: 0 0 4px var(--rarity); pointer-events: none; }
.rarity-sheen { position: absolute; inset: 2px; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 1; }
.rarity-sheen::before { content: ''; position: absolute; inset: 0; background: linear-gradient(125deg, transparent 20%, #fff5 48%, transparent 70%); opacity: 0; transform: scaleX(.35) translateX(-180%); animation: rarity-shimmer 5.5s ease-in-out infinite paused; }
.rarity-surface.in-view > .rarity-sheen::before { animation-play-state: running; }
@keyframes rarity-shimmer { 0%, 55% { opacity: 0; transform: scaleX(.35) translateX(-180%); } 65% { opacity: .65; } 85%, 100% { opacity: 0; transform: scaleX(.35) translateX(180%); } }
.rw-tiles { grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 8px; }
.rw-tile { min-width: 0; padding: 0; border-radius: 10px; }
.rw-tile .ic { width: 88%; height: 88%; max-width: none; max-height: none; }
.rw-tile b { right: 5px; bottom: 3px; z-index: 2; }
#panel .it-tile:not(.empty) .ic.lg { width: 85%; height: 85%; }
#panel .cz-skin.rarity-surface, #panel .hc.rarity-surface { border-color: var(--rarity); }
.rarity-surface .it-eq { z-index: 3; }

.empty[data-empty-art], .cv-empty[data-empty-art] { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 12px 20px; border: 0; border-radius: 10px; background: radial-gradient(ellipse at 50% 45%, #b0833c14, transparent 72%); color: #c8bda9; min-height: 0; }
.empty-vignette { display: block; width: min(240px, 100%); height: auto; aspect-ratio: 3/2; object-fit: contain; flex: none; filter: drop-shadow(0 5px 6px #0005); }
.empty-copy { max-width: 280px; font-size: 13px; line-height: 1.55; }
.empty-copy > .ic, .empty-copy > .ic.xl { display: none; }
.empty-copy p { margin: 4px 0; }
.th-hero:has(.th-empty-vignette) > .row:first-child { flex-direction: column; text-align: center; }
.th-hero .th-empty-vignette { width: min(240px, 100%); height: auto; border: 0; background: none; }
.th-empty-vignette img { display: block; width: 100%; height: auto; object-fit: contain; }

.md { position: relative; padding: 16px; max-height: min(86dvh, 760px); animation: item-arrive .24s cubic-bezier(.2,.8,.2,1); }
.md h3 { color: #f6d99c; padding: 10px 16px; background: var(--ui-title) center/100% 100% no-repeat; }
.md-btns .btn { flex: 1 1 0; }
.md.item-info { overflow-x: hidden; }
.ii-stage { display: grid; place-items: center; padding: 14px; background: radial-gradient(ellipse, #d9a95530, transparent 70%); }
.ii-art { width: 170px; height: 170px; margin: 0; border-radius: 20px; transform: rotate(-3deg); }
.ii-art .ic { width: 85%; height: 85%; transform: rotate(3deg); filter: drop-shadow(0 6px 5px #0008); }
.ii-rarity { color: var(--rarity); text-transform: uppercase; font-size: 11px; letter-spacing: .14em; margin: 2px 0 8px; }
.ii-n { color: #ffe1a1; font-size: 26px; }
.ii-desc { padding: 8px 10px; }
.ii-owned { margin: 14px 0 4px; padding: 10px; border-top: 1px solid #bc985e55; color: #bcb3a2; }
.ii-owned b { color: #f4dfb1; }
.md.reward { overflow-x: hidden; text-align: center; }
.reward-source { position: relative; z-index: 1; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.reward-burst { position: absolute; inset: 60px 10px 30px; pointer-events: none; background: repeating-conic-gradient(from 10deg, transparent 0 15deg, #edb44e20 15deg 22deg, transparent 22deg 40deg); mask-image: radial-gradient(ellipse, #000, transparent 70%); animation: reward-glow .65s ease-out; }
.celebration-tiles { position: relative; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); padding: 20px 0 12px; }
.celebration-tiles .rw-tile { animation: reward-arrive .45s cubic-bezier(.2,.9,.3,1.2) both; }
.reward-flight { position: fixed; z-index: 100; width: 36px; height: 36px; object-fit: contain; pointer-events: none; }
.reward-wallet { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(380px, calc(100% - 32px)); z-index: 99; display: flex; gap: 8px; padding: 7px; border: 1px solid #b79861; border-radius: 10px; background: #17191ef5; pointer-events: none; animation: wallet-pass 1.5s both; }
.reward-wallet-counter { display: flex; flex: 1; min-width: 0; align-items: center; justify-content: center; gap: 5px; color: #ffe0a3; font-size: 13px; }
.reward-wallet-counter .ic { width: 24px; height: 24px; }
.reward-wallet-counter .plus { display: none; }
@keyframes wallet-pass { 0% { opacity: 0; } 10%, 80% { opacity: 1; } 100% { opacity: 0; } }
.md.levelup .lu { position: relative; padding: 24px 0 8px; background: radial-gradient(ellipse at 50% 30%, #f9ce6d50, transparent 65%); }
.md.levelup .avatar { animation: level-burst .65s cubic-bezier(.2,.8,.2,1); }
.md.levelup .lu::before { content: ''; position: absolute; width: 180px; height: 180px; top: -5px; left: calc(50% - 90px); border: 2px solid #f7d98a; border-radius: 50%; animation: level-ring .8s ease-out both; pointer-events: none; }
@keyframes item-arrive { from { opacity: 0; transform: translateY(12px) scale(.94); } }
@keyframes reward-arrive { from { opacity: 0; transform: translateY(22px) scale(.55); } }
@keyframes reward-glow { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes level-burst { from { opacity: 0; transform: scale(.7); } }
@keyframes level-ring { from { opacity: .9; transform: scale(.4); } to { opacity: 0; transform: scale(1.5); } }
@media (max-width: 375px) {
  .pn-head h2 { font-size: 18px; padding-inline: 18px; }
  .pn-tabs { gap: 3px; }
  .pn-tabs button { font-size: 10px; }
  .card { padding: 8px; border-width: 7px; }
  .btn { padding-inline: 10px; font-size: 14px; }
  .md { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #panel *, #modals *, .reward-flight { animation: none !important; transition: none !important; }
  .btn.aw-main::after, .btn.claimable::before, .rarity-sheen, .levelup .lu::before { display: none !important; }
}
