@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Noto+Sans+JP:wght@400;500;700;900&display=swap');

/* ============ tokens ============ */
:root {
  --bg: #090b11;
  --bg2: #0e1118;
  --panel: #131722;
  --panel2: #1a1f2e;
  --line: #222838;
  --line2: #2d3548;
  --text: #e9ecf4;
  --muted: #8891a7;
  --dim: #5b6279;
  --accent: #f0b232;
  --live: #ff5252;

  /* ティア色（Tier1=金 → Tier5=灰） */
  --t1: #f5c542;
  --t2: #c9d2e6;
  --t3: #e0944f;
  --t4: #6aa3e8;
  --t5: #8f98ad;

  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 18px 40px -24px rgba(0,0,0,.85);
  --ease: cubic-bezier(.2,.7,.2,1);
  --font: 'Inter', 'Noto Sans JP', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 12% -150px, rgba(240,178,50,.10), transparent 70%),
    radial-gradient(800px 420px at 96% -120px, rgba(106,163,232,.10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
::selection { background: rgba(240,178,50,.3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ============ header ============ */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(9,11,17,.72);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 19px; letter-spacing: .2px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: conic-gradient(from 210deg, var(--t1), var(--t3), var(--t4), var(--t1));
  display: grid; place-items: center; color: #0b0d13; font-weight: 900; font-size: 16px;
  box-shadow: 0 8px 20px -8px rgba(245,197,66,.7);
}
.logo .sub { color: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav a { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; transition: color .15s, background .15s; }
.nav a.active, .nav a:hover { color: var(--text); background: var(--panel2); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.livebadge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); white-space: nowrap;
}
.livebadge i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.livebadge.on { color: #ff7b7b; border-color: rgba(255,82,82,.4); background: rgba(255,82,82,.08); }
.livebadge.on i { background: var(--live); animation: pulse 1.6s infinite; }

.search { position: relative; }
.search input {
  width: 250px; padding: 9px 14px 9px 38px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s, width .25s var(--ease);
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: rgba(240,178,50,.6); box-shadow: 0 0 0 3px rgba(240,178,50,.14); width: 290px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.top-right { flex-wrap: nowrap; }
.dl-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 15px; border-radius: 10px; font-size: 14px; font-weight: 800;
  color: #0b0d13; background: linear-gradient(180deg, #f7c456, var(--accent));
  box-shadow: 0 8px 20px -10px rgba(240,178,50,.8);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s;
}
.dl-btn:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 10px 24px -10px rgba(240,178,50,.9); }
.dl-btn:active { transform: translateY(0); }

/* ============ layout ============ */
.wrap { max-width: 1200px; margin: 0 auto; padding: 34px 20px 64px; }

.hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 26px;
}
.eyebrow {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent); background: rgba(240,178,50,.08); border: 1px solid rgba(240,178,50,.25);
  padding: 4px 10px; border-radius: 999px;
}
.hero h1 { margin: 14px 0 6px; font-size: clamp(28px, 4vw, 40px); font-weight: 900; letter-spacing: -.6px; line-height: 1.1; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; max-width: 560px; }

.kpis { display: flex; gap: 10px; margin: 0; flex-wrap: wrap; }
.kpis > div {
  min-width: 124px; padding: 12px 16px; border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line);
}
.kpis dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.kpis dd { margin: 4px 0 0; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }

.toolbar { margin-bottom: 16px; }
.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
}
.tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 9px 16px; border-radius: 9px; font-weight: 700; font-size: 14px;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel2); color: var(--text); box-shadow: 0 0 0 1px var(--line2), 0 6px 14px -6px rgba(0,0,0,.6); }

/* ============ leaderboard ============ */
.board {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.board-head, .row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 110px 140px 118px;
  align-items: center; gap: 14px; padding: 0 22px;
}
.board-head {
  height: 42px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .9px;
  color: var(--dim); border-bottom: 1px solid var(--line); background: rgba(0,0,0,.18);
}
.board-head > div:last-child { text-align: center; }
.row {
  position: relative; min-height: 70px; padding-top: 10px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line); color: inherit;
  transition: background .15s var(--ease);
}
.row::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--tc, transparent);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: rgba(255,255,255,.025); }
.row.lv1 { --tc: var(--t1); }
.row.lv2 { --tc: var(--t2); }
.row.lv3 { --tc: var(--t3); }
.row.lv4 { --tc: var(--t4); }
.row.lv5 { --tc: var(--t5); }

