:root {
  --bg: #0e1116; --panel: #151a22; --raised: #1c232d; --line: #29323f; --text: #e8edf4; --muted: #8794a6;
  --ct: #6f93d6; --t: #e3a63b; --ok: #58b36b; --danger: #e5604f; --warn: #e3a63b;
  --shadow: 0 12px 34px rgba(0, 0, 0, .38);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --head: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef1f5; --panel: #ffffff; --raised: #f3f5f9; --line: #d6dce6; --text: #16202c; --muted: #5d6a7c;
  --ct: #3f68b8; --t: #b87a10; --ok: #2f8a45; --danger: #c8412f; --warn: #b87a10;
  --shadow: 0 10px 26px rgba(20, 30, 50, .12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
body.noscroll { overflow: hidden; }
h1, h2, h3 { font-family: var(--head); font-weight: 650; letter-spacing: .01em; margin: 0 0 .3em; line-height: 1.15; }
h1 { font-size: clamp(26px, 4vw, 38px); }
h2 { font-size: clamp(20px, 3vw, 26px); margin-top: 1.4em; }
h3 { font-size: 17px; }
a { color: var(--ct); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; -webkit-user-drag: none; user-select: none; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ct); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
[hidden] { display: none !important; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); cursor: pointer; font-weight: 600; transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; color: var(--text); }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--t); border-color: var(--t); color: #1b1305; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn.big { min-height: 48px; padding: 10px 24px; font-size: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--ct); cursor: pointer; font-family: ui-monospace, Menlo, Consolas, monospace; }
input, select { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-height: 40px; width: 100%; }
input[type="checkbox"] { width: 18px; min-height: 0; height: 18px; accent-color: var(--t); }
select { width: auto; max-width: 100%; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.inwrap { display: flex; align-items: center; gap: 8px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding-left: 10px; color: var(--t); }
.inwrap input { border: 0; background: transparent; color: var(--text); }
.x { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; z-index: 3; }
.x:hover { color: var(--text); background: var(--raised); }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px clamp(12px, 3vw, 32px); padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 20px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; color: var(--t); }
.mainnav { display: flex; gap: 4px; margin-left: 12px; }
.mainnav a { position: relative; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.mainnav a:hover { color: var(--text); text-decoration: none; background: var(--raised); }
.mainnav a.on { color: var(--text); background: var(--raised); box-shadow: inset 0 -2px 0 var(--t); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.chip:hover { text-decoration: none; border-color: var(--muted); }
.chip.keys .ic { color: var(--t); }
.chip.coins .ic { color: var(--ct); }
.chip.sm { padding: 2px 9px; font-size: 13px; }
.ic { width: 18px; height: 18px; flex: none; }
.money { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.money .ic { width: 15px; height: 15px; color: var(--ct); }
.money b { font-weight: 600; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.usermenu { position: relative; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--raised); font-weight: 700; cursor: pointer; }
.menu { display: none; position: absolute; right: 0; top: 46px; min-width: 230px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.usermenu.open .menu { display: block; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--raised); text-decoration: none; }
.mu-name { padding: 6px 10px 8px; font-weight: 700; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.mu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; color: var(--muted); }
main#view { max-width: 1240px; margin: 0 auto; padding: 24px clamp(12px, 3vw, 32px) 56px; min-height: 70vh; }
.foot { max-width: 1240px; margin: 0 auto; padding: 18px clamp(12px, 3vw, 32px) 28px; display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.foot a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.foot a:hover { color: var(--text); text-decoration: none; }
.tabbar { display: none; }
.loading, .empty { padding: 48px 12px; text-align: center; color: var(--muted); }
.empty.small { padding: 18px 8px; grid-column: 1 / -1; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.hero.slim { margin-bottom: 16px; }
.hero p { margin: 0; }
.statbox { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; font-size: 20px; }
.statbox .muted { font-size: 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); font-weight: 600; }
.back::before { content: ""; width: 8px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.panel.narrow, .narrow { max-width: 520px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar input[type="search"] { flex: 1 1 220px; max-width: 360px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.fchip.on { color: var(--text); border-color: var(--c, var(--t)); box-shadow: inset 0 0 0 1px var(--c, var(--t)); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs.scroll { overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 16px; border: 0; background: none; color: var(--muted); font-weight: 650; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--text); border-color: var(--t); }

/* ---------- grids + cards ---------- */
.grid { display: grid; gap: 14px; }
.grid.crates { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid.items { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.grid.items.small { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grid.shop { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.ccard { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--text); transition: transform .15s, border-color .15s; }
.ccard:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--ct); }
.ccard.gold { border-color: color-mix(in srgb, #e4ae39 60%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, #e4ae39 10%, var(--panel)), var(--panel)); }
.cc-art { display: grid; place-items: center; aspect-ratio: 1 / .86; background: radial-gradient(70% 60% at 50% 55%, color-mix(in srgb, var(--t) 14%, transparent), transparent 70%); }
.cc-art img { width: 78%; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .45)); transition: transform .25s; }
.ccard:hover .cc-art img { transform: scale(1.06) rotate(-2deg); }
.cc-name { font-family: var(--head); font-weight: 650; font-size: 16px; line-height: 1.2; min-height: 2.4em; }
.cc-foot { display: flex; justify-content: space-between; align-items: center; }

.icard { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 10px 10px; text-align: left; cursor: pointer; border-radius: 12px; border: 1px solid var(--line); border-bottom: 3px solid var(--c); background: radial-gradient(110% 70% at 50% 28%, color-mix(in srgb, var(--c) 20%, transparent), transparent 72%), var(--panel); transition: transform .12s, box-shadow .12s; }
.icard:hover { transform: translateY(-2px); box-shadow: 0 8px 22px color-mix(in srgb, var(--c) 28%, transparent); }
.icard img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .4)); }
.ic-top { display: flex; gap: 4px; min-height: 18px; }
.pill { padding: 0 7px; border-radius: 6px; background: var(--raised); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 18px; }
.pill.st { color: #ff9a3c; }
.pill.lst { color: var(--ct); }
.ic-w { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-f { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-bot { margin-top: 4px; font-size: 13px; }
.tile { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); border-bottom: 3px solid var(--c); background: radial-gradient(110% 70% at 50% 28%, color-mix(in srgb, var(--c) 16%, transparent), transparent 72%), var(--panel); }
.tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.tile-p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tier { margin: 18px 0 8px; }
.tier h3 { display: flex; align-items: center; gap: 10px; }
.tier h3 i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); box-shadow: 0 0 12px var(--c); }
.tier h3 .muted { font-family: var(--font); font-weight: 400; font-size: 13px; }

.daily { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.daily.ready { border-color: var(--t); box-shadow: 0 0 0 1px var(--t) inset; }
.daily img { width: 52px; height: 52px; object-fit: contain; }
.dl-text { display: flex; flex-direction: column; font-size: 13px; }
.dl-text b { font-size: 15px; }
.drops h3 { font-size: 14px; color: var(--muted); font-weight: 600; }
.dropstrip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 18px; scrollbar-width: thin; }
.drop { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c); font-size: 13px; max-width: 280px; }
.drop img { width: 52px; height: 40px; object-fit: contain; }
.drop div { display: flex; flex-direction: column; min-width: 0; }
.drop b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.drop span { color: var(--muted); font-size: 12px; }

.case-head { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 28px; align-items: center; padding: 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.case-head.gold { border-color: color-mix(in srgb, #e4ae39 60%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, #e4ae39 12%, var(--panel)), var(--panel) 60%); }
.case-art { display: grid; place-items: center; background: radial-gradient(60% 55% at 50% 55%, color-mix(in srgb, var(--t) 22%, transparent), transparent 72%); }
.case-art img { width: 82%; max-height: 300px; object-fit: contain; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .5)); }
.case-info { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.keyline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.case-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- inspect modal ---------- */
#modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.m-back { position: absolute; inset: 0; background: rgba(5, 8, 12, .72); backdrop-filter: blur(4px); }
.m-box { position: relative; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.m-box.wide { width: min(860px, 100%); }
.m-pad { padding: 22px; }
.m-pad > .row { margin-top: 18px; }
.adm-modal hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.adm-modal form.row { margin-top: 12px; }
.inspect { display: grid; grid-template-columns: 1fr 1fr; background: radial-gradient(90% 80% at 25% 30%, color-mix(in srgb, var(--c) 24%, transparent), transparent 70%); }
.in-art, .rv-art, .mi-art { display: grid; place-items: center; padding: 28px; perspective: 700px; }
.tilt img { width: 100%; max-height: 300px; object-fit: contain; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .12s ease-out; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .55)); }
.in-body { padding: 28px 28px 24px 8px; display: flex; flex-direction: column; gap: 6px; }
.in-tier { color: var(--c); font-weight: 700; font-size: 13px; }
.in-body h2, .rv-info h2 { margin: 0; font-size: 26px; }
.in-finish { font-family: var(--head); font-size: 20px; color: var(--c); }
.fbar { position: relative; display: flex; height: 8px; margin: 14px 0 8px; border-radius: 4px; overflow: visible; }
.fbar span:nth-child(1) { background: #3fa86b; border-radius: 4px 0 0 4px; }
.fbar span:nth-child(2) { background: #7fbf4e; }
.fbar span:nth-child(3) { background: #d6b83c; }
.fbar span:nth-child(4) { background: #d98336; }
.fbar span:nth-child(5) { background: #c9503f; border-radius: 0 4px 4px 0; }
.fbar i { position: absolute; top: -5px; width: 3px; height: 18px; margin-left: -1px; background: var(--text); border-radius: 2px; box-shadow: 0 0 0 2px var(--panel); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 8px 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.listform { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.listform p { margin: 0; }

/* ---------- opening ---------- */
#modal.open-modal { padding: 0; }
.open-modal .m-back { background: rgba(4, 6, 9, .96); }
.open-modal .m-box { width: 100%; max-width: none; height: 100%; max-height: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; display: flex; }
.open-wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 18px clamp(10px, 3vw, 28px); display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.open-top { display: flex; align-items: center; gap: 14px; }
.open-top .mini { width: 64px; height: 56px; object-fit: contain; }
.ot { flex: 1; }
.ot-title { font-family: var(--head); font-size: 22px; font-weight: 650; color: #fff; }
.ot-sub { color: var(--muted); }
.open-modal .btn.ghost { color: #cfd7e3; border-color: #3a4556; }
.strip-view { position: relative; overflow: hidden; height: 214px; border-radius: 12px; border: 1px solid #263040; background: linear-gradient(180deg, #0d1117, #121821); }
.strip-view::before, .strip-view::after { content: ""; position: absolute; top: 0; bottom: 0; width: 16%; z-index: 2; pointer-events: none; }
.strip-view::before { left: 0; background: linear-gradient(90deg, #0a0d12, transparent); }
.strip-view::after { right: 0; background: linear-gradient(-90deg, #0a0d12, transparent); }
.marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; z-index: 3; background: var(--t); box-shadow: 0 0 14px var(--t); }
.marker::before, .marker::after { content: ""; position: absolute; left: -7px; border: 8px solid transparent; }
.marker::before { top: 0; border-top-color: var(--t); }
.marker::after { bottom: 0; border-bottom-color: var(--t); }
.strip { position: relative; display: flex; gap: 8px; padding: 12px 8px; height: 100%; will-change: transform; }
.rcard { flex: 0 0 152px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 8px 8px 10px; border-radius: 8px; color: #dfe6f0; text-align: center; background: radial-gradient(100% 70% at 50% 35%, color-mix(in srgb, var(--c) 30%, transparent), transparent 75%), #171d27; border-bottom: 4px solid var(--c); overflow: hidden; }
.rcard img { width: 100%; height: 108px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5)); }
.rcard .rw { font-size: 12px; color: #9aa6b6; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.rcard .rf { font-size: 13px; font-weight: 650; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; min-height: 1.3em; }
.rcard.gold { --c: #e4ae39; justify-content: center; gap: 8px; background: radial-gradient(100% 80% at 50% 40%, rgba(228, 174, 57, .32), transparent 75%), #1b1810; }
.rcard.gold .knife { width: 74px; height: 74px; filter: drop-shadow(0 0 14px rgba(228, 174, 57, .6)); }
.rcard.gold .rw { color: #e4ae39; font-weight: 650; font-size: 13px; white-space: normal; }
.rcard.win { box-shadow: 0 0 0 2px var(--c), 0 0 46px var(--c); }
.rcard.flip { animation: flip .7s ease-out; justify-content: flex-end; }
@keyframes flip { 0% { transform: rotateY(90deg) scale(.9); } 100% { transform: none; } }
.reveal { animation: rise .5s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rv { display: grid; grid-template-columns: minmax(200px, 360px) 1fr; align-items: center; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--c) 55%, #263040); background: radial-gradient(80% 90% at 20% 40%, color-mix(in srgb, var(--c) 28%, transparent), transparent 70%), #10151d; color: #e8edf4; }
.rv-info { padding: 22px 26px 22px 6px; display: flex; flex-direction: column; gap: 4px; }
.rv-meta, .rv-val { margin: 2px 0; color: #aab5c5; }
.rv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.open-modal .rv .btn:not(.primary) { background: #1c2430; color: #e8edf4; border-color: #3a4556; }

/* ---------- market ---------- */
.mlist { display: flex; flex-direction: column; gap: 6px; }
.mrow { display: grid; grid-template-columns: 56px minmax(0, 1fr) 80px 90px 120px 120px; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c, var(--line)); color: var(--text); }
a.mrow:hover { text-decoration: none; border-color: var(--ct); border-left-color: var(--c); }
.mrow.mine { grid-template-columns: 56px minmax(0, 1fr) 120px 120px auto; }
.mrow.head { background: none; border: 0; color: var(--muted); font-size: 12px; padding-top: 0; padding-bottom: 0; }
.mrow img { width: 56px; height: 42px; object-fit: contain; }
.m-name { display: flex; flex-direction: column; min-width: 0; }
.m-name b, .m-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-name span { font-size: 12px; color: var(--muted); }
.m-c { text-align: right; font-variant-numeric: tabular-nums; }
.mi-head { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; padding-right: 12px; border-radius: 16px; background: radial-gradient(80% 100% at 15% 50%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%), var(--panel); border: 1px solid var(--line); }
.mi-art { width: 220px; flex: none; padding: 16px; }
.mi-art img { width: 100%; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .5)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stats > div { display: flex; flex-direction: column; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; font-size: 18px; }
.stats span { font-size: 12px; color: var(--muted); }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .gl { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .gt { fill: var(--muted); font-size: 11px; }
.chart .ln { fill: none; stroke: var(--ct); stroke-width: 2.2; stroke-linejoin: round; }
.chart .ar { fill: var(--ct); opacity: .12; }
.chart .cur line { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .cur circle { fill: var(--t); }
.tip { position: absolute; top: 0; transform: translateX(-50%); padding: 4px 10px; border-radius: 6px; background: var(--raised); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; pointer-events: none; }
.ltable { display: flex; flex-direction: column; }
.lrow { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lt-item { background: none; border: 0; text-align: left; color: var(--ct); cursor: pointer; padding: 0; }

/* ---------- trades ---------- */
.trow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.trow:first-of-type { border-top: 0; }
.trow a:first-child { display: flex; flex-direction: column; color: var(--text); }
.newtrade .row input { max-width: 320px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); }
.banner.ok { border-color: var(--ok); }
.tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.tcol { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-height: 200px; }
.tcol.ready { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.tcol header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tcol .rdy { color: var(--muted); font-size: 13px; }
.tcol.ready .rdy { color: var(--ok); font-weight: 650; }
.tcol .grid { flex: 1; align-content: start; }

/* ---------- shop ---------- */
.shop-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 16px; align-items: stretch; }
.shop-top .panel { margin: 0; }
.scard { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.scard.gold { border-color: color-mix(in srgb, #e4ae39 60%, var(--line)); }
.sc-art { display: grid; place-items: center; height: 130px; }
.sc-art img { max-height: 120px; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .45)); }
.sc-name { font-family: var(--head); font-weight: 650; min-height: 2.4em; line-height: 1.2; }
.sc-meta { display: flex; justify-content: space-between; align-items: center; }
.sc-buy { display: flex; gap: 6px; }
.sc-buy .btn { flex: 1; padding-inline: 6px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--ct) 14%, transparent), transparent 70%); }
.auth-card { position: relative; width: min(420px, 100%); padding: 28px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card p { margin: 0; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 22px; color: var(--t); }
.auth-brand svg { width: 34px; height: 34px; }
.auth-lang { align-self: center; }
.errbox { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line); color: var(--danger); white-space: pre-wrap; word-break: break-word; font-size: 13px; }

/* ---------- tables + admin ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl thead th { border-top: 0; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tbl tr.dim { opacity: .55; }
.narrow-in { width: 110px; }
.thumb { width: 52px; height: 40px; object-fit: contain; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-bottom: 14px; }
.formgrid label.check.big { align-self: end; min-height: 40px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow); max-width: min(380px, 92vw); animation: rise .25s ease-out; transition: opacity .35s; }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }
.toast.warn { border-color: var(--warn); }
.toast.out { opacity: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .mainnav { display: none; }
  .tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.on { color: var(--t); }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .badge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; }
  main#view { padding-bottom: 96px; }
  .foot { padding-bottom: 90px; }
  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); right: 10px; left: 10px; align-items: stretch; }
  .case-head { grid-template-columns: 1fr; text-align: center; }
  .case-info { align-items: center; }
  .keyline, .case-actions { justify-content: center; }
}
@media (max-width: 720px) {
  .inspect, .rv { grid-template-columns: 1fr; }
  .in-body, .rv-info { padding: 0 20px 22px; }
  .in-art, .rv-art { padding: 22px 22px 8px; }
  .in-art img, .rv-art img { max-height: 200px; }
  .tgrid { grid-template-columns: 1fr; }
  .mrow { grid-template-columns: 48px minmax(0, 1fr) 54px 96px; gap: 8px; padding: 8px 10px; }
  .mrow.mine { grid-template-columns: 48px minmax(0, 1fr) 96px auto; }
  .mrow img { width: 48px; }
  .hide-s { display: none !important; }
  .mi-head { flex-direction: column; text-align: center; padding: 8px 12px 16px; }
  .mi-art { width: 170px; }
  .lrow { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .lrow .muted { grid-column: 1; }
  .lrow .btn { grid-row: 1 / span 2; grid-column: 2; }
  .hero { align-items: stretch; }
  .daily { flex-wrap: wrap; }
  .grid.crates { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid.items { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid.tiles { grid-template-columns: repeat(2, 1fr); }
  .grid.items.small { grid-template-columns: repeat(2, 1fr); }
  .rcard { flex-basis: 118px; }
  .rcard img { height: 80px; }
  .strip-view { height: 170px; }
  .top { gap: 8px; }
  .brand span { display: none; }
  .btn.big { width: 100%; }
}
@media (max-width: 380px) {
  .chip { padding: 4px 8px; }
  .grid.crates { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- profile, settings, avatars ---------- */
.userbtn { display: flex; align-items: center; gap: 8px; padding: 3px 14px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; max-width: 200px; }
.userbtn:hover { border-color: var(--muted); }
.userbtn .un { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover; color: #fff; font-weight: 700; background: var(--raised); }
.profile-head { display: flex; align-items: center; gap: 24px; padding: 22px; margin-bottom: 8px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.pr-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pr-info h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-info p { margin: 0; }
.pr-info .bio { white-space: pre-wrap; word-break: break-word; max-width: 60ch; margin-top: 4px; }
.pr-info .row { margin-top: 10px; }
.pill.adm { color: var(--t); border: 1px solid var(--t); background: none; font-family: var(--font); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 860px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.settings-grid .panel { margin: 0; }
.avrow { gap: 18px; }
.avrow label.btn { color: var(--text); cursor: pointer; }
textarea { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%; resize: vertical; font: inherit; color: inherit; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); align-self: flex-start; }
.seg button { padding: 7px 18px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--t); color: #1b1305; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.pwbox { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); }
.pwbox code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; letter-spacing: .04em; word-break: break-all; user-select: all; }
.auth-tabs { margin-bottom: 4px; }
.auth-tabs .tab { flex: 1; text-align: center; }
.drop span a, .lrow a.muted, .rdy a { color: inherit; }
.drop span a:hover, .lrow a.muted:hover, .rdy a:hover { color: var(--ct); }
@media (max-width: 560px) {
  .userbtn .un { display: none; }
  .userbtn { padding-right: 3px; }
  .profile-head { flex-direction: column; text-align: center; }
  .pr-info { align-items: center; }
  .pr-info h1 { justify-content: center; }
}

/* ---------- keys ---------- */
.kmini { width: 26px; height: 18px; object-fit: contain; }
.cc-sub { font-size: 12px; margin-top: -6px; }
.keybox { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); max-width: 100%; }
.keybox img { width: 84px; height: 56px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)); }
.kb-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kb-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keys-sec { margin-bottom: 18px; }
.keys-sec h3 { font-size: 14px; color: var(--muted); font-weight: 600; }
.kcard img { aspect-ratio: 16 / 9; }
.pill.qty { color: var(--t); font-size: 12px; }
.sc-sub { margin-top: -6px; }
.keyreveal { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 22px 24px; text-align: center; overflow: hidden; }
.kr-glow { position: absolute; left: 50%; top: 90px; width: 320px; height: 320px; margin: -160px 0 0 -160px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--t) 55%, transparent), transparent 68%); opacity: .25; transform: scale(.6); transition: opacity .5s, transform .6s; pointer-events: none; }
.keyreveal.landed .kr-glow { opacity: .85; transform: scale(1.15); animation: pulse 2.4s ease-in-out infinite .6s; }
@keyframes pulse { 50% { transform: scale(1.3); opacity: .6; } }
.kr-stage { position: relative; width: 100%; height: 150px; display: grid; place-items: center; z-index: 1; }
.kr-key { width: 190px; height: 120px; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .55)); transform: rotate(-8deg) scale(.9); }
.keyreveal:not(.landed) .kr-key { animation: wobble .22s linear infinite; opacity: .85; }
@keyframes wobble { 0% { transform: rotate(-9deg) scale(.9); } 50% { transform: rotate(7deg) scale(.95); } 100% { transform: rotate(-9deg) scale(.9); } }
.keyreveal.landed .kr-key { animation: land .9s cubic-bezier(.2, .9, .25, 1.25) forwards; }
@keyframes land { 0% { transform: translateY(-40px) rotate(-30deg) scale(.6); opacity: .4; } 60% { transform: translateY(6px) rotate(8deg) scale(1.18); opacity: 1; } 100% { transform: rotate(-6deg) scale(1.08); opacity: 1; } }
.kr-sparks { position: absolute; left: 50%; top: 50%; }
.kr-sparks i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--t); box-shadow: 0 0 10px var(--t); opacity: 0; }
.keyreveal.landed .kr-sparks i { animation: spark .9s ease-out var(--dl) forwards; }
@keyframes spark { 0% { opacity: 1; transform: rotate(var(--a)) translateX(0); } 100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)); } }
.kr-text { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; transform: translateY(10px); transition: opacity .5s .35s, transform .5s .35s; }
.keyreveal.landed .kr-text { opacity: 1; transform: none; }
.kr-small { color: var(--t); font-weight: 700; }
.kr-text h2 { margin: 0; font-size: 24px; }
.kr-text p { margin: 0; }
.kr-case { height: 70px; object-fit: contain; margin: 8px 0 12px; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .45)); }
@media (prefers-reduced-motion: reduce) { .keyreveal:not(.landed) .kr-key { animation: none; } }

/* ---------- key trading and market ---------- */
.qty-in { width: 72px; min-height: 32px; padding: 4px 8px; }
.lrow.k { grid-template-columns: minmax(0, 1fr) .5fr 1fr auto; }
.keybox.big img { width: 110px; height: 72px; }
.subh { margin: 18px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
@media (max-width: 720px) {
  .lrow.k { grid-template-columns: 1fr 1fr; }
  .lrow.k > .btn, .lrow.k > .row { grid-column: 1 / -1; grid-row: auto; justify-content: flex-end; }
}

/* ---------- daily key preview ---------- */
.daily img { width: 78px; height: 52px; }
.dl-key { font-weight: 650; }
.daily.ready img { filter: drop-shadow(0 0 12px color-mix(in srgb, var(--t) 70%, transparent)); }
.daily.locked { background: color-mix(in srgb, var(--panel) 80%, var(--bg)); }
.daily.locked img { filter: grayscale(1); opacity: .4; }
.daily.locked .dl-text b, .daily.locked .dl-key { color: var(--muted); }
.daily .cd { font-variant-numeric: tabular-nums; }

/* ---------- seller + profile listings ---------- */
.seller { display: inline-flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; font-weight: 600; }
.seller:hover { text-decoration: none; color: var(--ct); }
.seller span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seller .av { box-shadow: 0 0 0 1px var(--line); }
.mrow.lst { grid-template-columns: 56px minmax(0, 1fr) 120px 120px; }
@media (max-width: 720px) {
  .mrow.lst { grid-template-columns: 48px minmax(0, 1fr) 96px; }
  .lrow .seller { grid-column: 1; }
}
