/* css/digit.css */

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f6f9;
    overflow-y: auto;
    overflow-x: hidden;
}

#app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

#sidebar {
    width: 340px;
    flex-shrink: 0;
    box-sizing: border-box;
    background: white;
    padding: 25px;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

h2 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.2rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.instruct {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0;
    margin-bottom: 15px;
}

/* Drawing Pad */
#draw-container {
    width: 280px;
    height: 280px;
    margin: 0 auto 15px auto;
    border: 3px solid #34495e;
    border-radius: 8px;
    background: #000;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
    touch-action: none;
    /* Crucial: Prevents mobile pull-to-refresh while drawing */
}

#draw-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    border-radius: 5px;
}

/* Tool Buttons */
.tool-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.tool-btn {
    flex: 1;
    padding: 8px 5px;
    border: 2px solid #eee;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    background: #fdfefe;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.tool-btn:hover {
    background: #f4f6f7;
    color: #2c3e50;
}

.tool-btn.active {
    border-color: #3498db;
    background: #e8f4fd;
    color: #2980b9;
}

.tool-btn.danger {
    background: #fdedec;
    color: #e74c3c;
    border-color: #fadbd8;
}

.tool-btn.danger:hover {
    background: #fadbd8;
    color: #c0392b;
}

/* Action Button */
.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    background: #2ecc71;
    color: white;
    font-size: 1.1rem;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(46, 204, 113, 0.2);
    transition: all 0.2s;
}

.action-btn:hover {
    background: #27ae60;
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(1px);
}

.slider-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.95rem;
    color: #333;
    font-weight: bold;
    margin-bottom: 5px;
}

input[type=range] {
    width: 100%;
}

.hint {
    font-size: 0.8rem;
    color: #7f8c8d;
    line-height: 1.4;
    margin-top: 0;
    margin-bottom: 20px;
}

#status-box {
    padding: 18px;
    border-radius: 8px;
    background: #fdfefe;
    border: 1px solid #e5e8e8;
    border-left: 5px solid #2ecc71;
    text-align: center;
}

#status-box h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.05rem;
}

#prediction-display {
    font-family: monospace;
    font-size: 4rem;
    font-weight: bold;
    color: #2ecc71;
    margin-top: 5px;
}

/* Visualization Area */
#viz-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 15px;
    background: #e0e4e8;
    min-height: 100vh;
    box-sizing: border-box;
}

.viz-panel {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    padding: 15px;
}

.viz-panel h3 {
    margin: 0 0 15px 0;
    text-align: center;
    font-size: 1.1rem;
    color: #2c3e50;
}

.chart-panel {
    flex: 1;
    min-height: 250px;
}

#chart-container {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    position: relative;
}

.recon-panel {
    flex: 1;
    min-height: 300px;
}

#recon-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    width: 100%;
    height: 100%;
}

.recon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px;
}

.recon-label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #34495e;
    font-size: 1.2rem;
}

.recon-canvas {
    width: 84px;
    height: 84px;
    background: black;
    border: 1px solid #333;
    image-rendering: pixelated;
}

@media (max-width: 900px) {
    #app-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-height: auto;
    }

    #recon-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}