:root {
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --accent: #007aff;
    --accent-muted: #e0ecff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-subtle: #e5e7eb;
    --radius: 12px;
    --shadow-soft: 0 2px 6px rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-main);
}

.page {
    max-width: 900px;
    margin: 0 auto;
}

a {
    color: inherit;
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}

/* Headings & subtitles */

h1 {
    font-size: 1.6rem;
    margin: 0 0 10px;
}

h2 {
    font-size: 1.1rem;
    margin: 18px 0 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

h3 {
    font-size: 1.0rem;
    margin: 10px 0 4px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.section-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.muted {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Back links */

.back-link {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.back-link span {
    font-size: 1.1rem;
}

/* Meet list + meet cards */

.meet-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meet-card {
    display: block;
    padding: 12px 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.08s ease-out;
}

.meet-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    background: #ffffff;
}

.meet-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-soft);
    background: #f0f0f5;
}

.meet-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.badge-live {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-muted);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meet-dates {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.meet-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    gap: 8px;
}

.meet-meta-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.meta-pill {
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3f4f6;
}

.meta-pill.weak {
    background: transparent;
    padding-left: 0;
}

.no-results-tag {
    color: #b91c1c;
    font-weight: 500;
}

/* Meet header & dates */

.meet-header-title {
    font-size: 1.5rem;
    margin: 4px 0;
}

.meet-header-dates {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Scoreboard */

.scoreboard {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    padding: 10px 12px;
    margin-bottom: 16px;
}

.scoreboard-title {
    font-size: 1.0rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.scoreboard-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.score-table th,
.score-table td {
    padding: 3px 4px;
    text-align: left;
}

.score-table th {
    color: var(--text-muted);
    font-weight: 500;
}

/* Event list & event cards */

.event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-card {
    display: block;
    padding: 10px 12px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.08s ease-out;
}

.event-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    background: #ffffff;
}

.event-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-soft);
    background: #f0f0f5;
}

.event-main-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.event-title-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-name {
    font-size: 1.0rem;
    font-weight: 600;
}

.event-number {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.event-rounds {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.event-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.event-meta-left {
    display: flex;
    gap: 10px;
}

/* Heats & results in event_view */

.heat-section {
    margin-bottom: 16px;
}

.heat-header {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.08s ease-out, box-shadow 0.08s ease-out, transform 0.08s ease-out;
}

.result-card:hover {
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.result-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-soft);
    background: #f0f0f5;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.result-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lane-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.athlete-name {
    font-size: 1.0rem;
    font-weight: 600;
}

.team-code {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.result-times {
    text-align: right;
    font-size: 0.9rem;
}

.final-time {
    font-weight: 600;
}

.place-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-pill {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid transparent;
}
.status-ok {
    border-color: #10b981;
    color: #047857;
}
.status-dq {
    border-color: #b91c1c;
    color: #b91c1c;
}
.status-ns {
    border-color: #6b7280;
    color: #6b7280;
}

/* Splits */

.result-splits {
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 6px;
    display: none;
}

.result-card.open .result-splits {
    display: block;
}

.splits-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.splits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.splits-table th,
.splits-table td {
    padding: 2px 4px;
    text-align: right;
}

.splits-table th {
    color: var(--text-muted);
    font-weight: 500;
}

.splits-table td.label {
    text-align: left;
}

.splits-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Responsive tweaks */

@media (min-width: 768px) {
    body {
        padding: 24px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .meet-card,
    .event-card,
    .result-card,
    .scoreboard {
        padding: 12px 14px;
    }
}