.pos {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--muted);
  background: var(--bg2); border: 1px solid var(--line);
}
.pos.p1 { background: linear-gradient(135deg, #ffe489, #c98d17); color: #1a1405; border-color: transparent; box-shadow: 0 8px 20px -8px rgba(245,197,66,.7); }
.pos.p2 { background: linear-gradient(135deg, #f3f6fc, #8d98b3); color: #14161c; border-color: transparent; }
.pos.p3 { background: linear-gradient(135deg, #f4b27a, #8b4b1c); color: #1c1006; border-color: transparent; }
.pos.pu { background: none; border-color: transparent; color: var(--dim); font-size: 16px; }

.who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.who img {
  width: 44px; height: 44px; flex: none; border-radius: 10px; image-rendering: pixelated;
  background: var(--bg2); box-shadow: 0 0 0 2px var(--tc, var(--line2));
}
.who-text { min-width: 0; }
.who .name {
  font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.who .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.who .m-only { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row:hover .name { color: #fff; }

.num { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.num small { display: block; color: var(--dim); font-weight: 600; font-size: 11px; margin-top: 2px; }
.row .num { text-align: center; }

/* tier pill */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 64px; padding: 5px 11px; border-radius: 999px;
  font-weight: 800; font-size: 12px; letter-spacing: .6px;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 13%, transparent);
  white-space: nowrap;
}
.pill.big { font-size: 18px; padding: 9px 22px; min-width: 110px; }
.pill.unranked { color: var(--dim); border-style: dashed; background: none; }
.c1 { color: var(--t1); } .c2 { color: var(--t2); } .c3 { color: var(--t3); }
.c4 { color: var(--t4); } .c5 { color: var(--t5); }
.lt { opacity: .72; }
.ht { box-shadow: 0 0 16px -2px color-mix(in srgb, currentColor 45%, transparent); }
.row > div:last-child { display: flex; justify-content: center; }

.row.unranked { opacity: .7; }
.section-sep {
  padding: 10px 22px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--dim); background: rgba(0,0,0,.18); border-bottom: 1px solid var(--line);
}

/* live */
.fighting {
  display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 2px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  color: #ff7b7b; background: rgba(255,82,82,.12); border: 1px solid rgba(255,82,82,.35);
}
.fighting::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live);
  animation: pulse 1.6s infinite;
}
.row.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: rgba(240,178,50,.18); } to { background: transparent; } }
.num.bump { animation: numbump .5s ease-out; }
@keyframes numbump { 0% { color: var(--accent); transform: scale(1.12); } 100% { color: inherit; transform: none; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,82,82,.7); }
  70% { box-shadow: 0 0 0 7px rgba(255,82,82,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,82,82,0); }
}

/* ============ tiers view ============ */
.tiergrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tcol {
  --tc: var(--t5);
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.tcol.lv1 { --tc: var(--t1); }
.tcol.lv2 { --tc: var(--t2); }
.tcol.lv3 { --tc: var(--t3); }
.tcol.lv4 { --tc: var(--t4); }
.tcol.lv5 { --tc: var(--t5); }
.tcol h3 {
  margin: 0; padding: 14px 10px; text-align: center;
  font-size: 15px; font-weight: 900; letter-spacing: .4px; color: var(--tc);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 16%, transparent), transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 2px 0 var(--tc);
}
.tcol ul { list-style: none; margin: 0; padding: 6px; }
.tcol li a {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px;
  font-size: 14px; font-weight: 600; transition: background .15s;
}
.tcol li a:hover { background: var(--panel2); }
.tcol li img { width: 22px; height: 22px; flex: none; border-radius: 5px; image-rendering: pixelated; }
.tcol li span.name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcol li .lvl {
  font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px;
  border: 1px solid currentColor; letter-spacing: .4px;
}
.tcol .empty { color: var(--dim); font-size: 13px; text-align: center; padding: 16px 0; }

/* requirements */
.req { margin-top: 34px; }
.section-title { margin: 0 0 12px; font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
.table-wrap {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.req table { width: 100%; border-collapse: collapse; }
.req th, .req td { padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.req tr:last-child td { border-bottom: 0; }
.req th {
  color: var(--dim); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .9px;
  background: rgba(0,0,0,.18);
}
.req td.num { font-size: 15px; }
.req tr.hard td { background: color-mix(in srgb, var(--t1) 5%, transparent); }
.req tr.hard td:first-child { box-shadow: inset 3px 0 0 var(--t1); }

/* ============ player page ============ */
.profile {
  --tc: var(--line2);
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 30px;
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: 18px; padding: 28px;
  box-shadow: var(--shadow);
}
.profile.lv1 { --tc: var(--t1); }
.profile.lv2 { --tc: var(--t2); }
.profile.lv3 { --tc: var(--t3); }
.profile.lv4 { --tc: var(--t4); }
.profile.lv5 { --tc: var(--t5); }
.profile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 220px; pointer-events: none;
  background: radial-gradient(640px 220px at 0% 0%, color-mix(in srgb, var(--tc) 22%, transparent), transparent 70%);
}
.profile > * { position: relative; }
.profile .body {
  display: grid; place-items: center; min-height: 330px; padding: 18px;
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--tc) 22%, transparent), transparent 62%),
    var(--bg2);
  border: 1px solid var(--line); border-radius: 14px;
}
.profile .body img { height: 280px; width: auto; max-width: 100%; image-rendering: pixelated; filter: drop-shadow(0 18px 22px rgba(0,0,0,.55)); }
.profile h1 { margin: 0; font-size: clamp(28px, 4vw, 36px); font-weight: 900; letter-spacing: -.5px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.profile .rankline { display: flex; align-items: center; gap: 16px; margin: 14px 0 22px; flex-wrap: wrap; }
.profile .rankline .posbig { font-size: 14px; color: var(--muted); }
.profile .rankline .posbig b { color: var(--text); font-size: 22px; font-weight: 900; margin-left: 2px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  transition: transform .2s var(--ease), border-color .2s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--line2); }
.stat .k { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; }
.stat .v { font-size: 26px; font-weight: 900; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }

.progress {
  margin-top: 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; font-size: 14px; color: var(--muted); line-height: 1.7;
}
.progress b { color: var(--text); }
.progress .pill { min-width: 0; padding: 3px 10px; vertical-align: middle; }
.bar { height: 10px; background: var(--line); border-radius: 99px; margin-top: 12px; overflow: hidden; }
.bar i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--tc, var(--accent)), color-mix(in srgb, var(--tc, var(--accent)) 55%, #fff));
}
.section-title-wrap { margin: 34px 0 12px; }

