*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f5f5f5;
    color: #333;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

header {
    background: white;
    padding: 12px 16px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-top {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.header-user-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: transform 0.15s;
}

.header-user-btn:active {
    transform: scale(0.93);
}

header h1 {
    font-size: 17px;
    font-weight: 700;
    flex: 1;
    text-align: center;
    letter-spacing: -0.3px;
}

header h1 img {
    height: 16px;
    vertical-align: -2px;
    margin-right: 6px;
    border-radius: 2px;
}

nav {
    display: flex;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 3px;
    margin: 0 8px 12px;
}

.tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 7px 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: white;
    color: #333;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

main {
    padding: 16px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 16px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s;
}

.progress-fill.on-track {
    background: linear-gradient(90deg, #43a047, #66bb6a);
}

.progress-fill.behind {
    background: linear-gradient(90deg, #e53935, #ef5350);
}

.runners-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 8px;
    margin: 16px 0;
}

.runner-avatar {
    text-align: center;
    width: 60px;
    cursor: pointer;
}

.runner-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ddd;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.runner-avatar.selected img {
    box-shadow: 0 0 0 3px var(--runner-color);
    border-color: var(--runner-color);
}

.runner-avatar .name {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.runner-avatar .km {
    font-size: 13px;
    font-weight: bold;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    margin-bottom: 8px;
}

.stats-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.stat-card {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.stat-card .label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .value {
    font-size: 18px;
    font-weight: bold;
    margin-top: 2px;
}

.run-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.run-row:active {
    background: #f5f5f5;
}

.run-row img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.run-row .rank {
    font-size: 14px;
    font-weight: bold;
    width: 20px;
    color: #43a047;
}

.run-row .info {
    flex: 1;
}

.run-row .info .name {
    font-size: 12px;
    font-weight: 600;
}

.run-row .info .date {
    font-size: 11px;
    color: #888;
}

.run-row .stats {
    text-align: right;
}

.run-row .stats .distance {
    font-size: 15px;
    font-weight: bold;
}

.run-row .stats .pace {
    font-size: 11px;
    color: #888;
}

.run-row .chevron {
    color: #ccc;
    font-size: 16px;
}

.run-row.inactive {
    opacity: 0.4;
}

.week-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.week-selector .arrow {
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    user-select: none;
}

.week-selector .pills {
    display: flex;
    gap: 4px;
}

.week-pill {
    background: white;
    border: 1px solid #ddd;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
}

.week-pill.active {
    background: #2196f3;
    color: white;
    border-color: #2196f3;
    font-weight: 600;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.drop-zone.dragover {
    border-color: #2196f3;
    background: #e3f2fd;
}

.drop-zone .icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.btn {
    display: inline-block;
    background: #43a047;
    color: white;
    padding: 10px 28px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #388e3c;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.section-title {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.back-link {
    color: #999;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 16px;
    display: inline-block;
}

.week-summary {
    text-align: center;
    padding: 16px;
}

.week-summary .total {
    font-size: 32px;
    font-weight: bold;
}

.week-summary .goal {
    color: #aaa;
    font-weight: normal;
}

.week-summary .remaining {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    margin-bottom: 16px;
}

.ocr-result {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.ocr-result .fields {
    display: flex;
    gap: 16px;
}

.ocr-result .field {
    flex: 1;
}

.ocr-result .field .value {
    font-size: 20px;
    font-weight: bold;
}

.delete-run-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 20px;
    line-height: 1;
    padding: 4px 0 4px 12px;
    cursor: pointer;
    transition: color 0.15s;
}

.delete-run-btn:hover,
.delete-run-btn:active {
    color: #e53935;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}
