:root {
    --primary-color: #3b82f6;
    --secondary-color: #1e293b;
    --background-color: #f9fafb;
    --card-background: #ffffff;
    --text-color: #334155;
    --text-light: #64748b;
    --accent-color: #6366f1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 布局容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 搜索区域 */
.search-container {
    text-align: center;
    margin-bottom: 3rem;
    width: 100%;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1.8rem;
}

/* 搜索包装器 */
.search-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.2rem;
}

/* 搜索区域 */
.search-box {
    display: flex;
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    background-color: white;
}

.search-box:focus-within {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

input[type="text"] {
    flex: 1;
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    transition: var(--transition);
    outline: none;
    background: none;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
}

/* 国家选择器 */
.country-selector {
    position: relative;
    min-width: 100px;
    background: none;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
}

.selected-country {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 100%;
    cursor: pointer;
    user-select: none;
    width: 100%;
    background-color: white;
}

.selected-country i {
    margin-left: auto;
    color: var(--text-light);
    transition: transform 0.2s ease;
}

.selected-country:hover i {
    color: var(--text-color);
}

.country-selector.active .selected-country i {
    transform: rotate(180deg);
}

.selected-country img {
    width: 24px;
    height: auto;
    margin-right: 6px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-code {
    font-weight: 600;
    margin-right: 5px;
}

/* 国家选择器样式优化 */
.country-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 250px;
    max-height: 300px;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.country-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 移除国家搜索部分 */
.country-search {
    display: none;
}

/* 优化国家列表，避免双滚动条 */
.country-list {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 4px 0;
}

.country-list::-webkit-scrollbar {
    width: 6px;
}

.country-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.country-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.country-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.country-search {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.country-search input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
}

.country-list {
    max-height: 250px;
    overflow-y: auto;
}

.country-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.country-item:hover {
    background-color: #f1f5f9;
}

.country-item:active {
    background-color: #e2e8f0;
}

.country-item img {
    width: 24px;
    height: auto;
    margin-right: 10px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-item-name {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-color);
}

.country-item-code {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* 搜索按钮 */
button[type="submit"] {
    padding: 0 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    transition: var(--transition);
    min-width: 60px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

button[type="submit"]:hover {
    background-color: #2563eb;
}

button[type="submit"]:active {
    transform: translateY(1px);
}

.search-options {
    margin-top: 1.2rem;
    display: flex;
    justify-content: center;
}

select {
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid #e2e8f0;
    background-color: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    color: var(--text-color);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

select:hover {
    border-color: #cbd5e1;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* 图标卡片 */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* 图标卡片动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out forwards;
    opacity: 0;
}

.icon-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(229, 231, 235, 0.5);
}

.icon-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(203, 213, 225, 0.8);
}

.icon-image {
    margin-bottom: 1.2rem;
    position: relative;
    transition: var(--transition);
}

.icon-image img {
    width: 100px;
    height: 100px;
    border-radius: 22px;
    display: block;
    margin: 0 auto;
    object-fit: cover;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    border: 1px solid rgba(229, 231, 235, 0.8);
}

.icon-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.app-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.app-developer {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.download-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: auto;
}

.download-options-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.size-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.8rem;
    transition: var(--transition);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.size-btn:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--primary-color);
    transform: translateY(-2px);
}

.size-btn:active {
    transform: translateY(0);
}

.size-btn-small {
    height: 70px;
}

.size-btn-large {
    height: 70px;
    background-color: #eff6ff;
    border-color: #bfdbfe;
}

.size-btn-large:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
}

.size-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.size-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: white;
    font-size: 2.2rem;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1010;
    opacity: 0.8;
}

.close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 80%;
    max-height: 80vh;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.3s ease-in-out;
    object-fit: contain;
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#imageCaption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: white;
    padding: 10px 0;
    height: 150px;
    font-weight: 500;
}

/* 返回顶部按钮 */
#back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: var(--transition);
    z-index: 99;
    opacity: 0.9;
}

#back-to-top:hover {
    background-color: #2563eb;
    transform: translateY(-5px);
    opacity: 1;
}

/* 页脚 */
footer {
    padding: 2rem 0;
    margin-top: 4rem;
    background-color: var(--background-color);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: var(--text-light);
    font-size: 1.5rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* 无搜索结果 */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    width: 100%;
    grid-column: 1 / -1;
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    border: 1px dashed #e2e8f0;
}

