@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: 'PrintChar21', 'Courier New', monospace;
    color: #e0e0e0;
    overflow: hidden;
}

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

#psychicCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0a0a0a;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

#psychicCanvas.ready {
    opacity: 1;
}

/* Smooth transition for canvas elements when recentering */
#psychicCanvas * {
    transition: transform 0.3s ease-out;
}

/* UI Toggle Button */
.ui-toggle {
    position: fixed;
    top: 20px;
    left: 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);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Main UI Panel */
.ui-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: rgba(20, 20, 20, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    z-index: 999;
    transition: all 0.3s ease;
    font-size: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

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

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

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

/* Section Styling */
.section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: rgba(30, 30, 30, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

/* Action Buttons Section */
.action-buttons {
    gap: 8px;
}

.action-buttons button,
.action-buttons .auto-control {
    width: 100%;
}

.ui-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
}

.fade-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    cursor: pointer;
    white-space: nowrap;
}

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

.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);
}

/* Stats Section */
.stats {
    gap: 8px;
}

.stats div {
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.auto-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    padding: 8px 12px;
    background: rgba(50, 50, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: all 0.2s;
}

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

.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;
    white-space: nowrap;
}

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-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(100, 100, 100, 0.3);
    border-radius: 3px;
    outline: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    background: #4dff4d;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #4dff4d;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

/* Bias Control Group */
.bias-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bias-control-group label {
    font-size: 11px;
    color: #ccc;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
}

.bias-buttons-slider {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

#leftBiasBtn, #rightBiasBtn {
    width: 24px;
    height: 24px;
    font-size: 12px;
    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 {
    font-size: 12px;
    color: #4dff4d;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    white-space: nowrap;
    text-align: center;
    border: 1px solid rgba(77, 255, 77, 0.2);
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .ui-panel {
        width: 240px;
    }
    
    .ui-toggle {
        top: 10px;
        left: 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);
}