@font-face {
    font-family: 'PrintChar21';
    src: url('fonts/PrintChar21.ttf') format('truetype');
}

* {
    box-sizing: border-box;
}

body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #0a0a0a;
    font-family: 'Courier New', monospace;
    color: #e0e0e0;
    overflow: hidden;
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#clockCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0a0a0a;
    z-index: 1;
}

#controls {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    z-index: 999;
    backdrop-filter: blur(10px);
}

.control-group {
    margin-bottom: 10px;
}

.control-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    color: #e0e0e0;
}

input[type="range"] {
    width: 150px;
    height: 20px;
    background: rgba(50, 50, 50, 0.8);
    border-radius: 10px;
    outline: none;
    -webkit-appearance: none;
}

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

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
}

/* UI Toggle Button */
.ui-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.ui-toggle:hover {
    background: rgba(50, 50, 50, 0.9);
    transform: scale(1.1);
}

/* Main UI Panel */
.ui-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 280px;
    max-height: calc(100vh - 40px);
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(15px);
    z-index: 999;
    overflow-y: auto;
    transition: all 0.3s ease;
    font-size: 12px;
}

.ui-panel.faded {
    opacity: 0.3;
}

.ui-panel.faded:hover {
    opacity: 1;
}

.ui-panel.hidden {
    transform: translateX(-100%);
    opacity: 0;
}

/* UI Header */
.ui-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: bold;
    font-size: 14px;
}

.ui-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fade-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    cursor: pointer;
}

.fade-checkbox input {
    width: 12px;
    height: 12px;
}

.hide-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hide-btn:hover {
    background: rgba(255, 150, 150, 0.9);
}

/* Controls Section */
.controls-section {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.auto-control {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    cursor: pointer;
}

.auto-control input {
    width: 14px;
    height: 14px;
}

/* Buttons */
button {
    padding: 8px 12px;
    background: rgba(50, 50, 50, 0.8);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    transition: all 0.2s;
}

button:hover {
    background: rgba(70, 70, 70, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

#stepBtn {
    background: rgba(50, 100, 50, 0.8);
    border-color: rgba(100, 255, 100, 0.3);
}

#stepBtn:hover {
    background: rgba(70, 120, 70, 0.9);
}

#resetBtn {
    background: rgba(100, 50, 50, 0.8);
    border-color: rgba(255, 100, 100, 0.3);
}

#resetBtn:hover {
    background: rgba(120, 70, 70, 0.9);
}

/* Slider Controls */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.slider-control {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.slider-control label {
    font-size: 10px;
    color: #ccc;
    display: flex;
    justify-content: space-between;
}

/* Bias Section */
.bias-section {
    margin-bottom: 15px;
}

.bias-header {
    font-size: 11px;
    color: #ccc;
    margin-bottom: 8px;
    text-align: center;
}

.bias-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

#biasSlider {
    flex: 1;
    background: linear-gradient(to right, #ff4d4d 0%, #666 50%, #4dff4d 100%);
}

#leftBiasBtn, #rightBiasBtn {
    width: 30px;
    height: 30px;
    font-size: 14px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#leftBiasBtn {
    background: rgba(255, 100, 100, 0.8);
}

#rightBiasBtn {
    background: rgba(100, 255, 100, 0.8);
}

.roll-display {
    text-align: center;
    font-size: 10px;
    color: #4dff4d;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

/* Stats Section */
.stats-section {
    padding: 15px;
    font-size: 11px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 2px 0;
}

.stat-row.small {
    font-size: 9px;
    color: #aaa;
}

.stat-row span {
    flex: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ui-panel {
        width: calc(100vw - 40px);
        max-width: 300px;
    }
    
    .ui-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Scrollbar styling */
.ui-panel::-webkit-scrollbar {
    width: 4px;
}

.ui-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.ui-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.ui-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}