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

html, body {
    overflow-x: hidden;
    width: 100%;
}

/* 防止长单词溢出 */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #212529;
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid rgba(255, 122, 0, 0.3);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #ff7a00;
    font-size: 2.8em;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 0 30px rgba(255, 122, 0, 0.3);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    font-size: 1em;
    color: #6c757d;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #212529;
}

.controls {
    background: rgba(255, 255, 255, 0.8);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 122, 0, 0.2);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.search-filter {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

#searchInput {
    flex: 1;
    min-width: 300px;
    padding: 14px 18px;
    border: 2px solid rgba(255, 122, 0, 0.3);
    border-radius: 10px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #212529;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #ff7a00;
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.1);
}

#searchInput::placeholder {
    color: #666;
}

#sortSelect {
    padding: 14px 18px;
    border: 2px solid rgba(255, 122, 0, 0.3);
    border-radius: 10px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #212529;
    cursor: pointer;
    transition: all 0.3s ease;
}

#sortSelect:focus {
    outline: none;
    border-color: #ff7a00;
}

.filter-btn, .refresh-btn, .settings-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
}

.filter-btn {
    background: linear-gradient(135deg, #ff7a00, #ff9500);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 122, 0, 0.3);
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 122, 0, 0.4);
}

.filter-btn.active {
    background: linear-gradient(135deg, #e53e3e, #c53030);
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.3);
}

.refresh-btn, .settings-btn {
    background: rgba(255, 122, 0, 0.1);
    color: #ff7a00;
    border: 2px solid rgba(255, 122, 0, 0.3);
}

.refresh-btn:hover, .settings-btn:hover {
    background: rgba(255, 122, 0, 0.2);
    transform: translateY(-2px);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.refresh-btn.refreshing {
    cursor: wait;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 122, 0, 0.2);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: rgba(255, 122, 0, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.stat-number {
    display: block;
    font-size: 3em;
    font-weight: 800;
    color: #ff7a00;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(255, 122, 0, 0.3);
}

.stat-label {
    color: #6c757d;
    font-size: 0.9em;
    font-weight: 500;
    letter-spacing: 1px;
}

.loading, .error {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    border: 1px solid rgba(255, 122, 0, 0.2);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-size: 1.2em;
    color: #212529;
}

.error {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
    background: rgba(139, 0, 0, 0.1);
}

.models-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

@media (max-width: 900px) {
    .models-container {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 16px;
    }
}

.model-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid rgba(255, 122, 0, 0.2);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.model-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 122, 0, 0.4);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}

.model-card.free {
    border-left: 4px solid #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.model-card.free::before {
    content: '';
    position: absolute;
    top: 0;
    left: 4px;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 0 16px 0 0;
}

.model-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 12px;
}

.model-info {
    flex: 1;
    min-width: 0;
}

.model-name {
    font-size: 1.4em;
    font-weight: 700;
    color: #ff7a00;
    margin-bottom: 8px;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.model-id {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    color: #6c757d;
    font-size: 0.9em;
    background: rgba(248, 249, 250, 0.8);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 122, 0, 0.2);
}

.model-id:hover {
    background: rgba(255, 122, 0, 0.1);
    color: #ff7a00;
    border-color: rgba(255, 122, 0, 0.3);
}

.free-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    flex-shrink: 0;
    white-space: nowrap;
}

.model-description {
    color: #495057;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 20px;
    max-height: 60px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.model-description.expanded {
    max-height: none;
}

.model-description:not(.expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 20px;
    width: 100%;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.95));
}

.expand-toggle {
    color: #ff7a00;
    font-size: 0.85em;
    cursor: pointer;
    margin-top: 5px;
    display: inline-block;
}

.expand-toggle:hover {
    text-decoration: underline;
}

.model-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.detail-item {
    text-align: center;
    padding: 12px;
    background: rgba(248, 249, 250, 0.6);
    border-radius: 8px;
    border: 1px solid rgba(255, 122, 0, 0.15);
    transition: all 0.3s ease;
}

.detail-item:hover {
    border-color: rgba(255, 122, 0, 0.3);
    background: rgba(248, 249, 250, 0.8);
}

.detail-label {
    display: block;
    font-size: 0.75em;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    display: block;
    font-weight: 600;
    color: #212529;
    font-size: 0.9em;
}

