:root {
    /* Apple Light Cupertino Palette */
    --bg-system: #f5f5f7;
    --bg-elevated: #ffffff;
    --bg-secondary: #fbfbfd;
    --bg-grouped: #f2f2f7;
    --bg-translucent: rgba(255, 255, 255, 0.82);
    
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-separator: #e5e5ea;
    
    /* Apple System Colors */
    --apple-blue: #0071e3;
    --apple-blue-hover: #0077ed;
    --apple-green: #34c759;
    --apple-orange: #ff9500;
    --apple-red: #ff3b30;
    --apple-purple: #af52de;
    --apple-teal: #30b0c7;
    --apple-gray: #8e8e93;
    --apple-light-gray: #e5e5ea;
    
    /* Text */
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --text-quaternary: #aeaeb2;
    
    /* Typography */
    --font-apple: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", Menlo, Monaco, Consolas, monospace;
    
    /* Radii & Shadows */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-elevated: 0 12px 36px rgba(0, 0, 0, 0.09), 0 2px 6px rgba(0, 0, 0, 0.03);
    
    --transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

body {
    background-color: var(--bg-system);
    color: var(--text-primary);
    font-family: var(--font-apple);
    line-height: 1.47059;
    font-size: 15px;
    letter-spacing: -0.016em;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Apple Card */
.apple-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    transition: var(--transition);
}

.apple-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
}

/* Top Navigation Bar */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-separator);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: #000;
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.5px;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.022em;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Athlete Profile Capsule */
.athlete-capsule {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-grouped);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

/* Apple Badges */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-blue {
    background: rgba(0, 113, 227, 0.1);
    color: var(--apple-blue);
}

.badge-green {
    background: rgba(52, 199, 89, 0.12);
    color: #248a3d;
}

.badge-orange {
    background: rgba(255, 149, 0, 0.12);
    color: #b26800;
}

.badge-red {
    background: rgba(255, 59, 48, 0.12);
    color: var(--apple-red);
}

.badge-gray {
    background: var(--bg-grouped);
    color: var(--text-secondary);
}

/* Apple Segmented Control (Tabs) */
.segmented-wrapper {
    max-width: 1280px;
    margin: 1.25rem auto 0;
    padding: 0 1.5rem;
}

.segmented-control {
    display: inline-flex;
    background: #e9e9ee;
    padding: 3px;
    border-radius: var(--radius-sm);
    gap: 2px;
    max-width: 100%;
    overflow-x: auto;
}

.segment-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1.1rem;
    border-radius: 7px;
    font-family: var(--font-apple);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.segment-btn:hover {
    color: var(--text-primary);
}

.segment-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Main Layout */
.main-content {
    max-width: 1280px;
    margin: 1.5rem auto 4rem;
    padding: 0 1.5rem;
}

/* Views */
.view-section {
    display: none;
    animation: appleFadeIn 0.22s ease-out;
}

.view-section.active {
    display: block;
}

