/* SGG 游戏社区 - 前端样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --header-h: 60px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

img, video, svg { max-width: 100%; height: auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Header */
.site-header { background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    min-height: var(--header-h);
    gap: 1rem 1.25rem;
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text); display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap; }
.avatar-xs { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 4px; }

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}
body.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.header-nav-wrap { display: flex; align-items: center; gap: 1.5rem; flex-shrink: 0; justify-content: flex-end; min-width: 0; }
.header-nav-right {
    display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0;
    padding: 0.35rem 0.6rem; border-radius: 10px;
    background: rgba(15, 23, 42, 0.35);
}
.header-nav-link {
    color: var(--text-muted); font-size: 0.9rem; white-space: nowrap;
    padding: 0.45rem 0.85rem; border-radius: 8px; transition: color .15s, background .15s;
}
.header-nav-link:hover { color: var(--text); background: rgba(148, 163, 184, 0.12); }
.header-nav-right .btn.btn-sm {
    margin-left: 0.15rem; padding: 0.45rem 1rem; border-radius: 8px; font-weight: 600;
}
.header-nav-divider {
    width: 1px; height: 1.25rem; background: var(--border); margin: 0 0.35rem; flex-shrink: 0;
}
.user-nav-profile { display: inline-flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.user-nav-avatar {
    width: 32px; height: 32px; max-width: 32px; max-height: 32px;
    border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.user-nav-avatar.placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; font-size: 0.85rem; font-weight: 600;
}
.user-nav-name { font-size: 0.9rem; font-weight: 500; color: var(--text); white-space: nowrap; }
.user-uid { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.user-nav-logout { flex-shrink: 0; margin: 0; }
.user-logout-btn { font-size: 0.8rem; color: var(--text-muted); padding: 0.25rem 0.35rem; white-space: nowrap; }
.user-logout-btn:hover { color: var(--danger); }

/* Buttons */
.btn { display: inline-block; padding: 0.5rem 1.25rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; text-align: center; }
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; padding: 0.35rem 0.5rem; min-height: 44px; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin: 1rem auto; word-break: break-word; }
.alert-success { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid var(--success); }
.alert-error { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid var(--danger); }

.main-content { padding: 2rem 1rem; min-height: calc(100vh - 120px); }

/* Home layout */
.home-layout { display: grid; grid-template-columns: 1fr 300px; gap: 2rem; }
.home-layout.no-sidebar { grid-template-columns: 1fr; }

/* Phase 1 — enhanced homepage */
.main-content-wide { max-width: 1400px; }

.header-search { position: relative; max-width: 420px; width: 100%; min-width: 0; justify-self: center; }
.header-search-row {
    display: flex; flex-wrap: nowrap; align-items: stretch; width: 100%; gap: 0;
}
.header-search input {
    flex: 1; min-width: 0; width: 0; padding: 0.45rem 0.75rem; border-radius: 8px 0 0 8px;
    border: 1px solid var(--border); border-right: none; background: var(--bg); color: var(--text); font-size: 0.9rem;
}
.header-search-btn {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 0.75rem; min-width: 44px; min-height: 44px;
    border: 1px solid var(--primary); border-radius: 0 8px 8px 0;
    background: var(--primary); color: #fff; cursor: pointer;
}
.header-search-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.header-search-btn svg { display: block; width: 18px; height: 18px; max-width: none; flex-shrink: 0; }
.search-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    max-height: 320px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.search-item { display: block; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); color: var(--text); }
.search-item:hover { background: rgba(59,130,246,.08); color: var(--text); }
.search-type { font-size: 0.7rem; color: var(--primary); margin-right: 0.5rem; }
.search-sub { display: block; font-size: 0.75rem; color: var(--text-muted); }
.search-empty { padding: 0.75rem; color: var(--text-muted); font-size: 0.85rem; }

.home-v2 {
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    gap: 1.25rem;
    align-items: start;
}
.home-v2.no-sidebar { grid-template-columns: 200px 1fr; }

