/* Homepage & Shared Navigation Styles */

/* Override body for scrollable pages */
.page-home,
.page-lobby,
.page-howto {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
}

/* html must also allow scrolling when body is a scrollable page */
html:has(.page-home),
html:has(.page-lobby),
html:has(.page-howto) {
    overflow-y: auto;
    height: auto;
}

/* ===== NAVIGATION ===== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(20, 20, 30, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-brand {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--hex-blue), var(--hex-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.08);
}

/* Mobile hamburger */
.nav-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all 0.3s;
}

.nav-menu-btn.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.nav-menu-btn.open span:nth-child(2) {
    opacity: 0;
}
.nav-menu-btn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav-mobile-menu {
    display: none;
    flex-direction: column;
    padding: 8px 20px 16px;
    gap: 4px;
}

.nav-mobile-menu.open {
    display: flex;
}

.nav-mobile-link {
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-mobile-link:hover,
.nav-mobile-link.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

.nav-mobile-link.secondary {
    color: var(--text-muted);
    font-size: 13px;
}

.nav-mobile-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 8px 0;
}

@media (max-width: 640px) {
    .nav-links { display: none; }
    .nav-menu-btn { display: flex; }
}

/* ===== HEX BACKGROUND CANVAS ===== */
.hex-bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 60px 24px 40px;
    max-width: 640px;
    margin: 0 auto;
}

.hero-hex-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
}

.hero-hex-icon svg {
    width: 100%;
    height: 100%;
}

.hero-title {
    font-size: 56px;
    font-weight: 900;
    letter-spacing: 6px;
    background: linear-gradient(135deg, var(--hex-blue), var(--hex-purple), var(--hex-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: 8px;
}

.hero-tagline {
    font-size: 18px;
    color: var(--text-secondary);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero-desc {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

/* ===== GAME MODE GRID ===== */
.mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.gc-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 28px 24px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gc-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.gc-card:active {
    transform: scale(0.98);
}

.gc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.gc-quick::before { background: linear-gradient(90deg, var(--hex-blue), #2266dd); }
.gc-lobby::before { background: linear-gradient(90deg, var(--hex-purple), #7722bb); }
.gc-host::before { background: linear-gradient(90deg, var(--hex-green), #22aa55); }
.gc-daily::before { background: linear-gradient(90deg, var(--hex-orange), #dd6600); }

.gc-card-icon {
    font-size: 36px;
    line-height: 1;
}

.gc-card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.gc-quick .gc-card-title { color: var(--hex-blue); }
.gc-lobby .gc-card-title { color: var(--hex-purple); }
.gc-host .gc-card-title { color: var(--hex-green); }
.gc-daily .gc-card-title { color: var(--hex-orange); }

.gc-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Difficulty buttons in Quick Match card */
.gc-diff-btns {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.gc-diff {
    flex: 1;
    padding: 6px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.gc-diff:hover {
    background: var(--bg-hover);
}

.gc-diff.active {
    background: var(--hex-blue);
    color: white;
    border-color: var(--hex-blue);
}

/* Live count badge */
.gc-live-count {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.gc-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hex-green);
    animation: pulse 2s infinite;
}

/* Streak display */
.gc-streak {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
}

/* ===== ACTIVE GAMES SECTION ===== */
.active-games {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.active-games-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.active-game-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 14px 18px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.active-game-row:hover {
    background: var(--bg-hover);
    border-color: rgba(255,255,255,0.1);
}

.active-game-info {
    flex: 1;
}

.active-game-host {
    font-size: 15px;
    font-weight: 600;
}

.active-game-settings {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.active-game-join {
    padding: 8px 16px;
    border-radius: 10px;
    background: var(--hex-purple);
    color: white;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
}

/* ===== FOOTER ===== */
.site-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 32px 24px;
    margin-top: 40px;
}

.footer-inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-copy {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .mode-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .hero { padding: 40px 20px 24px; }
    .hero-title { font-size: 40px; letter-spacing: 4px; }
    .hero-tagline { font-size: 14px; letter-spacing: 2px; }

    .mode-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 0 16px 32px;
    }

    .gc-card { padding: 20px 18px; }
    .gc-card-icon { font-size: 28px; }
    .gc-card-title { font-size: 18px; }
}

/* ===== LOBBY PAGE ===== */
.lobby-page-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 24px;
}

.lobby-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.lobby-page-title {
    font-size: 28px;
    font-weight: 800;
}

.lobby-host-btn {
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--hex-purple), #7722bb);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lobby-host-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(153,51,230,0.3);
}

.lobby-game-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lobby-game-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 18px 20px;
    transition: all 0.2s;
}

.lobby-game-card:hover {
    background: var(--bg-hover);
    border-color: rgba(255,255,255,0.1);
}

.lobby-game-meta {
    flex: 1;
}

.lobby-game-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.lobby-game-detail {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.lobby-game-detail span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lobby-join-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    background: var(--hex-purple);
    color: white;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.lobby-join-btn:hover {
    transform: scale(1.05);
}

.lobby-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.lobby-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.lobby-empty-text {
    font-size: 15px;
    line-height: 1.5;
}

/* Direct join fallback */
.lobby-direct-join {
    margin-top: 32px;
    text-align: center;
}

.lobby-direct-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.lobby-direct-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    max-width: 320px;
    margin: 0 auto;
}

.lobby-direct-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.lobby-direct-input:focus {
    outline: none;
    border-color: var(--hex-purple);
}

.lobby-direct-go {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    background: var(--hex-purple);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

/* ===== HOW TO PLAY PAGE ===== */
.howto-page-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

.howto-page-title {
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 8px;
}

.howto-page-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.howto-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
}

.howto-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.howto-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 8px;
}

.howto-card p:last-child {
    margin-bottom: 0;
}

.howto-highlight {
    color: var(--hex-blue);
    font-weight: 600;
}

.howto-cta {
    text-align: center;
    margin-top: 32px;
}

.howto-play-btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--hex-blue), #2266dd);
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.howto-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(51,128,255,0.3);
}

/* ===== SETTINGS PAGE ===== */
.settings-page-content {
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.settings-page-title {
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 8px;
}

.settings-page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.5;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-card .setting-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-card .setting-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.settings-card .setting-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.settings-card .setting-btn {
    flex: 1;
    min-width: 54px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-card .setting-btn:hover {
    background: var(--bg-hover);
}

.settings-card .setting-btn.active {
    background: var(--hex-purple);
    color: white;
    border-color: var(--hex-purple);
}

.setting-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -2px;
}

.settings-saved-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: var(--hex-purple);
    color: white;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 500;
}

.settings-saved-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 600px) {
    .settings-page-content {
        padding: 24px 16px 40px;
    }
    .settings-page-title {
        font-size: 26px;
    }
    .settings-card {
        padding: 20px 16px;
    }
}
