html {
    height: 100%;
    width: 100%;
    background-color: #1d292c;
}
body {
    margin: 0;
    max-height: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1d292c;
    font-family: Helvetica, arial, sans-serif;
    position: relative;
    width: 100%;

    -webkit-tap-highlight-color: transparent;
}

#application-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
#application-canvas.fill-mode-NONE {
    margin: auto;
}
#application-canvas.fill-mode-KEEP_ASPECT {
    width: 100%;
    height: auto;
    margin: 0;
}
#application-canvas.fill-mode-FILL_WINDOW {
    width: 100%;
    height: 100%;
    margin: 0;
}

canvas:focus {
    outline: none;
}

/* ==========================================================================
   HyperKart — DOM UI layer (HUD / Settings / Credits / Coming Soon)
   ========================================================================== */

#hk-ui-root {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    font-family: 'Orbitron', 'Helvetica', Arial, sans-serif;
}

.hk-hidden { display: none !important; }

/* ---- modal overlay + panel ---- */
.hk-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 18, 0.72);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    padding: 24px;
    box-sizing: border-box;
}

.hk-panel {
    width: min(480px, 100%);
    max-height: 86vh;
    overflow-y: auto;
    border-radius: 18px;
    padding: 3px;
    background: linear-gradient(120deg, #ff0055, #ff8800, #ffee00, #00ff99, #00aaff, #8844ff);
    background-size: 400% 400%;
    animation: hk-rainbow 8s ease infinite;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

@keyframes hk-rainbow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hk-panel-inner {
    background: #14181f;
    border-radius: 16px;
    padding: 28px 26px 22px;
    color: #fff;
}

.hk-panel-title {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(90deg, #ff0055, #ffee00, #00aaff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hk-panel-body { display: flex; flex-direction: column; gap: 16px; }

.hk-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hk-row-label {
    font-size: 14px;
    letter-spacing: 1px;
    opacity: 0.85;
}

.hk-toggle {
    min-width: 64px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
}

.hk-toggle.hk-on {
    background: linear-gradient(90deg, #00ff99, #00aaff);
    border-color: transparent;
    color: #08110f;
}

.hk-slider {
    width: 55%;
    accent-color: #ff0055;
}

.hk-seg-group { display: flex; gap: 6px; }

.hk-seg {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
}

.hk-seg-active {
    background: linear-gradient(90deg, #ff8800, #ff0055);
    border-color: transparent;
}

.hk-controls-box {
    margin-top: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.hk-controls-title {
    font-size: 12px;
    letter-spacing: 2px;
    opacity: 0.6;
    margin-bottom: 10px;
}

.hk-controls-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    row-gap: 8px;
    column-gap: 16px;
    font-size: 13px;
}

.hk-controls-grid span:nth-child(2n) {
    text-align: right;
    opacity: 0.8;
    font-family: monospace;
}

.hk-row-link { justify-content: flex-end; margin-top: -4px; }

.hk-link-btn {
    background: none;
    border: none;
    color: #ffee00;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.hk-close-btn {
    display: block;
    margin: 22px auto 0;
    padding: 12px 34px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, #ff0055, #8844ff);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 13px;
    cursor: pointer;
}

/* ---- credits ---- */
.hk-credits-body { text-align: center; }
.hk-credits-logo {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 14px;
    color: #ffee00;
}
.hk-credits-section { margin-bottom: 12px; }
.hk-credits-section h4 {
    margin: 0 0 2px;
    font-size: 12px;
    letter-spacing: 1.5px;
    opacity: 0.55;
    text-transform: uppercase;
}
.hk-credits-section p { margin: 0; font-size: 14px; }
.hk-credits-thanks { margin-top: 16px; font-size: 13px; opacity: 0.8; }

/* ---- coming soon ---- */
.hk-comingsoon-body { text-align: center; }
.hk-comingsoon-icon { font-size: 42px; margin-bottom: 10px; }
.hk-roadmap {
    text-align: left;
    display: inline-block;
    margin: 14px auto 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.9;
    opacity: 0.9;
}

/* ==========================================================================
   In-race HUD
   ========================================================================== */
.hk-hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.hk-hud-top-left {
    position: absolute;
    top: 18px;
    left: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hk-hud-place {
    font-size: 40px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(90deg, #ffee00, #ff8800);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hk-hud-place sup { font-size: 16px; margin-left: 2px; }

.hk-hud-timer {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    opacity: 0.9;
}

.hk-hud-top-right {
    position: absolute;
    top: 18px;
    right: 18px;
}

#hk-minimap {
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.hk-hud-bottom-left {
    position: absolute;
    bottom: 22px;
    left: 18px;
    width: 220px;
}

.hk-boost-meter {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.hk-boost-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ffcc, #00aaff);
    transition: width 0.1s linear;
}

.hk-boost-label {
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: 1px;
    opacity: 0.85;
}

.hk-hud-bottom-right {
    position: absolute;
    bottom: 22px;
    right: 22px;
}

.hk-speedo {
    position: relative;
    width: 64px;
    height: 90px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
}

.hk-speedo-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, #ff0055, #ff8800);
    transition: height 0.08s linear;
    z-index: 0;
}

.hk-speedo-value {
    position: relative;
    z-index: 1;
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 2px;
}

.hk-speedo-unit {
    position: relative;
    z-index: 1;
    font-size: 9px;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 6px;
}

.hk-progress-track {
    position: absolute;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    width: 40%;
    max-width: 420px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

.hk-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff99, #00aaff, #8844ff);
    transition: width 0.15s linear;
}

.hk-finish-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(10, 12, 18, 0.85);
    padding: 30px 46px;
    border-radius: 18px;
    pointer-events: all;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.hk-finish-title {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(90deg, #ff0055, #ffee00, #00aaff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
}

.hk-finish-place { font-size: 15px; opacity: 0.9; margin-bottom: 4px; }

@media (max-width: 640px) {
    .hk-hud-place { font-size: 30px; }
    #hk-minimap { width: 90px; height: 90px; }
    .hk-hud-bottom-left { width: 150px; }
    .hk-speedo { width: 52px; height: 74px; }
    .hk-progress-track { width: 60%; }
    .hk-panel-inner { padding: 22px 18px 18px; }
}