.home-sidebar {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 0.75rem 0; position: sticky; top: calc(var(--header-h) + 12px);
}
.home-sidebar-toggle {
    display: none; width: 100%; margin-bottom: 0.75rem; padding: 0.6rem 1rem;
    border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text); font-weight: 600; cursor: pointer;
}
.home-sidebar-toggle.open .nav-caret { transform: rotate(180deg); }
.home-nav { font-size: 0.88rem; }
.nav-group-title {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 0.55rem 1rem; background: none; border: none; color: var(--text);
    cursor: pointer; font-weight: 600; text-align: left;
}
.nav-caret { font-size: 0.65rem; color: var(--text-muted); transition: transform .2s; }
.nav-group-title.open .nav-caret { transform: rotate(180deg); }
.nav-submenu { list-style: none; display: none; padding: 0 0 0.35rem; }
.nav-submenu.open { display: block; }
.nav-submenu a, .nav-submenu .nav-muted {
    display: block; padding: 0.35rem 1rem 0.35rem 1.5rem; color: var(--text-muted); font-size: 0.85rem;
}
.nav-submenu a:hover { color: var(--primary); }
.nav-submenu-label {
    padding: 0.45rem 1rem 0.2rem 1.5rem; font-size: 0.72rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.75;
}
.nav-muted { color: var(--text-muted); opacity: 0.7; }
.nav-item-single .nav-single-link {
    display: flex; align-items: center; gap: 0.35rem; padding: 0.55rem 1rem;
    color: var(--text-muted); font-weight: 600;
}
.nav-single-link.active, .nav-single-link:hover { color: var(--primary); background: rgba(59,130,246,.08); }

.home-main { min-width: 0; }
.view-tab-groups { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 0.75rem; }
.view-tab-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.view-tab-group-label {
    font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em; min-width: 4.5rem; opacity: 0.85; flex-shrink: 0;
}
.ranking-table--simple th:nth-child(3), .ranking-table--simple td:nth-child(3) { text-align: center; }
.home-news-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.home-news-table th, .home-news-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.home-news-table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; }
.home-news-table a { color: var(--text); font-weight: 500; }
.home-news-table a:hover { color: var(--primary); }
.home-news-table time { color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; }
.home-news-table .news-game { color: var(--text-muted); font-size: 0.82rem; }
.view-tab-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.view-tab {
    padding: 0.45rem 0.85rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-muted); cursor: pointer; font-size: 0.85rem;
}
.view-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.home-news-strip {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 0.75rem 1rem; margin-bottom: 0.85rem;
}
.home-news-strip-header {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.home-news-strip-header h3 { font-size: 0.92rem; margin: 0; }
.home-news-list {
    list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; margin: 0;
}
.home-news-list li {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.5rem;
    font-size: 0.82rem; min-width: 0; max-width: 100%;
}
.home-news-list a {
    color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px;
}
.home-news-list a:hover { color: var(--primary); }
.home-news-list time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }

.home-news-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.home-news-panel-col {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    min-width: 0;
}
.home-news-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}
.home-news-panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
}
.home-news-list--panel {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.45rem;
}
.home-news-list--panel li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    max-width: none;
}
.home-news-list--panel a {
    max-width: none;
    white-space: normal;
    flex: 1;
    min-width: 0;
}
.home-news-empty {
    margin: 0;
    padding: 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.home-coming-soon-list {
    list-style: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.home-coming-soon-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.home-coming-soon-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg);
}
.home-coming-soon-icon.placeholder {
    display: inline-block;
}
.home-coming-soon-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.home-coming-soon-name {
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
    word-break: break-word;
}
.home-coming-soon-name:hover { color: var(--primary); }
.home-coming-soon-meta time {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.home-steam-global {
    margin-top: 1.5rem;
    padding: 0 0 0.5rem;
}
.home-steam-global-inner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1rem 1rem;
}
.home-steam-global-head {
    margin-bottom: 0.85rem;
}
.home-steam-global-head h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}
.home-steam-global-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.home-steam-global-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.85rem;
}
.home-steam-global-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 8rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.18);
}
.home-steam-global-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.home-steam-global-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.home-steam-global-chart {
    width: 100%;
    height: 220px;
    min-height: 180px;
}

.loading-state, .empty-state { padding: 2rem; text-align: center; color: var(--text-muted); }

