@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    --background: #071522;
    --surface: #0d2234;
    --surface-raised: #11293d;
    --text: #eef5fa;
    --muted: #a8bfd0;
    --line: #29465c;
    --accent: #ffb763;
    --link: #7ce0e2;
    --heading: "Bricolage Grotesque", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font: 1rem/1.65 Inter, system-ui, sans-serif;
}

a { color: var(--link); text-underline-offset: 0.21em; }
a:hover { color: var(--text); }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: progress; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--heading); line-height: 1.12; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.5rem); letter-spacing: -0.035em; }
h3 { font-size: 1.21rem; letter-spacing: -0.02em; }

.wrap { width: min(calc(100% - 3rem), 72rem); margin-inline: auto; }

.skip-link {
    position: absolute;
    inset: 0 auto auto 1rem;
    z-index: 2;
    padding: 0.5rem 1rem;
    background: var(--background);
    transform: translateY(-125%);
}

.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--line); }
.site-header-inner, .footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.site-header-inner { min-height: 4.5rem; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    font: 700 1.125rem/1 var(--heading);
    letter-spacing: -0.02em;
}

.brand img { border-radius: 0.42rem; }
.brand strong { color: var(--accent); font-weight: inherit; }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-header nav a, .site-footer nav a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}
.site-header nav a:hover, .site-footer nav a:hover { color: var(--link); }

.hero { padding-block: clamp(2.2rem, 5.9vw, 4.75rem) 1.75rem; }
.hero h1 {
    font-size: clamp(2.4rem, 7vw, 5.3rem);
    font-weight: 800;
    line-height: 0.99;
    letter-spacing: -0.064em;
}
.hero p {
    max-width: 45rem;
    margin-top: 1rem;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.16rem);
}

.player {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0.85rem;
}

.player-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.15rem 0.85rem;
    min-height: 3.1rem;
    padding: 0.3rem clamp(0.8rem, 2.4vw, 1.35rem);
    color: var(--muted);
    font-size: 0.8125rem;
}

.player-top { border-bottom: 1px solid var(--line); }
.player-top h2 {
    color: var(--text);
    font-size: 1rem;
    letter-spacing: -0.015em;
}

.game-stage {
    position: relative;
    isolation: isolate;
    height: clamp(32rem, 52vw, 41rem);
    background: #06111f;
}

.game-cover, .game-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-cover {
    z-index: 1;
    display: grid;
    align-content: center;
    padding: clamp(1.65rem, 6.25vw, 5.6rem);
    background:
        linear-gradient(90deg, #061222 2%, #061222ac 38%, #06122208 77%),
        #061222 url("../images/krillion/dive-cover.webp") center 51% / cover no-repeat;
}

.game-loading { max-width: 28rem; }
.game-cover-title {
    color: var(--text);
    font: 800 clamp(2rem, 6vw, 4.1rem)/1.02 var(--heading);
    letter-spacing: -0.05em;
    text-wrap: balance;
    margin-bottom: 1.2rem;
}

.game-feedback {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text);
    font-weight: 600;
}

.game-spinner {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: game-loading-spin 0.8s linear infinite;
}

@keyframes game-loading-spin {
    to { transform: rotate(1turn); }
}

@media (prefers-reduced-motion: reduce) {
    .game-spinner { animation: none; }
}

.player-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    padding-inline: 0.75rem;
    background: var(--surface-raised);
    color: var(--text);
    font-weight: 700;
}

.player-button:hover { border-color: var(--link); }
.game-retry { margin-top: 1rem; }

.game-stage iframe {
    left: 50%;
    width: min(100%, 43rem);
    border: 0;
    background: #06111f;
    transform: translateX(-50%);
}
.player:fullscreen, .player.is-expanded {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
}
.player.is-expanded { position: fixed; inset: 0; z-index: 5; height: 100dvh; }
.player-expanded { overflow: hidden; }
.player:fullscreen .game-stage, .player.is-expanded .game-stage { height: auto; }

.player-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }

.content-section { padding-block: clamp(2.7rem, 6vw, 4.5rem); border-bottom: 1px solid var(--line); }
.section-heading { max-width: 47rem; margin-bottom: 1.5rem; }
.section-heading p, .stack p, .steps p, .guide-note p, .mode-card p, .faq p, .tiers p {
    color: var(--muted);
}
.section-heading p, .stack p, .steps p, .guide-note p, .mode-card p { margin-top: 0.65rem; }

.steps, .modes {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
}
.guide-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(1rem, 4vw, 3rem);
}
.steps { list-style: none; }
.game-screenshot {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--surface);
}
.game-screenshot img { display: block; width: 100%; height: auto; }
.game-screenshot figcaption { padding: 0.6rem 0.9rem; color: var(--muted); font-size: 0.875rem; }
.steps li, .mode-card, .tiers {
    padding: clamp(1rem, 2.25vw, 1.55rem);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--surface);
}
.guide-note {
    max-width: 54rem;
    padding: 0.15rem 0 0.15rem 1.2rem;
    margin-top: 1.6rem;
    border-left: 2px solid var(--accent);
}

.scoring-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr); gap: clamp(1.25rem, 5vw, 4rem); }
.stack { display: grid; align-content: start; gap: 1.4rem; }
.tiers { align-self: start; }
.tiers table { width: 100%; border-collapse: collapse; text-align: left; }
.tiers caption { margin-bottom: 0.7rem; text-align: left; font: 700 1.21rem var(--heading); }
.tiers td, .tiers th { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); }
.tiers thead { color: var(--muted); font-size: 0.875rem; }
.tiers td { color: var(--accent); width: 3.5rem; font-variant-numeric: tabular-nums; }
.tiers tbody th { font-weight: 500; }
.tiers p { margin-top: 1rem; font-size: 0.875rem; }

.modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-card { display: flex; flex-direction: column; }
.mode-card a { align-self: flex-start; display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; margin-top: auto; }

.faq { border-bottom: 0; }
.faq details {
    max-width: 54rem;
    border-top: 1px solid var(--line);
}
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 52px;
    padding: 0.7rem 0.1rem;
    list-style: none;
    font-weight: 600;
    cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ''; width: 0.55rem; height: 0.55rem; border-right: 2px solid var(--link); border-bottom: 2px solid var(--link); transform: rotate(45deg); flex: none; }
.faq details[open] summary::after { transform: rotate(225deg); }
.faq details p { max-width: 46rem; padding-bottom: 1rem; }
.back-to-play { display: inline-flex; align-items: center; min-height: 44px; gap: 0.4rem; margin-top: 1rem; }

.site-footer { border-top: 1px solid var(--line); padding-block: 1.8rem; background: var(--surface); }
.footer-inner p { color: var(--muted); margin-top: 0.65rem; font-size: 0.875rem; }

.legal { padding-block: clamp(2.8rem, 7vw, 5rem); min-height: 62vh; }
.legal > * { max-width: 47rem; }
.legal h1 { font-size: clamp(2.25rem, 6vw, 4rem); letter-spacing: -0.055em; }
.legal h2 { margin-top: 2rem; font-size: 1.44rem; }
.legal p { margin-top: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }

@media (min-width: 761px) {
    .game-loading { transform: translateY(clamp(-8rem, -16vh, -4.5rem)); }
}

@media (max-width: 760px) {
    .wrap { width: calc(100% - 2rem); }
    .site-header-inner, .footer-inner { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .site-header-inner { padding-top: 0.7rem; }
    .site-header nav, .site-footer nav { gap: 0 1.15rem; }
    .guide-layout, .scoring-layout, .modes { grid-template-columns: minmax(0, 1fr); }
    .game-stage { height: clamp(32rem, 73svh, 41rem); }
    .game-cover {
        align-content: end;
        padding-bottom: clamp(5.4rem, 21svh, 11rem);
        background:
            linear-gradient(0deg, #061222 3%, #06122282 47%, transparent 85%),
            #061222 url("../images/krillion/dive-cover.webp") 88% center / cover no-repeat;
    }
    .game-cover-title { max-width: 13ch; }
}
