/* ============================================================
   Athlete page — optimised for smartphone
   ============================================================ */

/* Override body centering from main.css */
body {
    display: block;
    align-items: unset;
    justify-content: unset;
    padding: 0;
}

/* --- Layout ------------------------------------------------- */

.ath-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
}

/* --- Header ------------------------------------------------- */

.ath-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.ath-back {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 1.2rem;
    line-height: 1;
    transition: color 0.15s;
}

.ath-back:hover {
    color: var(--color-text);
}

.ath-header__title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Search section ----------------------------------------- */

.ath-search {
    padding: 2rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ath-search__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-muted);
}

.ath-search__row {
    display: flex;
    gap: 0.5rem;
}

.ath-search__input {
    flex: 1;
    font-family: monospace;
    font-size: 1.1rem;
    background: #111;
    border: 1px solid #444;
    border-radius: 4px;
    color: var(--color-text);
    padding: 0.55rem 0.8rem;
    outline: none;
    transition: border-color 0.15s;
}

.ath-search__input:focus {
    border-color: var(--color-accent);
}

.ath-search__btn {
    font-family: monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: transparent;
    border: 1px solid var(--color-accent);
    border-radius: 4px;
    color: var(--color-accent);
    padding: 0.5rem 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.ath-search__btn:hover,
.ath-search__btn:active {
    background: var(--color-accent);
    color: #0d0d0d;
}

.ath-search__btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.ath-search__error {
    font-size: 0.78rem;
    color: #e06060;
    min-height: 1.1em;
}

/* --- Multiple results list ---------------------------------- */

.ath-results-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.2rem 0;
}

.ath-results-list__hint {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    margin-bottom: 0.7rem;
}

.ath-results-list__ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.ath-result-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    background: var(--color-surface);
    border-left: 4px solid #555;
    border-radius: 4px;
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    transition: background 0.12s;
}

.ath-result-item:hover,
.ath-result-item:active {
    background: #242424;
}

/* Heat info — left side, fixed width */
.ath-result-item__heat {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: #666;
    white-space: nowrap;
    text-align: left;
    min-width: 4rem;
}

/* Name + team stacked on the right */
.ath-result-item__right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: hidden;
}

.ath-result-item__name {
    font-size: 0.95rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ath-result-item__team {
    font-size: 0.7rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Result section ----------------------------------------- */

.ath-result {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Colored strip at top of result card */
.ath-color-strip {
    height: 5px;
    width: 100%;
    flex-shrink: 0;
}

/* --- Athlete identity --------------------------------------- */

.ath-identity {
    padding: 1.2rem 1.2rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border-bottom: 1px solid #222;
}

.ath-bib {
    display: none; /* no bib field in current config */
}

.ath-name {
    font-size: 1.3rem;
    color: var(--color-text);
    letter-spacing: 0.04em;
}

.ath-team {
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* --- Heat info ---------------------------------------------- */

.ath-heat-info {
    padding: 0.8rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border-bottom: 1px solid #222;
}

.ath-heat-name {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text);
}

.ath-heat-cat {
    font-size: 0.72rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ath-heat-start {
    font-size: 0.72rem;
    color: var(--color-muted);
    font-family: monospace;
}

/* --- Timer block -------------------------------------------- */

.ath-timer-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 2rem 1rem;
    transition: opacity 0.3s;
}

.ath-timer-block.is-stopped {
    opacity: 0.45;
    filter: grayscale(40%);
}

.ath-timer-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    min-height: 1em;
}

.ath-timer-block.is-running .ath-timer-status {
    color: #4caf50;
}

.ath-timer-block.is-waiting .ath-timer-status {
    color: var(--color-muted);
}

.ath-timer-block.is-stopped .ath-timer-status {
    color: #e06000;
}

.ath-timer {
    font-family: monospace;
    font-size: clamp(3rem, 18vw, 5rem);
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--color-text);
}

.ath-timer-block.is-running .ath-timer {
    color: var(--color-accent);
}

/* --- Race result block -------------------------------------- */

.ath-result-block {
    padding: 0.8rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    border-top: 1px solid #222;
    flex-shrink: 0;
}

/* Finisher image — fills available width up to a comfortable size */
.ath-finisher-img {
    width: min(60vw, 180px);
    height: auto;
}

.ath-result-badge {
    font-family: monospace;
    font-size: 1rem;
    letter-spacing: 0.06em;
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    border: 1px solid currentColor;
}

.ath-result-badge--abandon {
    color: #666;
    background: rgba(80, 80, 80, 0.08);
}

/* Penalty breakdown — shown below the total time when a penalty applies */
.ath-result-badge--penalty {
    color: #e06000;
    border-color: #e06000;
    background: rgba(224, 96, 0, 0.08);
    font-size: 0.85rem;
}

.ath-penalty-detail {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.ath-penalty-amount {
    color: #e06000;
    font-size: 0.9em;
    opacity: 0.85;
}

/* --- Station split times ------------------------------------ */

.ath-stations {
    border-top: 1px solid #222;
    padding: 0.8rem 1.2rem;
    flex-shrink: 0;
}

.ath-stations__title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.ath-stations__table {
    width: 100%;
    border-collapse: collapse;
}

.ath-stations__table tr {
    border-bottom: 1px solid #1e1e1e;
}

.ath-stations__table tr:last-child {
    border-bottom: none;
}

.ath-stations__num {
    font-family: monospace;
    font-size: 0.65rem;
    color: #555;
    width: 1.8rem;
    padding: 0.3rem 0.4rem 0.3rem 0;
    text-align: right;
    vertical-align: middle;
}

.ath-stations__label {
    font-size: 0.8rem;
    color: var(--color-muted);
    padding: 0.3rem 0.6rem;
    vertical-align: middle;
}

.ath-stations__time {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--color-text);
    text-align: right;
    padding: 0.3rem 0 0.3rem 0.4rem;
    vertical-align: middle;
    white-space: nowrap;
}

/* Row without a recorded time — muted appearance */
.ath-stations__row--empty .ath-stations__num,
.ath-stations__row--empty .ath-stations__label,
.ath-stations__row--empty .ath-stations__time {
    color: #444;
}

/* --- Reset button ------------------------------------------- */

.ath-reset {
    font-family: monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: transparent;
    border: none;
    border-top: 1px solid #222;
    color: var(--color-muted);
    padding: 1rem;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: color 0.15s;
    flex-shrink: 0;
}

.ath-reset:hover {
    color: var(--color-text);
}
