.mobile-dashboard { display: none; }
.desktop-home { display: contents; }

.tab-race { max-width: 540px; }
.race-page-title { display: flex; align-items: center; gap: 14px; margin: 2px 0 14px; font-size: 18px; }
.race-page-title button { width: 29px; height: 34px; color: var(--pink); font-size: 22px; text-align: left; }
.race-competition { margin-top: 16px; padding: 16px; border-radius: 16px; overflow: hidden; }
.race-competition h2 { margin: 0 0 12px; font-size: 17px; }
.race-competition h3 { margin: 11px 0 3px; font-size: 17px; line-height: 1.22; }
.race-period { margin: 0 0 8px; font-size: 13px; }
.race-banner {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 9px;
}
.race-table thead th { font-weight: 500; }
.race-table td:last-child { font-weight: 750; }
.race-medal { width: 29px; height: 29px; border-radius: 50%; font-weight: 650; }
.race-prize-block { border-top: 1px solid var(--line); margin: 10px -16px -16px; padding: 12px 16px 16px; }
.race-prize-block h3 { color: var(--muted); font-size: 15px; font-weight: 500; }
.race-prize-block .caption { margin: 8px 0 0; font-size: 14px; line-height: 1.5; }
.race-invited { border-radius: 16px; padding: 16px; }

