@import url(/css/fonts.css);

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --line: #e6e7eb;
  --line-strong: #d9dbe1;
  --ink: #0c0d10;
  --ink-2: #3b3e45;
  --muted: #6d7078;
  --blue: #2b4ee6;
  --blue-deep: #2140c9;
  --blue-tint: #eef1fe;
  --blue-line: #c9d2fb;
  --green: #1fa463;
  --red: #e5484d;
  --radius: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
b { font-weight: 600; }
[hidden] { display: none !important; }

main { max-width: 820px; margin: 0 auto; padding: 0 20px 48px; }

.testbar { background: #ffb020; color: #1a1200; text-align: center; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; padding: 7px 12px; }

/* ---------- header ---------- */
.top {
  max-width: 820px; margin: 0 auto; padding: 22px 20px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.how { font-size: 13.5px; font-weight: 500; color: var(--muted); text-align: right; }
.how b { color: var(--ink); }

/* ---------- hero ---------- */
.hero { padding: 26px 0 18px; }
.hero h1 {
  margin: 0; font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(42px, 8.8vw, 80px); line-height: .9; letter-spacing: -.035em;
}
.h1a, .h1b { display: block; }
.h1b { color: var(--blue); }
.you {
  margin: 16px 0 0; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  padding: 10px 14px 10px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  font-size: 14.5px; color: var(--ink-2); box-shadow: 0 1px 2px rgba(12,13,16,.03);
}
.you b { color: var(--ink); }
.you .flag.sm { border-radius: 3px; }
.you .amt { color: var(--blue); font-weight: 700; font-size: 16px; }
.you .link { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; }
.you .link:hover { text-decoration: underline; }

/* ---------- live bar ---------- */
.live {
  display: flex; align-items: center; gap: 14px; min-height: 48px;
  padding: 10px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; color: var(--ink-2); box-shadow: 0 1px 2px rgba(12,13,16,.03);
  overflow: hidden; white-space: nowrap; margin-top: 18px;
}
.live-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); font-weight: 700; font-size: 12.5px; letter-spacing: .04em; flex: none; }
.live-items { display: block; flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 94%, transparent); }
.live-track { display: inline-flex; white-space: nowrap; will-change: transform; animation: marquee var(--loop, 24s) linear infinite; }
.live-track.is-static { animation: none; }
.live:hover .live-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.live-item { display: inline-flex; align-items: center; gap: 6px; padding-right: 16px; margin-right: 16px; border-right: 1px solid var(--line); flex: none; }
.live-item.in b { color: var(--blue); }
.live-ago { flex: none; color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
@keyframes slide-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- battle for #1 ---------- */
.battle {
  margin-top: 14px; padding: 18px 20px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(12,13,16,.03);
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "lead vs chal" "bar bar bar" "gap gap gap"; align-items: center; column-gap: 14px;
}
.battle-side { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 4px; margin: -4px; border: 0; background: none; border-radius: 12px; text-align: left; transition: background-color .15s ease; }
.battle-side:hover { background: var(--bg); }
.battle-side.is-chal { grid-area: chal; }
.battle-side.is-chal { justify-content: flex-end; text-align: right; }
.battle-side.is-lead { grid-area: lead; }
.flag.round { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(12,13,16,.08), 0 2px 6px rgba(12,13,16,.08); flex: none; }
.battle-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.battle-rank { font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.is-chal .battle-rank { color: var(--red); }
.is-lead .battle-rank { color: var(--blue); }
.battle-name { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.battle-power { margin-top: 4px; }
.battle-power b { font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -.02em; color: var(--ink); }
.battle-power small { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-left: 2px; }
.is-lead .battle-power small { color: var(--blue); }
.battle-vs { grid-area: vs; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--ink-2); background: var(--card); }
.battle-bar { grid-area: bar; display: flex; height: 10px; margin-top: 14px; border-radius: 999px; overflow: hidden; background: var(--line); gap: 3px; }
.battle-fill { height: 100%; transition: width .7s var(--ease); }
.battle-fill.chal { background: var(--red); border-radius: 0 999px 999px 0; background-image: repeating-linear-gradient(-55deg, rgba(255,255,255,.18) 0 4px, transparent 4px 9px); }
.battle-fill.lead { background: var(--blue); border-radius: 999px 0 0 999px; background-image: repeating-linear-gradient(-55deg, rgba(255,255,255,.18) 0 4px, transparent 4px 9px); }
.battle-gap { grid-area: gap; justify-self: center; margin-top: 10px; border: 0; background: none; padding: 4px 8px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.battle-gap b { color: var(--red); font-weight: 800; font-size: 15px; }
.battle-gap:hover { background: var(--bg); color: var(--ink); }

/* ---------- stats ---------- */
.label { margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stats { margin: 14px 0 -6px; text-align: right; font-size: 12.5px; color: var(--muted); }
.stats b { color: var(--ink); font-weight: 600; }

/* ---------- board ---------- */
.board { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(12,13,16,.03); overflow: hidden; }
.board-head, .row { display: grid; grid-template-columns: 64px 1fr 140px 240px; align-items: center; gap: 12px; }
.board-head { padding: 16px 22px 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.board-head-power { text-align: right; padding-right: 36px; } /* = .power padding (8) + gap (14) + arrow (14): right edge matches the figures */
.rows { list-style: none; margin: 0; padding: 0; position: relative; }
.row {
  padding: 15px 22px; border-top: 1px solid var(--line); background: var(--card); position: relative; cursor: pointer;
  transition: background-color .25s ease;
}
.row:hover { background: #fafbff; }

.row.is-collapsed, .more-row.is-collapsed { display: none; }
.row.is-top { background: linear-gradient(90deg, #e9edfd, #f1f4ff 60%, #eef1fe); box-shadow: inset 4px 0 0 var(--blue), inset 0 0 0 1px rgba(43,78,230,.12), 0 6px 22px -14px rgba(43,78,230,.55); }
.row.is-top:hover { background: linear-gradient(90deg, #e3e8fd, #edf0ff 60%, #e9edfd); }
.row.is-top .rank { color: #d4a11e; }
.crown { display: inline-block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.team-text { display: flex; flex-direction: column; min-width: 0; }
.hook-sub { display: none; }
.world1 { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); line-height: 1.1; margin-bottom: 2px; }
.row.is-mine:not(.is-top) { box-shadow: inset 4px 0 0 var(--blue-line); }
.row.flash { background: #f3f6ff; }
.row.is-top.flash { background: #dfe5fc; }
.rank { font-size: 22px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; }
.rank .crown { width: 22px; height: 22px; }
.team { display: flex; align-items: center; gap: 14px; min-width: 0; }
.flag { width: 36px; height: 27px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(12,13,16,.08); object-fit: cover; flex: none; background: #eee; }
.flag.sm { width: 24px; height: 18px; border-radius: 3px; }
.flag.xs { width: 18px; height: 13px; border-radius: 2px; }
.flag.lg { width: 72px; height: 54px; border-radius: 6px; }
.name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.power { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-right: 8px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.is-top .power-val { color: var(--blue); }
.power-val { display: inline-block; transition: transform .35s var(--ease), color .35s ease; transform-origin: right center; }
.power-val.bump { transform: scale(1.08); color: var(--blue); }
.mv { width: 14px; font-size: 15px; font-weight: 600; text-align: center; }
.mv.up { color: var(--green); }
.mv.down { color: var(--red); }
.cta { display: flex; align-items: center; justify-content: flex-end; gap: 14px; white-space: nowrap; }
.hook { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.cta-amt { font-size: 15px; letter-spacing: -.01em; }
.cta-dot { color: var(--blue-line); font-weight: 400; }
.is-top .cta-amt { text-transform: none; letter-spacing: 0; font-weight: 700; }
.back {
  border: 0; border-radius: 10px; padding: 10px 18px; background: var(--blue); color: #fff;
  font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; flex: none;
  box-shadow: 0 1px 2px rgba(43,78,230,.25); transition: background-color .15s ease, transform .15s ease;
}
.back:hover { background: var(--blue-deep); }
.back:active { transform: scale(.97); }
.row:hover .back { background: var(--blue-deep); }
.more-row { border-top: 1px solid var(--line); text-align: center; padding: 10px; }
.show-all { background: none; border: 0; padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.show-all:hover { color: var(--blue); background: var(--blue-tint); }

/* ---------- activity ---------- */
.activity { margin-top: 20px; padding: 18px 22px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(12,13,16,.03); }
.acts { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.act { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.act.in { animation: slide-in .5s var(--ease); }
.act-text { flex: 1; min-width: 0; }
.act-ago { color: var(--muted); font-size: 12.5px; flex: none; }

.foot { max-width: 820px; margin: 0 auto; padding: 8px 20px 40px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ---------- payment sheet ---------- */
.sheet {
  width: min(430px, calc(100% - 24px)); max-height: min(92vh, 92dvh); overflow: auto; overscroll-behavior: contain;
  padding: 0; border: 0; border-radius: 22px; background: var(--card); color: var(--ink);
  box-shadow: 0 30px 80px rgba(12,13,16,.25);
}
.sheet::backdrop { background: rgba(12,13,16,.42); }
.sheet[open] { animation: sheet-in .28s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.sheet-card { padding: 26px 22px 20px; text-align: center; position: relative; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg); color: var(--muted); font-size: 20px; line-height: 1; display: grid; place-items: center; }
.sheet-close:hover { color: var(--ink); }
.sheet .flag.lg { margin: 0 auto; }
.sheet-name { margin: 14px 0 0; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 27px; letter-spacing: -.02em; line-height: 1.05; }
.sheet-rank { margin: 4px 0 0; color: var(--blue); font-weight: 500; font-size: 15px; }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.sheet-power { margin: 2px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 40px; letter-spacing: -.03em; line-height: 1.1; }
.sheet-note { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--blue-tint); border: 1px solid var(--blue-line); font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.sheet-note .note-title { display: block; color: var(--blue); font-weight: 700; font-size: 15px; }
.sheet .label { margin-top: 22px; }
.chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 12px; }
.chip { grid-column: span 2; padding: 14px 0; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--card); font-size: 17px; font-weight: 700; letter-spacing: -.01em; transition: all .15s ease; }
.chip.wide { grid-column: span 3; }
.chip.take { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; border-color: var(--blue-line); background: var(--blue-tint); color: var(--blue); }
.chip.take small { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chip.take[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.take[aria-pressed="true"] small { color: rgba(255,255,255,.85); }
.chip:hover { border-color: var(--blue); }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.custom { display: flex; align-items: stretch; margin-top: 10px; border: 1.5px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--card); transition: border-color .15s ease; }
.custom:focus-within { border-color: var(--blue); }
.custom span { display: grid; place-items: center; padding: 0 14px; background: var(--bg); font-weight: 700; font-size: 17px; border-right: 1px solid var(--line); }
.custom input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 14px; font: inherit; font-size: 16px; font-weight: 600; background: transparent; color: var(--ink); }
.custom input::placeholder { color: var(--muted); font-weight: 400; }
.pay-area { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
#ece { min-height: 0; }
#ece:empty { display: none; }
.diag { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff7e0; color: #5a4300; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: left; word-break: break-all; }
#pe { text-align: left; }
.pay-btn { width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--blue); color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -.01em; transition: background-color .15s ease, transform .15s ease; }
.pay-btn:hover { background: var(--blue-deep); }
.pay-btn:active { transform: scale(.99); }
.pay-btn[disabled] { opacity: .6; cursor: default; }
.more { background: none; border: 0; padding: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; margin: 4px auto 0; }
.more:hover { color: var(--ink); }
.more svg { transition: transform .2s ease; }
.more[aria-expanded="true"] svg { transform: rotate(180deg); }
.err { margin: 10px 0 0; font-size: 13.5px; color: var(--red); min-height: 0; }
.err:empty { display: none; }
.secure { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.done { padding: 40px 22px 28px; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; margin: 0 auto 18px; animation: pop .45s var(--ease); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.done h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; text-transform: uppercase; }
.done p { margin: 8px 0 0; color: var(--ink-2); }
.done .pay-btn { margin-top: 22px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; vertical-align: -4px; margin-right: 8px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- mobile ---------- */
@media (max-width: 680px) {
  main { padding: 0 14px 40px; }
  .top { padding: 16px 16px 2px; }
  .how { display: none; }
  .hero { padding: 14px 0 12px; }
  .hero h1 { font-size: clamp(40px, 12vw, 52px); }
  .you { font-size: 13.5px; padding: 8px 12px; border-radius: 14px; margin-top: 12px; }
  .live { font-size: 13px; padding: 9px 12px; gap: 10px; margin-top: 14px; }
  .total { padding: 26px 0 18px; }
  .board-head { display: none; }
  .row { grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 10px; padding: 11px 12px 11px 14px; }
  .rank { font-size: 17px; }
  .team { gap: 10px; }
  .flag { width: 30px; height: 22px; }
  .name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
  .cta .hook, .world1 { display: none; }
  .hook-sub { display: block; margin-top: 1px; font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .back { padding: 8px 14px; font-size: 13.5px; border-radius: 9px; }
  .stats { text-align: center; margin: 12px 0 -6px; }
  .battle { padding: 14px 14px 12px; column-gap: 8px; }
  .battle-side { gap: 10px; }
  .flag.round { width: 42px; height: 42px; }
  .battle-name { font-size: 10.5px; letter-spacing: .02em; }
  .battle-power { white-space: nowrap; }
  .battle-power b { font-size: 21px; }
  .battle-power small { display: none; }
  .battle-vs { width: 32px; height: 32px; font-size: 10.5px; }
  .power { font-size: 15px; gap: 6px; padding-right: 0; }
  .mv { width: 12px; font-size: 13px; }
  .sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 94dvh; }
  .sheet-card { padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); }
  .sheet-name { font-size: 24px; }
  .sheet-power { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