.ranking-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: 10px; overflow: hidden; border: 1px solid var(--border); table-layout: fixed; }
.ranking-table th, .ranking-table td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
.ranking-table th { color: var(--text-muted); font-weight: 600; background: rgba(0,0,0,.15); }
.ranking-table th:first-child, .ranking-table td:first-child { width: 4.5rem; text-align: center; }
.ranking-table th:last-child, .ranking-table td:last-child { width: 5.5rem; text-align: center; }
.ranking-table--site th:nth-child(3), .ranking-table--site td:nth-child(3),
.ranking-table--site th:nth-child(4), .ranking-table--site td:nth-child(4),
.ranking-table--site th:nth-child(5), .ranking-table--site td:nth-child(5) { width: 7.5rem; }
.ranking-table--steam-hot th:nth-child(3), .ranking-table--steam-hot td:nth-child(3),
.ranking-table--steam-hot th:nth-child(4), .ranking-table--steam-hot td:nth-child(4),
.ranking-table--steam-top-seller th:nth-child(3), .ranking-table--steam-top-seller td:nth-child(3),
.ranking-table--steam-top-seller th:nth-child(4), .ranking-table--steam-top-seller td:nth-child(4) { width: 7.5rem; }
.ranking-table--steam-price th:nth-child(3), .ranking-table--steam-price td:nth-child(3),
.ranking-table--steam-price th:nth-child(4), .ranking-table--steam-price td:nth-child(4) { width: 6.5rem; }
.ranking-table .rank-num, .ranking-table .rank-price { text-align: right; white-space: nowrap; }
.ranking-table-note { margin: 0 0 0.5rem; font-size: 0.78rem; color: var(--text-muted); }
.ranking-table tr.rank-1 td:first-child { color: #fbbf24; }
.ranking-table tr.rank-2 td:first-child { color: #94a3b8; }
.ranking-table tr.rank-3 td:first-child { color: #cd7f32; }
.rank-game-info { display: flex; align-items: center; gap: 0.5rem; }
.rank-game-icon { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--bg); }
.rank-game-icon.placeholder { display: inline-block; }
.rank-score { color: #ff6b35; font-weight: 700; }
.rank-follow-btn {
    padding: 0.3rem 0.75rem; border-radius: 6px; border: 1px solid var(--primary);
    background: transparent; color: var(--primary); cursor: pointer; font-size: 0.8rem;
}
.rank-follow-btn.following { background: var(--primary); color: #fff; }

.game-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.game-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; height: 100%;
}
.game-card-top { display: flex; gap: 0.75rem; }
.game-card-icon { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.game-card-meta h3 { font-size: 0.95rem; margin-bottom: 0.25rem; word-break: break-word; }
.game-card-meta p { font-size: 0.78rem; color: var(--text-muted); margin: 0.1rem 0; }
.game-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: auto; }
.game-card-meta .tag-line {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.btn.disabled { opacity: 0.5; pointer-events: none; }

.pagination-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.75rem; margin-top: 1.25rem; padding: 0.75rem 0; font-size: 0.85rem; color: var(--text-muted);
}
.pagination-controls { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.page-btn {
    min-width: 34px; min-height: 34px; padding: 0.25rem 0.5rem; border-radius: 6px;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); cursor: pointer; font-size: 0.82rem;
}
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-ellipsis { padding: 0 0.25rem; }
.pagination-jump input { width: 56px; padding: 0.3rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.pagination-left select { padding: 0.3rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); }

.home-right-sidebar { min-width: 0; }

/* Game follow stats */
.game-follow-stats {
    display: flex; flex-direction: column; gap: 4px; margin: 0.75rem 0 1rem;
    padding: 12px 16px; background: rgba(255, 107, 53, 0.08);
    border-radius: 8px; border: 1px solid rgba(255, 107, 53, 0.2);
}
.follow-score { display: flex; align-items: baseline; gap: 8px; }
.score-value { font-size: 1.5rem; font-weight: 700; color: #ff6b35; }
.score-label { font-size: 0.85rem; color: var(--text-muted); }
.follow-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text-muted); }
.req-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.75rem; }
.req-col { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.req-col h4 { margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--primary); }
.req-col dl { display: grid; grid-template-columns: 72px 1fr; gap: 0.35rem 0.5rem; font-size: 0.85rem; }
.req-col dt { color: var(--text-muted); }

.forum-apply-box { padding: 1rem; background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; }
.forum-apply-form .form-group { margin-bottom: 0.75rem; }
.forum-apply-form input, .forum-apply-form textarea {
    width: 100%; padding: 0.5rem; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text);
}
.apply-status { font-size: 0.85rem; padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 0.75rem; }
.apply-status.pending { background: rgba(245,158,11,.15); color: var(--warning); }
.apply-status.approved { background: rgba(34,197,94,.12); color: var(--success, #22c55e); }
.apply-status.rejected { background: rgba(239,68,68,.15); color: var(--danger); }
.forum-meta { font-size: 0.8rem; color: var(--text-muted); margin: 0.35rem 0; }

.forum-applications-section { margin: 1.5rem 0; }
.forum-applications-section h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.forum-applications-list { display: flex; flex-direction: column; gap: 0.5rem; }
.forum-app-row {
    padding: 0.75rem 1rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; border-left: 3px solid var(--border);
}
.forum-app-row.status-pending { border-left-color: var(--warning); }
.forum-app-row.status-approved { border-left-color: var(--success, #22c55e); }
.forum-app-row.status-rejected { border-left-color: var(--danger); }
.forum-app-main { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: center; margin-bottom: 0.35rem; }
.forum-app-game { font-weight: 600; color: var(--text); }
.forum-app-name { font-size: 0.88rem; color: var(--text-muted); }
.forum-app-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.8rem; color: var(--text-muted); }
.forum-app-badge { padding: 0.15rem 0.5rem; border-radius: 4px; background: var(--bg); }
.forum-app-note { font-size: 0.82rem; color: var(--danger); margin-top: 0.35rem; }

.game-back-link { display: inline-block; margin-bottom: 1rem; font-size: 0.9rem; color: var(--text-muted); }
.game-back-link:hover { color: var(--primary); }

.game-page { margin-bottom: 2rem; }
.game-detail-hero {
    display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start;
    margin-bottom: 2rem; padding: 1.25rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 10px;
}
.game-hero-cover { flex-shrink: 0; }
.game-hero-cover img {
    width: 280px; max-width: 100%; aspect-ratio: 460 / 215; object-fit: cover;
    border-radius: 8px; background: var(--bg);
}
.game-name-en { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }
.game-tags-line, .game-stats-line, .game-meta-line {
    font-size: 0.88rem; color: var(--text-muted); margin: 0.35rem 0;
}
.game-meta-line { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.game-description { line-height: 1.8; color: var(--text-muted); word-break: break-word; }
.game-follow-btn.following { border-color: var(--success, #22c55e); color: var(--success, #22c55e); }
.req-empty .empty { margin: 0; }


.ranking-section h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

.ranking-item { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; background: var(--bg-card); border-radius: 8px; margin-bottom: 0.5rem; border: 1px solid var(--border); }
.rank { font-size: 1.25rem; font-weight: 700; color: var(--text-muted); width: 2rem; text-align: center; flex-shrink: 0; }
.game-icon { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.game-info { flex: 1; min-width: 0; }
.game-info h3 { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-count { color: var(--success); font-size: 0.85rem; }
.chart-mini { width: 200px; height: 60px; flex-shrink: 0; }

/* Sidebar */
.sidebar .ad-block { margin-bottom: 1.5rem; }
.sidebar .ad-block img { width: 100%; border-radius: 8px; }
.news-widget { background: var(--bg-card); padding: 1rem; border-radius: 8px; border: 1px solid var(--border); }
.news-widget h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.news-widget ul { list-style: none; }
.news-widget li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.news-widget time { display: block; font-size: 0.75rem; color: var(--text-muted); }
.more-link { display: inline-block; margin-top: 0.75rem; font-size: 0.85rem; }

/* Badges */
.badge-list { display: inline-flex; gap: 4px; vertical-align: middle; flex-wrap: wrap; }
.badge-icon { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; }
.speak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.28);
    font-size: 0.75rem;
    color: var(--accent);
    vertical-align: middle;
    white-space: nowrap;
}
.speak-badge-icon { line-height: 1; }
.speak-badge-level { font-weight: 600; }
.badge-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.badge-card { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1rem; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border); width: 100px; }
.badge-card img { width: 48px; height: 48px; border-radius: 8px; }
.badge-toggle { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; }

/* Forms */
.form-card { background: var(--bg-card); padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 1.5rem; max-width: 600px; }
.form-card h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.6rem 0.75rem; background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: 16px; /* 16px prevents iOS zoom on focus */
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hint { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; min-height: 44px; }

/* Auth */
.auth-card { max-width: 400px; margin: 2rem auto; background: var(--bg-card); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); width: 100%; }
.auth-card h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.auth-footer { text-align: center; margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); }

/* Server */
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--danger); flex-shrink: 0; }
.status-dot.online { background: var(--success); }
.status-dot.lg { width: 14px; height: 14px; }
.server-row { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; background: var(--bg-card); border-radius: 8px; margin-bottom: 0.5rem; border: 1px solid var(--border); }
.server-main { flex: 1; min-width: 0; }
.server-main a { word-break: break-word; }
.game-tag { display: inline-block; padding: 0.15rem 0.5rem; background: rgba(59,130,246,0.15); color: var(--primary); border-radius: 4px; font-size: 0.8rem; margin-left: 0.5rem; }
.server-ip { font-family: monospace; color: var(--text-muted); font-size: 0.85rem; word-break: break-all; }
.server-players, .server-user { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }

.server-detail-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.server-detail-header h1 { font-size: 1.5rem; word-break: break-word; flex: 1 1 auto; min-width: 0; }
.server-detail .description {
    padding: 1rem 0; line-height: 1.8; word-break: break-word; overflow-wrap: anywhere;
}

.server-list { display: flex; flex-direction: column; gap: 0.5rem; }
.server-item {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem;
    padding: 0.75rem 1rem; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border);
}
.server-item a { flex: 1; min-width: 0; word-break: break-word; }
.server-item .server-ip { flex: 1 1 100%; font-size: 0.8rem; }

