
html[data-page-type="athlete_profile"] .app-shell { margin-top: 0 !important; }
.ap-page {
    width: 100%;
    box-sizing: border-box;
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-2xl);
    color: var(--text-primary);
    padding-top: var(--spacing-lg);
}
.ap-state {
    max-width: 560px;
    margin: var(--spacing-2xl) auto;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    text-align: center;
}
.ap-state-icon { font-size: 32px; color: var(--text-muted); }
.ap-state-title { margin: var(--spacing-sm) 0; font-family: var(--font-display); font-size: 28px; font-weight: 700; }
.ap-state-copy { color: var(--text-secondary); font-size: 14px; }
.ap-state-link { color: var(--text-primary); font-weight: 700; }
.ap-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}
.ap-head-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-lg);
    background: var(--premium-card), linear-gradient(135deg, var(--surface-card), var(--surface-hover));
    box-shadow: var(--premium-edge), var(--premium-lift);
    min-height: 210px;
    align-items: flex-end;
}
.ap-head-card.has-hero-photo::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    background-image: var(--ap-hero-image);
    background-position: center;
    background-size: cover;
    content: "";
    opacity: .42;
}
.ap-head-card.has-hero-photo::after {
    position: absolute;
    z-index: 1;
    inset: 0;
    background: linear-gradient(90deg, var(--surface-card), transparent 62%, var(--surface-hover));
    content: "";
}
.ap-head-card > * { position: relative; z-index: 2; }
.ap-identity { display: flex; align-items: center; gap: var(--spacing-md); min-width: 0; }
.ap-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    border: 2px solid var(--action-primary);
    border-radius: var(--avatar-radius, 28%);
    corner-shape: var(--avatar-corner, round);
    background: var(--surface-hover);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.ap-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ap-identity-text { min-width: 0; }