.no-results p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-top: 1rem;
}

.no-results i {
    font-size: 3rem;
    color: #cbd5e1;
}

/* 响应式样式 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 0.3rem;
    }

    .subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    /* 搜索框移动端优化 */
    .search-box {
        flex-direction: column;
        background: none;
        box-shadow: none;
    }

    input[type="text"] {
        width: 100%;
        border-radius: var(--border-radius);
        border: 1px solid #e2e8f0;
        background: white;
        box-shadow: var(--shadow-sm);
    }

    .country-selector {
        width: 100%;
        margin-top: 0.5rem;
        border: 1px solid #e2e8f0;
        border-radius: var(--border-radius);
        background: white;
        box-shadow: var(--shadow-sm);
    }

    .selected-country {
        padding: 0.8rem 1rem;
    }

    button[type="submit"] {
        width: 100%;
        margin-top: 0.5rem;
        border-radius: var(--border-radius);
        padding: 0.8rem;
    }

    .search-options {
        margin-top: 0.8rem;
    }

    select {
        width: 100%;
        max-width: 200px;
    }

    /* 图标网格移动端优化 */
    .icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .icon-card {
        padding: 1rem;
    }

    .icon-image {
        margin-bottom: 0.8rem;
    }

    .icon-image img {
        width: 80px;
        height: 80px;
        border-radius: 18px;
    }

    .app-name {
        font-size: 0.95rem;
        margin-bottom: 0.3rem;
    }

    .app-developer {
        font-size: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .download-options {
        gap: 0.5rem;
    }

    .download-options-row {
        gap: 0.3rem;
    }

    .size-btn {
        padding: 0.5rem 0;
        min-height: 52px;
    }

    .size-btn-small {
        height: auto;
    }

    .size-btn-large {
        height: auto;
    }

    .size-label {
        font-size: 0.85rem;
    }

    .size-desc {
        font-size: 0.7rem;
    }

    /* 国家选择器移动端优化 */
    .country-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        transform: translateY(100%);
    }

    .country-dropdown.show {
        transform: translateY(0);
    }

    .country-list {
        max-height: calc(60vh - 20px);
    }

    .country-item {
        padding: 0.8rem 1rem;
    }

    /* 模态框移动端优化 */
    .modal {
        padding-top: 0;
    }

    .modal-content {
        max-width: 95%;
        max-height: 90vh;
    }

    .close {
        top: 10px;
        right: 10px;
        font-size: 2rem;
    }

    #imageCaption {
        padding: 0.8rem;
        height: auto;
        max-height: 100px;
    }

    /* 返回顶部按钮移动端优化 */
    #back-to-top {
        width: 40px;
        height: 40px;
        bottom: 15px;
        right: 15px;
        font-size: 1rem;
    }

    /* 页脚移动端优化 */
    footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 0 1rem;
    }

    .social-links {
        justify-content: center;
    }
}

/* 小屏幕设备额外优化 */
@media (max-width: 375px) {
    .icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.8rem;
    }

    .icon-card {
        padding: 0.8rem;
    }

    .icon-image img {
        width: 70px;
        height: 70px;
        border-radius: 16px;
    }

    .app-name {
        font-size: 0.9rem;
    }

    .app-developer {
        font-size: 0.75rem;
    }

    .size-btn {
        min-height: 48px;
    }

    .size-label {
        font-size: 0.8rem;
    }

    .size-desc {
        font-size: 0.65rem;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1a1a1a;
        --card-background: #2d2d2d;
        --text-color: #e5e5e5;
        --text-light: #a3a3a3;
        --primary-color: #3b82f6;
        --accent-color: #6366f1;
    }

    body {
        background-color: var(--background-color);
    }

    input[type="text"],
    select,
    .country-selector,
    .country-dropdown,
    .selected-country,
    .icon-card {
        background-color: var(--card-background);
        border-color: #404040;
    }

    .country-item:hover {
        background-color: #404040;
    }

    .country-item:active {
        background-color: #4a4a4a;
    }

    .size-btn {
        background-color: #404040;
        border-color: #4a4a4a;
    }

    .size-btn:hover {
        background-color: #4a4a4a;
        border-color: #525252;
    }

    .size-btn-large {
        background-color: #1e3a8a;
        border-color: #1e40af;
    }

    .size-btn-large:hover {
        background-color: #1e40af;
        border-color: #2563eb;
    }
}