/* Posts */
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.5rem; }
.post-row { padding: 1rem; background: var(--bg-card); border-radius: 8px; margin-bottom: 0.5rem; border: 1px solid var(--border); }
.post-row.pinned { border-color: var(--warning); }
.pin-badge { background: var(--warning); color: #000; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.75rem; margin-right: 0.5rem; }
.post-title { font-size: 1.05rem; font-weight: 600; color: var(--text); word-break: break-word; }
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
.post-content, .reply-content { padding: 1.5rem 0; line-height: 1.8; word-break: break-word; overflow-wrap: anywhere; }
.post-content img, .reply-content img { max-width: 100%; height: auto; border-radius: 6px; }
.post-detail h1 { font-size: 1.5rem; margin-bottom: 0.75rem; word-break: break-word; line-height: 1.35; }
.post-author { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.replies-section h2 { font-size: 1.15rem; margin-bottom: 1rem; }
.reply-item { padding: 1rem; border-bottom: 1px solid var(--border); }
.reply-author { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; margin-bottom: 0.5rem; flex-wrap: wrap; }

/* Profile */
.profile-header { text-align: center; margin-bottom: 2rem; }
.profile-page section { margin-bottom: 2rem; }
.profile-page section h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.post-row.compact { padding: 0.75rem 1rem; }
.avatar-lg { width: 80px; height: 80px; max-width: 80px; max-height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: 0.75rem; }
.avatar-lg.placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); font-size: 2rem; font-weight: 700; color: #fff; }
.badge-wall { margin-bottom: 2rem; }
.avatar-preview { width: 64px; height: 64px; max-width: 64px; max-height: 64px; border-radius: 50%; object-fit: cover; margin-top: 0.5rem; }

/* Game page */
.game-header { display: flex; gap: 1.5rem; align-items: flex-start; margin-bottom: 2rem; }
.game-header-main { flex: 1; min-width: 0; }
.game-icon-lg { width: 120px; height: 56px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.game-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.game-title-row h1 { font-size: 1.75rem; word-break: break-word; }
.game-short-desc { color: var(--text-muted); margin-bottom: 1rem; line-height: 1.7; }
.game-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.price-badge { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.price-current { font-size: 1.25rem; font-weight: 700; color: var(--success); }
.price-current.free { color: var(--success); }
.price-current.muted { font-size: 0.9rem; font-weight: 400; color: var(--text-muted); }
.price-original { text-decoration: line-through; color: var(--text-muted); font-size: 0.9rem; }
.price-discount { background: var(--success); color: #000; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.8rem; font-weight: 700; }

.game-store-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin-bottom: 2rem; }
.game-store-panel h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.store-meta { margin: 0 0 1.5rem; }
.online-highlight { color: var(--success); font-weight: 600; }

.game-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.chart-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; min-width: 0; }
.chart-card h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.chart-lg { width: 100%; height: 220px; }

.game-updates { margin-bottom: 2rem; }
.game-updates h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.update-list { display: flex; flex-direction: column; gap: 0.5rem; }
.update-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; }
.update-item summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; }
.update-item summary::-webkit-details-marker { display: none; }
.update-title { font-weight: 600; flex: 1; min-width: 0; word-break: break-word; }
.update-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }
.feed-tag { background: rgba(59,130,246,0.15); color: var(--primary); padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.75rem; }
.update-content { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); font-size: 0.9rem; line-height: 1.7; color: var(--text-muted); max-height: 300px; overflow-y: auto; word-break: break-word; }
.update-link { display: inline-block; margin-top: 0.5rem; font-size: 0.85rem; }
.empty.compact { padding: 1rem; text-align: left; font-size: 0.9rem; }

