* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.container {
    background: #ffffff;
    max-width: 800px;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 24px;
}

header {
    text-align: center;
    margin-bottom: 24px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 8px;
}

header p {
    color: #666;
}

.main-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.canvas-panel {
    background: #1a1a2e;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

canvas {
    max-width: 100%;
    height: auto;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 5px solid #ccc;
}

.p-row { border-left-color: #e74c3c; }
.n-row { border-left-color: #95a5a6; }
.e-row { border-left-color: #3498db; }

.label-col strong {
    font-size: 1.1em;
    display: block;
}

.sub-label {
    font-size: 0.8em;
    color: #666;
}

.btn-col {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #e0e0e0;
    font-size: 20px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover { background: #d0d0d0; }
.btn:active { transform: scale(0.95); }

.count {
    font-size: 1.2em;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    background: #f0f2f5;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c3e50;
}

@media (min-width: 768px) {
    .main-layout {
        flex-direction: row;
    }
    .controls-panel {
        flex: 1;
        justify-content: center;
    }
    .canvas-panel {
        flex: 2;
    }
}