@font-face {
  font-family: "CTMKF";
  src:
    url("/assets/ctmkf.woff2") format("woff2"),
    url("/assets/ctmkf.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #080d14;
  --surface: #0f1823;
  --surface-raised: #13202d;
  --surface-soft: #182736;
  --line: #24384a;
  --line-bright: #35536d;
  --text: #f7fafc;
  --muted: #97a9ba;
  --muted-strong: #becbd6;
  --lime: #82ff00;
  --orange: #ffad17;
  --blue: #4bbcff;
  --blue-soft: #123453;
  --green: #4be09a;
  --gold: #f5c957;
  --silver: #c8d5e3;
  --bronze: #e29563;
  --danger: #ff7585;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  font-family:
    Inter, "Segoe UI", "Noto Sans", "Noto Sans CJK JP", Arial, sans-serif;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(12px);
}

.ambient-one {
  top: -320px;
  right: -220px;
  width: 760px;
  height: 660px;
  background: radial-gradient(circle, rgba(31, 145, 219, 0.2), transparent 66%);
}

.ambient-two {
  bottom: -360px;
  left: -320px;
  width: 760px;
  height: 760px;
  background: radial-gradient(circle, rgba(28, 87, 134, 0.12), transparent 68%);
}

.site-header,
main,
footer {
  width: min(1240px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 104px;
}

.brand {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  position: relative;
  display: block;
  width: 96px;
  height: 62px;
  overflow: hidden;
  border: 1px solid rgba(151, 220, 255, 0.38);
  border-radius: 15px;
  background: #020300;
  box-shadow:
    0 12px 36px rgba(28, 142, 215, 0.18),
    inset 0 0 0 1px rgba(151, 220, 255, 0.05);
}

.brand-logo img {
  position: absolute;
  top: -21px;
  left: -7px;
  width: 110px;
  height: 110px;
  max-width: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.source-link {
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted-strong);
  background: rgba(12, 21, 31, 0.72);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.source-link:hover {
  border-color: var(--line-bright);
  color: var(--text);
  transform: translateY(-1px);
}

.hero {
  position: relative;
  display: flex;
  min-height: 288px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  overflow: hidden;
  padding: 56px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 92% 0%, rgba(39, 162, 238, 0.22), transparent 43%),
    linear-gradient(135deg, rgba(17, 29, 41, 0.97), rgba(10, 17, 25, 0.97));
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  top: 0;
  left: 56px;
  width: 190px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--blue), transparent);
  content: "";
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-brand-logo {
  position: absolute;
  z-index: 1;
  top: -52px;
  right: 120px;
  width: 390px;
  height: 390px;
  overflow: hidden;
  opacity: 0.22;
  pointer-events: none;
  filter: saturate(1.08);
}

.hero-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.live-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b2d7ec;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(245, 201, 87, 0.1);
}