.detail-value.highlight {
    color: #ff7a00;
}

.detail-value.free {
    color: #10b981;
}

.expandable-section {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 122, 0, 0.2);
    padding-top: 15px;
}

.expandable-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ff7a00;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.expandable-header:hover {
    color: #ff9500;
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.expandable-content.expanded {
    max-height: 500px;
}

.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.copy-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* 模态框样式 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    margin: 10% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 122, 0, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 122, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #ff7a00;
    font-size: 1.3em;
    font-weight: 600;
}

.close {
    font-size: 24px;
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ff7a00;
}

.modal-body {
    padding: 25px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: #212529;
    font-weight: 600;
    font-size: 0.9em;
}

.setting-item input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 122, 0, 0.2);
    border-radius: 8px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.8);
    color: #212529;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.setting-item input:focus {
    outline: none;
    border-color: #ff7a00;
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.1);
}

.setting-item small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.8em;
    line-height: 1.4;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 122, 0, 0.2);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.save-btn, .cancel-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #ff7a00, #ff9500);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 122, 0, 0.3);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 122, 0, 0.4);
}

.cancel-btn {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border: 2px solid rgba(108, 117, 125, 0.3);
}

.cancel-btn:hover {
    background: rgba(108, 117, 125, 0.2);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    header {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .controls {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .search-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    #searchInput {
        min-width: auto;
        width: 100%;
        font-size: 16px; /* 防止iOS缩放 */
        box-sizing: border-box;
    }
    
    #sortSelect {
        width: 100%;
        font-size: 16px;
        box-sizing: border-box;
    }
    
    .filter-btn, .refresh-btn, .settings-btn {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px;
        box-sizing: border-box;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-width: none;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 15px 20px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .save-btn, .cancel-btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .stat-item {
        padding: 12px 8px;
    }
    
    .stat-number {
        font-size: 1.6em;
        margin-bottom: 3px;
    }
    
    .stat-label {
        font-size: 0.75em;
    }
    
    .models-container {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }
    
    .model-card {
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .model-header {
        margin-bottom: 12px;
        gap: 8px;
    }
    
    .model-info {
        flex: 1;
        min-width: 0;
    }
    
    .model-name {
        font-size: 1.1em;
        line-height: 1.3;
        margin-bottom: 6px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .model-id {
        font-size: 0.8em;
        padding: 4px 8px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .model-description {
        font-size: 0.85em;
        max-height: 40px;
        line-height: 1.4;
    }
    
    .model-details {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-top: 12px;
    }
    
    .detail-item {
        padding: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .detail-label {
        font-size: 0.7em;
        margin-bottom: 0;
        margin-right: 8px;
        flex-shrink: 0;
    }
    
    .detail-value {
        font-size: 0.8em;
        text-align: right;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
    
    .expandable-header {
        font-size: 0.8em;
        padding: 6px 0;
    }
    
    .expandable-section {
        margin-top: 10px;
        padding-top: 10px;
    }
    
    .free-badge {
        font-size: 0.7em;
        padding: 4px 10px;
        flex-shrink: 0;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header {
        padding: 12px;
    }
    
    h1 {
        font-size: 1.6em;
        margin-bottom: 6px;
    }
    
    .controls {
        padding: 12px;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .stat-item {
        padding: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .stat-number {
        font-size: 1.4em;
        margin-bottom: 0;
    }
    
    .stat-label {
        font-size: 0.7em;
    }
    
    .model-card {
        padding: 12px;
    }
    
    .model-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .model-info {
        width: 100%;
    }
    
    .model-name {
        font-size: 1em;
        line-height: 1.2;
    }
    
    .model-id {
        font-size: 0.75em;
        padding: 3px 6px;
    }
    
    .model-description {
        font-size: 0.8em;
        max-height: 36px;
    }
    
    .model-details {
        grid-template-columns: 1fr;
        gap: 4px;
        margin-top: 10px;
    }
    
    .detail-item {
        padding: 6px;
        font-size: 0.8em;
    }
    
    .detail-label {
        font-size: 0.65em;
    }
    
    .detail-value {
        font-size: 0.75em;
    }
    
    .free-badge {
        font-size: 0.65em;
        padding: 3px 8px;
        align-self: flex-start;
    }
    
    .expandable-header {
        font-size: 0.75em;
        padding: 4px 0;
    }
}