:root {
  color-scheme: dark;
  --ink: #ECEAF2;
  --muted: #A398A8;
  --obsidian: #0E0A10;
  --panel: #150F17;
  --raised: #1E1520;
  --hover: #2A1622;
  --line: #3A2430;
  --edge: #4A1626;
  --crimson: #E0213F;
  --crimson-bright: #FF4D68;
  --crimson-deep: #3A0F1C;
  --rose: #FF8DA0;
  --silver: #C9CCD8;
  --twitch: #9146FF;
  --kick: #53FC18;

  --r-common: #9AA0AC;
  --r-uncommon: #4FC38A;
  --r-rare: #3D8BFF;
  --r-epic: #A457FF;
  --r-legendary: #FFB02E;
  --r-mythic: #FF5C8A;
  --r-creator: #22D3EE;
  --r-god: #FFE58A;

  --radius: 14px;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--obsidian); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 15px/1.55 var(--body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(224, 33, 63, .22), transparent 70%),
    linear-gradient(180deg, #1C0B14 0, #120A11 420px, var(--obsidian) 900px);
  background-color: var(--obsidian);
}
a { color: var(--rose); text-decoration: none; }
a:hover { color: var(--ink); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--crimson-bright); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(14, 10, 16, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand img { border-radius: 10px; box-shadow: 0 0 0 1px var(--edge), 0 4px 18px rgba(224, 33, 63, .35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font: 700 15px/1.1 var(--display); letter-spacing: .08em; }
.brand-text small { font-size: 10px; letter-spacing: .28em; color: var(--rose); font-weight: 600; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .02em;
}
.nav a:hover { color: var(--ink); background: var(--hover); }
.nav a.active { color: var(--ink); background: var(--crimson-deep); box-shadow: inset 0 0 0 1px var(--edge); }
.search { margin-left: auto; position: relative; }
.search input {
  width: 220px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.search input:focus { border-color: var(--crimson); outline: none; }
.search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 260px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.search-results a, .search-results p { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin: 0; color: var(--ink); font-size: 14px; }
.search-results a:hover, .search-results a.focus { background: var(--hover); }
.search-results p { color: var(--muted); }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; outline: none; }
.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}
h1, h2, h3 { font-family: var(--display); letter-spacing: .04em; margin: 0; line-height: 1.2; }
h1 { font-size: clamp(26px, 4vw, 40px); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .24em; color: var(--rose); text-transform: uppercase; }
.lead { color: var(--muted); max-width: 640px; margin: 8px 0 0; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head a { font-size: 13px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: linear-gradient(180deg, var(--raised), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.empty { color: var(--muted); padding: 26px 18px; text-align: center; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.error { color: var(--rose); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--edge);
  background:
    radial-gradient(600px 260px at 0% 0%, rgba(224, 33, 63, .28), transparent 70%),
    linear-gradient(135deg, #1E0D16, #120A11);
  box-shadow: 0 30px 80px rgba(224, 33, 63, .12);
}
.hero img { width: 150px; height: 150px; border-radius: 26px; box-shadow: 0 0 0 1px var(--edge), 0 10px 40px rgba(224, 33, 63, .45); }
.hero h1 span { color: var(--crimson-bright); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.stat { padding: 10px 16px; border-radius: 12px; background: rgba(14, 10, 16, .6); border: 1px solid var(--line); min-width: 110px; }
.stat b { display: block; font: 700 22px/1.1 var(--display); }
.stat span { font-size: 11px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; font-weight: 600; }
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding: 22px; }
  .hero img { margin: 0 auto; width: 110px; height: 110px; }
  .stats { justify-content: center; }
}

/* ---------- chips / names ---------- */
.who { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; color: var(--ink); }
.who a { color: inherit; }
.who a:hover { color: var(--rose); }
.pf { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; font-size: 10px; font-weight: 800; color: #fff; flex: none; }
.pf.twitch { background: var(--twitch); }
.pf.kick { background: var(--kick); color: #0b1a05; }
.link-glyph { color: var(--muted); font-size: 12px; }
.rarity { font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.rarity.common { color: var(--r-common); } .rarity.uncommon { color: var(--r-uncommon); } .rarity.rare { color: var(--r-rare); }
.rarity.epic { color: var(--r-epic); } .rarity.legendary { color: var(--r-legendary); } .rarity.mythic { color: var(--r-mythic); }
.rarity.creator { color: var(--r-creator); } .rarity.god { color: var(--r-god); text-shadow: 0 0 10px rgba(255, 229, 138, .6); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { text-align: left; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board td { padding: 11px 10px; border-bottom: 1px solid rgba(58, 36, 48, .55); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board tbody tr:hover { background: rgba(42, 22, 34, .5); }
.board .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank { font: 700 15px var(--display); color: var(--muted); width: 44px; }
.rank.top1 { color: var(--r-god); } .rank.top2 { color: var(--silver); } .rank.top3 { color: #E3A06B; }
.bar { position: relative; height: 8px; border-radius: 99px; background: var(--obsidian); border: 1px solid var(--line); overflow: hidden; min-width: 90px; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--crimson), var(--rose)); }
.bar-cell { display: flex; align-items: center; gap: 10px; }
.bar-cell .bar { flex: 1; }
.bar-cell span { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); width: 48px; text-align: right; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: 600 13px var(--body);
  cursor: pointer;
}
.tab:hover { color: var(--ink); border-color: var(--edge); }
.tab[aria-selected="true"] { color: var(--ink); background: var(--crimson-deep); border-color: var(--crimson); }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(58, 36, 48, .55); font-size: 14px; flex-wrap: wrap; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- news ---------- */
.post { padding: 20px; }
.post + .post { margin-top: 14px; }
.post h3 { font-size: 18px; }
.post .meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.post .body { margin-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pin { font-size: 10px; font-weight: 800; letter-spacing: .14em; color: var(--obsidian); background: var(--rose); padding: 2px 7px; border-radius: 99px; }

/* ---------- player ---------- */
.profile { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.profile .accounts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.acct { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 6px; border-radius: 999px; background: var(--obsidian); border: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--crimson-bright) calc(var(--p) * 1%), var(--obsidian) 0); box-shadow: 0 0 0 1px var(--line), 0 0 40px rgba(224, 33, 63, .25); }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; text-align: center; }
.ring b { font: 700 26px/1 var(--display); display: block; }
.ring span { font-size: 11px; color: var(--muted); }
@media (max-width: 640px) { .profile { grid-template-columns: 1fr; justify-items: center; text-align: center; } .profile .accounts { justify-content: center; } }
.rarity-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rchip { padding: 8px 12px; border-radius: 10px; background: var(--obsidian); border: 1px solid var(--line); min-width: 104px; }
.rchip b { display: block; font-variant-numeric: tabular-nums; font-size: 15px; }
.banned { margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: var(--crimson-deep); border: 1px solid var(--crimson); color: var(--rose); font-weight: 600; }

/* ---------- cards ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 18px 0 14px; }
.filters .spacer { flex: 1; }
.filters select {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 600 13px var(--body);
}
.binder { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
@media (max-width: 460px) { .binder { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.tile {
  --rc: var(--r-common);
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--rc) 55%, transparent);
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 70%), var(--raised);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  cursor: pointer;
  padding: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, .45), 0 0 0 1px var(--rc); }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .shade { position: absolute; inset: auto 0 0 0; padding: 26px 10px 9px; background: linear-gradient(180deg, transparent, rgba(8, 5, 9, .92) 55%); }
.tile .shade b { display: block; font: 700 13px/1.2 var(--display); letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .no { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: rgba(8, 5, 9, .75); color: var(--silver); }
.tile .copies { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: var(--crimson); color: #fff; }
.tile .glyph { position: absolute; inset: 0; display: grid; place-items: center; font: 800 54px var(--display); color: color-mix(in srgb, var(--rc) 70%, white 10%); opacity: .55; }
.tile.missing { cursor: default; border-style: dashed; border-color: var(--line); background: repeating-linear-gradient(135deg, #130d15 0 10px, #110b13 10px 20px); box-shadow: none; filter: saturate(.2); }
.tile.missing:hover { transform: none; box-shadow: none; }
.tile.missing .glyph { color: var(--line); opacity: 1; }
.tile.missing .shade b { color: var(--muted); }
.tile[data-r="common"] { --rc: var(--r-common); } .tile[data-r="uncommon"] { --rc: var(--r-uncommon); } .tile[data-r="rare"] { --rc: var(--r-rare); }
.tile[data-r="epic"] { --rc: var(--r-epic); } .tile[data-r="legendary"] { --rc: var(--r-legendary); } .tile[data-r="mythic"] { --rc: var(--r-mythic); }
.tile[data-r="creator"] { --rc: var(--r-creator); } .tile[data-r="god"] { --rc: var(--r-god); }
.tile .owners { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- how to play ---------- */
.cmds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cmd code { font: 700 15px ui-monospace, 'Cascadia Code', Consolas, monospace; color: var(--rose); }
.cmd p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.odds td:first-child { width: 50%; }
.steps { margin: 10px 0 0; padding-left: 20px; color: var(--muted); }
.steps li { margin: 6px 0; }
.steps code { color: var(--rose); font-family: ui-monospace, Consolas, monospace; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6, 3, 7, .82); backdrop-filter: blur(6px); }
.modal-body { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(440px, 100%); }
.modal-body iframe { width: 100%; aspect-ratio: 5 / 7; max-height: 78vh; border: 0; background: transparent; }
.modal-caption { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.modal-caption b { font: 700 18px var(--display); }
.modal-caption span { color: var(--muted); font-size: 13px; }
.modal-close { position: absolute; top: -6px; right: -6px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-close:hover { border-color: var(--crimson); }

@media (max-width: 720px) {
  .top-inner { gap: 10px; }
  .search { margin-left: 0; width: 100%; order: 3; }
  .search input { width: 100%; }
  .search-results { width: 100%; }
  .nav { order: 2; width: 100%; gap: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 6px 9px; font-size: 12.5px; white-space: nowrap; }
}