.mu .board-head, .mu .row { grid-template-columns: minmax(0, 1fr) 100px 100px 100px 100px; }
.mu .board-head > div:not(:first-child) { text-align: center; }
.mu .row .num { text-align: center; }

.notice { color: var(--muted); text-align: center; padding: 64px 16px; line-height: 1.8; }
.foot { color: var(--dim); font-size: 12px; text-align: center; margin-top: 38px; }

/* ============ realtime pulse ============ */
@media (max-width: 1040px) {
  .tiergrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .top-inner { padding: 10px 14px; gap: 10px; }
  .nav { display: none; }
  .search input, .search input:focus { width: 120px; }
  .top-right { gap: 8px; }
  .dl-btn { padding: 9px 11px; font-size: 13px; gap: 5px; }
  .wrap { padding: 24px 14px 52px; }
  .hero { margin-bottom: 20px; }
  .kpis { width: 100%; }
  .kpis > div { flex: 1; min-width: 0; padding: 10px 12px; }
  .kpis dd { font-size: 20px; }

  .board-head, .row { grid-template-columns: 46px minmax(0, 1fr) 84px; gap: 8px; padding: 0 12px; }
  .pos { margin-left: 2px; }
  .board-head .hide-sm, .row .hide-sm { display: none; }
  .who .m-only { display: block; }
  .row { min-height: 66px; }
  .pos { width: 34px; height: 34px; font-size: 14px; border-radius: 9px; }
  .who img { width: 38px; height: 38px; }
  .who .name { font-size: 15px; }
  .section-sep { padding: 10px 14px; }

  .tiergrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .profile { grid-template-columns: 1fr; gap: 20px; padding: 18px; }
  .profile .body { min-height: 240px; }
  .profile .body img { height: 220px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 22px; }

  .mu .board-head, .mu .row { grid-template-columns: minmax(0, 1fr) 72px 72px; }
  .mu .hide-sm { display: none !important; }
  .table-wrap { overflow-x: auto; }
}

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

.progress .sub { margin-top: 10px; font-size: .9em; }
.bar.thin { height: 6px; margin-top: 6px; }

/* 進捗バーの色分け（1本のバーの中で 比率ぶん / スキル補正ぶん） */
:root { --seg-skill: #4fd1c5; }
.bar.split { display: flex; }
.bar.split i { border-radius: 0; flex: none; }
.bar.split i:first-child { border-radius: 99px 0 0 99px; }
.bar.split i:last-child { border-radius: 0 99px 99px 0; }
.bar.split i:only-child { border-radius: 99px; }
.seg-ratio { background: linear-gradient(90deg, var(--tc, var(--accent)), color-mix(in srgb, var(--tc, var(--accent)) 70%, #fff)) !important; }
.seg-skill { background: linear-gradient(90deg, var(--seg-skill), color-mix(in srgb, var(--seg-skill) 60%, #fff)) !important; }
.progress .legend { margin-top: 8px; font-size: .85em; display: flex; align-items: center; gap: 6px; }
.progress .legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.progress .legend .sw:first-child { margin-left: 0; }
.progress .breakdown { margin-left: 6px; font-size: .9em; }
.progress .plus-skill { color: var(--seg-skill); font-weight: 700; }
.progress .legend .ramp { margin-left: 6px; color: var(--dim); }
/* スキル分が細すぎて見えないとき用に最低幅をつける */
.bar.split .seg-skill { min-width: 4px; }
:root { --seg-penalty: #ef5b5b; }
.seg-penalty { background: repeating-linear-gradient(135deg, var(--seg-penalty) 0 6px, color-mix(in srgb, var(--seg-penalty) 65%, #000) 6px 12px) !important; }
.bar.split .seg-penalty { min-width: 4px; }
.progress .minus-skill { color: var(--seg-penalty); font-weight: 700; }
.progress .breakdown-line { font-size: .9em; margin-top: 2px; }
