body {
    margin: 0;
    padding: 0;
    background-color: #121212;
    font-family: 'Courier New', monospace;
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#container {
    width: 90%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.ruler-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ruler-label {
    font-size: 14px;
    font-weight: bold;
    color: #aaa;
    text-align: center;
}

#numberLine {
    position: relative;
    width: 100%;
    height: 60px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
    will-change: transform;
}

#dynamicRuler {
    position: relative;
    width: 100%;
    height: 60px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
    will-change: contents;
}

#dynamicTicksContainer {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
}

#dynamicDot {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #4dff4d;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    box-shadow: 0 0 10px rgba(77, 255, 77, 0.6);
    will-change: left;
}

.dynamicTick {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dynamicTickMark {
    width: 1px;
    height: 10px;
    background-color: #777;
}

.dynamicTickLabel {
    color: #aaa;
    font-size: 12px;
    margin-top: 5px;
}

.dynamicLabel {
    position: absolute;
    color: #f0f0f0;
    font-size: 12px;
    padding: 3px 6px;
    background-color: rgba(80, 80, 80, 0.6);
    border-radius: 3px;
    bottom: 5px;
}

#minLabel {
    left: 5px;
}

#maxLabel {
    right: 5px;
}

#ticksContainer {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    will-change: transform;
}

.tick {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
}

.tick-mark {
    width: 1px;
    height: 10px;
    background-color: #777;
}

.tick-label {
    color: #aaa;
    font-size: 12px;
    margin-top: 5px;
}

.min-tick .tick-label {
    color: #4d9fff;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(77, 159, 255, 0.8);
}

.min-tick .tick-mark {
    background-color: #4d9fff;
    height: 15px;
}

.max-tick .tick-label {
    color: #ff4d4d;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 77, 77, 0.8);
}

.max-tick .tick-mark {
    background-color: #ff4d4d;
    height: 15px;
}

#walker {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #ff4d4d;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.6);
}

#controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

button {
    padding: 8px 16px;
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background-color: #444;
}

button:active {
    background-color: #2a2a2a;
    transform: translateY(1px);
}

#stepBtn {
    background-color: #3a3a3a;
}

#resetBtn {
    background-color: #5a3030;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #555;
}

input[type="range"] {
    width: 120px;
    -webkit-appearance: none;
    height: 8px;
    background: #333;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #777;
    border-radius: 50%;
}

#stats {
    display: flex;
    gap: 20px;
    font-size: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

#positionDisplay, #stepsDisplay, #extremesDisplay, #streaksDisplay {
    padding: 8px 12px;
    background-color: #1a1a1a;
    border-radius: 4px;
}

#extremesDisplay {
    color: #f0f0f0;
}

#streaksDisplay {
    color: #f0f0f0;
}

/* Optimize rendering performance */
* {
    box-sizing: border-box;
}

/* Apply hardware acceleration to animated elements */
#dynamicDot, #ticksContainer {
    transform: translateZ(0);
    backface-visibility: hidden;
}

#speed-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background-color: #1a1a1a;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #333;
    font-size: 12px;
    min-width: 120px;
}

#stepsPerSecond {
    color: #4dff4d;
    font-weight: bold;
}

#batchSize {
    color: #aaa;
}

.bias-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.bias-label {
    font-size: 14px;
    font-weight: bold;
    color: #aaa;
    text-align: center;
}

.bias-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.bias-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80%;
    max-width: 400px;
}

#biasSlider {
    width: 100%;
    -webkit-appearance: none;
    height: 8px;
    background: linear-gradient(to right, #4d9fff, #aaa, #ff4d4d);
    border-radius: 4px;
    outline: none;
}

#biasSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #e0e0e0;
    border-radius: 50%;
    border: 2px solid #777;
    cursor: pointer;
}

#biasDisplay {
    margin-top: 8px;
    font-size: 14px;
    color: #ccc;
    text-align: center;
}

.bias-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background-color: #333;
    color: #e0e0e0;
}

#leftBiasBtn {
    background-color: #4d9fff44;
    color: #4d9fff;
}

#rightBiasBtn {
    background-color: #305a3a;
}

/* Rules Container Styles */
.rules-container {
    width: 100%;
    margin-top: 10px;
    padding: 15px;
    background-color: #222;
    border: 1px solid #333;
    border-radius: 4px;
}

.rules-label {
    font-size: 14px;
    font-weight: bold;
    color: #ddd;
    margin-bottom: 10px;
    text-align: center;
}

.rules-control {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rules-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.rules-status {
    text-align: center;
    font-size: 13px;
    color: #bbb;
    padding: 5px;
    background-color: #2a2a2a;
    border-radius: 3px;
}

.rules-status .active {
    color: #4dff4d;
    font-weight: bold;
}

.rules-status .inactive {
    color: #ff4d4d;
    font-weight: bold;
}

.rules-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 5px;
}

.rule-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.rule-input {
    width: 60px;
    padding: 4px;
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    text-align: center;
}

input[type="number"].rule-input {
    -moz-appearance: textfield;
}

input[type="number"].rule-input::-webkit-outer-spin-button,
input[type="number"].rule-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rule-input::-webkit-outer-spin-button,
input[type="number"].rule-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rules-log {
    margin-top: 10px;
    padding: 8px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 3px;
    font-size: 12px;
    color: #aaa;
}

.rule-last-pos {
    margin-top: 5px;
    color: #bbb;
    font-style: italic;
}

.last-roll {
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    color: #aaa;
}

#rollValue {
    font-weight: bold;
    color: #e0e0e0;
}

/* Mode selector styling */
.mode-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 0 10px;
}

.mode-toggle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#modeToggle {
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 5px 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

#modeToggle option {
    background-color: #1a1a1a;
}

/* Speed controls container */
.speed-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

/* Mode indicator in the speed info display */
#speed-info .mode-label {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 3px;
}

#speed-info.normal-mode {
    background-color: rgba(77, 159, 255, 0.2);
    border: 1px solid rgba(77, 159, 255, 0.4);
}

#speed-info.batch-mode {
    background-color: rgba(255, 159, 77, 0.2);
    border: 1px solid rgba(255, 159, 77, 0.4);
}