:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --line: #dfe2e7;
  --text: #18191d;
  --muted: #686d76;
  --red: #ee292d;
  --red-dark: #a9161a;
  --red-soft: #fff0f1;
  --green: #188548;
  --gold: #f0c24e;
  --focus: #18191d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  min-height: 86px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: block;
  width: 320px;
  height: 76px;
  overflow: hidden;
  background: #f1f2f4;
  border-radius: 6px;
}
.brand img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.brand.compact { width: 210px; height: 56px; }
.app-header .viewer {
  margin-left: auto;
  color: var(--muted);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 18px;
  color: var(--text);
  background: #ffffff;
  cursor: pointer;
  font-weight: 800;
}
.button:hover { border-color: #969ca6; background: var(--surface-2); }
.button:disabled { cursor: wait; opacity: .68; }
.button.primary { border-color: var(--red); background: var(--red); color: #fff; }
.button.primary:hover { background: #ff3438; }
.button.quiet { min-height: 38px; padding: 0 14px; background: transparent; }

.login-page { display: flex; flex-direction: column; }
.login-main {
  width: min(980px, calc(100% - 40px));
  margin: auto;
  padding: 64px 0 72px;
}
.login-intro { max-width: 760px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}
h1, h2, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 58px; line-height: 1.02; }
.lead { max-width: 700px; margin: 20px 0 0; color: var(--muted); font-size: 21px; }
.access-box {
  margin-top: 44px;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(210px, .7fr) minmax(420px, 1.3fr);
  gap: 34px;
  align-items: end;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(31, 35, 43, .08);
}
.access-box h2 { margin: 0; font-size: 25px; }
.access-box p { margin: 8px 0 0; color: var(--muted); }
.access-box label, .filter-field span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.login-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 13px;
  color: var(--text);
  background: #ffffff;
}
input::placeholder { color: #989da6; }
.form-note { font-size: 13px; line-height: 1.4; }
.form-message { min-height: 22px; margin-top: 8px; font-weight: 800; }
.form-message.error { color: #b3161a; }
.form-message.success { color: var(--green); }
.feature-band {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.feature-band div { min-width: 0; padding: 19px 20px; border-right: 1px solid var(--line); }
.feature-band div:last-child { border-right: 0; }
.feature-band strong, .feature-band span { display: block; }
.feature-band span { margin-top: 4px; color: var(--muted); font-size: 13px; }

.rankings-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 72px; }
.rankings-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; }
.rankings-heading h1 { font-size: 46px; }
.result-note { max-width: 520px; margin: 0; color: var(--muted); font-size: 14px; }
.segmented {
  display: flex;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.segment {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 18px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}
.segment:last-child { border-right: 0; }
.segment.active { color: #fff; background: var(--red); }
.category-tabs { margin-top: 30px; }
.filters {
  margin-top: 14px;
  padding: 14px;
  display: flex;
  align-items: end;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 35, 43, .05);
}
.filter-field { width: 190px; }
.filter-field select { min-width: 180px; }
.content-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .55fr); gap: 18px; align-items: start; }
.ranking-panel, .personal-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 12px 32px rgba(31, 35, 43, .06); overflow: hidden; }
.panel-heading { min-height: 86px; padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 23px; }
.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.ranking-list { min-height: 320px; }
.ranking-row {
  min-height: 80px;
  padding: 13px 20px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.ranking-row:last-child { border-bottom: 0; }
.ranking-row.mine { background: var(--red-soft); box-shadow: inset 4px 0 0 var(--red); }
.ranking-row:nth-child(1) .place { color: #181208; background: var(--gold); }
.place { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #eceef1; font-weight: 900; }
.competitor { min-width: 0; }
.competitor strong, .competitor span { display: block; }
.competitor strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
.competitor span { margin-top: 2px; color: var(--muted); font-size: 13px; }
.ranking-score { text-align: right; }
.ranking-score strong, .ranking-score span { display: block; }
.ranking-score strong { font-size: 26px; line-height: 1; }
.ranking-score span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.personal-hours { max-height: 560px; overflow: auto; }
.hour-row {
  width: 100%;
  min-height: 78px;
  padding: 13px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.hour-row:hover { background: var(--surface-2); }
.hour-row span, .hour-row strong, .hour-row small { display: block; }
.hour-row small { margin-top: 3px; color: var(--muted); }
.hour-row b { color: var(--red); text-align: right; font-size: 18px; }
.hour-row em { display: block; color: var(--muted); font-size: 11px; font-style: normal; }
.empty-state { padding: 28px 20px; color: var(--muted); text-align: center; }
.empty-state.large { min-height: 320px; display: grid; place-items: center; }
.error-text { color: #b3161a; }
.site-footer { width: min(1180px, calc(100% - 40px)); margin: auto auto 0; padding: 22px 0; border-top: 1px solid var(--line); color: #7a7f88; font-size: 12px; font-weight: 900; }

@media (max-width: 820px) {
  .site-header, .rankings-main, .login-main, .site-footer { width: min(100% - 24px, 1180px); }
  .login-main { padding: 40px 0 48px; }
  h1 { font-size: 42px; }
  .lead { font-size: 18px; }
  .access-box { grid-template-columns: 1fr; gap: 20px; }
  .feature-band { grid-template-columns: 1fr; }
  .feature-band div { border-right: 0; border-bottom: 1px solid var(--line); }
  .feature-band div:last-child { border-bottom: 0; }
  .rankings-heading { display: block; }
  .result-note { margin-top: 14px; }
  .content-grid { grid-template-columns: 1fr; }
  .personal-panel { grid-row: 1; }
  .personal-hours { max-height: 320px; }
  .filters { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .site-header { min-height: 72px; }
  .brand { width: 230px; height: 58px; }
  .brand.compact { width: 144px; height: 43px; }
  .app-header { gap: 9px; }
  .app-header .viewer { font-size: 12px; }
  .button.quiet { min-height: 36px; padding: 0 10px; font-size: 13px; }
  h1, .rankings-heading h1 { font-size: 34px; }
  .login-row { grid-template-columns: 1fr; }
  .access-box { padding: 20px; }
  .category-tabs, .period-tabs { width: 100%; overflow-x: auto; }
  .segment { flex: 1 0 auto; min-height: 42px; padding: 0 13px; font-size: 13px; }
  .filters { padding: 10px; gap: 10px; }
  .filter-field { width: 100%; }
  .filter-field select { min-width: 0; }
  .panel-heading { min-height: 74px; padding: 15px; }
  .panel-heading h2 { font-size: 20px; }
  .count { font-size: 12px; }
  .ranking-row { min-height: 72px; padding: 11px 12px; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; }
  .place { width: 32px; height: 32px; }
  .competitor strong { font-size: 15px; }
  .competitor span { font-size: 11px; }
  .ranking-score strong { font-size: 20px; }
  .hour-row { padding: 11px 12px; }
}
