.kg-page {
    --kg-bg: #0d1019;
    --kg-panel: #151926;
    --kg-raised: #1c2030;
    --kg-border: #30354a;
    --kg-text: #f2f2fb;
    --kg-muted: #afb4ca;
    --kg-accent: #a58afa;
    --kg-button: #6946ca;
    background: var(--kg-bg);
    color: var(--kg-text);
}
.kg-shell { width:min(100% - 48px, 1240px); margin:0 auto; padding:42px 0 72px; }
.kg-shell * { box-sizing:border-box; }
.kg-shell h1,.kg-shell h2,.kg-shell h3,.kg-shell p { margin:0; }
.kg-shell h1 { font-size:3.1rem; line-height:1.08; letter-spacing:-.04em; }
.kg-shell h2 { font-size:1.25rem; line-height:1.25; letter-spacing:-.02em; }
.kg-shell h3 { font-size:1rem; }
.kg-hub { padding-top:52px; }
.kg-intro { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:26px; }
.kg-hub-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.kg-shuffle {
    display:inline-flex; align-items:center; justify-content:center; gap:12px;
    min-height:42px; padding:9px 14px; border:1px solid var(--kg-border); border-radius:8px;
    color:var(--kg-text); text-decoration:none; font-size:.875rem; font-weight:650;
}
.kg-shuffle:hover { background:var(--kg-raised); color:white; }
.kg-lineup {
    display:grid; grid-template-columns:minmax(0,1.54fr) minmax(0,1fr);
    align-items:stretch; gap:clamp(26px,4vw,60px);
}
.kg-feature {
    position:relative; isolation:isolate; display:flex; align-items:flex-end;
    min-width:0; min-height:440px; overflow:hidden; padding:clamp(28px,4vw,52px);
    border:1px solid #2d2740; border-radius:16px; background:#151126;
    color:#f8f5ff; text-decoration:none;
}
.kg-feature-art {
    position:absolute; z-index:-2; inset:0 0 0 auto; width:min(76%,540px);
    height:100%; object-fit:cover; object-position:center;
}
.kg-feature::before {
    position:absolute; z-index:-1; inset:0; content:"";
    background:linear-gradient(90deg,#151126 14%,#15112600 75%),linear-gradient(0deg,#151126 2%,#151126e8 20%,#15112600 69%);
}
.kg-feature-copy { width:min(100%,27rem); }
.kg-feature h2 { font-size:clamp(2.6rem,4.7vw,4.25rem); line-height:1; letter-spacing:-.04em; }
.kg-feature p { max-width:34ch; margin-top:14px; color:#d7cfe5; line-height:1.55; }
.kg-feature-actions { display:flex; flex-wrap:wrap; align-items:center; gap:12px 17px; margin-top:24px; color:#d7cfe5; font-size:.875rem; }
.kg-feature-play {
    display:inline-flex; align-items:center; justify-content:center; min-height:44px; gap:16px;
    padding:10px 17px; border-radius:8px; background:#f1eaff; color:#201431; font-weight:750;
    transition:background-color .18s ease;
}
.kg-feature:hover .kg-feature-play { background:#d9c5ff; }
.kg-arrow { width:13px; height:1px; background:currentColor; position:relative; flex:none; }
.kg-arrow::after {
    position:absolute; top:50%; right:0; width:6px; height:6px; content:"";
    border:solid currentColor; border-width:1px 1px 0 0; transform:translateY(-50%) rotate(45deg);
}
.kg-game-index h2 { margin:1px 0 12px; font-size:1.3rem; }
.kg-game-index .kg-soon-title { margin-top:18px; }
.kg-game-index ul { list-style:none; padding:0; margin:0; }
.kg-game-index li { border-top:1px solid var(--kg-border); }
.kg-game-index li:last-child { border-bottom:1px solid var(--kg-border); }
.kg-game-link {
    display:grid; grid-template-columns:58px minmax(0,1fr) auto; align-items:center; gap:15px;
    min-height:79px; padding:10px 6px 10px 0; color:var(--kg-text); text-decoration:none;
    transition:background-color .18s ease;
}
.kg-game-link:hover { background:#ffffff07; }
.kg-game-link img { display:block; width:58px; height:58px; border-radius:8px; object-fit:cover; }
.kg-game-link h3 { line-height:1.3; overflow-wrap:anywhere; }
.kg-game-link p { margin-top:5px; color:var(--kg-muted); font-size:.8rem; line-height:1.4; }
.kg-game-link .kg-arrow { color:var(--kg-muted); transition:transform .18s ease; }
.kg-game-link:hover .kg-arrow { color:var(--kg-text); transform:translateX(3px); }
.kg-game-upcoming:hover { background:transparent; }
.kg-game-upcoming img { opacity:.78; }
.kg-coming-soon { color:#b9c8e1; font-size:.74rem; font-weight:650; white-space:nowrap; }
@media(max-width:390px) {
    .kg-game-upcoming { grid-template-columns:46px minmax(0,1fr) auto; gap:9px; }
    .kg-game-upcoming img { width:46px; height:46px; }
}
.kg-game-head p { color:var(--kg-muted); max-width:57ch; line-height:1.6; }
.kg-back { display:inline-block; color:var(--kg-accent); margin-bottom:20px; }
.kg-game-head { display:flex; align-items:center; gap:16px; margin-bottom:26px; }
.kg-game-head h1 { font-size:2.3rem; }
.kg-game-head img { flex:0 0 72px; border:1px solid var(--kg-border); border-radius:14px; object-fit:cover; }
.kg-game-head p { margin-top:6px; }
.kg-app { min-height:220px; }
.kg-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(235px,315px); gap:18px; align-items:start; }
.kg-stack { display:grid; gap:14px; min-width:0; }
.kg-panel,.kg-reading { display:grid; align-content:start; gap:14px; background:var(--kg-panel); border:1px solid var(--kg-border); border-radius:14px; padding:20px; min-width:0; }
.kg-reading { max-width:72ch; }
.kg-reading p,.kg-story-parts p { line-height:1.65; overflow-wrap:anywhere; }
.kg-muted { color:var(--kg-muted); line-height:1.5; }
.kg-small { font-size:.85rem; }
.kg-status { color:#f2c0b9; margin-bottom:12px; overflow-wrap:anywhere; }
.kg-status:empty { display:none; }
.kg-status[data-kind=success] { color:#9de4bd; }
.kg-actions,.kg-room-bar { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.kg-room-bar { justify-content:space-between; }
.kg-room-bar h2 { overflow-wrap:anywhere; }
.kg-btn { display:inline-flex; justify-content:center; align-items:center; gap:6px; min-height:42px; padding:9px 13px; color:var(--kg-text); background:var(--kg-raised); border:1px solid var(--kg-border); border-radius:8px; font:inherit; font-size:.88rem; font-weight:650; text-decoration:none; cursor:pointer; transition:background .15s,border-color .15s; }
.kg-btn:hover { border-color:var(--kg-accent); }
.kg-primary { background:var(--kg-button); border-color:var(--kg-button); color:white; }
.kg-primary:hover { background:#7854d5; }
.kg-btn:disabled { opacity:.52; cursor:default; }
.kg-shell :focus-visible { outline:2px solid #d5c4ff; outline-offset:3px; }
.kg-form { display:grid; gap:10px; }
.kg-inline { display:flex; flex-wrap:wrap; align-items:flex-end; gap:8px; }
.kg-field { display:grid; gap:5px; color:var(--kg-muted); font-size:.85rem; min-width:0; }
.kg-inline .kg-field { flex:1 1 160px; }
.kg-shell :is(input:not([type=checkbox]):not([type=range]),textarea,select) { display:block; width:100%; min-height:42px; padding:8px 10px; border:1px solid var(--kg-border); border-radius:8px; background:#101320; color:var(--kg-text); font:inherit; }
.kg-shell textarea { resize:vertical; min-height:74px; }
.kg-check { display:flex; gap:8px; align-items:center; }
.kg-list { list-style:none; padding:0; margin:0; display:grid; gap:8px; }
.kg-row { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; padding:9px 0; border-bottom:1px solid var(--kg-border); overflow-wrap:anywhere; }
.kg-row:last-child { border-bottom:0; }
.kg-turn { font-weight:650; color:#dbcfff; overflow-wrap:anywhere; }
.kg-timer { color:var(--kg-muted); font-variant-numeric:tabular-nums; }
.kg-secret { padding:10px 12px; border-radius:8px; background:#251c3d; color:#e4d7ff; font-size:1.25rem; letter-spacing:.02em; overflow-wrap:anywhere; }
.kg-feed { overflow:auto; max-height:255px; overscroll-behavior:contain; }
.kg-feed p { padding:7px 0; border-bottom:1px solid var(--kg-border); overflow-wrap:anywhere; }
.kg-feed strong { color:#c9b7ff; }
.kg-draw { display:block; width:100%; height:auto; border-radius:8px; background:#f4f1ff; touch-action:none; }
.kg-draw[data-drawing] { cursor:crosshair; }
.kg-palette { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.kg-color { width:29px; height:29px; padding:0; border:1px solid #665f77; border-radius:5px; cursor:pointer; }
.kg-color[aria-pressed=true] { outline:2px solid #e0d4ff; outline-offset:2px; }
.kg-map { max-height:65vh; overflow:auto; border:1px solid var(--kg-border); border-radius:8px; background:#101320; overscroll-behavior:contain; }
.kg-map canvas { display:block; touch-action:none; image-rendering:pixelated; cursor:crosshair; max-width:none; }
.kg-map canvas[data-pan] { cursor:grabbing; }
.kg-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.kg-option { text-align:left; display:grid; justify-content:stretch; align-content:space-between; min-height:76px; gap:10px; overflow-wrap:anywhere; }
.kg-option[aria-pressed=true] { border-color:var(--kg-accent); background:#291f43; }
.kg-option:disabled { opacity:1; }
.kg-percent { color:#d9c8ff; font-size:1rem; }
.kg-result { color:#d9c8ff; font-size:3rem; line-height:1; font-weight:750; font-variant-numeric:tabular-nums; }
.kg-compare { display:grid; grid-template-columns:1fr 1fr; gap:6px 12px; padding:9px 0; border-bottom:1px solid var(--kg-border); overflow-wrap:anywhere; }
.kg-compare strong { grid-column:1/-1; }
.kg-compare[data-same=true] strong { color:#a3e6be; }
.kg-shell summary { cursor:pointer; color:#d1c1ff; }
.kg-shell details[open] > summary { margin-bottom:12px; }
.kg-dialog { color:var(--kg-text); background:var(--kg-panel); border:1px solid var(--kg-border); border-radius:14px; width:min(440px,calc(100% - 32px)); padding:20px; }
.kg-dialog::backdrop { background:#0009; }
@media(max-width:850px){
    .kg-layout,.kg-lineup { grid-template-columns:1fr; }
    .kg-feature { min-height:380px; }
}
@media(max-width:510px){
    .kg-shell { width:calc(100% - 28px); padding-top:24px; }
    .kg-intro { flex-wrap:wrap; gap:12px; margin-bottom:18px; }
    .kg-shell h1 { font-size:2.2rem; }
    .kg-feature { min-height:360px; padding:22px; }
    .kg-feature-art { width:100%; height:77%; object-position:center 40%; }
    .kg-feature::before { background:linear-gradient(0deg,#151126 13%,#151126f5 27%,#15112600 76%); }
    .kg-feature p { font-size:.9rem; }
    .kg-feature-actions { margin-top:16px; }
    .kg-game-head h1 { font-size:1.7rem; }
    .kg-game-head img { width:54px; height:54px; flex-basis:54px; }
    .kg-panel { padding:15px; }
}
@media(prefers-reduced-motion:reduce){.kg-shell *{transition:none!important}}

@media (prefers-reduced-motion: no-preference) {
    .kg-result { animation: kg-result-in .2s ease-out both; }
}
@keyframes kg-result-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
