:root {
    color-scheme: dark;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.7;
    color: #f3f8fb;
    background: #063b58;
    --page-overlay: linear-gradient(180deg, rgb(3 31 48 / 77%), rgb(3 31 48 / 90%));
    --page-color: #f3f8fb;
    --link-color: #9ce7ff;
    --link-hover: #fff;
    --muted-color: #d0e0e8;
    --body-copy: #e0edf3;
    --eyebrow-color: #9ce7ff;
    --surface-color: rgb(3 31 48 / 87%);
    --surface-border: rgb(255 255 255 / 14%);
    --header-border: rgb(255 255 255 / 22%);
    --stats-background: rgb(0 0 0 / 34%);
    --summary-color: #fff;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

:root[data-theme="light"] {
    color-scheme: light;
    color: #172b35;
    background: #e8f2f5;
    --page-overlay: linear-gradient(180deg, rgb(244 250 252 / 90%), rgb(230 241 245 / 94%));
    --page-color: #172b35;
    --link-color: #075a79;
    --link-hover: #00384d;
    --muted-color: #425c68;
    --body-copy: #29434f;
    --eyebrow-color: #075a79;
    --surface-color: rgb(255 255 255 / 92%);
    --surface-border: rgb(23 43 53 / 16%);
    --header-border: rgb(23 43 53 / 22%);
    --stats-background: rgb(218 233 238 / 90%);
    --summary-color: #172b35;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--page-overlay), url("images/sea.png") center / cover fixed;
}

a {
    color: var(--link-color);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--link-hover);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 3px solid #ffda74;
    outline-offset: 3px;
}

.site-shell {
    width: min(100% - 32px, 1080px);
    margin: 0 auto;
}

.site-header,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 0;
}

.site-header {
    border-bottom: 1px solid var(--header-border);
}

.site-name {
    color: var(--page-color);
    font-size: 1.15rem;
    font-weight: 800;
    text-decoration: none;
}

.site-header nav,
.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
}

.theme-toggle {
    border: 1px solid var(--surface-border);
    border-radius: 7px;
    padding: 5px 10px;
    background: var(--surface-color);
    color: var(--page-color);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--stats-background);
    color: var(--page-color);
}

.intro {
    max-width: 760px;
    padding: 64px 0 54px;
}

.intro h1 {
    margin: 0;
    font-size: clamp(2.25rem, 7vw, 4rem);
    line-height: 1.15;
}

.intro > p:not(.eyebrow) {
    max-width: 650px;
    margin: 18px 0 24px;
    color: var(--body-copy);
    font-size: 1.12rem;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--eyebrow-color);
    font-size: 0.82rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.primary-link,
button {
    display: inline-block;
    border: 0;
    border-radius: 7px;
    padding: 11px 18px;
    background: #ffda74;
    color: #172b35;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.primary-link:hover,
button:hover {
    background: #ffe9a9;
    color: #172b35;
}

.game-section,
.content-section {
    margin: 0 0 24px;
    border: 1px solid rgb(255 255 255 / 14%);
    border-radius: 14px;
    padding: clamp(20px, 4vw, 38px);
    background: var(--surface-color);
    box-shadow: 0 12px 34px rgb(0 0 0 / 18%);
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.section-heading h2,
.content-section h2 {
    margin: 0 0 12px;
    line-height: 1.3;
}

.section-heading .eyebrow {
    margin-bottom: 2px;
}

.section-note,
.game-caption {
    margin: 0;
    color: var(--muted-color);
    font-size: 0.92rem;
}

.game-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 18px;
}

.game-container {
    position: relative;
    width: min(100%, 480px);
    line-height: 0;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #b6d4df;
    background: #fff;
}

.game-over-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(0 0 0 / 68%);
    line-height: 1.5;
}

.game-over-content {
    margin: 16px;
    border-radius: 10px;
    padding: 22px 28px;
    background: #fff;
    color: #19323f;
    text-align: center;
}

.game-over-content h2,
.game-over-content p {
    margin: 0 0 12px;
}

.game-stats {
    flex: 0 0 205px;
    border-radius: 8px;
    padding: 12px 15px;
    background: var(--stats-background);
    text-align: left;
}

.game-stats p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0;
}

.game-stats strong {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.stat-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.game-caption {
    margin-top: 14px;
}

.content-section h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.content-section h3 {
    margin: 26px 0 8px;
    font-size: 1.15rem;
}

.content-section p,
.content-section li {
    color: var(--body-copy);
}

.content-section li + li {
    margin-top: 6px;
}

.content-section details {
    border-top: 1px solid var(--surface-border);
    padding: 16px 0;
}

.content-section summary {
    color: var(--summary-color);
    font-weight: 700;
    cursor: pointer;
}

.content-section details p {
    margin-bottom: 0;
}

.policy-content h1 {
    margin-top: 0;
    line-height: 1.25;
}

.policy-content h2 {
    margin-top: 30px;
    font-size: 1.25rem;
}

.site-footer {
    align-items: flex-start;
    border-top: 1px solid var(--header-border);
    color: var(--muted-color);
    font-size: 0.92rem;
}

.site-footer p {
    margin: 0;
}

@media (max-width: 700px) {
    .site-header,
    .site-footer,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .intro {
        padding: 44px 0 38px;
    }

    .game-layout {
        align-items: center;
        flex-direction: column;
    }

    .game-stats {
        width: min(100%, 480px);
        flex-basis: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