@keyframes appleFadeIn {
    from { opacity: 0; transform: scale(0.995) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Grids */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.25rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

/* Match Card */
.match-card {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.2rem;
}

.match-card.home-ma {
    border-left: 4px solid var(--apple-blue);
}

.match-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-top: 0.35rem;
}

.match-dates {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0;
}

/* Logistics Info Box */
.logistics-box {
    background: var(--bg-grouped);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logistics-item {
    display: flex;
    flex-direction: column;
}

.logistics-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.logistics-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logistics-val.highlight {
    color: var(--apple-blue);
}

/* Apple Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font-apple);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--apple-blue);
    color: #ffffff;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--apple-blue-hover);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-separator);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: #d1d1d6;
}

.btn-maps {
    background: #ffffff;
    color: #1a73e8;
    border: 1px solid #dadce0;
    font-weight: 500;
}

.btn-maps:hover {
    background: #f8fafd;
    border-color: #1a73e8;
}

.btn-success {
    background: var(--apple-green);
    color: #ffffff;
    font-weight: 600;
}

.btn-danger {
    background: #fff;
    color: var(--apple-red);
    border: 1px solid rgba(255, 59, 48, 0.25);
}

.btn-danger:hover {
    background: rgba(255, 59, 48, 0.06);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 0;
}

.form-control {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid var(--border-separator);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-apple);
    font-size: 0.95rem;
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border-subtle);
}

.apple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.apple-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-separator);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.apple-table td {
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid var(--border-separator);
    color: var(--text-primary);
}

.apple-table tr:last-child td {
    border-bottom: none;
}

.apple-table tr:hover td {
    background: #fbfbfd;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal-overlay.open,
.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    padding: 2rem;
    box-shadow: var(--shadow-elevated);
    border: 1px solid var(--border-subtle);
}

/* Power Factor Clean Gauge */
.pf-gauge-container {
    text-align: center;
    padding: 2rem;
}

.pf-number {
    font-size: 4.5rem;
    font-weight: 700;
    font-family: var(--font-apple);
    letter-spacing: -2px;
    line-height: 1;
    margin: 0.5rem 0;
}

.pf-bar-wrapper {
    height: 10px;
    background: var(--apple-light-gray);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
    margin: 1.25rem 0;
}

.pf-bar-fill {
    height: 100%;
    width: 50%;
    transition: width 0.3s ease, background 0.3s ease;
    border-radius: var(--radius-full);
}

.pf-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #000;
    z-index: 2;
    opacity: 0.3;
}

/* High-Visibility Field Range Inputs for Power Factor */
.pf-field-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-subtle);
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}
.pf-field-card:focus-within {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
.pf-field-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pf-large-input {
    font-size: clamp(2.4rem, 6.5vw, 3.8rem);
    font-weight: 800;
    font-family: var(--font-apple);
    letter-spacing: -0.04em;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    padding: 0;
    margin: 0;
    line-height: 1;
    -moz-appearance: textfield;
}
.pf-large-input::-webkit-outer-spin-button,
.pf-large-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pf-unit-switch-group {
    display: flex;
    background: var(--bg-grouped);
    border-radius: var(--radius-md);
    padding: 5px;
    gap: 6px;
    border: 1px solid var(--border-subtle);
}
.pf-unit-switch-btn {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.8rem 0.5rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.pf-unit-switch-btn.active {
    background: #ffffff;
    color: var(--apple-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive & Mobile / Pixel 10 Pro Fold Optimization */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        -webkit-tap-highlight-color: transparent;
    }
    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        padding: 0.85rem 1rem;
    }
    .athlete-capsule {
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
        padding: 0.45rem 0.75rem;
        gap: 0.4rem;
        box-sizing: border-box;
    }
    .segmented-wrapper {
        padding: 0 0.85rem;
        margin-bottom: 1.25rem;
    }
    .segmented-control {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px;
        gap: 4px;
    }
    .segmented-control::-webkit-scrollbar {
        display: none;
    }
    .segment-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.55rem 0.95rem;
        font-size: 0.82rem;
    }
    .main-content {
        padding: 0 0.85rem 3rem;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    .apple-card {
        padding: 1.15rem !important;
        border-radius: var(--radius-md);
    }
    .pf-number {
        font-size: 3.2rem !important;
    }
    .table-wrapper {
        margin: 0 -0.85rem;
        padding: 0 0.85rem;
        border-radius: 0;
    }
    .btn {
        min-height: 40px;
    }
}

/* Specific Folded Screen (Pixel 10 Pro Fold Cover Screen: ~400px) */
@media (max-width: 440px) {
    .brand-title {
        font-size: 1rem;
    }
    .apple-card {
        padding: 1rem !important;
    }
    .btn {
        padding: 0.65rem 0.95rem;
    }
    h2 {
        font-size: 1.35rem !important;
    }
}