.forum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.forum-card { padding: 1rem; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border); }
.forum-card h3 { margin-bottom: 0.25rem; word-break: break-word; }
.forum-card p { font-size: 0.85rem; color: var(--text-muted); }
.game-sections section { margin-bottom: 2rem; }
.game-sections h2 { margin-bottom: 1rem; font-size: 1.25rem; }

/* News */
.news-item { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.news-item h2 { font-size: 1.15rem; margin-bottom: 0.35rem; word-break: break-word; }
.news-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.85rem; color: var(--text-muted); }
.source-badge { background: rgba(139,92,246,0.2); color: #a78bfa; padding: 0.1rem 0.4rem; border-radius: 3px; }
.news-content { padding: 1.5rem 0; line-height: 1.8; word-break: break-word; overflow-wrap: anywhere; }
.news-content img { max-width: 100%; height: auto; border-radius: 6px; }

/* Error pages */
.error-page { padding: 4rem 1rem; text-align: center; }
.error-page h1 { font-size: 3rem; margin-bottom: 0.5rem; }
.error-page p { font-size: 1.1rem; margin-bottom: 1.5rem; color: var(--text-muted); }

/* Pagination (Laravel default) */
nav[role="navigation"] { margin-top: 1.5rem; }
nav[role="navigation"] .flex { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; align-items: center; }
nav[role="navigation"] a,
nav[role="navigation"] span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; min-height: 36px; padding: 0.35rem 0.65rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-muted); font-size: 0.85rem;
}
nav[role="navigation"] a:hover { color: var(--text); border-color: var(--primary); }
nav[role="navigation"] span[aria-current="page"] span,
nav[role="navigation"] span[aria-disabled="true"] span {
    background: var(--primary); color: #fff; border-color: var(--primary);
}

