/* color variables */
:root {
    --bg-void: #0a1220;
    --accent: hsl(24, 100%, 62%);
    --accent2:rgb(104, 169, 255);
    --ink: #a8a8a8;
    --bg-panel: rgba(18, 29, 51, 0.6);
    --grid-line: rgba(88, 130, 203, 0.15);
    --grid-line-strong: rgba(88, 130, 203, 0.35);
    --ink-dark: rgb(38, 38, 38);
    --ink-dim: #7c93b3;
}
/* make the page not highlightable */
html, body {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg-void);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    flex-direction: column;
    overflow: hidden;

}

canvas {
    display: block;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    background-color: var(--bg-void);
    background-image:
        /* big stripes */
        repeating-linear-gradient(90deg, var(--grid-line-strong) 0, var(--grid-line-strong) 1px, transparent 1px, transparent 160px),
        repeating-linear-gradient(0deg, var(--grid-line-strong) 0, var(--grid-line-strong) 1px, transparent 1px, transparent 160px),
        /* small stripes */
        repeating-linear-gradient(90deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 32px),
        repeating-linear-gradient(0deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 32px);

}

/* styles for the control bar */
#controls {
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 12px 0;
    flex: 0 0 auto;

}
.controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
}

/* stylized overlay buttons */
#button-overlay button {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink);
    background: var(--bg-panel);
    border: 1px solid var(--ink-dim);
    padding: 9px 16px;
    cursor: pointer;
}

#button-overlay button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* time scale button */
#resetTimeScale {
    font-size: 10px;
    font-weight: 700;
    color: var(--ink-dim);
    background: transparent;
    border: 1px solid var(--ink-dim);
    padding: 3px 8px;
    cursor: pointer;
}

#resetTimeScale:hover {
    border-color: var(--accent);
    color: var(--accent);
}



/* the text in the top left corner */
#overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    color: var(--ink);
    font-size: 14px;
    background: var(--bg-panel);
    padding: 8px 12px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* corners around the overlay */
#overlay::before {
    content: "";
    position: absolute;
    top: -1px;
    left: -1px;
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--accent);
    border-left: 2px solid var(--accent);
}

#overlay::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
}

/* info box for inspect mode */
#infoBox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 200px;
    color: var(--ink);
    font-size: 14px;
    background: var(--bg-panel);
    padding: 8px 12px;
    pointer-events: none;
    display: none;
    flex-direction: column;
    gap: 6px;
    
}
/* blue corners to the info box */
#infoBox::before {
    content: "";
    position: absolute;
    bottom: -1px;
    left: -1px;
    width: 10px;
    height: 10px;
    border-bottom: 2px solid var(--accent2);
    border-left: 2px solid var(--accent2);
    
}
#infoBox::after {
    content: "";
    position: absolute;
    top: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--accent2);
    border-right: 2px solid var(--accent2);
    
}
#infoBox.flipped::before {
    bottom: auto;
    left: -1px;
    top: -1px;
    border-bottom: none;
    border-top: 2px solid var(--accent2);
}
#infoBox.flipped::after {
    top: auto;
    right: -1px;
    bottom: -1px;
    border-top: none;
    border-bottom: 2px solid var(--accent2);
}

/* diagonal line leading to the info box */
.diagonal-line {
    content: "";
    position: absolute;
    height: 0;
    border-top: 2px solid var(--accent2);
    transform-origin: left center;
}

/* The button in the top right corner */
#button-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--ink);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* style for the settings sliders and labels */
.control-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-panel);
    border: 1px solid var(--ink-dim);
    padding: 8px 18px;
    color: var(--ink);
    font-size: 14px;
}

/* gap between per-ball properties and global ones */
.global-group {
    margin-left: 32px;
}

/* highlight the active mode button */
#controls button.active {
    background-color: var(--accent);
    color: var(--ink-dark);
    font-weight: bold;
}

#spawn-modes button.active {
    background-color: var(--accent);
    color: var(--ink-dark);
    font-weight: bold;
}

#spawnMode,
#pushMode,
#inspectMode,
#circleButton,
#squareButton,
#triangleButton {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-dim);
    background: transparent;
    border: 1px solid var(--ink-dim);
    padding: 8px 14px;
    cursor: pointer;
}

#button-overlay #circleButton {
    border-right: none;
}
#button-overlay #squareButton {
    border-left: none;
    border-right: none;
}
#button-overlay #triangleButton {
    border-left: none;
}
/* #spawnMode:hover,
#inspectMode:hover,
#pushMode:hover,
#circleButton:hover,
#squareButton:hover {
    border-color: var(--accent);
    color: var(--accent);
} */

/* remove the double line between the 3 buttons */
/* middle button has no side borders */
#pushMode {
    border-right: none;
    border-left: none;
}

/* make the buttons side by side instead of vertical */
.mode-buttons {
    display: flex;
    gap: 0px;
    
}



input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 18px;
    background-color: transparent;
    background-image: repeating-linear-gradient(90deg,
            var(--ink-dim) 0,
            var(--ink-dim) 1px,
            transparent 1px,
            transparent 12.5%);
    background-position: center;
    background-size: 100% 6px;
    background-repeat: no-repeat;
    cursor: grab;
}

/* Chrome/Safari track */
input[type="range"]::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    height: 2px;
    background: var(--ink-dim);
}

/* Chrome/Safari thumb */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 6px;
    height: 18px;
    margin-top: -8px;
    background: var(--accent);
    border: none;
    cursor: grab;
    /* glow!! */
    box-shadow: 0 0 6px 1px rgba(255, 138, 61, 0.35);

}

/* Firefox track */
input[type="range"]::-moz-range-track {
    height: 2px;
    background: var(--ink-dim);
}

/* Firefox thumb */
input[type="range"]::-moz-range-thumb {
    width: 6px;
    height: 18px;
    background: var(--accent);
    border: none;
    border-radius: 0;
    cursor: grab;
    /* glow!! */
    box-shadow: 0 0 6px 1px rgba(255, 138, 61, 0.35);
}

.control-group label {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.unit {
    color: var(--ink-faint);
    font-size: 10px;
}

.value-readout {
    margin-left: auto;
    width: 4.5ch;
    text-align: right;
    color: var(--accent);
    font-weight: 700;
}

.hud-title {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
    position: relative;
    z-index: 1;

}

.hud-title-sub {
    font-weight: 400;
    color: var(--ink-dim);
    font-size: 11px;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.hud-key {
    color: var(--ink-dim);
    font-size: 11px;
}

.hud-val {
    color: var(--accent2);
    font-weight: 500;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: transparent;
    border: 1px solid var(--ink-dim);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

input[type="checkbox"]:hover {
    border-color: var(--accent);
}

input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 6px 1px rgba(255, 138, 61, 0.35);
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid var(--ink-dark);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