.ap-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.1;
    overflow-wrap: anywhere;
}
.ap-meta { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.ap-hero-context { margin: 0 0 6px; color: var(--text-primary); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ap-id { color: var(--text-muted); }
.ap-scope { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ap-head-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--spacing-sm); }
.ap-contact { flex: 0 0 auto; }
.ap-contact-summary {
    cursor: pointer;
    padding: 8px 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.ap-contact-list { margin: var(--spacing-sm) 0 0; padding: 0; color: var(--text-secondary); font-size: 13px; }
.ap-contact-list dt { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.ap-contact-list dd { margin: 0; overflow-wrap: anywhere; }
.ap-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}
.ap-kpi {
    position: relative;
    overflow: hidden;
    padding: var(--spacing-md);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, var(--surface-card), var(--surface-hover));
    box-shadow: var(--shadow-sm);
}
.ap-kpi-num {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 700;
    line-height: 1.05;
    overflow-wrap: anywhere;
}
.ap-kpi-top { display: flex; align-items: center; gap: var(--spacing-sm); }
.ap-kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid currentColor; border-radius: var(--radius-md); color: var(--action-primary); background: var(--surface-default); font-size: 15px; }
.ap-kpi-info .ap-kpi-icon, .ap-kpi-info .ap-kpi-num { color: var(--state-info); }
.ap-kpi-success .ap-kpi-icon { color: var(--state-success); }
.ap-kpi-warning .ap-kpi-icon, .ap-kpi-warning .ap-kpi-num { color: var(--state-warning); }
.ap-kpi-latest .ap-kpi-icon { color: var(--action-primary); }
.ap-kpi-info { border-color: var(--state-info-border-strong); }
.ap-kpi-warning { border-color: var(--state-warning-border-strong); }
.ap-kpi-label { margin-top: 2px; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ap-kpi-sub { margin-top: 4px; color: var(--text-secondary); font-size: 12px; }
.ap-kpi-success { border-color: var(--state-success-border-strong); }
.ap-kpi-success .ap-kpi-num { color: var(--state-success); }
.ap-dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 340px); gap: var(--spacing-xl); align-items: start; }
.ap-dashboard-main, .ap-dashboard-side { min-width: 0; }
.ap-dashboard-main { display: grid; gap: var(--spacing-lg); }
.ap-dashboard-side { display: grid; gap: var(--spacing-md); }
.ap-panel, .ap-next, .ap-history {
    padding: var(--spacing-md);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    box-shadow: var(--shadow-sm);
    margin: 0;
}
.ap-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--spacing-sm); }
.ap-section-kicker { margin: 0 0 4px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ap-section-count { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; }
.ap-next { border-left: 3px solid var(--action-primary); }
.ap-next-card { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, .9fr); gap: var(--spacing-md); margin-top: var(--spacing-sm); min-height: 118px; padding: var(--spacing-md); border: 1px solid var(--border-active); border-radius: var(--radius-md); background: var(--premium-card), linear-gradient(135deg, var(--surface-hover), var(--surface-card)); box-shadow: var(--premium-edge); }
.ap-next-card.has-event-banner::before { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; left: 0; background-image: var(--ap-event-banner); background-position: center; background-size: cover; content: ""; opacity: .40; }
.ap-next-card.has-event-banner::after { position: absolute; z-index: 1; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--surface-card) 96%, transparent) 0%, color-mix(in srgb, var(--surface-card) 76%, transparent) 45%, transparent 84%); content: ""; }
.ap-next-card > * { position: relative; z-index: 2; }
.ap-next-primary h3 { margin: var(--spacing-sm) 0 2px; font-family: var(--font-display); font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.ap-next-primary p, .ap-next-more, .ap-history-limit, .ap-panel-note { margin: 0; color: var(--text-secondary); font-size: 13px; }
.ap-next-more, .ap-history-limit, .ap-panel-note { margin-top: var(--spacing-sm); }
.ap-next-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 0; }
.ap-next-facts div { min-width: 0; padding: 8px; border-left: 1px solid var(--border-default); }
.ap-next-facts dt, .ap-activity-list dt { color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ap-next-facts dd { margin: 4px 0 0; color: var(--text-primary); font-family: var(--font-display); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.ap-next-empty { margin-top: var(--spacing-sm); }
.ap-compact-empty { padding: var(--spacing-md); border: 1px dashed var(--border-default); border-radius: var(--radius-md); color: var(--text-secondary); font-size: 13px; }
.ap-action-link { display: flex; align-items: center; gap: var(--spacing-sm); min-height: 44px; padding: 10px 0; border-top: 1px solid var(--border-soft); color: var(--text-primary); font-weight: 600; text-decoration: none; }
.ap-action-link:hover, .ap-action-link:focus-visible { color: var(--text-primary); text-decoration: none; }
.ap-action-link span { flex: 1; }
.ap-contact { border-top: 1px solid var(--border-soft); }
.ap-contact-summary { width: 100%; justify-content: flex-start; padding: 10px 0; border: 0; border-radius: 0; background: transparent; }
.ap-contact-list { padding: 0 0 var(--spacing-sm); }
.ap-contact-list a { color: var(--text-primary); }
.ap-journey .ap-section-kicker i { margin-right: 6px; color: var(--action-primary); }
.ap-journey-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ap-journey-grid > div, .ap-activity-list > div { padding: 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--surface-hover); }
.ap-journey-grid > div { text-align: center; }
.ap-journey-grid > div > i { display: block; margin-bottom: 8px; color: var(--action-primary); font-size: 16px; }
.ap-journey-grid strong { display: block; font-family: var(--font-display); font-size: 24px; line-height: 1; }
.ap-journey-grid span { display: block; margin-top: 4px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ap-activity-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.ap-activity-list dd { margin: 4px 0 0; color: var(--text-primary); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.ap-section-title {
    margin: 0 0 var(--spacing-sm);
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .02em;
}
.ap-history { margin-bottom: var(--spacing-lg); }
.ap-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ap-history-row {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: 52px minmax(0, 2fr) minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: var(--spacing-md);
    padding: 12px var(--spacing-md);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--premium-card), var(--surface-card);
    color: var(--text-primary);
    text-decoration: none;
    min-height: 76px;
    transition: background .15s, border-color .15s, transform .15s;
}
.ap-history-row.has-event-banner::before { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; left: 0; background-image: var(--ap-event-banner); background-position: center; background-size: cover; content: ""; opacity: .26; }
.ap-history-row.has-event-banner::after { position: absolute; z-index: 1; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--surface-card) 78%, transparent), color-mix(in srgb, var(--surface-card) 94%, transparent) 68%, var(--surface-card)); content: ""; }
.ap-history-row > * { position: relative; z-index: 2; }
.ap-history-media { display: grid; place-items: center; width: 52px; height: 52px; overflow: hidden; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface-default) 82%, transparent); color: var(--action-primary); font-size: 17px; }
.ap-history-row:hover,
.ap-history-row:focus-visible {
    background: var(--surface-hover);
    border-color: var(--border-active);
    color: var(--text-primary);
    text-decoration: none;
    transform: translateY(-1px);
}
.ap-history-event { min-width: 0; display: grid; }
.ap-history-name { font-weight: 700; overflow-wrap: anywhere; }
.ap-history-date { color: var(--text-muted); font-size: 12px; }
.ap-history-div { color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.ap-history-time { font-family: var(--font-display); font-size: 18px; font-weight: 700; white-space: nowrap; }
.ap-history-rank { color: var(--text-secondary); font-size: 13px; white-space: nowrap; }
.ap-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.ap-badge-success { color: var(--state-success); background: var(--state-success-bg); border-color: var(--state-success-border-strong); }
.ap-badge-danger  { color: var(--state-danger);  background: var(--state-danger-bg);  border-color: var(--state-danger-border-strong); }
.ap-badge-info    { color: var(--state-info);    background: var(--state-info-bg);    border-color: var(--state-info-border-strong); }
.ap-badge-muted   { color: var(--text-secondary); background: transparent; }
.ap-empty {
    padding: var(--spacing-lg);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-align: center;
}
.ap-detail {
    display: none;
    scroll-margin-top: 90px;
    margin: var(--spacing-md) 0 var(--spacing-lg);
    padding: var(--spacing-md);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
}
.ap-detail:target { display: block; }
.ap-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--spacing-sm); }
.ap-detail-title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.ap-detail-close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--text-secondary);
    text-decoration: none;
}
.ap-detail-close:hover, .ap-detail-close:focus-visible { background: var(--surface-hover); color: var(--text-primary); }
.ap-detail-meta { margin: var(--spacing-sm) 0 0; color: var(--text-secondary); font-size: 13px; }
.ap-detail-state { margin: var(--spacing-sm) 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ap-detail-partner { margin: var(--spacing-sm) 0 0; color: var(--text-secondary); font-size: 13px; }
.ap-detail-partner a { color: var(--text-primary); font-weight: 600; }
.ap-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}
.ap-chip-success { color: var(--state-success); background: var(--state-success-bg); border-color: var(--state-success-border-strong); }
.ap-chip-muted { color: var(--text-secondary); }
.ap-detail-times { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--spacing-sm); margin-top: var(--spacing-md); }
.ap-detail-time { padding: 10px var(--spacing-sm); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-hover); }
.ap-detail-time-label { display: block; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.ap-detail-time-value { display: block; margin-top: 2px; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.ap-detail-ranks { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--spacing-sm); margin-top: var(--spacing-md); }
.ap-rank { padding: 10px var(--spacing-sm); border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.ap-rank-label { display: block; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.ap-rank-value { display: block; margin-top: 2px; font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.ap-splits { width: 100%; border-collapse: collapse; margin-top: var(--spacing-md); font-size: 13px; }
.ap-splits-caption { text-align: left; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding-bottom: 6px; }
.ap-splits th, .ap-splits td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); text-align: left; }
.ap-splits thead th { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ap-splits tbody th { font-weight: 600; }
.ap-num { text-align: right; font-family: var(--font-display); font-weight: 700; }
.ap-detail-back { margin: var(--spacing-md) 0 0; }
.ap-detail-back a { color: var(--text-secondary); font-size: 13px; text-decoration: none; }
.ap-detail-back a:hover, .ap-detail-back a:focus-visible { color: var(--text-primary); text-decoration: underline; }
.ap-notes { margin-bottom: var(--spacing-lg); }
.ap-notes-list { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 13px; }
.ap-actions { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); }
.ap-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.ap-btn:hover, .ap-btn:focus-visible { background: var(--surface-hover); border-color: var(--border-active); color: var(--text-primary); text-decoration: none; }
@media (max-width: 640px) {
    .ap-page { padding-left: var(--spacing-sm); padding-right: var(--spacing-sm); }
    .ap-head-card { min-height: 180px; padding: var(--spacing-md); }
    .ap-identity { align-items: flex-start; }
    .ap-name { font-size: 26px; }
    .ap-dashboard { grid-template-columns: 1fr; }
    .ap-next-card { grid-template-columns: 1fr; }
    .ap-next-facts div { border-left: 0; border-top: 1px solid var(--border-default); }
    .ap-journey-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ap-history-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "event  time"
            "div    badge"
            "rank   rank";
        row-gap: 6px;
    }
    .ap-history-media { display: none; }
    .ap-history-event { grid-area: event; }
    .ap-history-time  { grid-area: time; }
    .ap-history-div   { grid-area: div; }
    .ap-history-row .ap-badge { grid-area: badge; justify-self: end; }
    .ap-history-rank  { grid-area: rank; }
    .ap-splits th, .ap-splits td { padding: 8px 6px; }
}
.ap-page { padding-bottom: 76px; }
.ap-next .ap-btn { margin-top: var(--spacing-sm); }
@media (max-width: 640px) {
    .ap-race-row .ap-badge { grid-area: badge; justify-self: end; }
}
.ap-simhistory-detail .ap-num {
    text-align: right;
    font-family: var(--font-display);
    font-weight: 700;
}
.ap-race-upcoming .ap-strip { margin-top: var(--spacing-sm); }
.ap-race-upcoming .ap-btn { margin-top: var(--spacing-sm); }
.ap-home-last .ap-btn, .ap-race-result .ap-btn { margin-top: var(--spacing-sm); }
@keyframes ap-pulse { 50% { opacity: .35; } }
.ap-next .ap-strip-train .ap-kpi-num { font-size: 26px; }
.ap-setup .ap-btn.ap-start { width: 100%; min-height: 56px; margin-top: var(--spacing-sm); }
.ap-page.is-simulating .ap-nav { display: none; }
.ap-page.is-simulating { padding-bottom: var(--spacing-md); }
.ap-next-card { grid-template-columns: 116px minmax(0, 1fr) minmax(210px, .9fr); }
.ap-next-media { position:relative; display:grid; place-items:center; overflow:hidden; min-height:88px; border:1px solid var(--border-default); border-radius:var(--radius-md); background:var(--surface-default); color:var(--action-primary); font-size:22px; }
.ap-next-media > img:first-child { width:100%; height:100%; object-fit:cover; opacity:.58; }
.ap-next-media .ap-next-logo { position:absolute; max-width:76%; max-height:68%; object-fit:contain; filter:drop-shadow(0 2px 5px rgba(0,0,0,.6)); }
.ap-history-controls { display:flex; align-items:center; gap:6px; }
.ap-history-control { min-height:32px; padding:5px 10px; border:1px solid var(--border-default); border-radius:var(--radius-sm); background:var(--surface-hover); color:var(--text-secondary); font-size:12px; }
.ap-history-control:disabled { opacity:1; cursor:default; }.ap-history-control i { margin-left:5px; font-size:10px; }
.ap-history-media { position:relative; }.ap-history-media > img:first-child { width:100%; height:100%; object-fit:cover; opacity:.62; }
.ap-history-logo { position:absolute; max-width:78%; max-height:66%; object-fit:contain; filter:drop-shadow(0 1px 3px rgba(0,0,0,.8)); }.ap-history-media > i { position:absolute; }
.ap-history-time small,.ap-history-rank small { display:block; margin-bottom:2px; color:var(--text-muted); font-family:var(--font-body); font-size:10px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; }
@media (max-width:640px) { .ap-next-card { grid-template-columns:72px minmax(0,1fr); }.ap-next-facts { grid-column:1 / -1; }.ap-next-media { min-height:72px; }.ap-section-head { flex-wrap:wrap; }.ap-history-controls { width:100%; flex-wrap:wrap; } }
