/* 瓦查查 v2 — editorial, poster-like. Monochrome ink + bone, square geometry, hairlines,
   big numerals. Colour comes from the game itself (maps, agents), not from UI chrome. */
:root, :root[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-grid: transparent;
  --surface: #121214;
  --surface-2: #18181b;
  --surface-3: #222226;
  --line: rgba(236, 232, 225, .08);
  --line-strong: rgba(236, 232, 225, .16);
  --text: #ece8e1;
  --text-2: #b9b4ab;
  --muted: #7c786f;
  --accent: #ece8e1;
  --accent-ink: #0a0a0b;
  --accent-soft: rgba(236, 232, 225, .08);
  --amber: #f0c36a;
  --amber-soft: rgba(240, 195, 106, .12);
  --win: #5fd39b;
  --win-soft: rgba(95, 211, 155, .1);
  --loss: #f06a6a;
  --loss-soft: rgba(240, 106, 106, .1);
  --shadow: none;
  --radius: 6px;
  --radius-sm: 4px;
  --display: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f1eee8;
  --surface: #faf8f4;
  --surface-2: #ece8e1;
  --surface-3: #e2ddd4;
  --line: rgba(10, 10, 11, .09);
  --line-strong: rgba(10, 10, 11, .18);
  --text: #111112;
  --text-2: #3d3b37;
  --muted: #7a766e;
  --accent: #111112;
  --accent-ink: #f1eee8;
  --accent-soft: rgba(10, 10, 11, .06);
  --amber: #a8730f;
  --amber-soft: rgba(168, 115, 15, .1);
  --win: #1f8f5c;
  --win-soft: rgba(31, 143, 92, .09);
  --loss: #c4413f;
  --loss-soft: rgba(196, 65, 63, .08);
  color-scheme: light;
}

body { background: var(--bg); letter-spacing: .01em; }
::selection { background: var(--text); color: var(--bg); }

