:root {
    --bg: #0d0709;
    --surface: #1a1013;
    --border: #33191f;
    --text: #f3e9ec;
    --text-dim: #a58c93;
    --accent: #d6153f;
    --accent-rgb: 214, 21, 63;
    --accent-hover: #ff5c8a;
    --accent-hover-rgb: 255, 92, 138;
}

* {
    box-sizing: border-box;
}

/* ---------- Site-wide themed scrollbars ---------- */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
}

/* Chromium/WebKit - applies everywhere, including inside CodeMirror's own
   scrollbar divs (those are just normal overflow:scroll elements under the
   hood) and any overflow-x:auto table wrapper, modal, etc. */
*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: var(--bg);
}

*::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 8px;
    border: 3px solid var(--bg);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

*::-webkit-scrollbar-corner {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
}

/* ---------- Header / Hero ---------- */

.site-header {
    position: relative;
    overflow: hidden;
    padding: 1.5rem 1.5rem 4rem;
    background: var(--bg);
}

#header-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* Natural aspect ratio, not stretched/cropped to match the header's
       full (much taller) height like object-fit:cover was doing - spans
       the same full width the hex-rain canvas did, but sits as a shorter
       strip across the top instead of being blown up to fill the whole
       header vertically. */
    height: auto;
    display: block;
    z-index: 0;
    opacity: 0.5;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

/* Darkens the video enough for the hero text on top of it to stay readable,
   same job the hex-rain canvas's own translucent fill used to do. */
.header-bg-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(13, 7, 9, 0.55);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.nav, .hero {
    position: relative;
    z-index: 1;
}

.nav {
    max-width: 1000px;
    margin: 0 auto 3rem;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    color: var(--text);
    text-decoration: none;
}

.hero {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

.hero h1, .hero .tagline, .hero-note {
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    line-height: 1.2;
    margin: 0 0 1rem;
}

.tagline {
    color: var(--text-dim);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0 auto 2rem;
    max-width: 520px;
}

.hero-note {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.9rem;
}


/* ---------- App body ---------- */

.app {
    max-width: 720px;
    margin: -2.5rem auto 3rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
}

.mode-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.mode-tab-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    border-radius: 8px 8px 0 0;
    padding: 0.65rem 1.1rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.mode-tab-button:hover {
    background: var(--surface);
    color: var(--text);
}

.mode-tab-button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

/* ---------- Downloads ---------- */

.kk-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
}

.kk-card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
}

.kk-card p {
    color: var(--text-dim);
    line-height: 1.6;
    margin: 0 0 1.25rem;
}

.kk-card code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.9em;
}

.download-button {
    display: inline-block;
    background: var(--accent);
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.download-button:hover {
    background: var(--accent-hover);
}

.kk-contents-list {
    margin: 1.5rem 0 0;
    padding-left: 1.25rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.kk-contents-list code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.9em;
    color: var(--text);
}

.kk-credit {
    margin: 1.5rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.6;
}

.kk-credit a {
    color: var(--accent-hover);
}

/* ---------- Tutorial ---------- */

.kk-steps {
    list-style: none;
    counter-reset: kk-step;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.kk-steps li {
    counter-increment: kk-step;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem 1.5rem 1.5rem 3.75rem;
}

.kk-steps li::before {
    content: counter(kk-step);
    position: absolute;
    left: 1.25rem;
    top: 1.5rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kk-steps h3 {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
}

.kk-steps p {
    margin: 0 0 0.75rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.kk-steps p:last-child {
    margin-bottom: 0;
}

.kk-step-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 0 0 0.75rem;
}

.kk-step-image:last-child {
    margin-bottom: 0;
}

.kk-steps code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.9em;
}