body[data-connected="true"] .live-dot {
  background: var(--green);
  animation: live-breathe 2.8s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

body[data-connected="true"] .live-dot::after {
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(75, 224, 154, 0.58);
  border-radius: inherit;
  content: "";
  animation: live-ring 2.8s cubic-bezier(0.2, 0.65, 0.3, 1) infinite;
  pointer-events: none;
}

.hero h1 {
  max-width: 760px;
  margin: 20px 0 10px;
  font-size: clamp(38px, 5.2vw, 70px);
  line-height: 1.02;
  letter-spacing: -0.052em;
}

.hero p {
  max-width: 650px;
  margin: 0;
  color: var(--muted-strong);
  font-size: clamp(16px, 2vw, 19px);
}

.hero-meta {
  position: relative;
  z-index: 1;
  min-width: 202px;
  padding: 17px 19px;
  border: 1px solid rgba(110, 183, 228, 0.3);
  border-radius: 15px;
  background: rgba(8, 16, 24, 0.72);
}

.hero-meta span,
.hero-meta strong {
  display: block;
}

.hero-meta span {
  color: #9eb1c2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-meta strong {
  margin-top: 6px;
  font-size: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 42px;
}

.stats article {
  min-height: 142px;
  padding: 25px 27px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(15, 24, 35, 0.94);
}

.stats span,
.stats small,
.stats strong {
  display: block;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stats strong {
  overflow: hidden;
  margin: 8px 0 1px;
  font-size: 29px;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats small {
  color: #879aab;
  font-size: 13px;
}

.ranking-shell {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(11, 18, 27, 0.93);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 2px 25px;
}

.toolbar h2 {
  margin: 1px 0 0;
  font-size: 27px;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search {
  display: flex;
  height: 44px;
  min-width: 245px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted-strong);
  background: #0e1721;
}

.search:focus-within {
  border-color: #2e79a8;
  box-shadow: 0 0 0 3px rgba(62, 181, 255, 0.08);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
}

.search input::placeholder {
  color: #8396a8;
}

.filter-button,
.icon-button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted-strong);
  background: #0e1721;
  cursor: pointer;
}

.filter-button {
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

.filter-button[aria-pressed="true"] {
  border-color: #206b4b;
  color: var(--green);
  background: rgba(32, 107, 75, 0.17);
}

.icon-button {
  width: 44px;
  font-size: 22px;
  line-height: 1;
}

.icon-button.is-loading {
  animation: spin 700ms linear infinite;
}

.column-head,
.ranking-row {
  display: grid;
  grid-template-columns:
    88px minmax(285px, 1.5fr) minmax(245px, 0.95fr)
    minmax(130px, 0.6fr) minmax(170px, 0.78fr);
  align-items: center;
}

.column-head {
  padding: 0 20px 12px;
  color: #73889b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-row {
  position: relative;
  min-height: 112px;
  padding: 16px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(105deg, #14212d, #111b26 62%, #0f1822);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.ranking-row:hover {
  border-color: #3a5b76;
  background: linear-gradient(105deg, #172633, #13202c 62%, #111c27);
  transform: translateY(-1px);
}

.ranking-row.is-rank-moving {
  z-index: 3;
  will-change: transform;
}

.ranking-row.is-rank-moving.rank-up {
  border-color: rgba(75, 224, 154, 0.58);
  box-shadow: 0 18px 48px rgba(38, 178, 118, 0.14);
}

.ranking-row.is-rank-moving.rank-down {
  border-color: rgba(255, 158, 112, 0.52);
  box-shadow: 0 18px 48px rgba(226, 119, 75, 0.12);
}

.ranking-row[data-position="1"] {
  border-color: rgb(239 184 65 / 58%);
  background:
    radial-gradient(circle at 88% 50%, rgb(239 184 65 / 11%), transparent 31%),
    linear-gradient(105deg, #1b1d20, #121a22 62%, #10171d);
  box-shadow:
    inset 0 0 0 1px rgb(239 184 65 / 5%),
    0 10px 32px rgb(0 0 0 / 12%);
}

.ranking-row[data-position="1"]:hover {
  border-color: rgb(255 205 92 / 68%);
  background:
    radial-gradient(circle at 88% 50%, rgb(239 184 65 / 15%), transparent 33%),
    linear-gradient(105deg, #202125, #151c23 62%, #111920);
}

.ranking-row::before {
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--lime), #dfff00);
  content: "";
}

.ranking-row[data-position="1"]::before {
  background: linear-gradient(180deg, #eaff00, var(--orange));
}

.ranking-row[data-position="2"]::before {
  background: var(--silver);
}

.ranking-row[data-position="3"]::before {
  background: var(--bronze);
}

.ranking-row.is-suspicious {
  border-color: rgba(255, 117, 133, 0.58);
  background:
    radial-gradient(circle at 88% 50%, rgba(255, 117, 133, 0.1), transparent 34%),
    linear-gradient(105deg, #241a20, #171a22 62%, #121820);
  box-shadow:
    inset 0 0 0 1px rgba(255, 117, 133, 0.05),
    0 10px 32px rgba(69, 18, 30, 0.12);
}

.ranking-row.is-suspicious:hover {
  border-color: rgba(255, 139, 151, 0.72);
  background:
    radial-gradient(circle at 88% 50%, rgba(255, 117, 133, 0.14), transparent 35%),
    linear-gradient(105deg, #2a1d23, #1b1d25 62%, #141b23);
}

.ranking-row.is-suspicious::before {
  background: #ff7585;
}

.ranking-row.is-suspicious .name {
  color: #ffd5d9;
}

.position {
  display: inline-grid;
  width: 64px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  color: #8bd3ff;
  background: var(--blue-soft);
  font-size: 18px;
  font-weight: 900;
}

.ranking-row[data-position="1"] .position {
  color: #ffe594;
  background: #342b17;
}

.ranking-row[data-position="1"] .name {
  color: #ffe7a3;
}

.ranking-row[data-position="2"] .position {
  color: #e7eff8;
  background: #222d39;
}

.ranking-row[data-position="3"] .position {
  color: #ffc29b;
  background: #34241d;
}

.player {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 17px;
}

.mii {
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #23394c;
  border-radius: 50%;
  object-fit: contain;
  background: #162330;
}

.mii-fallback {
  color: #dcecff;
  background: linear-gradient(145deg, #29445d, #172938);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.player-copy {
  min-width: 0;
}

.name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
    "Noto Sans CJK JP", "CTMKF", sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-profile-link {
  width: fit-content;
  max-width: 100%;
  text-decoration: none;
  transition:
    color 160ms ease,
    text-decoration-color 160ms ease;
}

.player-profile-link:hover {
  color: #9edcff;
  text-decoration: underline;
  text-decoration-color: rgba(75, 188, 255, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

#stat-leader {
  color: #ffe7a3;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
    "Noto Sans CJK JP", "CTMKF", sans-serif;
}

.friend-code {
  margin-top: 4px;
  color: #9aabba;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.player-flags {
  display: flex;
  gap: 6px;
  margin-top: 5px;
}

.flag {
  padding: 2px 6px;
  border-radius: 5px;
  color: #d8b865;
  background: rgba(216, 184, 101, 0.08);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.flag.is-suspicious {
  border: 1px solid rgba(255, 117, 133, 0.3);
  color: #ffadb7;
  background: rgba(255, 117, 133, 0.1);
}

.vr {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.performance {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(70px, auto);
  align-items: center;
  gap: 22px;
}

.vr strong {
  font-size: clamp(24px, 2.3vw, 31px);
  letter-spacing: -0.04em;
  transition:
    color 260ms ease,
    text-shadow 260ms ease,
    transform 260ms ease;
}

.vr-value.is-vr-counting {
  transform: translateY(-1px);
}

.vr-value.is-vr-counting.vr-gain {
  color: var(--green);
  text-shadow: 0 0 18px rgba(75, 224, 154, 0.23);
}

.vr-value.is-vr-counting.vr-loss {
  color: var(--danger);
  text-shadow: 0 0 18px rgba(255, 117, 133, 0.2);
}

.vr-change {
  display: grid;
  align-content: center;
  gap: 1px;
  white-space: nowrap;
}

.vr-change strong {
  font-size: 18px;
  letter-spacing: -0.025em;
}

.vr-change small {
  color: #8296a8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.vr-change.positive strong,
.positive {
  color: var(--green);
}

.vr-change.negative strong,
.negative {
  color: var(--danger);
}

.vr-change.neutral strong,
.neutral {
  color: #9aabba;
}

.vr small {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.global-rank {
  display: grid;
  align-content: center;
  gap: 1px;
}

.global-rank strong {
  font-size: 19px;
}

.global-rank small {
  color: #8296a8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  justify-self: stretch;
  padding: 0 14px;
  border-radius: 11px;
  color: #b3c0cb;
  background: #1a2938;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.status::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #93a6b8;
  content: "";
}

.status.online {
  color: var(--green);
  background: rgba(31, 105, 75, 0.18);
}

.status.online::before {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(75, 224, 154, 0.08);
}

.loading-card,
.empty-card {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px dashed var(--line-bright);
  border-radius: 17px;
  color: var(--muted);
  background: rgba(13, 21, 31, 0.55);
  text-align: center;
}

.loading-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
  animation: live-pulse 1.4s ease-in-out infinite;
}

.ranking-demo-notice {
  position: fixed;
  z-index: 30;
  top: 22px;
  left: 50%;
  max-width: min(520px, calc(100% - 32px));
  padding: 11px 16px;
  border: 1px solid rgba(75, 188, 255, 0.48);
  border-radius: 12px;
  color: #dff3ff;
  background: rgba(9, 21, 31, 0.95);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  animation: demo-notice-in 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
  backdrop-filter: blur(12px);
}

.ranking-demo-notice.is-complete {
  border-color: rgba(75, 224, 154, 0.46);
  color: #b9f4d8;
}

.history-shell {
  margin-top: 42px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(11, 18, 27, 0.93);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

.history-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.history-heading h2 {
  margin: 3px 0 4px;
  font-size: 30px;
  letter-spacing: -0.035em;
}

.history-heading > div:first-child > p:last-child {
  max-width: 690px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.period-selector {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b141e;
}

.period-selector button {
  min-width: 58px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted-strong);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.period-selector button:hover {
  color: var(--text);
  background: #152434;
}

.period-selector button[aria-pressed="true"] {
  border-color: #318ece;
  color: #fff;
  background: #177fc0;
  box-shadow: 0 8px 24px rgba(23, 127, 192, 0.22);
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 25px 0 20px;
}

.history-stats article {
  min-height: 104px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #101b27;
}

.history-stats span,
.history-stats strong,
.history-stats small {
  display: block;
}

.history-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.history-stats strong {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.history-stats strong[data-trend="positive"] {
  color: var(--green);
}

.history-stats strong[data-trend="negative"] {
  color: var(--danger);
}

.history-stats small {
  color: #8296a8;
  font-size: 11px;
}

#history-total-caption.is-player-name {
  overflow: hidden;
  color: #b9c9d7;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
    "Noto Sans CJK JP", "CTMKF", sans-serif;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-stats small.is-extreme-caption {
  margin-top: 3px;
  color: #b9c9d7;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
    "Noto Sans CJK JP", "CTMKF", sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.history-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.legend-item {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #213448;
  border-radius: 10px;
  color: var(--muted-strong);
  background: #0e1823;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  text-align: left;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    opacity 180ms ease,
    filter 180ms ease;
}

.legend-item:hover {
  border-color: var(--line-bright);
  color: var(--text);
}

.legend-item.is-selected {
  border-color: var(--series-color);
  color: var(--text);
  background: #162332;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--series-color) 30%, transparent),
    0 8px 24px rgba(0, 0, 0, 0.18);
}

.history-legend.has-selection .legend-item.is-dimmed {
  opacity: 0.3;
  filter: grayscale(0.8);
}

.history-legend.has-selection .legend-item.is-dimmed:hover {
  opacity: 0.7;
  filter: grayscale(0.2);
}

.legend-item strong {
  overflow: hidden;
  max-width: 145px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
    "Noto Sans CJK JP", "CTMKF", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-item > span:last-child {
  color: #73899b;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 10%, transparent);
}

.chart-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #0b131e;
  scrollbar-color: #2a4359 #0b131e;
}

.chart-wrap::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  content: "";
  pointer-events: none;
}

#history-chart {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
  touch-action: pan-x;
}

.chart-background {
  fill: #0d1724;
}

.chart-grid {
  stroke: #33475b;
  stroke-dasharray: 5 7;
  stroke-opacity: 0.72;
  vector-effect: non-scaling-stroke;
}

.chart-grid-vertical {
  stroke-opacity: 0.28;
}

.chart-axis-label {
  fill: #91a2b4;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
}

.history-line {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
  pointer-events: none;
  shape-rendering: geometricPrecision;
  transition:
    opacity 180ms ease,
    filter 180ms ease,
    stroke-width 180ms ease;
}

.history-line.is-dimmed {
  opacity: 0.11;
  filter: grayscale(0.9);
}

.history-line.is-selected {
  opacity: 1;
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.16));
  stroke-width: 4px;
}

.chart-crosshair {
  stroke: #a9bfd1;
  stroke-dasharray: 4 6;
  stroke-opacity: 0.48;
  vector-effect: non-scaling-stroke;
}

.chart-hover-ring {
  fill: #0d1724;
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

.chart-hover-dot {
  vector-effect: non-scaling-stroke;
}

.chart-hit-area {
  cursor: crosshair;
  pointer-events: all;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 218px;
  padding: 13px 14px;
  border: 1px solid #365069;
  border-radius: 12px;
  color: var(--text);
  background: rgba(9, 16, 24, 0.97);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.tooltip-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tooltip-heading span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.tooltip-heading strong {
  overflow: hidden;
  max-width: 190px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
    "Noto Sans CJK JP", "CTMKF", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tooltip time {
  display: block;
  margin: 3px 0 9px 16px;
  color: #8fa2b4;
  font-size: 11px;
}

.tooltip-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
  padding-top: 8px;
  border-top: 1px solid #26394c;
}

.tooltip-values strong {
  font-size: 16px;
}

.tooltip-values span {
  font-size: 10px;
  font-weight: 800;
  text-align: right;
}

.chart-loading {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted-strong);
  background: rgba(9, 16, 24, 0.88);
  font-size: 13px;
  font-weight: 800;
  transition: opacity 180ms ease;
}

.chart-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.chart-error {
  fill: #95a8ba;
  font-family: "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
}

footer {
  display: flex;
  min-height: 110px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #788c9e;
  font-size: 13px;
  font-weight: 700;
}

footer a {
  color: #9aabba;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.82);
  }
}

@keyframes live-breathe {
  0%,
  100% {
    box-shadow:
      0 0 0 4px rgba(75, 224, 154, 0.08),
      0 0 8px rgba(75, 224, 154, 0.18);
    transform: scale(0.96);
  }
  50% {
    box-shadow:
      0 0 0 7px rgba(75, 224, 154, 0.13),
      0 0 15px rgba(75, 224, 154, 0.32);
    transform: scale(1.08);
  }
}

@keyframes live-ring {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  22% {
    opacity: 0.52;
  }
  72%,
  100% {
    opacity: 0;
    transform: scale(1.65);
  }
}

@keyframes demo-notice-in {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  .hero {
    min-height: 250px;
    align-items: flex-start;
    flex-direction: column;
    padding: 42px;
  }

  .hero-meta {
    min-width: 220px;
  }

  .hero-brand-logo {
    top: -20px;
    right: -24px;
    width: 330px;
    height: 330px;
    opacity: 0.16;
  }

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

  .column-head {
    display: none;
  }

  .ranking-row {
    grid-template-columns:
      78px minmax(210px, 1fr) minmax(205px, 0.78fr)
      minmax(140px, 0.66fr);
  }

  .global-rank {
    display: none;
  }

  .history-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 720px) {
  .site-header,
  main,
  footer {
    width: min(100% - 28px, 1240px);
  }

  .site-header {
    min-height: 86px;
  }

  .brand {
    gap: 10px;
  }

  .brand-logo {
    width: 76px;
    height: 52px;
    border-radius: 12px;
  }

  .brand-logo img {
    top: -17px;
    left: -6px;
    width: 88px;
    height: 88px;
  }

  .brand strong {
    font-size: 13px;
  }

  .source-link {
    padding-inline: 11px;
    font-size: 0;
  }

  .source-link span {
    font-size: 16px;
  }

  .hero {
    min-height: 0;
    gap: 28px;
    padding: 36px 26px 28px;
    border-radius: 22px;
  }

  .hero-brand-logo {
    top: 2px;
    right: -55px;
    width: 270px;
    height: 270px;
    opacity: 0.12;
  }

  .hero::after {
    left: 26px;
  }

  .hero h1 {
    font-size: clamp(36px, 12vw, 54px);
  }

  .stats {
    gap: 9px;
    margin-bottom: 28px;
  }

  .stats article {
    min-height: 126px;
    padding: 20px;
  }

  .stats strong {
    font-size: 24px;
  }

  .ranking-shell {
    padding: 20px 14px;
    border-radius: 20px;
  }

  .history-shell {
    margin-top: 28px;
    padding: 22px 14px;
    border-radius: 20px;
  }

  .history-heading {
    gap: 18px;
    padding-inline: 4px;
  }

  .history-heading h2 {
    font-size: 26px;
  }

  .period-selector {
    width: 100%;
    overflow-x: auto;
  }

  .period-selector button {
    flex: 1 0 auto;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }

  .search {
    min-width: 0;
    flex: 1;
  }

  .filter-button {
    padding-inline: 11px;
  }

  .ranking-row {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    min-height: 118px;
    padding: 15px 14px;
  }

  .position {
    width: 48px;
    height: 38px;
    font-size: 15px;
  }

  .mii {
    width: 64px;
    height: 64px;
  }

  .name {
    font-size: 19px;
  }

  .friend-code {
    font-size: 12px;
  }

  .vr {
    text-align: right;
  }

  .performance {
    justify-self: end;
    gap: 13px;
  }

  .vr strong {
    font-size: 23px;
  }

  .vr small {
    font-size: 11px;
  }

  .status {
    grid-column: 2 / 4;
    min-height: 0;
    justify-content: flex-start;
    justify-self: start;
    margin: -11px 0 0 81px;
    padding: 0;
    background: transparent;
    font-size: 11px;
  }

  .status.online {
    background: transparent;
  }

  .history-stats {
    gap: 8px;
    margin-top: 20px;
  }

  .history-stats article {
    min-height: 96px;
    padding: 15px;
  }

  .history-stats strong {
    font-size: 19px;
  }

  .history-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .legend-item {
    flex: 0 0 auto;
  }

  footer {
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 470px) {
  .brand small,
  .filter-button {
    display: none;
  }

  .brand-logo {
    width: 66px;
    height: 46px;
  }

  .brand-logo img {
    top: -15px;
    left: -5px;
    width: 76px;
    height: 76px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .stats article {
    min-height: 112px;
    padding: 16px;
  }

  .ranking-row {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 3px;
  }

  .position {
    width: 43px;
  }

  .player {
    gap: 10px;
  }

  .mii {
    width: 54px;
    height: 54px;
  }

  .performance {
    grid-column: 2;
    justify-self: start;
    margin: -5px 0 0 64px;
  }

  .vr {
    text-align: left;
  }

  .vr strong {
    font-size: 19px;
  }

  .status {
    grid-column: 2;
    margin: -2px 0 0 64px;
  }

  .history-stats {
    grid-template-columns: 1fr 1fr;
  }

  .history-stats article {
    min-width: 0;
  }

  .history-stats strong {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
