:root{
  --ms-bg:#f7f8fa;
  --ms-surface:#ffffff;
  --ms-surface-soft:#f1f5f9;
  --ms-border:#e2e8f0;
  --ms-text:#0f172a;
  --ms-muted:#64748b;
  --ms-accent:#0284c7;
  --ms-accent-soft:#e0f2fe;
  --ms-accent-strong:#0369a1;
  --ms-teal:#0d9488;
  --ms-teal-soft:#ccfbf1;
  --ms-amber:#b45309;
  --ms-amber-soft:#fef3c7;
  --ms-price:#e1251b;
  --ms-radius:14px;
}
[data-theme="dark"]{
  --ms-bg:#0b1120;
  --ms-surface:#111827;
  --ms-surface-soft:#1e293b;
  --ms-border:#273549;
  --ms-text:#f1f5f9;
  --ms-muted:#94a3b8;
  --ms-accent:#38bdf8;
  --ms-accent-soft:rgba(56,189,248,.16);
  --ms-accent-strong:#7dd3fc;
  --ms-teal:#2dd4bf;
  --ms-teal-soft:rgba(45,212,191,.16);
  --ms-amber:#fbbf24;
  --ms-amber-soft:rgba(251,191,36,.16);
  --ms-price:#fb7185;
}
*{box-sizing:border-box}
body{
  margin:0;
  background:var(--ms-bg);
  color:var(--ms-text);
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  line-height:1.6;
}
a{color:inherit;text-decoration:none}
.ms-subnav-wrap{
  max-width:1200px;
  height:56px;
  margin:0 auto;
  border-bottom:1px solid var(--slate-5,var(--ms-border));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:0 2px;
}
.ms-subnav-links{
  display:inline-flex;
  align-items:center;
  height:36px;
  gap:2px;
  background:var(--slate-3,#f0f0f3);
  padding:3px;
  border-radius:11px;
  border:1px solid var(--slate-5,var(--ms-border));
}
.ms-subnav-links a{
  height:28px;
  padding:0 14px;
  border-radius:8px;
  font-size:12.5px;
  font-weight:500;
  color:var(--ms-muted);
  display:inline-flex;
  align-items:center;
  gap:5px;
  transition:background .16s,color .16s,box-shadow .16s;
}
.ms-subnav-links a:hover{color:var(--ms-text)}
.ms-subnav-links a[aria-current="page"]{
  background:var(--ms-surface);
  color:var(--indigo-11,#3a5bc7);
  box-shadow:0 1px 3px rgba(31,45,92,.08);
  font-weight:600;
}
[data-theme="dark"] .ms-subnav-links{background:var(--slate-2,#18191b);border-color:var(--slate-5,#2e3135)}
[data-theme="dark"] .ms-subnav-links a[aria-current="page"]{background:var(--indigo-9,#3e63dd);color:#fff}
.ms-nav-count{
  font-size:11px;
  font-weight:500;
  opacity:.72;
  font-variant-numeric:tabular-nums;
}
.ms-subnav-tools{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}
.ms-source-pill{
  height:34px;
  padding:0 11px;
  border-radius:10px;
  border:1px solid var(--ms-border);
  background:var(--ms-surface);
  font-size:12px;
  color:var(--ms-muted);
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
.ms-source-dot{
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--teal-9,#12a594);
  display:inline-block;
  flex-shrink:0;
}
.ms-main{
  max-width:1200px;
  margin:0 auto;
  padding:18px 0 48px;
}
.ms-hero{
  background:linear-gradient(135deg,#f0f9ff 0%,#ffffff 55%,#f0fdfa 100%);
  border:1px solid #bae6fd;
  border-radius:16px;
  padding:22px 24px;
  display:grid;
  grid-template-columns:1fr auto;
  gap:18px;
  align-items:center;
}
[data-theme="dark"] .ms-hero{
  background:linear-gradient(135deg,#0f2238 0%,#111827 60%,#0f2926 100%);
  border-color:#1e3a5f;
}
.ms-hero-eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  font-weight:600;
  color:var(--ms-accent-strong);
  margin:0 0 6px;
}
.ms-hero h1{
  margin:0 0 6px;
  font-size:24px;
  line-height:1.3;
  letter-spacing:-.02em;
}
.ms-hero-sub{
  margin:0 0 14px;
  font-size:14px;
  color:var(--ms-muted);
}
.ms-hero-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.ms-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  height:36px;
  padding:0 14px;
  border-radius:9px;
  font-size:13.5px;
  font-weight:600;
  border:1px solid var(--ms-border);
  background:var(--ms-surface);
  color:var(--ms-text);
  cursor:pointer;
  transition:border-color .15s,background .15s,transform .12s;
}
.ms-btn:hover{border-color:var(--ms-accent);color:var(--ms-accent-strong)}
.ms-btn.primary{
  background:var(--ms-accent);
  border-color:var(--ms-accent);
  color:#fff;
}
.ms-btn.primary:hover{background:var(--ms-accent-strong);border-color:var(--ms-accent-strong);color:#fff}
.ms-hero-count{
  min-width:152px;
  padding:14px 18px;
  border-radius:12px;
  background:var(--ms-surface);
  border:1px solid var(--ms-border);
  text-align:center;
}
.ms-hero-count-label{font-size:12px;color:var(--ms-muted);margin:0 0 2px}
.ms-hero-count-num{
  font-size:38px;
  font-weight:700;
  line-height:1.08;
  color:var(--ms-accent-strong);
  font-variant-numeric:tabular-nums;
  margin:0;
}
.ms-hero-count-num small{font-size:14px;font-weight:500;margin-left:2px;color:var(--ms-muted)}
.ms-hero-count-date{font-size:12px;color:var(--ms-muted);margin:4px 0 0}

/* Compact JD Running Gear Strip */
.ms-jd-strip{
  margin:16px 0;
  padding:12px 14px;
  background:var(--ms-surface);
  border:1px solid var(--ms-border);
  border-radius:12px;
}
.ms-jd-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}
.ms-jd-label{
  font-size:12.5px;
  font-weight:600;
  color:var(--ms-muted);
}
.ms-jd-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}
.ms-jd-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--ms-border);
  background:var(--ms-bg);
  transition:border-color .15s,background .15s;
}
.ms-jd-item:hover{border-color:var(--ms-accent);background:var(--ms-surface)}
.ms-jd-thumb{
  width:44px;
  height:44px;
  border-radius:7px;
  object-fit:cover;
  flex-shrink:0;
  background:#fff;
}
.ms-jd-info{min-width:0;display:flex;flex-direction:column;gap:2px}
.ms-jd-title{
  font-size:12.5px;
  line-height:1.35;
  color:var(--ms-text);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.ms-jd-price{
  font-size:13px;
  font-weight:700;
  color:var(--ms-price);
  font-variant-numeric:tabular-nums;
}

/* Filter bar */
.ms-filter-panel{
  background:var(--ms-surface);
  border:1px solid var(--ms-border);
  border-radius:var(--ms-radius);
  padding:14px 16px;
  margin:16px 0 14px;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
}
.ms-search{
  flex:1 1 220px;
  height:36px;
  padding:0 12px;
  border-radius:9px;
  border:1px solid var(--ms-border);
  background:var(--ms-bg);
  color:var(--ms-text);
  font-size:13.5px;
}
.ms-select{
  height:36px;
  padding:0 10px;
  border-radius:9px;
  border:1px solid var(--ms-border);
  background:var(--ms-bg);
  color:var(--ms-text);
  font-size:13px;
}
.ms-chips{display:flex;flex-wrap:wrap;gap:6px}
.ms-chip{
  height:32px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid var(--ms-border);
  background:var(--ms-surface);
  color:var(--ms-muted);
  font-size:13px;
  cursor:pointer;
}
.ms-chip[aria-pressed="true"]{
  background:var(--ms-accent-soft);
  border-color:var(--ms-accent);
  color:var(--ms-accent-strong);
  font-weight:600;
}
.ms-result-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:13px;
  color:var(--ms-muted);
  margin:0 2px 12px;
}

/* Race Grid */
.ms-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}
.ms-card{
  background:var(--ms-surface);
  border:1px solid var(--ms-border);
  border-radius:var(--ms-radius);
  padding:15px 16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  transition:border-color .15s,box-shadow .15s;
}
.ms-card:hover{
  border-color:#7dd3fc;
  box-shadow:0 4px 16px rgba(2,132,199,.07);
}
.ms-card-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.ms-badges{display:flex;flex-wrap:wrap;gap:5px;margin-bottom:5px}
.ms-tag{
  display:inline-flex;
  align-items:center;
  padding:2px 7px;
  border-radius:6px;
  font-size:11.5px;
  font-weight:600;
  background:var(--ms-surface-soft);
  color:var(--ms-muted);
}
.ms-tag.platinum{background:#ede9fe;color:#5b21b6}
.ms-tag.gold{background:var(--ms-amber-soft);color:var(--ms-amber)}
.ms-tag.confirmed{background:var(--ms-teal-soft);color:var(--ms-teal)}
.ms-card h2{
  margin:0;
  font-size:16px;
  line-height:1.35;
}
.ms-card h2 a:hover{color:var(--ms-accent-strong)}
.ms-days-pill{
  flex-shrink:0;
  padding:4px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  background:var(--ms-accent-soft);
  color:var(--ms-accent-strong);
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}
.ms-days-pill.pending{background:var(--ms-surface-soft);color:var(--ms-muted);font-weight:500}
.ms-meta-rows{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:13px;
  color:var(--ms-muted);
  border-top:1px dashed var(--ms-border);
  padding-top:9px;
}
.ms-meta-row{display:flex;justify-content:space-between;gap:8px}
.ms-meta-row strong{color:var(--ms-text);font-weight:600;text-align:right}
.ms-card-foot{
  margin-top:auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding-top:8px;
  border-top:1px solid var(--ms-border);
  font-size:12.5px;
}
.ms-card-foot a,.ms-card-foot button{
  color:var(--ms-accent-strong);
  font-weight:600;
  background:none;
  border:0;
  padding:0;
  cursor:pointer;
  font-size:12.5px;
}
.ms-card-foot button.muted{color:var(--ms-muted);font-weight:500}

/* Detail & Pace 2-column layout */
.ms-crumb{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  color:var(--ms-muted);
  margin-bottom:14px;
}
.ms-crumb a:hover{color:var(--ms-accent-strong)}
.ms-two-col{
  display:grid;
  grid-template-columns:minmax(0,1fr) 292px;
  gap:18px;
  align-items:start;
}
.ms-panel{
  background:var(--ms-surface);
  border:1px solid var(--ms-border);
  border-radius:var(--ms-radius);
  padding:18px 20px;
}
.ms-panel + .ms-panel{margin-top:14px}
.ms-panel h2{
  margin:0 0 12px;
  font-size:16.5px;
  line-height:1.3;
}
.ms-timeline{
  list-style:none;
  margin:0;
  padding:0 0 0 18px;
  border-left:2px solid var(--ms-border);
  display:flex;
  flex-direction:column;
  gap:14px;
}
.ms-timeline li{position:relative;padding-left:6px}
.ms-timeline li::before{
  content:"";
  position:absolute;
  left:-25px;
  top:6px;
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--ms-border);
  border:2px solid var(--ms-surface);
}
.ms-timeline li.is-confirmed::before{background:var(--ms-accent)}
.ms-timeline h3{margin:0 0 2px;font-size:14.5px}
.ms-timeline p{margin:0;font-size:13.5px;color:var(--ms-muted)}
.ms-sidebar{
  display:flex;
  flex-direction:column;
  gap:14px;
  position:sticky;
  top:112px;
}
.ms-sidebar .ms-jd-list{
  display:flex;
  flex-direction:column;
  gap:9px;
}
.ms-facts{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}
.ms-fact{
  padding:10px 12px;
  border-radius:10px;
  background:var(--ms-bg);
  border:1px solid var(--ms-border);
}
.ms-fact span{display:block;font-size:12px;color:var(--ms-muted)}
.ms-fact strong{font-size:14px}
.ms-related-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.ms-related-item{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--ms-border);
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:13.5px;
}
.ms-related-item:hover{border-color:var(--ms-accent);color:var(--ms-accent-strong)}
.ms-related-item small{color:var(--ms-muted);font-size:12px}

/* Pace Calculator */
.ms-pace-presets{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:16px;
}
.ms-pace-inputs{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-bottom:16px;
}
.ms-input-box{
  padding:14px;
  border-radius:12px;
  background:var(--ms-bg);
  border:1px solid var(--ms-border);
}
.ms-input-box label{
  display:block;
  font-size:12.5px;
  font-weight:600;
  color:var(--ms-muted);
  margin-bottom:8px;
}
.ms-time-fields{
  display:flex;
  align-items:center;
  gap:6px;
}
.ms-time-fields input{
  width:64px;
  height:38px;
  border-radius:8px;
  border:1px solid var(--ms-border);
  background:var(--ms-surface);
  color:var(--ms-text);
  font-size:17px;
  font-weight:700;
  text-align:center;
  font-variant-numeric:tabular-nums;
}
.ms-time-fields span{font-size:13px;color:var(--ms-muted)}
.ms-pace-summary{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-bottom:16px;
}
.ms-stat{
  padding:12px 14px;
  border-radius:10px;
  background:var(--ms-accent-soft);
  text-align:center;
}
.ms-stat span{display:block;font-size:12px;color:var(--ms-accent-strong)}
.ms-stat strong{font-size:20px;color:var(--ms-text);font-variant-numeric:tabular-nums}
.ms-table{
  width:100%;
  border-collapse:collapse;
  font-size:13.5px;
  font-variant-numeric:tabular-nums;
}
.ms-table th,.ms-table td{
  padding:9px 10px;
  border-bottom:1px solid var(--ms-border);
  text-align:left;
}
.ms-table th{font-size:12.5px;color:var(--ms-muted);font-weight:600;background:var(--ms-bg)}
.ms-table tr.highlight td{background:var(--ms-accent-soft);font-weight:600}
.ms-gel-badge{
  display:inline-block;
  padding:1px 6px;
  border-radius:5px;
  font-size:11.5px;
  background:var(--ms-teal-soft);
  color:var(--ms-teal);
  font-weight:600;
}
.ms-footer{
  max-width:1200px;
  margin:0 auto;
  padding:18px 0 36px;
  border-top:1px solid var(--ms-border);
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  gap:10px;
  font-size:12.5px;
  color:var(--ms-muted);
}
@media (max-width:1260px){
  .ms-subnav-wrap,.ms-main,.ms-footer{margin-left:24px;margin-right:24px}
}
@media (max-width:960px){
  .ms-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .ms-jd-grid{grid-template-columns:1fr}
  .ms-two-col{grid-template-columns:1fr}
  .ms-sidebar{position:static}
}
@media (max-width:700px){
  .ms-subnav-wrap,.ms-main,.ms-footer{margin-left:14px;margin-right:14px}
  .ms-subnav-wrap{height:auto;padding:8px 0;gap:8px}
  .ms-subnav-links{flex:1;justify-content:space-between}
  .ms-subnav-links a{flex:1;justify-content:center;padding:0 8px;font-size:12px}
  .ms-subnav-tools{display:none}
  .ms-main{padding:12px 0 36px}
}
@media (max-width:640px){
  .ms-hero{grid-template-columns:1fr;padding:18px 16px}
  .ms-hero h1{font-size:20px}
  .ms-grid{grid-template-columns:1fr}
  .ms-pace-inputs,.ms-pace-summary,.ms-related-list,.ms-facts{grid-template-columns:1fr}
}