/* Calm the chrome: no glow, no gradient text, no letter-spaced mono kickers */
.eyebrow { font: 600 12px/1 var(--sans); letter-spacing: .12em; color: var(--muted); text-transform: none; }
.eyebrow::before, .eyebrow::after { display: none; }
.card, .mrow, .lrow, .fc, .kpi, .stat, .side-card, .palette-panel, .sf-box, .field, .btn, .badge, .pick, .icon-btn, .search-trigger, .seg, .seg button, .lb-pager .pages button {
  border-radius: var(--radius) !important;
}
.card { background: var(--surface); border-color: var(--line); box-shadow: none; }
.btn { font-weight: 700; letter-spacing: .02em; }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--text); }
.badge { background: transparent; border: 1px solid var(--line-strong); color: var(--text-2); font-family: var(--sans); font-weight: 600; }
.badge.mvp { background: var(--amber); color: #1a1206; border: 0; }
.badge.win { border-color: transparent; background: var(--win-soft); }
.badge.loss { border-color: transparent; background: var(--loss-soft); }

/* Header: thin, quiet */
.header { background: color-mix(in srgb, var(--bg) 86%, transparent); border-bottom-color: var(--line); }
.header .wrap { height: 58px; }
.brand { font-size: 17px; letter-spacing: .06em; }
.brand svg { display: none; }
.brand::before {
  content: "瓦"; display: grid; place-items: center; width: 28px; height: 28px; margin-right: 2px;
  background: var(--text); color: var(--bg); font-weight: 900; font-size: 16px; border-radius: 4px;
}
.brand small { font-family: var(--sans); letter-spacing: .3em; font-size: 9px; }
.nav a { border-radius: 4px; }
.nav a.active { background: transparent; color: var(--text); box-shadow: inset 0 -2px 0 var(--text); border-radius: 0; }
.pill { border-radius: 4px; font-family: var(--sans); letter-spacing: .04em; }
.notice { background: var(--surface); color: var(--amber); font-weight: 600; }
.nav-count { background: var(--text); color: var(--bg); }
.footer { border-top-color: var(--line); }

/* Search pieces use ink-on-bone buttons */
.sf-go { background: var(--text); color: var(--bg); }
.sf-hash { background: transparent; color: var(--text); }
.sf-box:focus-within { border-color: var(--text); box-shadow: none; }
.sf-field-name svg, .sf-box:focus-within .sf-field-name svg { color: var(--muted); }

/* ============ Home: cinematic search ============ */
.is-home .header { position: absolute; left: 0; right: 0; background: linear-gradient(180deg, rgba(0,0,0,.55), transparent); border-bottom: 0; backdrop-filter: none; }
.is-home .header, .is-home .header a, .is-home .header .pill, .is-home .icon-btn { color: #ece8e1; }
.is-home .icon-btn { background: transparent; border-color: rgba(236,232,225,.25); }
.is-home .brand::before { background: #ece8e1; color: #0a0a0b; }
.is-home .nav a.active { box-shadow: none; }
.is-home .pill { border-color: rgba(236,232,225,.25); }
.is-home main { padding-top: 0; }

.cine {
  position: relative; width: 100vw; margin-left: calc(50% - 50vw); min-height: min(100svh, 980px);
  display: grid; place-items: center; overflow: hidden; color: #ece8e1; isolation: isolate; background: #0a0a0b;
}
.cine-bg { position: absolute; inset: 0; z-index: -3; }
.cine-slide {
  position: absolute; inset: -4%; background: var(--art) center / cover no-repeat; opacity: 0;
  filter: grayscale(.85) contrast(1.05) brightness(.55);
  transition: opacity 1.8s ease; transform: scale(1.04);
}
.cine-slide.on { opacity: 1; animation: kenburns 14s linear both; }
@keyframes kenburns { from { transform: scale(1.04) translate3d(0, 0, 0); } to { transform: scale(1.12) translate3d(-1.5%, -1%, 0); } }
.cine::before {
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, transparent 20%, rgba(10,10,11,.75) 100%),
    linear-gradient(180deg, rgba(10,10,11,.2) 0%, rgba(10,10,11,.1) 50%, #0a0a0b 100%);
}
.cine-grain {
  position: absolute; inset: -50%; z-index: -1; pointer-events: none; opacity: .09; mix-blend-mode: overlay;
  background-image: repeating-radial-gradient(circle at 17% 32%, #fff 0 .6px, transparent .6px 2.4px),
    repeating-radial-gradient(circle at 71% 63%, #000 0 .7px, transparent .7px 2.9px);
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0% { transform: translate(0, 0); } 33% { transform: translate(-2%, 1%); } 66% { transform: translate(1%, -2%); } 100% { transform: translate(0, 0); } }
.cine-inner { width: min(1060px, 100% - 40px); padding: 120px 0 90px; text-align: center; }
.cine-kicker { margin: 0 0 34px; font-size: 13px; letter-spacing: .5em; color: rgba(236,232,225,.6); padding-left: .5em; }
.cine-hint { margin: 26px 0 0; font-size: 14px; color: rgba(236,232,225,.55); letter-spacing: .06em; }
.cine-picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.cine-picks .pick { background: rgba(10,10,11,.45); border-color: rgba(236,232,225,.18); color: #ece8e1; backdrop-filter: blur(6px); border-radius: 999px !important; }
.cine-picks .pick:hover { border-color: #ece8e1; }
.cine-caption {
  position: absolute; left: max(20px, calc(50% - 580px)); bottom: 34px; display: flex; gap: 14px; align-items: baseline;
  font-size: 12px; letter-spacing: .3em; color: rgba(236,232,225,.55);
}
.cine-caption b { font-size: 15px; letter-spacing: .2em; color: #ece8e1; font-weight: 700; transition: opacity .6s ease; }
.cine-scroll {
  position: absolute; right: max(20px, calc(50% - 580px)); bottom: 30px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .25em; color: rgba(236,232,225,.6);
}
.cine-scroll:hover { color: #ece8e1; }
.cine-scroll svg { width: 16px; height: 16px; transform: rotate(90deg); animation: nudge 2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: rotate(90deg) translateX(4px); } }

/* The giant inline search */
.sf-xl { color: #ece8e1; }
.sf-xl .sf-box {
  height: auto !important; padding: 0 0 14px; gap: 18px; background: transparent; border: 0; border-bottom: 2px solid rgba(236,232,225,.35);
  border-radius: 0 !important; box-shadow: none !important; transition: border-color .25s ease;
}
.sf-xl .sf-box:focus-within { border-bottom-color: #ece8e1; }
.sf-xl .sf-field-name { padding-left: 0; }
.sf-xl .sf-field-name svg { display: none; }
.sf-xl .sf-field input {
  font-size: clamp(30px, 5.4vw, 64px); font-weight: 800; letter-spacing: -.01em; color: #ece8e1; font-family: var(--display);
  caret-color: #ece8e1;
}
.sf-xl .sf-field input::placeholder { color: rgba(236,232,225,.28); font-weight: 700; }
.sf-xl .sf-hash { width: auto; height: auto; margin: 0; background: none; color: rgba(236,232,225,.45); font: 300 clamp(30px, 5.4vw, 64px)/1 var(--display); }
.sf-xl .sf-field-tag { width: clamp(120px, 17vw, 230px); }
.sf-xl .sf-field-tag input { font-family: var(--display); letter-spacing: .04em; }
.sf-xl .sf-go {
  width: clamp(58px, 6.4vw, 78px); height: clamp(58px, 6.4vw, 78px); padding: 0; border-radius: 50% !important;
  background: #ece8e1; color: #0a0a0b; font-size: clamp(20px, 2.2vw, 26px); font-weight: 900; align-self: center;
}
.sf-xl .sf-go svg { display: none; }
.sf-xl.busy .sf-go { animation: breathe 1s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.92); opacity: .7; } }
.sf-xl .sf-go:hover { transform: scale(1.05); }
.sf-xl .sf-msg { text-align: center; color: rgba(236,232,225,.7); font-size: 14px; margin-top: 16px; }
.sf-xl .sf-msg.error { color: #ff9b8f; }

/* Feed below the fold */
.wc-feed, .wc-invite { scroll-margin-top: 80px; }
.wc-invite { border-radius: var(--radius); }
.wc-invite-art .dot { border-color: var(--text); }
.wc-invite-art { color: var(--text); }

/* ============ Player page v2 ============ */
.pv { --a1: #3a3a40; --a2: #1b1b1f; }
.pv-hero {
  position: relative; width: 100vw; margin-left: calc(50% - 50vw); min-height: 460px; overflow: hidden; isolation: isolate;
  color: #ece8e1; background: #0a0a0b;
}
.pv-bg { position: absolute; inset: 0; z-index: -3; background: var(--art, none) center 35% / cover no-repeat; filter: grayscale(.5) brightness(.5); transform: scale(1.03); }
.pv-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    linear-gradient(90deg, rgba(10,10,11,.92) 0%, rgba(10,10,11,.6) 45%, transparent 80%),
    linear-gradient(0deg, var(--bg) 0%, transparent 38%),
    radial-gradient(ellipse 60% 90% at 78% 40%, color-mix(in srgb, var(--a1) 55%, transparent), transparent 70%);
}
.pv-agent {
  position: absolute; z-index: -1; right: max(-40px, calc(50% - 720px)); bottom: -6%; height: 118%; width: auto;
  filter: drop-shadow(0 30px 60px rgba(0,0,0,.6)); pointer-events: none; user-select: none;
  animation: agent-in .9s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes agent-in { from { opacity: 0; transform: translateX(40px); } }
.pv-inner { position: relative; display: flex; align-items: flex-end; gap: 26px; min-height: 460px; padding: 90px 0 40px; }
.pv-card { width: 112px; height: 112px; flex: none; border-radius: 4px; overflow: hidden; position: relative; background: #222226; box-shadow: 0 0 0 1px rgba(236,232,225,.15); display: grid; place-items: center; font-size: 40px; font-weight: 900; }
.pv-id { flex: 1; min-width: 0; }
.pv-kicker { display: flex; align-items: center; gap: 10px; font-size: 14px; letter-spacing: .08em; color: rgba(236,232,225,.8); }
.pv-kicker img { width: 30px; height: 30px; }
.pv-kicker b { color: #ece8e1; font-size: 15px; }
.pv-name { margin: 10px 0 6px; font: 900 clamp(40px, 6.8vw, 86px)/.95 var(--display); letter-spacing: -.03em; word-break: break-word; }
.pv-tag { font-weight: 300; color: rgba(236,232,225,.5); font-size: .42em; letter-spacing: .02em; margin-left: .25em; }
.pv-sub { font-size: 14px; color: rgba(236,232,225,.65); letter-spacing: .04em; }
.pv-sub i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--a1); margin-right: 8px; vertical-align: 1px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--a1) 30%, transparent); }
.pv-actions { display: flex; gap: 8px; }
.pv-actions .btn.follow { background: #ece8e1; color: #0a0a0b; height: 42px; padding: 0 20px; }
.pv-actions .btn.follow.on { background: transparent; color: #ece8e1; border: 1px solid rgba(236,232,225,.4); }
.pv-actions .btn.ghost { color: #ece8e1; border-color: rgba(236,232,225,.3); height: 42px; width: 42px; }

/* Stat band: big numerals on hairlines */
.pv-stats { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); margin-top: 0; }
.pv-stat { padding: 22px 22px 20px 0; position: relative; }
.pv-stat + .pv-stat { padding-left: 22px; border-left: 1px solid var(--line); }
.pv-stat label { display: block; font-size: 12.5px; color: var(--muted); letter-spacing: .1em; }
.pv-stat b { display: block; margin-top: 10px; font: 800 clamp(30px, 3.6vw, 46px)/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pv-stat small { display: block; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.pv-stat .spark { position: absolute; right: 16px; top: 22px; width: 84px; height: 34px; }
.pv-stat .spark polyline { fill: none; stroke: var(--a1); stroke-width: 2; vector-effect: non-scaling-stroke; }
.pv-stat .spark .base { stroke: var(--line-strong); }
.wr-bar { display: flex; height: 4px; margin-top: 10px; background: var(--loss); opacity: .9; width: 100%; max-width: 160px; }
.wr-bar i { background: var(--win); display: block; }

/* Section titles */
.pv-section { margin-top: 34px; }
.pv-section > h2, .list-head h2 { font: 800 20px/1.2 var(--display); letter-spacing: .02em; margin: 0 0 14px; }
.list-head { margin-top: 34px; }

/* Best match */
.best {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 20px; min-height: 210px; padding: 24px;
  border-radius: var(--radius); overflow: hidden; isolation: isolate; color: #ece8e1; cursor: pointer;
  background: #0a0a0b;
}
.best::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--art) center / cover; filter: brightness(.45) saturate(.8); transition: transform .6s ease; }
.best:hover::before { transform: scale(1.04); }
.best::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(10,10,11,.85), rgba(10,10,11,.2) 70%); }
.best .bk { font-size: 12.5px; letter-spacing: .3em; color: rgba(236,232,225,.7); }
.best .bv { font: 900 clamp(54px, 7vw, 84px)/.9 var(--display); letter-spacing: -.04em; margin: 12px 0 6px; }
.best .bv small { font-size: 16px; font-weight: 700; letter-spacing: .1em; margin-left: 8px; color: rgba(236,232,225,.7); }
.best .bm { font-size: 14px; color: rgba(236,232,225,.8); }
.best .bm b { color: #ece8e1; }
.best .bagent { height: 170px; margin: -24px -10px -24px 0; align-self: end; filter: drop-shadow(0 10px 30px rgba(0,0,0,.5)); }

/* Agent pool */
.pool { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pool-tile {
  position: relative; height: 150px; border-radius: var(--radius); overflow: hidden; isolation: isolate; padding: 12px;
  display: flex; flex-direction: column; justify-content: flex-end; color: #ece8e1;
  background: linear-gradient(160deg, var(--c1, #333), var(--c2, #111));
}
.pool-tile img { position: absolute; z-index: -1; right: -18%; top: -6%; height: 125%; width: auto; transition: transform .4s ease; }
.pool-tile:hover img { transform: scale(1.05) translateX(-4px); }
.pool-tile::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgba(10,10,11,.85) 0%, transparent 65%); }
.pool-tile b { font-size: 15px; }
.pool-tile span { font-size: 12px; color: rgba(236,232,225,.75); margin-top: 2px; font-variant-numeric: tabular-nums; }
.pool-tile .pool-wr { position: absolute; top: 10px; left: 12px; font: 800 18px/1 var(--display); }

/* Match rows: flatter, editorial */
.mrow { border-radius: var(--radius) !important; }
.mrow.win { background: linear-gradient(90deg, var(--win-soft), transparent 40%), var(--surface); }
.mrow.loss { background: linear-gradient(90deg, var(--loss-soft), transparent 40%), var(--surface); }
.mrow .kda b, .mrow .score b { font-family: var(--display); }

/* Side cards */
.side-card h3 { font: 800 15px/1.2 var(--display); letter-spacing: .04em; }
.side-card h3 small { font-family: var(--sans); letter-spacing: .1em; }
.chart .line { stroke: var(--text); }

@media (max-width: 1020px) {
  .pv-stats { grid-template-columns: repeat(3, 1fr); }
  .pv-stat:nth-child(4) { border-left: 0; padding-left: 0; }
  .pv-stat:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .cine-inner { padding: 110px 0 100px; }
  .cine-kicker { letter-spacing: .3em; margin-bottom: 24px; }
  .sf-xl .sf-box { gap: 10px; }
  .pv-hero, .pv-inner { min-height: 420px; }
  .pv-inner { flex-wrap: wrap; padding-top: 80px; gap: 16px; }
  .pv-card { width: 76px; height: 76px; }
  .pv-agent { right: -30%; opacity: .55; }
  .pv-actions { width: 100%; }
  .pv-actions .btn.follow { flex: 1; }
  .pv-stats { grid-template-columns: repeat(2, 1fr); }
  .pv-stat, .pv-stat + .pv-stat { padding: 16px 12px 14px 0; border-left: 0; }
  .pv-stat:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
  .pv-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .pv-stat .spark { display: none; }
  .best { grid-template-columns: 1fr; }
  .best .bagent { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cine-slide.on, .cine-grain, .pv-agent { animation: none !important; }
}
.sf-xl .sf-go-label { display: inline !important; }

/* fixes */
.is-home .header { top: auto; width: 100%; }
.pv-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
.pv-card.has-img img { opacity: 1; }
.pv-card.has-img { color: transparent; }
.best { min-height: 230px; }
.best .bagent { height: 280px; margin: -60px -24px -24px 0; }
.pool-tile span { line-height: 1.35; }
@media (max-width: 640px) {
  .sf-xl .sf-box { flex-wrap: wrap; row-gap: 18px; column-gap: 10px; border-bottom: 0; padding-bottom: 0; }
  .sf-xl .sf-field-name { flex: 1 1 100%; padding-bottom: 10px; border-bottom: 2px solid rgba(236,232,225,.35); }
  .sf-xl .sf-field-tag { flex: 1; width: auto; padding-bottom: 10px; border-bottom: 2px solid rgba(236,232,225,.35); }
  .sf-xl .sf-field-name:focus-within, .sf-xl .sf-field-tag:focus-within { border-bottom-color: #ece8e1; }
  .sf-xl .sf-field input { font-size: 34px; }
  .sf-xl .sf-hash { font-size: 34px; }
}

/* Leaderboard: editorial list */
.lb-list { gap: 0; border-top: 1px solid var(--line-strong); }
.lrow, .lrow.m1, .lrow.m2, .lrow.m3 {
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0 !important; padding: 14px 8px;
  box-shadow: none !important;
}
.lrow:hover { transform: none; background: var(--surface); box-shadow: none; }
.lrow .medal, .lrow.m1 .medal, .lrow.m2 .medal, .lrow.m3 .medal {
  width: auto; height: auto; background: none !important; border: 0; box-shadow: none !important;
  font: 900 22px/1 var(--display); color: var(--muted); letter-spacing: -.02em; justify-content: start;
}
.lrow.m1 .medal { color: #e8c26a; }
.lrow.m2 .medal { color: #c9ccd2; }
.lrow.m3 .medal { color: #c88a5b; }
.lrow .avatar { border-radius: 4px; }
.lrow .nm { font-size: 15.5px; }
.lrow .rrbar .meter { height: 3px; background: var(--surface-3); }
.lrow .rrbar .meter i { background: var(--text); opacity: .55; }
.lrow.m1 .rrbar .meter i { background: #e8c26a; opacity: .9; }
.lrow .rr b { font-family: var(--display); font-size: 20px; }
.lrow.m1 .rr b { color: #e8c26a; }
.lb-pager { margin-top: 18px; }
.lb-pager .pages button.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.pv-stat .spark polyline:not(.base) { stroke: color-mix(in srgb, var(--a1) 40%, var(--text)); }
.pv-sub i { background: color-mix(in srgb, var(--a1) 50%, #ece8e1); }
.badge.nonstd { color: var(--muted); border-style: dashed; }
