* {
    box-sizing: border-box;
}

:root {
    --primary: #c1440e;
    --primary-soft: #fff5f0;
    --bg-color: #f5f0e8;
    --border: #e2d7c8;
    --text: #1a1a1a;
    --muted: #7a5e4a;
}

body {
    margin: 0;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-color);
    color: var(--text);
}

.ainav-container {
    max-width: 1120px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    padding: 20px 22px 24px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
    min-height: 40px;
}

.back-home {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    color: #888;
    text-decoration: none;
    background: #fafafa;
    flex-shrink: 0;
}

.back-home:hover {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--primary);
}

.back-home svg {
    width: 20px;
    height: 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.language-select {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
}

h1 {
    margin: 0;
    color: var(--primary);
    text-align: center;
    font-size: 1.55rem;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    margin: 2px 0 14px;
    color: var(--muted);
    font-size: 0.88rem;
}

.ainav-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ainav-search-wrap {
    flex: 1;
    min-width: 0;
}

.ainav-search-wrap input {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    background: #fff;
}

.ainav-search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(193, 68, 14, 0.1);
}

.ainav-platforms {
    display: flex;
    flex-shrink: 0;
    gap: 6px;
}

.ainav-tab,
.ainav-chip {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    height: 32px;
    padding: 0 12px;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
}

.ainav-tab.is-active,
.ainav-chip.is-active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.ainav-filter-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.ainav-filter-label {
    flex-shrink: 0;
    width: 2.5em;
    padding-top: 5px;
    font-size: 0.75rem;
    color: var(--muted);
}

.ainav-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0;
    min-width: 0;
}

.ainav-chip {
    height: 28px;
    padding: 0 10px;
    font-size: 0.78rem;
}

.ainav-jump {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 8;
    background: #fff;
    padding: 8px 0 10px;
    margin: 0 0 4px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 12px -8px rgba(0, 0, 0, 0.08);
}

.ainav-jump-chips {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ainav-jump-chips::-webkit-scrollbar {
    display: none;
}

.ainav-jump-chips .ainav-chip {
    flex-shrink: 0;
}

#ainavSections {
    padding-bottom: 8px;
}

.ainav-section {
    margin: 0 0 28px;
    scroll-margin-top: 56px;
}

.ainav-section:last-child {
    margin-bottom: 0;
}

.ainav-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 12px;
    padding: 8px 12px 8px 14px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text);
    background: #faf6f0;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.ainav-count {
    margin: 8px 0 4px;
    font-size: 0.78rem;
    color: var(--muted);
}

.ainav-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.ainav-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ainav-card:hover {
    border-color: rgba(193, 68, 14, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.ainav-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: contain;
    background: #fff;
    border: 1px solid #f0ebe3;
}

.ainav-letter {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.ainav-card.is-fallback .ainav-logo {
    display: none;
}

.ainav-card.is-fallback .ainav-letter {
    display: inline-flex;
}

.ainav-body {
    min-width: 0;
    flex: 1;
}

.ainav-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.ainav-name {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ainav-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 3px;
}

.ainav-badge {
    font-size: 0.68rem;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 999px;
    background: #f4efe8;
    color: var(--muted);
}

.ainav-badge-hard,
.ainav-chip-hard.is-active {
    background: #f8e8e4;
    color: #a3380c;
    border-color: rgba(163, 56, 12, 0.35);
}

.ainav-chip-hard.is-active {
    font-weight: 600;
}

.ainav-desc {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ainav-empty {
    text-align: center;
    color: var(--muted);
    padding: 32px 8px;
    margin: 0;
}

.sr-only,
.ainav-seo-fallback {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

footer {
    margin-top: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 1020px) {
    .ainav-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .ainav-container {
        padding: 16px 14px 20px;
    }

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

    .ainav-platforms {
        width: 100%;
    }

    .ainav-tab {
        flex: 1;
    }

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