/* Rifted website: dark catalog look (fortnite.gg style) in Rifted purple. */
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-BlackItalic.ttf') format('truetype'); font-weight: 900; font-style: italic; font-display: swap; }

:root {
  --bg: #121216;
  --bg-2: #1a1a20;
  --panel: #202028;
  --panel-2: #2a2a34;
  --line: #34343f;
  --text: #f2f0f6;
  --muted: #a4a1b0;
  --faint: #6f6c7c;
  --brand: #8f3fd1;
  --brand-2: #641f79;
  --accent: #ffd23f;
  --good: #3ccf7a;
  --bad: #ef5a5a;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 500;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: 60px;
  background: rgba(18, 18, 22, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-style: italic; font-size: 22px; letter-spacing: 0.5px; }
.brand img { height: 34px; }
.brand span b { color: var(--brand); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.4px; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--brand); }
.account { display: flex; align-items: center; gap: 10px; }
.account img { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); }
.account .name { font-weight: 700; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}
.btn:hover { background: #363643; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: transparent; }
.btn.primary:hover { background: #a24fe6; }
.btn.yellow { background: var(--accent); color: #18151c; border-color: transparent; }
.btn.white { background: #fff; color: #18151c; border-color: transparent; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.danger { background: #5a1e25; border-color: #7a2a33; }
.btn:disabled { opacity: 0.5; cursor: default; }

main { max-width: 1400px; margin: 0 auto; padding: 22px 20px 60px; }
h1 { font-weight: 900; font-style: italic; font-size: 30px; margin: 4px 0 6px; letter-spacing: 0.3px; }
.subtitle { color: var(--muted); margin: 0 0 18px; }

/* ---------------------------------------------------------------- filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters input[type=search], .filters select, .field input, .field select, .field textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; outline: none;
}
.filters input[type=search] { flex: 1 1 260px; min-width: 200px; }
.filters input:focus, .filters select:focus, .field input:focus, .field textarea:focus { border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { padding: 7px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--brand); border-color: transparent; color: #fff; }
.count-line { color: var(--faint); font-size: 13px; margin: 0 0 12px; }

/* ---------------------------------------------------------------- cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.card {
  position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, var(--c1, #777) 0%, var(--c2, #333) 85%);
  aspect-ratio: 1 / 1.18; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .art { flex: 1; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.card .art img { width: 100%; height: 100%; object-fit: cover; }
.card .label {
  background: linear-gradient(180deg, rgba(10, 10, 14, 0.55), rgba(10, 10, 14, 0.92));
  padding: 6px 8px 7px; border-top: 3px solid var(--c1, #777);
}
.card .label .n { font-weight: 800; font-size: 13px; text-transform: uppercase; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .label .t { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.card .badge { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 800; padding: 3px 6px; border-radius: 5px; background: var(--accent); color: #18151c; text-transform: uppercase; }
.card .badge.off { background: #5a1e25; color: #fff; }
.grid.small .card .label { padding: 4px 6px; }
.grid.small .card .label .n { font-size: 11px; }
.grid.small .card .label .t { display: none; }

.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border-radius: var(--radius); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- item page */
.item { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.stage {
  position: relative; border-radius: 14px; overflow: hidden; min-height: 520px; aspect-ratio: 4 / 5;
  background: radial-gradient(circle at 50% 40%, var(--c1, #6d3bb3) 0%, var(--c2, #241034) 80%);
  box-shadow: var(--shadow);
}
.stage img.main { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage .watermark { position: absolute; left: 16px; bottom: 14px; font-weight: 900; font-style: italic; opacity: 0.35; font-size: 22px; }
.stage .visualizer { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; width: 100%; }
.side { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.side h1 { text-align: center; text-transform: uppercase; margin: 0; font-size: 26px; }
.tagline { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.rarity-tag { padding: 3px 10px; border-radius: 5px; font-weight: 800; font-size: 12px; text-transform: uppercase; background: linear-gradient(90deg, var(--c1), var(--c2)); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.rarity-tag img { height: 18px; }
.type-tag { font-weight: 800; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.price { display: flex; justify-content: center; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; }
.price img { width: 22px; height: 22px; }
.status { text-align: center; }
.status .pill { display: inline-block; padding: 5px 12px; border-radius: 6px; font-weight: 700; font-size: 13px; background: #2b5f8a; }
.status .pill.instore { background: #1d6b3d; }
.section-title { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 800; font-size: 13px; text-transform: uppercase; }
.section-title::before, .section-title::after { content: ''; flex: 1; height: 2px; background: var(--line); }
.styles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.style { width: 58px; height: 58px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: var(--panel-2); cursor: pointer; position: relative; }
.style.active { border-color: #fff; }
.style.locked::after { content: '🔒'; position: absolute; right: 2px; bottom: 0; font-size: 12px; }
.style img { width: 100%; height: 100%; object-fit: cover; }
.description { text-align: center; color: var(--text); font-style: italic; margin: 0; }
.tags { text-align: center; color: var(--muted); font-size: 13px; text-decoration: underline dotted; }
.facts { background: var(--panel); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.facts dt { color: var(--muted); text-align: right; }
.facts dd { margin: 0; font-weight: 700; }
.facts .ago { color: var(--muted); font-weight: 500; }
.actions { display: flex; justify-content: center; gap: 10px; }
.actions .btn { flex: 1; background: #fff; color: #18151c; border: none; }
.actions .btn.on { background: var(--brand); color: #fff; }
.actions .btn .num { color: #6a6676; font-weight: 600; font-size: 12px; }
.actions .btn.on .num { color: #e9dbf7; }
.reactions { display: flex; justify-content: space-around; gap: 4px; background: linear-gradient(90deg, #6b1d3a, #6b3a1d); border-radius: 10px; padding: 8px 6px; }
.reaction { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 8px; font-size: 22px; }
.reaction span { font-size: 11px; font-weight: 800; background: var(--accent); color: #18151c; border-radius: 6px; padding: 0 5px; }
.reaction.mine { background: rgba(255, 255, 255, 0.18); }
.bundle { display: flex; gap: 10px; align-items: center; background: var(--panel); border-radius: 10px; padding: 10px; }
.bundle img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.bundle .bn { font-weight: 800; }
.bundle .bp { color: var(--muted); font-size: 13px; }
.preview-pick { display: flex; gap: 8px; align-items: center; justify-content: center; }
.banner-preview { display: flex; justify-content: center; }
.banner-preview .plate { width: 220px; height: 220px; border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.banner-preview .plate img { width: 70%; height: 70%; object-fit: contain; }
.audio-bar { display: flex; gap: 10px; justify-content: center; align-items: center; }

/* ---------------------------------------------------------------- shop */
.shop-section { margin-bottom: 26px; }
.shop-section h2 { font-weight: 900; font-style: italic; text-transform: uppercase; margin: 0 0 10px; }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.offer { background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.offer .card { aspect-ratio: 1; border-radius: 0; }
.offer .meta { padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.offer .meta .on { flex: 1; min-width: 0; font-weight: 800; font-size: 13px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer .meta .pr { flex-shrink: 0; display: flex; align-items: center; gap: 4px; font-weight: 800; }
.offer .meta .pr img { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- panels, forms */
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.field textarea { min-height: 80px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.note { color: var(--muted); font-size: 13px; }
.error-box { background: #3a1820; border: 1px solid #6b2a35; color: #ffd4d9; padding: 10px 12px; border-radius: 8px; }
.ok-box { background: #17331f; border: 1px solid #2a6b3d; color: #d2ffe0; padding: 10px 12px; border-radius: 8px; }
.code-box { font-family: ui-monospace, Consolas, monospace; font-size: 18px; background: var(--panel); padding: 12px; border-radius: 8px; text-align: center; letter-spacing: 0.5px; user-select: all; }
.stat { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.stat img { width: 24px; height: 24px; }

/* admin */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; position: sticky; top: 60px; background: var(--bg); }
.admin-table tr:hover td { background: var(--bg-2); }
.admin-table img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
.flag { font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.flag.on { background: #1d6b3d; color: #fff; }
.flag.warn { background: #6b4a1d; color: #fff; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg-2); border-left: 1px solid var(--line); z-index: 40; padding: 18px; overflow-y: auto; box-shadow: var(--shadow); }
.drawer pre { background: var(--panel); padding: 10px; border-radius: 8px; font-size: 12px; overflow-x: auto; max-height: 260px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); font-weight: 700; }

footer { text-align: center; color: var(--faint); font-size: 12px; padding: 30px 20px; }

@media (max-width: 900px) {
  .item { grid-template-columns: 1fr; }
  .stage { min-height: 360px; aspect-ratio: 1; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .brand span { display: none; }
  .account .name { display: none; }
  main { padding: 16px 16px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  h1 { font-size: 24px; }
}
