/* ========== 响应式设计 ========== */

/* 触控 Chip 按钮 */
.chip-group {
    gap: 0.5rem;
}

.chip-item {
    min-height: 44px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    background: var(--card-bg);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.chip-item:has(input:checked),
.chip-item:has(input[type="radio"]:checked) {
    background: #dbeafe;
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.chip-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.btn-match {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    justify-content: center;
}

.result-export-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.result-export-actions .btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
    padding: 0.875rem 1rem;
}

.result-header {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.result-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collapse-icon {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.result-section.collapsed .result-list,
.result-section.collapsed .result-cards {
    display: none;
}

.result-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

@media (max-width: 768px) {
    body.has-bottom-nav {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0));
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .header-title {
        font-size: 1rem;
    }

    .header-icon {
        width: 40px;
        height: 40px;
    }

    .header-stats {
        font-size: 0.7rem;
        margin-top: 0.25rem;
    }

    .header-actions-desktop {
        display: none;
    }

    .tabs-desktop {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }

    .container {
        padding: 1rem;
        padding-bottom: 0.5rem;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .card:hover {
        transform: none;
    }

    .match-form {
        grid-template-columns: 1fr;
    }

    .result-cards {
        grid-template-columns: 1fr;
    }

    .list-header {
        display: none;
    }

    .list-item-summary {
        grid-template-columns: 36px 1fr 28px;
        grid-template-rows: auto auto;
        gap: 0.25rem 0.5rem;
        padding: 0.875rem;
    }

    .col-index {
        grid-row: 1 / 3;
        align-self: center;
    }

    .col-school {
        grid-column: 2;
    }

    .col-score {
        grid-column: 2;
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

    .col-score .list-score,
    .col-score .list-rank {
        display: inline;
        font-size: 0.75rem;
    }

    .col-score .list-rank::before {
        content: '· ';
    }

    .col-subject {
        grid-column: 2;
        margin-top: -0.15rem;
    }

    .col-action {
        grid-row: 1 / 3;
        grid-column: 3;
        align-self: center;
    }

    .list-item-detail {
        padding-left: 0.75rem;
    }

    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .data-toolbar {
        gap: 0.5rem;
    }

    .data-toolbar .btn-sm {
        flex: 1;
        justify-content: center;
        min-height: 40px;
    }

    .scores-container {
        overflow-x: visible;
    }

    .score-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
        border-bottom: 1px solid var(--border-color);
    }

    .score-row:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .score-year {
        text-align: left;
        font-size: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .result-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.25rem;
        max-height: 85vh;
    }

    .toast {
        top: auto;
        bottom: calc(70px + env(safe-area-inset-bottom, 0));
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .result-card:hover {
        transform: none;
    }

    .result-header {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 0.95rem;
    }

    .header-icon {
        width: 36px;
        height: 36px;
    }

    .header-stats {
        font-size: 0.65rem;
    }

    .data-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-title {
        font-size: 1rem;
    }

    .result-export-actions {
        flex-direction: column;
    }

    .result-export-actions .btn {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .header-icon {
        width: 56px;
        height: 56px;
    }
}

@media (min-width: 1400px) {
    .container {
        padding: 2rem;
    }

    .header-title {
        font-size: 1.75rem;
    }
}
