* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
    margin: 0;
    padding: 16px;
    color: #1f2937;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 28px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    padding: 20px;
    flex: 1;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 4px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.sub {
    color: #6b7280;
    margin-bottom: 16px;
    border-left: 3px solid #3b82f6;
    padding-left: 12px;
    font-size: .9rem;
}

.title-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.title-left {
    flex: 1;
}

.action-btn-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* 下拉菜单 */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.dropdown-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 16px;
    z-index: 1;
    margin-top: 8px;
}
.dropdown-content.open {
    display: block;
}
.dropdown-content a {
    color: #1f2937;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    border-radius: 16px;
    transition: 0.1s;
}
.dropdown-content a:hover {
    background-color: #f3f4f6;
}

.all-games-btn,
.guide-btn {
    min-width: 170px;
    padding: 8px 24px;
    border-radius: 40px;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: .2s;
    text-decoration: none;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.all-games-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.all-games-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.guide-btn {
    background: #f59e0b;
    color: white;
}
.guide-btn:hover {
    background: #d97706;
    transform: translateY(-2px);
}

.guide-card {
    background: #fef9e3;
    border-radius: 24px;
    padding: 14px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid #fde68a;
}

.guide-text {
    color: #92400e;
    font-size: .95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #d1d5db;
    border-radius: 48px;
    font-size: 1rem;
    outline: none;
    background: #f9fafb;
}
.search-box input:focus {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-box button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 48px;
    font-weight: 500;
    cursor: pointer;
}
.search-box button:hover {
    background: #2563eb;
}

.random-btn {
    background: #8b5cf6;
}
.random-btn:hover {
    background: #7c3aed;
}

.notice-bar {
    background: #e0f2fe;
    border-left: 4px solid #0284c7;
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 24px;
    font-size: .9rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 20px;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
    table-layout: fixed;
}

th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
    word-break: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: #1e293b;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

tr:hover td {
    background-color: #faf9ff;
    transition: background 0.2s;
}

th:first-child, td:first-child {
    width: 70%;
}
th:nth-child(2), td:nth-child(2),
th:nth-child(3), td:nth-child(3) {
    width: 15%;
}

.game-name-link {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
}
.game-name-link:hover {
    text-decoration: underline;
    color: #3b82f6;
}

.game-name-text {
    color: #1f2937;
    font-weight: 600;
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    white-space: normal;
}

.download-btn {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 5px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    width: 100%;
    max-width: 90px;
    text-align: center;
}
.download-btn:hover {
    background: #059669;
}

.pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 30px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    font-size: .85rem;
}
.pagination .current {
    background: #3b82f6;
    color: white;
}

.info {
    text-align: center;
    margin-top: 16px;
    font-size: .8rem;
    color: #6b7280;
}

.alert {
    background: #fee2e2;
    color: #b91c1c;
    padding: 12px 20px;
    border-radius: 48px;
    margin-bottom: 20px;
    text-align: center;
}

.footer {
    text-align: center;
    padding: 20px 12px 12px;
    font-size: .75rem;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-content {
    background: white;
    padding: 24px;
    border-radius: 32px;
    text-align: center;
    max-width: 90%;
    width: 300px;
}
.modal-content h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 500;
}
.qrcode-container {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}
.extract-code {
    font-size: .9rem;
    background: #f3f4f6;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 30px;
}
.close-modal {
    background: #9ca3af;
    margin-top: 8px;
    padding: 8px 20px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
}

.img-modal .modal-content {
    max-width: min(90vw, 900px);
    width: auto;
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 20px 35px rgba(0,0,0,0.3);
}
.img-modal .modal-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    margin-bottom: 12px;
}
.img-modal .modal-content .game-description {
    max-width: 100%;
    word-wrap: break-word;
    text-align: left;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #1f2937;
    max-height: 30vh;
    overflow-y: auto;
}
.img-modal .close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 20px;
}

@media (max-width: 640px) {
    body { padding: 12px; }
    .container { padding: 16px; }
    h1 { font-size: 1.5rem; }
    .title-actions { flex-direction: column; align-items: stretch; }
    .action-btn-group { justify-content: flex-start; margin-top: 8px; gap: 8px; }
    .dropdown-btn, .all-games-btn { padding: 8px 16px; font-size: 0.85rem; }
    .guide-card { flex-direction: column; text-align: center; }
    .guide-btn, .all-games-btn { min-width: unset; width: 100%; }
    .search-box { flex-direction: column; }
    .search-box button { padding: 10px; width: 100%; }
    .notice-bar { font-size: .8rem; }
    th, td { font-size: 0.75rem; padding: 10px 6px; }
    th:first-child, td:first-child { width: 60%; }
    th:nth-child(2), td:nth-child(2), th:nth-child(3), td:nth-child(3) { width: 20%; }
    .download-btn { font-size: 0.6rem; padding: 3px 4px; max-width: 70px; }
    .pagination a, .pagination span { padding: 4px 8px; font-size: .75rem; }
    .game-name-link, .game-name-text { font-size: .75rem; }
}