*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #050816;
    color: #f9fafb;
}

a {
    color: #22c55e;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    background: radial-gradient(circle at top left, #1e293b, #020617);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-main {
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #22c55e;
}

.logo-sub {
    font-size: 12px;
    color: #e5e7eb;
}

.main-nav a {
    margin-left: 16px;
    font-size: 14px;
    color: #e5e7eb;
}

.site-main {
    padding: 20px 16px 40px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr);
    gap: 20px;
    margin-bottom: 24px;
}

.hero h1 {
    font-size: 28px;
    margin: 0 0 10px;
    color: #e2e8f0;
}

.hero p {
    margin: 0;
    color: #f9fafb;
    line-height: 1.5;
}

.section-title,
section > h2 {
    color: #e2e8f0;
    font-size: 20px;
    margin-bottom: 16px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 24px;
}

.game-grid > .game-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

@media (max-width: 460px) {
    .game-grid {
        grid-template-columns: 1fr;
    }

    .game-grid .game-icon {
        width: 110px;
        height: 110px;
    }
}

.game-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid rgba(203, 213, 225, 0.25);
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: hidden;
    min-width: 0;
    contain: layout;
}

.game-card .game-card-header > div,
.game-card .game-name,
.game-card .rating,
.game-card .game-card-footer,
.game-card .game-card-footer .btn {
    max-width: 100%;
}

.game-card.pinned {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.game-grid .game-card-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    min-width: 0;
}

.game-grid .game-icon {
    width: 140px;
    height: 140px;
    min-width: 140px;
    border-radius: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

.game-grid .game-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Related games: same style as index */
.related-grid a.game-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid rgba(203, 213, 225, 0.25);
    display: flex;
    flex-direction: row;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
}

.related-grid a.game-card:hover {
    border-color: rgba(34, 197, 94, 0.5);
}

.related-grid a.game-card .game-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.related-grid a.game-card .game-name {
    text-align: left;
    font-size: 16px;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-grid .game-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
}

.game-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.game-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Game detail page: larger icon in header */
.game-detail-header .game-icon {
    width: 120px;
    height: 120px;
    border-radius: 24px;
}


.game-name {
    font-size: 20px;
    font-weight: 700;
    color: #e2e8f0;
    text-decoration: none;
}

.game-name:hover {
    color: #22c55e;
}

.game-grid .game-card-header > div {
    flex: 1;
    min-width: 0;
}

.game-grid .game-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.rating {
    font-size: 13px;
    color: #f9fafb;
    margin-top: 4px;
}

.rating .star-rating {
    letter-spacing: 2px;
}

.rating .star-full {
    color: #eab308;
}

.rating .star-empty {
    color: #475569;
}

.game-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-card-footer {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.game-card-footer .btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: calc(50% - 4px);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(180deg, #34d399 0%, #16a34a 100%);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn:hover {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
}

.btn-secondary {
    background: #1e293b;
    border: 1px solid rgba(203, 213, 225, 0.3);
    color: #fff;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #334155;
    border-color: rgba(203, 213, 225, 0.5);
}

.btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.pagination .current {
    background: #22c55e;
    color: #022c22;
    font-weight: 600;
}

.site-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: #020617;
    margin-top: 20px;
    padding-top: 24px;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    padding: 0 16px 16px;
}

.footer-col h3 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #22c55e;
}

.footer-col h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #f9fafb;
}

.footer-col p {
    color: #f9fafb;
}

.footer-col a {
    color: #22c55e;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col li {
    margin-bottom: 4px;
}

.footer-bottom {
    border-top: 1px solid rgba(55, 65, 81, 0.8);
    margin-top: 10px;
    padding: 10px 16px;
    font-size: 12px;
    color: #9ca3af;
}

.ad-slot {
    margin: 12px 0;
    text-align: center;
}

.game-detail {
    display: grid;
    grid-template-columns: minmax(0, 2.4fr);
    gap: 20px;
}

.game-detail-header {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.game-detail-title {
    margin: 0;
    font-size: 24px;
}

.game-detail-subtitle {
    margin: 0;
    color: #9ca3af;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-size: 11px;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #9ca3af;
}

.download-section {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.article {
    line-height: 1.6;
    font-size: 15px;
    color: #e5e7eb;
}

.comments {
    margin-top: 28px;
}

.comments h3 {
    margin-bottom: 8px;
}

.comment {
    padding: 10px 0;
    border-bottom: 1px solid rgba(55, 65, 81, 0.8);
    font-size: 14px;
}

.comment-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.form-field {
    margin-bottom: 10px;
}

.form-field label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: #020617;
    color: #e5e7eb;
    font-size: 14px;
}

.form-field textarea {
    min-height: 90px;
    resize: vertical;
}

.alert {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
}

.alert-success {
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(22, 163, 74, 0.5);
}

.alert-error {
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(220, 38, 38, 0.6);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.related-title {
    margin-top: 22px;
    margin-bottom: 8px;
    font-size: 16px;
}

@media (min-width: 768px) {
    .hero {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }

    .game-detail {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
}
