:root {
  --purple-deep: #3f1d6e;
  --purple: #5b2c96;
  --yellow: #f4e81a;
  --ink: #231a33;
  --muted: #6b6478;
  --line: #e6e0ef;
  --soft: #f1edf7;
  --background: #f7f5fa;
  --rank-width: 56px;
  --team-width: 260px;
  --rating-width: 104px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--background); color: var(--ink); font-family: "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.shell { width: min(100%, 1200px); margin-inline: auto; padding-inline: clamp(14px, 4vw, 32px); }

.site-header { color: #fff; background: var(--purple-deep); }
.header-content { min-height: 68px; padding-block: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-size: 18px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand-logo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--yellow); }
.city-picker { position: relative; display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: #d9ccec; }
.city-picker::after { content: ""; position: absolute; right: 17px; top: calc(50% - 3px); width: 8px; height: 8px; border-right: 2px solid var(--yellow); border-bottom: 2px solid var(--yellow); transform: rotate(45deg); pointer-events: none; }
.city-picker select { min-width: 178px; max-width: 260px; appearance: none; color: #fff; background: #57377e; border: 1px solid #81689d; border-radius: 10px; padding: 9px 38px 9px 14px; font-size: 15px; font-weight: 600; cursor: pointer; }
.city-picker option { color: var(--ink); background: #fff; }
.city-picker select:disabled { opacity: .65; cursor: wait; }

.main-content { flex: 1; padding-block: clamp(22px, 3vw, 34px) 44px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 18px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.intro-text { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--purple); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow::before { content: ""; display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); background: var(--yellow); box-shadow: 0 0 0 2px var(--purple); }
h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: -.025em; }
h1 { display: flex; flex-wrap: wrap; gap: 0 .35em; margin-bottom: 8px; font-size: clamp(25px, 3.6vw, 36px); line-height: 1.18; font-weight: 800; }
h1 span { color: var(--purple); }
.meta { min-height: 21px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.search-wrap { position: relative; flex: 1 1 260px; max-width: 340px; }
.search-wrap input { width: 100%; color: var(--ink); background: #fff; border: 1px solid #dcd4e8; border-radius: 12px; padding: 11px 42px 11px 14px; font-size: 15px; font-weight: 500; }
.search-wrap input::placeholder { color: #8a8296; }
.search-wrap input:focus { border-color: var(--purple); outline: 3px solid #ddcbed; outline-offset: 0; }
.clear-search { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--soft); color: var(--purple); font-size: 20px; line-height: 1; }
.clear-search:hover { background: #e6def0; }
.loading { padding-block: 34px; color: var(--muted); font-size: 15px; }

.state-card { max-width: 720px; padding: clamp(24px, 4vw, 40px); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 2px 12px #2b155008; }
.state-card h2 { margin-bottom: 8px; font-size: clamp(18px, 2.4vw, 22px); line-height: 1.3; font-weight: 800; }
.state-card p { margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.empty-card { display: grid; gap: 18px; }
.empty-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--soft); }
.empty-mark::before { content: ""; width: 14px; height: 14px; border-radius: 2px; background: var(--purple); transform: rotate(45deg); }
.published-label { margin-bottom: 10px !important; font-size: 13px !important; }
.city-links { display: flex; flex-wrap: wrap; gap: 8px; }
.city-link { border: 1px solid #dcd4e8; border-radius: 999px; background: #fff; color: var(--purple-deep); padding: 8px 14px; font-size: 14px; font-weight: 600; }
.city-link:hover { background: var(--soft); border-color: var(--purple); }
.primary-button { margin-top: 20px; padding: 10px 16px; border: 0; border-radius: 10px; background: var(--purple); color: #fff; font-size: 14px; font-weight: 700; }
.primary-button:hover { background: var(--purple-deep); }
.search-status { margin: -4px 0 12px; color: var(--muted); font-size: 14px; }

.table-frame { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 2px 12px #2b155008; }
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
th, td { height: 42px; padding: 7px 12px; border-bottom: 1px solid #eee9f4; vertical-align: middle; }
thead th { position: sticky; top: 0; z-index: 3; height: 42px; background: var(--soft); color: #5e5670; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
thead th.rank-cell { z-index: 6; }
thead th.team-cell { z-index: 6; }
thead th.rating-cell { z-index: 6; }
.rank-cell { position: sticky; left: 0; width: var(--rank-width); min-width: var(--rank-width); max-width: var(--rank-width); text-align: center; font-variant-numeric: tabular-nums; }
.team-cell { position: sticky; left: var(--rank-width); width: var(--team-width); min-width: var(--team-width); max-width: var(--team-width); text-align: left; }
.rating-cell { position: sticky; left: calc(var(--rank-width) + var(--team-width)); width: var(--rating-width); min-width: var(--rating-width); max-width: var(--rating-width); text-align: right; box-shadow: 1px 0 0 var(--line); font-variant-numeric: tabular-nums; }
.number-cell { min-width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.detail-cell { min-width: 176px; max-width: 260px; overflow-wrap: anywhere; font-size: 13px; }
.title-badge { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--soft); color: var(--purple-deep); font-weight: 700; line-height: 1.3; }
.history-cell { min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.team-row { background: #fff; }
.team-row.row-alt { background: #fbfafd; }
.team-row:hover { background: #f7f2fd; }
.team-row td { background: inherit; }
.team-row .team-cell { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.team-row .rating-cell { color: var(--purple); font-weight: 800; }
.team-row .top-rank { color: var(--purple-deep); font-weight: 800; }
.team-row .top-rank::before { content: ""; position: absolute; left: calc(50% - 14px); top: calc(50% - 14px); z-index: -1; width: 28px; height: 28px; border-radius: 50%; background: var(--yellow); }
.team-row .top-rank { isolation: isolate; }
.league-row th { height: 42px; padding: 11px 14px; background: #fbfafd; color: var(--purple-deep); font-size: 14px; font-weight: 800; text-align: left; white-space: nowrap; }
.league-heading::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 12px; transform: rotate(45deg); border-radius: 1px; background: var(--yellow); box-shadow: 0 0 0 2px var(--purple); vertical-align: 2px; }
.scroll-hint { display: none; margin: 0 0 8px; color: var(--muted); font-size: 13px; }

.site-footer { border-top: 1px solid var(--line); }
.footer-content { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; padding-block: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }

@media (max-width: 720px) {
  .scroll-hint:not([hidden]) { display: block; }
  :root { --rank-width: 42px; --team-width: 166px; --rating-width: 82px; }
  .header-content { align-items: flex-start; }
  .city-picker { width: 100%; justify-content: space-between; }
  .city-picker select { flex: 1; max-width: 260px; }
  .intro { align-items: stretch; }
  .search-wrap { max-width: none; flex-basis: 100%; }
  table { font-size: 14px; }
  th, td { padding: 7px 8px; }
  .detail-cell { min-width: 150px; }
  .history-cell { min-width: 70px; }
  .number-cell { min-width: 54px; }
  .team-row .team-cell { font-size: 14px; }
}