.traffic-slider {
  --traffic-position: 0;
  --traffic-size: clamp(22px, 5.9vw, 28px);
  --traffic-thumb: calc(var(--traffic-size) - 2px);
  --traffic-marker: calc(var(--traffic-size) / 2 + (100% - var(--traffic-size)) * var(--traffic-position));
  position: relative;
  height: var(--traffic-size);
  margin: 43px clamp(12px, 4.2vw, 20px) 31px;
  border: 1px solid #72406c;
  border-radius: 25px;
  background: linear-gradient(90deg, #ff9ee9 0%, #e075cc var(--traffic-marker), var(--tint) var(--traffic-marker));
}
.traffic-slider-dots {
  position: absolute;
  inset: 0 calc(var(--traffic-size) / 2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.traffic-slider-dots span { width: clamp(5px, 1.65vw, 8px); height: auto; aspect-ratio: 1; border-radius: 50%; background: #9c929d; }
.traffic-slider input[type="range"] {
  appearance: none;
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}
.traffic-slider input::-webkit-slider-runnable-track { height: var(--traffic-thumb); background: transparent; }
.traffic-slider input::-moz-range-track { height: var(--traffic-thumb); background: transparent; }
.traffic-slider input::-webkit-slider-thumb {
  appearance: none;
  box-sizing: border-box;
  width: var(--traffic-thumb); height: var(--traffic-thumb);
  border: 3px solid #e784d4; border-radius: 50%; background: #101219;
  box-shadow: 0 0 10px #f784df80;
}
.traffic-slider input::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--traffic-thumb); height: var(--traffic-thumb);
  border: 3px solid #e784d4; border-radius: 50%; background: #101219;
  box-shadow: 0 0 10px #f784df80;
}
.traffic-slider input:focus-visible { outline: 2px solid var(--pink); outline-offset: 4px; }
.traffic-slider-hint {
  --hint-width: clamp(181px, 51vw, 246px);
  --hint-offset: clamp(0px, calc(var(--traffic-marker) - 21px), calc(100% - var(--hint-width)));
  position: absolute;
  left: var(--hint-offset);
  bottom: calc(100% + 18px);
  z-index: 2;
  width: var(--hint-width);
  max-width: 100%;
  padding: clamp(8px, 3.15vw, 14px) 10px;
  border-radius: 30px;
  background: var(--rose);
  color: white;
  font-size: clamp(12px, 3.55vw, 16px);
  font-weight: 750;
  text-align: center;
  pointer-events: none;
}
.traffic-slider-hint::after {
  content: "";
  position: absolute;
  top: calc(100% - 1px);
  left: clamp(14px, calc(var(--traffic-position) * 100%), calc(100% - 24px));
  border: 8px solid transparent;
  border-top: 10px solid var(--rose);
  border-bottom: 0;
}

.setup-overlay:has(.setup-device-sheet) { padding: 16px 10px 20px; }
.setup-overlay .setup-device-sheet { position: relative; max-width: 420px; padding: 5px 0 20px; }
.setup-device-sheet .sheet-header { position: absolute; top: 0; left: 0; margin: 0; }
.setup-device-sheet .sheet-header h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.setup-device-sheet .setup-back { min-height: 34px; font-size: 24px; }
.setup-device-sheet .setup-subtitle { margin: 5px 32px 18px; }
.setup-device-sheet .platform-grid { gap: 10px; }
.setup-device-sheet .subscription-qr-wrap { min-height: 192px; }
.subscription-qr-code { width: min(320px, 100%); margin-inline: auto; }
.subscription-qr-code svg { display: block; width: 100%; height: auto; border-radius: 9px; }
.setup-device-sheet .subscription-qr-code { width: min(192px, 100%); }
.setup-device-sheet .subscription-qr-code:has(.subscription-qr-dense) { width: min(280px, 100%); }
.subscription-qr-dense > :is(path, g) { shape-rendering: crispEdges; }

.sheet:has(.subscription-link) {
  width: min(100%, 420px);
  max-height: 100dvh;
  padding: 16px 16px calc(22px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--panel);
}
.sheet:has(.subscription-link) .handle { display: none; }
.sheet:has(.subscription-link) .sheet-header { margin: 0 0 12px; }
.sheet:has(.subscription-link) .sheet-header h2 { font-size: 16px; font-weight: 650; }
.sheet:has(.subscription-link) .close { flex: 0 0 34px; height: 34px; background: none; font-size: 28px; }
.subscription-link {
  --qr-space-for-controls: 144px;
  display: grid;
  gap: 16px;
}
.subscription-link:has(.subscription-link-picker) { --qr-space-for-controls: 198px; }
.subscription-link .subscription-qr-wrap { margin: 0; }
.subscription-link .subscription-qr-code {
  width: min(248px, 100%, max(105px, calc(100dvh - var(--qr-space-for-controls) - var(--safe-bottom))));
}
.subscription-link .subscription-qr-code:has(.subscription-qr-dense) {
  width: min(286px, 100%, max(105px, calc(100dvh - var(--qr-space-for-controls) - var(--safe-bottom))));
}
.subscription-link .subscription-qr-code svg { border-radius: 14px; }
.subscription-link-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.subscription-link-picker select { min-width: 0; min-height: 36px; padding: 5px 10px; font-size: 13px; }
.subscription-link .button { min-height: 38px; padding: 6px 10px; box-shadow: none; font-size: 13px; }
.subscription-link .button .icon { width: 16px; height: 16px; }
@media (min-width: 601px) {
  .sheet:has(.subscription-link) { border-radius: 24px; padding: 18px 20px 24px; }
}

@media (max-width: 600px) {
  #app:has(> :is(.tab-profile, .tab-race, .tab-support)) { padding-inline: 10px; }
  #app > :is(.tab-home, .tab-profile, .tab-race) > .topbar { display: none; }
  .tab-home .desktop-home { display: none; }
  .mobile-dashboard { display: flex; flex-direction: column; min-height: 100%; align-items: center; gap: 10px; padding-block: 5px clamp(12px, 3.25dvh, 22px); }
  .mobile-dashboard-hero { flex: 1 1 auto; display: grid; place-items: center; min-height: 60px; }
  .mobile-dashboard-hero img { width: clamp(88px, 27dvh, 205px); max-width: 63vw; max-height: 29dvh; }
  .mobile-account-banner { display: flex; align-items: center; gap: 9px; padding: 11px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); width: min(100%, 342px); font-size: 13px; }
  .mobile-account-banner span { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: left; }
  .mobile-account-banner strong { color: var(--pink); }
  .mobile-product { width: min(100%, 342px); }
  .mobile-product-tabs { display: flex; gap: 7px; padding-left: 22px; margin-bottom: -1px; }
  .mobile-product-tabs button { padding: 5px 10px; border: 1px solid var(--line); border-radius: 13px 13px 0 0; font-size: 13px; font-weight: 750; color: var(--muted); background: var(--panel); }
  .mobile-product-tabs button[aria-pressed="true"] { color: inherit; border-bottom-color: transparent; z-index: 1; }
  .mobile-product-card { display: grid; gap: 9px; padding: 20px; border-radius: 22px; }
  .mobile-product-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .mobile-product-card h1, .mobile-product-card header span { margin: 0; font-size: 14px; font-weight: 750; }
  .mobile-product-stats { display: flex; justify-content: space-between; align-items: center; gap: 5px; }
  .mobile-product-stats button {
    display: inline-flex; align-items: center; gap: 4px; min-height: 25px; padding: 2px 8px; border: 1px solid color-mix(in srgb, var(--pink) 27%, var(--line));
    background: var(--tint); color: var(--pink); border-radius: 18px; text-align: left; font-size: 12px; font-weight: 700;
  }
  .mobile-product-stats .icon { width: 12px; height: 12px; flex: 0 0 auto; }
  .mobile-product-card .button { min-height: 44px; border-radius: 24px; font-size: 13px; }
  .mobile-setup-actions { display: flex; gap: 8px; }
  .mobile-setup-actions > [data-action="subscription"] { flex: 0 0 44px; padding: 0; }
  .mobile-setup-actions .button { color: var(--pink); border-color: var(--pink); }
  .mobile-product-card .button .icon { width: 16px; height: 16px; }
  .mobile-dashboard .account-key-control { width: min(100%, 342px); margin: 0; }
  .tab-profile .user-info { margin: 0 0 12px; }
  #app > .tab-support > .button { min-height: 50px; font-size: 16px; }
  .tab-support > .card .list-item { min-height: 60px; }
  .tab-support #ticket-list .empty { height: min(100%, 174px); border-radius: 16px; }
  .bottom-nav { padding: 4px; border-radius: 30px; }
  .bottom-nav .mobile-tabs { grid-template-columns: repeat(3, 44px); gap: 3px; }
  .bottom-nav .mobile-tabs > button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 50%; }
  .plan-overlay .sheet {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 6px 10px max(10px, var(--safe-bottom));
    border: 0;
    border-radius: 0;
  }
  .plan-overlay .handle { display: none; }
  .plan-overlay .sheet-header { flex-direction: row-reverse; justify-content: start; gap: 12px; }
  .plan-overlay .sheet-header h2 { font-size: 17px; }
  .plan-overlay .sheet-header .close { width: 31px; border: 0; background: none; color: var(--pink); font-size: 0; }
  .plan-overlay .sheet-header .close::before { content: "←"; font-size: 21px; }
  .plan-overlay .purchase-layout { gap: 12px; }
  .plan-overlay .purchase-catalog, .plan-overlay .purchase-summary { padding: 15px; border-radius: 20px; }
  .plan-overlay .device-picker h3 { font-size: 16px; }
  .plan-overlay .device-picker p { margin-bottom: 16px; font-size: 13px; }
  .plan-overlay .range-endpoints { margin-bottom: 14px; }
  .plan-overlay .plan-grid { gap: 16px 12px; }
  .plan-overlay .purchase-catalog .plan { min-height: 82px; padding: 12px 10px 8px; border-radius: 16px; }
  .plan-overlay .purchase-catalog .plan strong { font-size: 15px; }
  .plan-overlay .purchase-catalog .plan span { margin: 2px 0 0; font-size: 19px; line-height: 1.2; }
  .plan-overlay .purchase-catalog .plan small { font-size: 11px; }
  .plan-overlay .purchase-aside { display: contents; }
  .plan-overlay .purchase-total { position: sticky; bottom: 0; z-index: 2; flex-wrap: nowrap; padding: 12px; border-radius: 22px; background: #191622; }
  body.light .plan-overlay .purchase-total { background: #fff; }
  .plan-overlay .purchase-total strong { font-size: 19px; }
  .plan-overlay .purchase-total .button { flex: 0 1 auto; min-height: 43px; min-width: min(118px, 42vw); border-radius: 24px; }
}

.modal-refresh, .modal-refresh .sheet { animation: none; }
.plan:not(.active) .plan-check,
[data-plan-original][hidden],
[data-plan-benefit][hidden],
[data-action="retry-plan-prices"][hidden] { display: none; }
.sheet, .plan-overlay, .setup-overlay { overscroll-behavior: contain; }
@media (max-width: 600px) {
  .overlay, .has-dashboard .bottom-nav { backdrop-filter: none; }
}

@media (max-width: 600px) and (max-height: 620px) {
  .mobile-dashboard-hero img { width: clamp(82px, 24.6dvh, 150px); }
  .mobile-product-card { padding: 17px 18px; gap: 8px; }
  .mobile-product-card .button { min-height: 41px; }
}

@media (max-width: 600px) and (max-height: 510px) {
  .mobile-dashboard { padding-bottom: 5px; gap: 7px; }
  .mobile-dashboard-hero img { width: clamp(62px, 18dvh, 100px); }
  .mobile-product-card { padding: 10px 12px; }
}
