.nkd-console {
    --nkd-ink: #070e1d;
    --nkd-copy: #edfaff;
    --nkd-mute: #aabdd5;
    --nkd-mint: #a2fff1;
    --nkd-case-top: clamp(22px, 3.3vw, 37px);
    --nkd-case-side: clamp(21px, 3.05vw, 36px);
    --nkd-case-base: clamp(23px, 3.3vw, 45px);
    box-sizing: border-box;
    width: min(100%, clamp(368px, calc((100svh - 253px) * .81 + var(--nkd-case-side) * 2), 710px));
    min-width: 0;
    margin: 0 auto;
    padding: 5px clamp(5px, 1.05vw, 12px) 7px;
    border-style: solid;
    border-color: #13233e;
    border-width: var(--nkd-case-top) var(--nkd-case-side) var(--nkd-case-base);
    border-image-source: url("cabinet-frame.webp");
    border-image-slice: 9.33% 9.3% 20.2%;
    border-image-repeat: stretch;
    background: linear-gradient(90deg, #101f38, #070e1d 9%, #070e1d 91%, #101f38) padding-box;
    color: var(--nkd-copy);
    font-family: inherit;
}
.nkd-console *, .nkd-console *::before, .nkd-console *::after { box-sizing: border-box; }
.nkd-console [hidden] { display: none !important; }
.nkd-marquee {
    position: relative;
    isolation: isolate;
    display: grid;
    align-items: end;
    min-height: clamp(78px, 12svh, 121px);
    margin: 0 0 9px;
    padding: 8px 5px 7px;
    overflow: hidden;
    border: 1px solid #466388;
    border-radius: 9px 9px 6px 6px;
    background: linear-gradient(0deg, #050918 0%, #0509185c 40%, transparent 72%),
        #0c1931 url("marquee.webp") center 48% / cover no-repeat;
    text-align: center;
}
.nkd-marquee h3 {
    margin: 0;
    color: #ffe5a1;
    font-family: inherit;
    font-size: clamp(18px, 5.4vw, 35px);
    font-weight: 900;
    font-style: italic;
    line-height: 1.1;
    letter-spacing: .024em;
    text-shadow: 0 2px #6c341b, 0 4px 13px #000, 0 0 17px #07090c;
    text-transform: uppercase;
}
.nkd-hud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; margin: 0 0 6px; }
.nkd-hud div {
    display: grid;
    gap: 2px;
    padding: 5px clamp(4px, 1vw, 9px);
    border: 1px solid #2d4563;
    border-radius: 4px;
    background: #071527;
    line-height: 1.1;
}
.nkd-hud span { color: var(--nkd-mute); font-size: clamp(8px, 2.5vw, 10px); text-transform: uppercase; letter-spacing: .065em; }
.nkd-hud strong { color: var(--nkd-mint); font: 700 clamp(15px, 4vw, 22px)/1 ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.nkd-stage {
    position: relative;
    overflow: hidden;
    border: 1px solid #4f7297;
    border-radius: 8px;
    background: #070d1c;
    box-shadow: 0 0 13px #4fa8e024, 0 0 0 2px #070d1c;
}
.nkd-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    aspect-ratio: 17 / 21;
    touch-action: none;
    outline-offset: -3px;
}
.nkd-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 9px; background: #040a178a; }
.nkd-overlay:not([data-nkd-screen="intro"]) {
    background: #040a177a;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.nkd-overlay[data-nkd-screen="intro"] {
    align-items: end;
    padding-bottom: clamp(35px, 11%, 70px);
    background: linear-gradient(0deg, #040a17a1, #040a171f 62%);
}
.nkd-panel {
    display: grid;
    justify-items: center;
    width: min(100%, 315px);
    gap: clamp(7px, 2vw, 12px);
    padding: clamp(11px, 3vw, 22px);
    text-align: center;
    border: 1px solid #496b88;
    border-radius: 12px;
    background: linear-gradient(160deg, #13233af5 10%, #070f20fa 74%);
    box-shadow: 0 15px 42px #0009;
}
.nkd-panel h3 { margin: 0; color: #f4f9ff; font-size: clamp(22px, 5vw, 32px); line-height: 1.05; }
.nkd-panel p { max-width: 31ch; margin: 0; color: #c7d6e8; font-size: clamp(12px, 3.3vw, 14px); line-height: 1.36; }
.nkd-emblem, .nkd-gem {
    display: inline-block;
    flex: 0 0 auto;
    background: linear-gradient(140deg, #d4fffd 15%, #61f8dc 44%, #16809d 45% 73%, #86fff2 74%);
    clip-path: polygon(50% 0%, 100% 45%, 53% 100%, 0% 45%);
}
.nkd-emblem { width: clamp(21px, 6vw, 34px); aspect-ratio: 1; }
.nkd-gem { width: 11px; height: 11px; }
.nkd-console button {
    appearance: none;
    display: inline-grid;
    place-items: center;
    min-height: 36px;
    margin: 0;
    padding: 4px 10px;
    border: 1px solid #3a5273;
    border-radius: 7px;
    background: #14233d;
    color: var(--nkd-copy);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}
.nkd-console button:hover, .nkd-console button[aria-pressed="true"] { border-color: #8ddbcf; background: #234357; color: #e8fff9; }
.nkd-console button:focus-visible, .nkd-console canvas:focus-visible { outline: 2px solid #cefff4; }
.nkd-console button:disabled { cursor: default; opacity: .55; }
.nkd-console .nkd-primary { min-width: 112px; min-height: 43px; padding-inline: 16px; background: #8af7db; border-color: #a3ffec; color: #091f2b; }
.nkd-console .nkd-primary:hover { background: #c9fff4; color: #091f2b; }
.nkd-progress, .nkd-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; font-size: 12px; }
.nkd-progress { justify-content: space-between; min-height: 29px; padding: 3px 2px; color: var(--nkd-mute); }
.nkd-progress span { display: inline-flex; align-items: center; gap: 5px; }
.nkd-progress strong { color: #f2fbff; }
.nkd-progress .nkd-power, .nkd-power strong { color: #efc7ff; }
.nkd-power .nkd-gem { background: linear-gradient(135deg, #fff7bf, #ffa83c 65%, #ffed83); }
.nkd-deck {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(8px, 2vw, 18px);
    min-width: 0;
    padding: 9px clamp(8px, 2vw, 15px) 10px;
    border: 1px solid #416080;
    border-top-color: #698398;
    border-bottom-color: #080f1c;
    border-radius: 8px 8px 6px 6px;
    background:
        linear-gradient(90deg, transparent 3%, #bdeaff39 25%, #91dddf6b 50%, #bdeaff39 75%, transparent 97%) top / 100% 1px no-repeat,
        repeating-linear-gradient(175deg, transparent 0 3px, #afd0ed09 4px 5px),
        linear-gradient(168deg, #263d56, #14263c 51%, #152a40 79%, #0e1d2d);
    box-shadow: inset 0 0 0 2px #0b1b2f81, inset 0 -4px 7px #0713207a, 0 3px 0 #050e19;
}
.nkd-deck::before,
.nkd-deck::after {
    position: absolute;
    z-index: 0;
    top: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #d4e9f4, #667e96 43%, #131e29 80%);
    content: "";
}
.nkd-deck::before { left: 4px; }
.nkd-deck::after { right: 4px; }
.nkd-kickplate {
    display: grid;
    grid-template-columns: 1fr 35px 1fr;
    align-items: center;
    gap: clamp(9px, 2vw, 17px);
    height: 34px;
    margin: 4px 0 0;
    padding: 2px clamp(10px, 3vw, 24px);
    border: 1px solid #263b51;
    border-top-color: #8e7246;
    border-radius: 4px 4px 10px 10px;
    background: linear-gradient(0deg, #071320, #102237 75%, #192836);
    box-shadow: inset 0 1px #dfb46f44, inset 0 -2px #07101b, 0 0 0 1px #040d18;
}
.nkd-grille {
    height: 10px;
    opacity: .84;
    background: repeating-linear-gradient(90deg, #92afbd60 0 1px, #030d18 2px 4px, transparent 5px 7px);
    mask-image: linear-gradient(90deg, transparent, black 16%, black 84%, transparent);
}
.nkd-kickplate-medallion {
    justify-self: center;
    display: grid;
    place-items: center;
    width: 29px;
    height: 23px;
    border: 1px solid #bc9051;
    border-radius: 5px;
    background: radial-gradient(ellipse, #427677 5%, #193945 45%, #0b172a 78%);
    box-shadow: 0 0 10px #93ffee32, inset 0 1px #ffe0a459;
}
.nkd-kickplate-medallion .nkd-gem { width: 12px; height: 12px; }
.nkd-pad {
    display: grid;
    grid-template-columns: repeat(3, minmax(46px, 56px));
    grid-template-areas: ". up ." "left down right";
    gap: 4px;
    padding: 4px;
    border: 1px solid #42546b;
    border-radius: 8px;
    background: linear-gradient(135deg, #0b1725, #081420 75%, #16293c);
    box-shadow: inset 0 1px 3px #02070e, 0 1px #7990a748;
}
.nkd-key-w { grid-area: up; }
.nkd-key-a { grid-area: left; }
.nkd-key-s { grid-area: down; }
.nkd-key-d { grid-area: right; }
.nkd-pad button {
    grid-auto-flow: column;
    gap: 4px;
    min-height: 45px;
    border-color: #4c8797;
    border-bottom-color: #17434e;
    background: linear-gradient(170deg, #35586a, #203c50 52%, #142d40);
    box-shadow: inset 0 1px #a5fff56b, inset 0 -3px #0a2431, 0 2px #020a16;
    color: #d6fff8;
    line-height: 1;
    font-size: 17px;
}
.nkd-pad button span { color: #98ede2; font-size: 11px; }
.nkd-pad button:active { transform: translateY(2px); box-shadow: inset 0 1px #b9fff280; }
.nkd-tools { justify-content: flex-end; min-width: 0; z-index: 1; }
.nkd-tools small { flex-basis: 100%; color: var(--nkd-mute); font-size: 11px; text-align: right; }
.nkd-tools .nkd-touch { display: none; }
.nkd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) and (hover: none) {
    .nkd-pad, .nkd-tools .nkd-keyboard { display: none; }
    .nkd-tools { justify-content: flex-start; width: 100%; }
    .nkd-tools .nkd-touch { display: block; flex: 1; text-align: left; }
    .nkd-tools button { min-height: 34px; }
}
@media (max-width: 600px) {
    .nkd-console {
        --nkd-case-top: clamp(14px, 4.5vw, 24px);
        --nkd-case-side: clamp(9px, 3.65vw, 21px);
        --nkd-case-base: clamp(16px, 5.9vw, 32px);
        width: 100%;
        padding: 3px 4px 5px;
    }
    .nkd-marquee { min-height: clamp(77px, 24vw, 120px); margin-bottom: 6px; }
    .nkd-hud { margin-bottom: 4px; }
    .nkd-deck { padding: 6px 7px; }
    .nkd-kickplate { height: 26px; margin-top: 3px; }
    .nkd-kickplate-medallion { width: 22px; height: 18px; }
    .nkd-kickplate-medallion .nkd-gem { width: 9px; height: 9px; }
    .nkd-grille { height: 7px; }
}
@media (max-width: 360px) {
    .nkd-hud div { padding-inline: 3px; }
    .nkd-progress, .nkd-tools { font-size: 11px; }
    .nkd-tools button { padding-inline: 6px; }
}
@media (max-height: 670px) and (max-width: 480px) {
    .nkd-marquee { min-height: 73px; }
    .nkd-console {
        --nkd-case-top: 13px;
        --nkd-case-base: 17px;
        width: min(100%, max(254px, calc((100svh - 215px) * .81 + var(--nkd-case-side) * 2)));
    }
}
