:root {
    --primary: #1b5e20;
    --primary-light: #4caf50;
    --primary-dark: #0d3d11;
    --accent: #ff6f00;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #212121;
    --text-light: #757575;
    --border: #e0e0e0;
    --danger: #d32f2f;
    --success: #388e3c;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --nav-height: 64px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding-bottom: calc(var(--nav-height) + 16px);
    -webkit-tap-highlight-color: transparent;
}

.app-header {
    background: var(--primary);
    color: white;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.app-main {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.7rem;
    padding: 8px 12px;
    transition: color 0.2s;
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-add {
    background: var(--primary);
    color: white !important;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    margin-top: -16px;
    box-shadow: 0 4px 12px rgba(27,94,32,0.3);
    justify-content: center;
    padding: 0;
}

.nav-add svg {
    width: 28px;
    height: 28px;
}

.nav-add span {
    display: none;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--text);
}

h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-light);
    font-weight: 500;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.match-team {
    flex: 1;
    text-align: center;
}

.match-team .players {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
}

.match-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
    text-align: center;
}

.match-sets-detail {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s, box-shadow 0.2s;
    min-height: 48px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(27,94,32,0.25);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-height: 36px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.player-list {
    list-style: none;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: 600;
    font-size: 1rem;
}

.player-stats {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}

.player-actions {
    display: flex;
    gap: 8px;
}

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

.stats-table th {
    background: var(--primary);
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
}

.stats-table th:first-child {
    text-align: left;
    border-radius: var(--radius) 0 0 0;
}

.stats-table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.stats-table td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.stats-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.stats-table tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius);
}

.stats-table tr:last-child td:last-child {
    border-radius: 0 0 var(--radius) 0;
}

.rank-position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.rank-1 { background: #ffd700; color: #333; }
.rank-2 { background: #c0c0c0; color: #333; }
.rank-3 { background: #cd7f32; color: white; }

.sets-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.sets-inputs input {
    width: 60px;
    text-align: center;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
}

.sets-inputs span {
    font-weight: 600;
    color: var(--text-light);
}

.team-section {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
}

.team-section h4 {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vs-divider {
    text-align: center;
    font-weight: 700;
    color: var(--text-light);
    padding: 8px 0;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 16px;
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--card-bg);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-light);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: #e8f5e9;
    color: var(--success);
    border: 1px solid #c8e6c9;
}

.alert-error {
    background: #ffebee;
    color: var(--danger);
    border: 1px solid #ffcdd2;
}

.filter-bar {
    margin-bottom: 16px;
}

.filter-bar select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--card-bg);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: calc(var(--radius) - 4px);
    transition: all 0.2s;
}

.tab.active {
    background: var(--primary);
    color: white;
}

.category-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

.category-select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    background: var(--card-bg);
    min-width: 50px;
}

@media (min-width: 768px) {
    .app-main {
        padding: 24px;
    }
    
    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius) var(--radius) 0 0;
    }
}
