/* =========================================
   PROFESSIONAL GAMING PLATFORM THEME
   ========================================= */

/* --- CSS Variables --- */
:root {
    --bg-main: #FFFFFF;
    --bg-container: #FFFFFF;
    --border-color: #EAECEF;
    --text-primary: #1A202C;
    --text-secondary: #7A8599;
    --accent-primary: #4A90E2; 
    --accent-primary-dark: #357ABD;
    --accent-gradient: linear-gradient(to right, #4A90E2, #0056b3);
    
    --success-color: #28A745;
    --success-gradient: linear-gradient(to bottom, #34D399, #28A745);

    --tile-bg: #FFFFFF;
    --tile-border: #D1D5DB;
    --tile-found-bg: var(--success-gradient);
    --tile-found-border: #1E8449;

    --font-primary: 'Nunito', sans-serif;
    --font-display: 'Fredoka One', cursive;
}

/* --- Base Reset --- */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }

body {
    font-family: var(--font-primary);
    background: var(--bg-main);
    color: var(--text-primary);
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

#app-container {
    max-width: 1200px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Header --- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    position: relative;
}

.brand { display: flex; align-items: center; gap: 16px; }
.logo {
    display: block;
    height: 38px;
    width: auto;
}
.tagline { 
    font-weight: 600;
    font-size: 1rem; 
    color: var(--text-secondary);
    border-left: 2px solid var(--border-color);
    padding-left: 16px;
}

/* --- Layout --- */
main { display: flex; justify-content: center; align-items: flex-start; }
.game-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    align-items: stretch; /* allow children to fill width */
}

.game-section {
    flex: 2;
    background: var(--bg-container);
    background-image: none;
    background-size: cover; /* theme images will fill the full card area */
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

/* --- Game Board --- */
.puzzle-header-banner {
    background: none;
    padding: 12px 0;
    border-radius: 0;
    text-align: center;
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.2rem;
    text-shadow: none;
    margin-bottom: 0;
    width: 100%;
}

.game-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-rows: 1fr;
    grid-template-areas:
        "grid info";
    column-gap: 24px;
    row-gap: 16px;
    align-items: start;
    justify-content: center;
}

.grid-container {
    grid-area: grid;
    position: relative; /* For the overlay */
    display: grid;
    grid-template-columns: repeat(10, 1fr); 
    gap: 0;
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    background-color: var(--bg-main);
    padding: 0;
    border-radius: 12px;
    touch-action: none;
    overflow: hidden; /* Ensures tiles conform to the container's border radius */
}

.info-card {
    grid-area: info;
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 150px;
    justify-self: stretch;
}

/* --- Start Overlay --- */
#start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#start-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

#start-btn {
    font-family: var(--font-display);
    font-size: 1.8rem;
    padding: 18px 40px;
    border-radius: 100px;
    border: none;
    background: var(--accent-primary);
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
    transition: all 0.2s ease;
}

#start-btn:hover {
    background: var(--accent-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 144, 226, 0.5);
}


.grid-tile {
    aspect-ratio: 1;
    background: transparent;
    border: none;
    border-radius: 0;
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s, border-color 0.2s;
}

.letter {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60%;
    height: 60%;
    margin: auto;
    pointer-events: none;
    border: 3px solid transparent;
    transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease, border-radius 220ms ease, box-shadow 220ms ease;
}

/* --- INTERACTION STYLES --- */
.grid-container.disabled .grid-tile {
    cursor: not-allowed;
}

.grid-tile.selected {
    transform: scale(1.08);
    z-index: 10;
}

.grid-tile.selected .letter {
    background: var(--active-color, var(--accent-primary));
    color: white;
    border-radius: 50%;
    border-color: transparent;
    box-shadow: none;
}

.grid-tile.found-tile .letter {
    background: transparent;
    color: var(--text-primary);
    border-color: transparent;
    border-radius: 50%;
    box-shadow: none;
}

.ws-found-outlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.ws-found-outline {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(var(--outline-rotate, 0deg)) scale(0.98);
    transform-origin: center;
    border: clamp(2px, 0.34vw, 4px) solid var(--outline-color, var(--accent-primary));
    border-radius: 9999px;
    background: transparent;
    opacity: 0;
    transition: opacity 220ms ease, transform 220ms ease;
}

.ws-found-outline.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--outline-rotate, 0deg)) scale(1);
}

/* --- Word Board --- */
.word-board {
    align-self: start;
    width: 100%;
    padding: 0;
}

.timer-section {
    text-align: center;
    margin-bottom: 12px;
    width: 100%;
    align-self: center;
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.word-board-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
}