/* Misc */
.empty { color: var(--text-muted); padding: 2rem; text-align: center; }
.breadcrumb-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-bottom: 1rem; font-size: 0.85rem; }
.breadcrumb { color: var(--text-muted); font-size: 0.85rem; }
.breadcrumb:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); opacity: 0.6; user-select: none; }
.breadcrumb-current { color: var(--text); word-break: break-all; }
.filter-bar { margin-bottom: 1rem; }
.filter-bar select { padding: 0.5rem; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 6px; width: 100%; max-width: 320px; font-size: 16px; }
.detail-list { display: grid; grid-template-columns: 100px 1fr; gap: 0.5rem 1rem; margin: 1.5rem 0; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { word-break: break-word; }
.detail-list code { background: var(--bg); padding: 0.2rem 0.5rem; border-radius: 4px; word-break: break-all; }

.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 1.5rem 0 calc(1.5rem + var(--safe-bottom)); text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.site-footer p { word-break: break-word; padding: 0 0.5rem; }

/* Touch-friendly */
a, button, .btn, .forum-card, summary { -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2); }

/* ========== Responsive ========== */

@media (max-width: 900px) {
    .nav-toggle { display: flex; order: 2; justify-self: end; }
    .header-inner {
        display: flex; flex-wrap: wrap; align-items: center;
    }
    .logo { order: 1; flex: 1 1 auto; min-width: 0; }
    .header-nav-wrap {
        display: none;
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 1rem;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.nav-open .header-nav-wrap { display: flex; }
    body.nav-open { overflow: hidden; }

    .header-nav-right {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    .header-nav-divider { display: none; }

    .header-nav-link {
        display: block;
        padding: 0.85rem 0.75rem;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
        white-space: normal;
    }
    .header-nav-link:hover { background: transparent; }

    .user-nav-profile {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.85rem 0.75rem;
        border-bottom: 1px solid var(--border);
        gap: 0.65rem;
    }

    .user-nav-logout {
        width: 100%;
        border-bottom: 1px solid var(--border);
    }

    .user-logout-btn {
        display: block;
        width: 100%;
        text-align: center;
        padding: 0.75rem;
        min-height: 44px;
        font-size: 0.95rem;
    }

    .header-nav-right .btn {
        display: block;
        text-align: center;
        padding: 0.75rem;
        min-height: 44px;
        margin: 0.5rem 0.75rem 0;
    }

    .home-layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .sidebar { order: 2; }

    .home-v2 { grid-template-columns: 1fr; }
    .home-sidebar-toggle { display: flex; align-items: center; justify-content: space-between; }
    .home-sidebar { position: static; display: none; }
    .home-sidebar.mobile-open { display: block; }
    .home-right-sidebar { order: 3; }
    .game-card-grid { grid-template-columns: repeat(2, 1fr); }
    .header-search { max-width: none; order: 3; flex: 1 1 100%; width: 100%; justify-self: stretch; }
    .header-search-row { flex-wrap: nowrap; }
    .header-nav-wrap { order: 4; }
    .home-news-panel { grid-template-columns: 1fr; }
    .home-steam-global-chart { height: 200px; }
    .req-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .main-content { padding: 1.25rem 0.75rem; }
    .ranking-section h1 { font-size: 1.4rem; }
    .game-title-row h1 { font-size: 1.35rem; }
    .post-detail h1 { font-size: 1.25rem; }

    .ranking-item {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .game-info { flex: 1 1 calc(100% - 5rem); min-width: 0; }
    .game-info h3 { white-space: normal; }

    .chart-mini {
        width: 100%;
        height: 56px;
        flex: 1 1 100%;
        order: 10;
    }

    .form-row { grid-template-columns: 1fr; }
    .form-card { padding: 1.25rem; max-width: none; }

    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .btn { width: 100%; }

    .server-row {
        flex-wrap: wrap;
        gap: 0.5rem 0.75rem;
        align-items: flex-start;
    }

    .server-main { flex: 1 1 100%; }
    .server-ip { flex: 1 1 100%; font-size: 0.8rem; }
    .server-players, .server-user { font-size: 0.8rem; }

    .game-header { flex-direction: column; align-items: stretch; }
    .game-icon-lg { width: 100%; max-width: 184px; height: auto; aspect-ratio: 460 / 215; }
    .game-detail-hero { flex-direction: column; padding: 1rem; }
    .game-hero-cover img { width: 100%; max-width: 100%; }
    .game-actions { flex-wrap: wrap; }
    .game-actions .btn { flex: 1 1 auto; min-width: 120px; }
    .follow-detail { flex-direction: column; align-items: flex-start; gap: 0.25rem; }

    .game-charts { grid-template-columns: 1fr; }
    .chart-lg { height: 200px; }

    .detail-list { grid-template-columns: 1fr; gap: 0.25rem; }
    .detail-list dt { font-size: 0.8rem; margin-top: 0.5rem; }
    .detail-list dt:first-child { margin-top: 0; }

    .forum-grid { grid-template-columns: 1fr; }
    .badge-card { width: calc(50% - 0.5rem); min-width: 0; }

    .auth-card { margin: 1rem auto; padding: 1.5rem; }

    .error-page h1 { font-size: 2.25rem; }
    .error-page p { font-size: 1rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 0.75rem; }
    .logo { font-size: 1.1rem; }

    .ranking-item .rank { width: 1.5rem; font-size: 1rem; }
    .game-icon { width: 36px; height: 36px; }

    .btn { padding: 0.65rem 1rem; min-height: 44px; }
    .game-actions .btn { flex: 1 1 auto; text-align: center; }

    .post-meta { gap: 0.35rem 0.75rem; }
    .news-item h2 { font-size: 1.05rem; }

    .badge-card { width: 100%; }
    .update-item summary { flex-direction: column; align-items: flex-start; }
    .game-card-grid { grid-template-columns: 1fr; }
    .ranking-table { font-size: 0.8rem; }
    .ranking-table--site th:nth-child(3), .ranking-table--site td:nth-child(3),
    .ranking-table--site th:nth-child(5), .ranking-table--site td:nth-child(5) { display: none; }
    .ranking-table--steam-hot th:nth-child(4), .ranking-table--steam-hot td:nth-child(4) { display: none; }
    .ranking-table--steam-top-seller th:nth-child(3), .ranking-table--steam-top-seller td:nth-child(3) { display: none; }
    .ranking-table--steam-price th:nth-child(4), .ranking-table--steam-price td:nth-child(4) { display: none; }

    .server-detail-header h1 { font-size: 1.25rem; }
    .server-players, .server-user { white-space: normal; }
}
