/* Colreg Game — mobile-first styles. */

.cg-wrap {
    max-width: 1140px;
    margin: 20px auto 60px;
    padding: 0 14px;
}

.cg-hero {
    background: linear-gradient(135deg, #0b2a4a 0%, #133b66 60%, #0b2a4a 100%);
    color: #fff;
    border-radius: 18px;
    padding: 24px 26px 20px;
    margin-bottom: 16px;
    box-shadow: 0 10px 26px rgba(11, 42, 74, 0.16);
    position: relative;
    overflow: hidden;
}
.cg-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}
.cg-hero > * { position: relative; z-index: 2; }
.cg-pretitle {
    display: inline-block;
    background: rgba(243, 145, 0, 0.18);
    color: #f39100;
    font-weight: 700;
    font-size: 0.78em;
    padding: 4px 12px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}
.cg-hero h1 {
    color: #fff;
    font-size: 1.75em;
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.cg-accent { color: #f39100; }
.cg-sub {
    color: #cdd9ea;
    font-size: 0.95em;
    margin: 0;
    line-height: 1.5;
}

.cg-beta-banner {
    max-width: 720px;
    margin: 0 auto 12px;
    background: #fff4e0;
    border: 1px dashed #f39100;
    color: #8c5a00;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.86em;
    text-align: center;
    line-height: 1.4;
}
/* Slim scoreboard pill floating in the sky area at the top of the canvas. */
.cg-scoreboard {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 18px;
    background: rgba(11, 26, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 6px 18px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.cg-scoreboard-cell {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: #fff;
}
.cg-scoreboard-num {
    font-weight: 800;
    color: #f8e85b;
    font-size: 1.05em;
    line-height: 1;
}
.cg-scoreboard-label {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #cdd9ea;
}

.cg-stage {
    position: relative;
    background: #0b2a4a;
    border-radius: 14px;
    padding: 0;
    aspect-ratio: 1 / 1;
    max-width: 720px;
    margin: 0 auto 14px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(11, 42, 74, 0.18);
}
#cg-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Non-blocking toast floating on the sea between the horizon and our bow —
 * appears for ~3s after an answer, then auto-fades. The next scenario loads
 * underneath in parallel so the player can keep answering without ever
 * waiting for a Next button. */
.cg-toast {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 22%;
    background: rgba(11, 26, 46, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-left: 4px solid #f39100;
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    z-index: 4;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    animation: cgToastIn 0.25s ease-out;
    pointer-events: none;
}
.cg-toast.cg-toast-correct { border-left-color: #2ec46b; }
.cg-toast.cg-toast-wrong   { border-left-color: #e84a4a; }
.cg-toast.cg-toast-fading  { animation: cgToastOut 0.5s ease-in forwards; }
.cg-toast[hidden] { display: none; }
@keyframes cgToastIn  { from { transform: translateY(8px);  opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cgToastOut { from { opacity: 1; } to { transform: translateY(-6px); opacity: 0; } }

.cg-toast-tag {
    display: inline-block;
    background: rgba(243, 145, 0, 0.22);
    color: #f8b760;
    font-weight: 800;
    font-size: 0.66em;
    letter-spacing: 0.12em;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    text-transform: uppercase;
}
.cg-toast-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.cg-toast-icon { font-size: 1.2em; line-height: 1; }
.cg-toast-headline { font-weight: 800; font-size: 1em; }
.cg-toast-rule {
    background: #f39100;
    color: #0b2a4a;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 800;
}
.cg-toast-rule:empty { display: none; }
.cg-toast-points {
    margin-left: auto;
    color: #f39100;
    font-weight: 800;
    font-size: 0.92em;
}
.cg-toast-points:empty { display: none; }
.cg-toast-answer {
    color: #f8e85b;
    font-size: 0.85em;
    font-weight: 700;
    margin-top: 4px;
}
.cg-toast-answer:empty { display: none; }
.cg-toast-explanation {
    color: #cdd9ea;
    font-size: 0.83em;
    line-height: 1.4;
    margin-top: 4px;
}
.cg-toast-explanation:empty { display: none; }

.cg-prompt {
    position: absolute;
    top: 56px;
    left: 14px;
    right: 14px;
    background: rgba(11, 26, 46, 0.78);
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.95em;
    line-height: 1.4;
    border-left: 3px solid #f39100;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

/* "WE ARE: X" reminder — bright pill sitting right above the choice buttons,
 * so the player can re-orient at a glance without re-reading the top prompt. */
.cg-we-are {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 92px;
    background: rgba(243, 145, 0, 0.94);
    color: #0b2a4a;
    font-weight: 800;
    font-size: 0.92em;
    padding: 6px 14px;
    border-radius: 8px;
    text-align: center;
    z-index: 3;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.cg-we-are:empty { display: none; }

/* Buttons overlay the canvas (per spec) — translucent caps over the dark scene. */
.cg-choices {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    z-index: 2;
}
.cg-choice {
    position: relative;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 8px 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.15s, background 0.15s;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    font-family: inherit;
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.cg-choice:hover:not(.cg-disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}
.cg-choice:focus { outline: 3px solid rgba(243, 145, 0, 0.5); outline-offset: 2px; }
.cg-choice.cg-disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.cg-standon { border-color: #3b86c7; color: #0b2a4a; }
.cg-standon:hover:not(.cg-disabled) { background: #eaf3fb; }
.cg-giveway { border-color: #f39100; color: #0b2a4a; }
.cg-giveway:hover:not(.cg-disabled) { background: #fff4e0; }
.cg-choice-text { font-weight: 800; font-size: 1.02em; letter-spacing: 0.03em; }
.cg-choice-hint { font-size: 0.7em; color: #5b6878; font-weight: 500; }
.cg-choice-key {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.68em;
    background: rgba(11, 42, 74, 0.08);
    color: #5b6878;
    border: 1px solid rgba(11, 42, 74, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-weight: 700;
}


/* Compact auth row sitting directly under the STAND-ON / GIVE-WAY buttons
 * (outside the canvas stage). Quickest possible path to register/sign in. */
.cg-auth-row {
    max-width: 720px;
    margin: 14px auto 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* CTA card below the canvas — register prompt for guests, simulator
 * upsell for logged-in players. Designed to read as a serious training
 * platform offer, not a game wrapper. */
.cg-cta-card {
    max-width: 720px;
    margin: 18px auto 0;
    padding: 26px 30px;
    border-radius: 16px;
    text-align: left;
    box-shadow: 0 10px 28px rgba(11, 42, 74, 0.1);
}
.cg-cta-eyebrow {
    display: inline-block;
    background: rgba(11, 42, 74, 0.08);
    color: #0b2a4a;
    font-size: 0.7em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.cg-cta-upgrade .cg-cta-eyebrow {
    background: rgba(59, 134, 199, 0.18);
    color: #0b2a4a;
}
.cg-cta-register .cg-cta-eyebrow {
    background: rgba(184, 106, 0, 0.18);
    color: #8c4f00;
}
.cg-cta-register {
    background: linear-gradient(135deg, #fff4e0 0%, #ffe5b8 100%);
    border: 1px solid #f5c97a;
}
.cg-cta-upgrade {
    background: linear-gradient(135deg, #eaf3fb 0%, #d4e6f7 100%);
    border: 1px solid #88b9e2;
}
.cg-cta-card h3 {
    margin: 0 0 10px;
    color: #0b2a4a;
    font-size: 1.32em;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.cg-cta-card p {
    margin: 0 0 14px;
    color: #46566b;
    font-size: 0.95em;
    line-height: 1.55;
}
.cg-cta-list {
    text-align: left;
    margin: 0 0 18px;
    padding: 0 0 0 18px;
    color: #46566b;
    font-size: 0.92em;
    line-height: 1.55;
}
.cg-cta-list li { margin-bottom: 8px; }
.cg-cta-list li:last-child { margin-bottom: 0; }
.cg-cta-list strong { color: #0b2a4a; }
.cg-cta-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

/* OAuth icon buttons — Google + Facebook, mirror the home-page hero form. */
.cg-oauth-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #cdd9ea;
    transition: transform 0.08s, box-shadow 0.15s, border-color 0.15s;
}
.cg-oauth-btn:hover { transform: translateY(-1px); }
.cg-oauth-google:hover { border-color: #4285f4; box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25); }
.cg-oauth-fb {
    background: #1877f2;
    border-color: #1877f2;
    color: #fff;
}
.cg-oauth-fb:hover { box-shadow: 0 4px 12px rgba(24, 119, 242, 0.35); border-color: #1877f2; }

/* Trust-signal row at the bottom of the register CTA. */
.cg-cta-trust {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(11, 42, 74, 0.12);
    color: #6c7a8c;
    font-size: 0.82em;
    font-weight: 600;
}
.cg-cta-trust span { white-space: nowrap; }

/* ============ SEO / educational body content ============
 * Sits below the game + CTAs. Semantic HTML for crawlers and AI,
 * readable prose for human visitors. */
.cg-seo {
    max-width: 720px;
    margin: 28px auto 40px;
    color: #2b3a52;
    line-height: 1.6;
}
.cg-seo-head h2 {
    color: #0b2a4a;
    font-size: 1.5em;
    font-weight: 800;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}
.cg-seo-lede {
    font-size: 1em;
    color: #46566b;
    margin: 0 0 18px;
}
.cg-seo-section {
    margin-top: 22px;
}
.cg-seo-section h3 {
    color: #0b2a4a;
    font-size: 1.15em;
    font-weight: 800;
    margin: 0 0 8px;
}
.cg-seo-section p {
    margin: 0 0 10px;
    color: #46566b;
}
.cg-seo-section ul,
.cg-seo-section ol {
    margin: 6px 0 12px;
    padding-left: 22px;
    color: #46566b;
}
.cg-seo-section li {
    margin-bottom: 6px;
}
.cg-seo-section strong { color: #0b2a4a; }

.cg-seo-faq details {
    border-top: 1px solid #e6ecf3;
    padding: 10px 0;
}
.cg-seo-faq details:last-of-type {
    border-bottom: 1px solid #e6ecf3;
}
.cg-seo-faq summary {
    cursor: pointer;
    font-weight: 700;
    color: #0b2a4a;
    list-style: none;
    padding-right: 24px;
    position: relative;
}
.cg-seo-faq summary::-webkit-details-marker { display: none; }
.cg-seo-faq summary::after {
    content: "+";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: #f39100;
    font-weight: 800;
    font-size: 1.1em;
    line-height: 1;
}
.cg-seo-faq details[open] summary::after { content: "−"; }
.cg-seo-faq details p {
    margin-top: 8px;
    color: #5b6878;
}

.cg-seo-related ul {
    padding-left: 22px;
}
.cg-seo-related a {
    color: #b96a00;
    text-decoration: none;
    font-weight: 700;
}
.cg-seo-related a:hover { text-decoration: underline; }
.cg-cta-btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.96em;
    transition: transform 0.08s, box-shadow 0.15s;
}
.cg-cta-btn:hover { transform: translateY(-1px); text-decoration: none; }
.cg-cta-primary {
    background: #f39100;
    color: #fff;
    box-shadow: 0 4px 12px rgba(243, 145, 0, 0.32);
}
.cg-cta-primary:hover { background: #e07f00; color: #fff; }
.cg-cta-secondary {
    background: #fff;
    color: #0b2a4a;
    border: 1px solid #cdd9ea;
}
.cg-cta-secondary:hover { background: #f5f7fa; color: #0b2a4a; }

/* Tablet+ */
@media (min-width: 720px) {
    .cg-hero h1 { font-size: 2em; }
    .cg-choices { gap: 12px; }
    .cg-choice { min-height: 64px; padding: 10px 12px 8px; }
    .cg-choice-text { font-size: 1.12em; }
    .cg-prompt { font-size: 1.02em; padding: 12px 16px; }
}

/* ====== Leaderboard styles (used by leaderboard.php) ====== */
.cg-lb-wrap {
    max-width: 1100px;
    margin: 24px auto 40px;
    padding: 0 16px;
}
.cg-lb-hero {
    background: linear-gradient(135deg, #0b2a4a 0%, #133b66 60%, #0b2a4a 100%);
    color: #fff;
    border-radius: 18px;
    padding: 26px 28px 22px;
    margin-bottom: 18px;
    box-shadow: 0 10px 26px rgba(11, 42, 74, 0.16);
    position: relative;
    overflow: hidden;
}
.cg-lb-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}
.cg-lb-hero > * { position: relative; z-index: 2; }
.cg-lb-pretitle {
    display: inline-block;
    background: rgba(243, 145, 0, 0.18);
    color: #f39100;
    font-weight: 700;
    font-size: 0.78em;
    padding: 4px 12px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}
.cg-lb-hero h1 {
    color: #fff;
    font-size: 1.75em;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.cg-lb-sub {
    color: #cdd9ea;
    font-size: 0.95em;
    margin: 0 0 14px;
    line-height: 1.5;
}
.cg-lb-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.cg-lb-play-btn {
    background: #f39100;
    color: #fff;
    padding: 10px 18px;
    border-radius: 9px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.92em;
    box-shadow: 0 4px 12px rgba(243, 145, 0, 0.3);
}
.cg-lb-play-btn:hover { background: #e07f00; color: #fff; text-decoration: none; }

.cg-lb-section-title {
    color: #0b2a4a;
    font-size: 1.1em;
    font-weight: 700;
    margin: 22px 0 10px;
    padding-left: 12px;
    border-left: 4px solid #f39100;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cg-lb-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #eef1f6;
    box-shadow: 0 4px 14px rgba(11, 42, 74, 0.05);
    overflow: hidden;
    margin-bottom: 18px;
}
.cg-lb-table-wrap { overflow-x: auto; }
.cg-lb-card table { width: 100%; border-collapse: collapse; }
.cg-lb-card thead th {
    background: #f8fafc;
    color: #5b6878;
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eef1f6;
    white-space: nowrap;
}
.cg-lb-card thead th.right { text-align: right; }
.cg-lb-card tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f7;
    color: #0b2a4a;
    font-size: 0.94em;
    vertical-align: middle;
}
.cg-lb-card tbody tr:last-child td { border-bottom: 0; }
.cg-lb-card tbody tr:hover { background: #f8fafc; }
.cg-lb-card tbody tr.first {
    background: linear-gradient(90deg, rgba(243, 145, 0, 0.08) 0%, rgba(243, 145, 0, 0.02) 100%) !important;
    font-weight: 600;
}
.cg-lb-card tbody tr.first td:first-child { border-left: 3px solid #f39100; }

.cg-lb-place { font-weight: 700; color: #0b2a4a; font-size: 1.05em; text-align: center; min-width: 36px; }
.cg-lb-place.medal { font-size: 1.5em; line-height: 1; }
.cg-lb-name { color: #0b2a4a; font-weight: 600; }
.cg-lb-points { text-align: right; font-weight: 700; color: #0b2a4a; font-family: 'SF Mono', Menlo, Consolas, monospace; }
.cg-lb-rounds { text-align: right; color: #5b6878; font-weight: 600; }

.cg-lb-empty {
    text-align: center;
    padding: 50px 20px;
    color: #5b6878;
    font-style: italic;
}
.cg-lb-empty .ico { font-size: 44px; margin-bottom: 10px; font-style: normal; }
.cg-lb-empty a { color: #f39100; font-weight: 600; }

@media (max-width: 720px) {
    .cg-lb-card thead { display: none; }
    .cg-lb-card tbody tr {
        display: grid;
        grid-template-columns: 42px 1fr auto;
        column-gap: 12px;
        row-gap: 0;
        align-items: center;
        padding: 11px 14px;
        border-bottom: 1px solid #eef1f6;
    }
    .cg-lb-card tbody tr:last-child { border-bottom: 0; }
    .cg-lb-card tbody td { display: block; padding: 0; border: 0; }
    .cg-lb-card tbody .cg-lb-place { grid-row: 1 / span 2; align-self: center; font-size: 1.55em; text-align: center; line-height: 1; }
    .cg-lb-card tbody .cg-lb-place:not(.medal) { font-size: 1.05em; color: #94a3b8; }
    .cg-lb-card tbody .cg-lb-name { grid-row: 1; grid-column: 2; font-size: 0.96em; font-weight: 600; }
    .cg-lb-card tbody .cg-lb-points { grid-row: 1; grid-column: 3; text-align: right; font-size: 0.98em; white-space: nowrap; }
    .cg-lb-card tbody .cg-lb-rounds { grid-row: 2; grid-column: 2 / span 2; font-size: 0.8em; color: #5b6878; margin-top: 2px; }
    .cg-lb-card tbody .cg-lb-rounds::before { content: "🎯 "; }
}

.cg-lb-rules {
    background: #f8fafc;
    border-left: 3px solid #f39100;
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 0.9em;
    color: #5b6878;
    line-height: 1.6;
}
.cg-lb-rules strong { color: #0b2a4a; }