.word-list {
    margin: 12px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.word-pill {
    width: 100%;
    padding: 8px 0;
    background: transparent;
    border: none;
    border-radius: 0;
    font-weight: 800;
    color: #000;
    transition: color 0.3s;
    text-align: center;
    text-decoration: none; /* remove strikethrough */
}

.word-pill.found {
    background: transparent;
    color: #000;
    border: none;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

.progress-counter {
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* --- Sidebar, Stats & Victory --- */
.stats-card {
    background: var(--bg-container);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.timer-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.timer-display {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--text-primary);
    width: 100%;
    text-align: center;
}

.header-stats {
    display: flex;
    gap: 12px;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}
.stat {
    padding: 8px 14px;
    background: var(--bg-main);
    border-radius: 10px;
    color: var(--text-secondary);
}

.victory-card {
    background: var(--bg-container);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}
.victory-title {
    font-family: var(--font-display); 
    font-size: 1.8rem; 
    color: var(--accent-primary);
}
.victory-score { 
    font-weight: 800; 
    font-size: 1.2rem; 
    margin: 12px 0 20px; 
    color: var(--text-primary); 
}
.share-btn {
    width: 100%; 
    padding: 14px; 
    background: var(--accent-primary);
    border: none; 
    border-radius: 12px; 
    font-size: 1rem;
    font-family: var(--font-primary);
    font-weight: 700;
    color: white; 
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.share-btn:hover { background: var(--accent-primary-dark); }

/* --- Footer --- */
.site-footer {
    margin-top: 20px;
    padding: 16px 24px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.policy-content,
.policy-content * {
    user-select: text;
}

/* --- Responsive --- */
@media (max-width: 1100px) {
    .game-content {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .info-card { 
        display: contents;
    }
    .grid-container { order: 2; }
    .timer-section {
        order: 1;
        width: 60%;
        margin: 0;
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 10px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }
    .word-board {
        order: 3;
        width: 60%;
        margin: 0 auto;
        align-self: center;
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 10px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }
    .word-list { flex-direction: row; flex-wrap: wrap; justify-content: center;}
    .word-pill { width: auto; flex-grow: 1; }
}

@media (max-width: 900px) {
    body { padding: 10px; }
    #app-container { gap: 16px; }
    main { flex-direction: column; }
    .site-header { padding: 12px 16px; }
    .logo { height: 32px; }
    .tagline { display: none; }
    .game-section { padding: 16px; }
    .grid-tile { font-size: 1rem; }
}

/* --- Collections Page Layout --- */
.collections-page .collections-layout {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.collections-page .hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px 24px 80px;
    gap: 60px;
    background: var(--bg-container);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.collections-page .hero-left {
    flex: 1;
    max-width: 50%;
}

.collections-page .hero-left img {
    width: 100%;
    height: auto;
    display: block;
}

.collections-page .hero-right {
    flex: 1;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.collections-page .hero-right-image {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 30px;
}

.collections-page .main-cta-button {
    background: linear-gradient(90deg, #ff9a44 0%, #fc6076 100%);
    border: none;
    border-radius: 50px;
    color: white;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(255, 100, 70, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.collections-page .main-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px -5px rgba(255, 100, 70, 0.6);
}

.collections-page .collections-section {
    padding: 24px;
    background: var(--bg-container);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.collections-page .section-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 40px;
    color: var(--text-primary);
}

.collections-page .collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.collections-page .collection-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    text-align: center;
    padding-bottom: 25px;
    transition: transform 0.3s ease;
    border: 1px solid #f0f0f0;
    position: relative;
}

.collections-page .collection-card:hover {
    transform: translateY(-5px);
}

.collections-page .card-image-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
    margin-bottom: 20px;
    background-color: #f9f9f9;
}

.collections-page .card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.collections-page .card-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 15px;
    color: #2c3e50;
}

.collections-page .card-play-btn {
    border: none;
    border-radius: 30px;
    color: white;
    padding: 10px 30px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: opacity 0.2s ease;
    font-family: var(--font-primary);
}

.collections-page .card-play-btn:hover {
    opacity: 0.9;
}

.collections-page .btn-foodie { background: linear-gradient(90deg, #ffba00, #ff8c00); }
.collections-page .btn-travel { background: linear-gradient(90deg, #4facfe, #00f2fe); }
.collections-page .btn-science { background: linear-gradient(90deg, #43e97b, #38f9d7); }
.collections-page .btn-pop { background: linear-gradient(90deg, #fa709a, #fee140); }

@media (max-width: 900px) {
    .collections-page .hero {
        flex-direction: column;
        text-align: center;
        gap: 40px;
        padding: 24px;
    }

    .collections-page .hero-left,
    .collections-page .hero-right {
        max-width: 100%;
    }

    .collections-page .hero-right {
        align-items: center;
    }
}
/* --- Collections Page Link Fix --- */
.collections-page .card-play-btn {
    text-decoration: none;
    display: inline-block;
}
/* --- Header Nav --- */
.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 999px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.site-nav a:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-container);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.nav-toggle-lines {
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    position: relative;
    display: block;
}

.nav-toggle-lines::before,
.nav-toggle-lines::after {
    content: '';
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    position: absolute;
    left: 0;
}

.nav-toggle-lines::before {
    top: -6px;
}

.nav-toggle-lines::after {
    top: 6px;
}

@media (max-width: 900px) {
    .nav-toggle { display: inline-flex; }

    .site-nav {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px;
        background: var(--bg-container);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
        z-index: 50;
        min-width: 200px;
    }

    .site-nav a {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .site-header.nav-open .site-nav { display: flex; }
}

/* --- Collections Page Section Border --- */
.collections-page:not(.home-page) .collections-section {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* --- Home Page Section Boxes --- */
.home-page .hero,
.home-page .collections-section {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* --- Home Page Hero CTA --- */
.home-page .hero-right {
    position: relative;
}

.home-page .hero-right-image {
    margin-bottom: 0;
}

.home-page .hero-left img,
.home-page .hero-right-image {
    opacity: 0.95;
}


.home-page .hero-right .main-cta-button {
    position: absolute;
    left: 38%;
    top: 70%;
    transform: translate(-50%, -50%);
    z-index: 2;
    font-size: clamp(14px, 2.2vw, 18px);
    padding: clamp(12px, 2.5vw, 15px) clamp(18px, 5vw, 40px);
    white-space: nowrap;
}

.home-page .hero-right .main-cta-button:hover {
    transform: translate(-50%, -50%) translateY(-2px);
}

@media (max-width: 900px) {
    .home-page .hero {
        flex-direction: column-reverse;
    }

    .home-page .hero-right .main-cta-button {
        left: 40%;
        top: 74%;
    }
}

/* --- SEO Content --- */
.seo-section {
    padding: 24px;
    max-width: 980px;
}

.seo-section,
.seo-section * {
    user-select: text;
}

.seo-title {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 3vw, 2.4rem);
    line-height: 1.1;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.seo-lead {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-top: 10px;
    max-width: 70ch;
}

.seo-lead a {
    color: var(--accent-primary-dark);
    font-weight: 800;
    text-decoration: none;
}

.seo-lead a:hover {
    text-decoration: underline;
}

.seo-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.seo-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.95rem;
}

.seo-link:hover {
    background: rgba(74, 144, 226, 0.08);
    border-color: rgba(74, 144, 226, 0.35);
}

.collections-intro,
.collections-intro * {
    user-select: text;
}

.collections-intro {
    margin-top: -20px;
    margin-bottom: 28px;
    max-width: 980px;
}

.archive-section,
.archive-section * {
    user-select: text;
}

.archive-section {
    padding: 24px;
}

.archive-list {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.archive-list-item {
    margin: 0;
    padding: 0;
}

.archive-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    text-decoration: none;
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
}

.archive-item:hover {
    border-color: rgba(74, 144, 226, 0.35);
    background: rgba(74, 144, 226, 0.06);
}

.archive-empty {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    font-weight: 800;
}

/* --- Archive Controls --- */
.archive-controls {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 520px;
}

.archive-label {
    font-weight: 800;
    color: var(--text-primary);
}

.archive-control-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.archive-date-input {
    font-family: var(--font-primary);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    font-weight: 800;
    min-height: 44px;
}

.archive-go-btn,
.archive-load-more {
    font-family: var(--font-primary);
    font-weight: 900;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    min-height: 44px;
}

.archive-go-btn:hover,
.archive-load-more:hover {
    background: rgba(74, 144, 226, 0.08);
    border-color: rgba(74, 144, 226, 0.35);
}

.archive-actions {
    margin-top: 16px;
}

/* --- Play Page SEO Heading --- */
.play-page .play-heading {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}

.play-page .play-date-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 2.8vw, 2.2rem);
    line-height: 1.1;
    letter-spacing: 0.2px;
    max-width: 40ch;
}

@media (max-width: 560px) {
    .play-page .play-date-title {
        white-space: pre-line;
    }
}

.play-page .play-theme-subtitle {
    padding: 0;
    font-size: clamp(1.05rem, 2vw, 1.2rem);
}

/* --- Completion Modal --- */
body.modal-open {
    overflow: hidden;
}

.completion-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1000;
}

.completion-overlay.hidden {
    display: none;
}

.hidden#ts,
#ts.hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    left: -9999px;
    top: 0;
}

.completion-modal {
    width: min(520px, 100%);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    padding: 22px 20px 18px;
    position: relative;
    text-align: center;
}

.completion-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    font-weight: 900;
    cursor: pointer;
}

.completion-close:hover {
    background: rgba(0, 0, 0, 0.04);
}

.completion-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2rem);
    line-height: 1.1;
    margin-top: 4px;
    color: var(--text-primary);
}

.completion-subtitle {
    margin-top: 10px;
    color: var(--text-secondary);
    font-weight: 800;
    font-size: 1.05rem;
}

.completion-next {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.completion-next-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    border: none;
    background: var(--accent-primary);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    font-family: var(--font-primary);
    box-shadow: 0 10px 22px rgba(74, 144, 226, 0.24);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.completion-next-primary:hover {
    transform: translateY(-1px);
    background: var(--accent-primary-dark);
    box-shadow: 0 12px 26px rgba(74, 144, 226, 0.28);
}

.completion-next-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.completion-next-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.completion-next-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 900;
    color: var(--accent-primary);
    transition: background 0.15s ease, color 0.15s ease;
}

.completion-next-link:hover {
    background: rgba(74, 144, 226, 0.10);
    color: var(--accent-primary-dark);
}

.completion-next-link.is-hidden {
    display: none;
}

.completion-share-line {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.completion-share-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
}

.completion-share-row::-webkit-scrollbar {
    display: none;
}

.completion-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    font-family: var(--font-primary);
}

.completion-share-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

@media (max-width: 420px) {
    .completion-next-links {
        gap: 10px;
    }

    .completion-share-btn {
        padding: 8px 10px;
        min-height: 38px;
        font-size: 0.95rem;
    }
}

/* --- Leaderboard Page --- */
.leaderboard-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
    background: #FFFFFF;
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(16, 24, 40, 0.06);
    border: 1px solid var(--border-color);
}

.leaderboard-head {
    text-align: center;
    margin-bottom: 14px;
}

.leaderboard-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 4px;
}

.leaderboard-date {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0;
}

.leaderboard-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #FFFFFF;
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 8px 12px;
    text-align: left;
    font-size: 0.92rem;
    font-weight: 800;
    vertical-align: middle;
}

.leaderboard-table thead {
    background-color: #F8FAFC;
}

.leaderboard-table th {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.leaderboard-table tbody tr {
    background: #FFFFFF;
}

.leaderboard-table tbody tr:nth-child(odd) {
    background: rgba(16, 24, 40, 0.02);
}

.leaderboard-table tbody tr:hover {
    background: rgba(74, 144, 226, 0.06);
}

.leaderboard-table tbody td {
    border-top: 1px solid var(--border-color);
}

.leaderboard-table th:nth-child(1),
.leaderboard-table td:nth-child(1) {
    width: 72px;
    text-align: center;
}

.leaderboard-table th:nth-child(3),
.leaderboard-table td:nth-child(3) {
    width: 96px;
    text-align: right;
}

.leaderboard-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.leaderboard-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--accent-primary);
    background: rgba(74, 144, 226, 0.10);
    border: 1px solid rgba(74, 144, 226, 0.18);
}

.leaderboard-table tbody tr[data-rank="1"] .leaderboard-rank {
    background: linear-gradient(135deg, #FFB020, #FF7A18);
    border-color: transparent;
    color: #FFFFFF;
}

.leaderboard-table tbody tr[data-rank="2"] .leaderboard-rank {
    background: linear-gradient(135deg, #94A3B8, #64748B);
    border-color: transparent;
    color: #FFFFFF;
}

.leaderboard-table tbody tr[data-rank="3"] .leaderboard-rank {
    background: linear-gradient(135deg, #E6A56B, #B7791F);
    border-color: transparent;
    color: #FFFFFF;
}

.leaderboard-country-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.leaderboard-country-code {
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.leaderboard-country-flag-emoji {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
    font-size: 1.05em;
    line-height: 1;
    font-variant-emoji: emoji;
    display: none;
}

.leaderboard-country-flag-img {
    width: 18px;
    height: 18px;
    display: inline-block;
    border-radius: 4px;
    vertical-align: -0.15em;
}

@media (max-width: 620px) {
    .leaderboard-container {
        padding: 16px;
        border-radius: 18px;
    }

    .leaderboard-title {
        font-size: 1.6rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 10px;
        font-size: 0.92rem;
    }

    .leaderboard-table th:nth-child(1),
    .leaderboard-table td:nth-child(1) {
        width: 64px;
    }

    .leaderboard-rank {
        width: 28px;
        height: 28px;
        border-radius: 10px;
        font-size: 0.95rem;
    }
}
