* {
    box-sizing: border-box;
}
 
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #ffffff;
    padding: 0;
    height: 100vh;
    color: #1e293b;
    width: 100vw;
    overflow: hidden;
    display: flex;
}

.sidebar {
    width: 320px;
    background-color: #f8fafc;
    display: flex;
    border-right: 1px solid #e2e8f0;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    box-shadow: 4px 0 24px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 16px;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: #64748b;
    margin: 4px 0 0 0;
}

.sidebar-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.sidebar-footer {
    padding: 16px;
    background-color: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.parameter-section {
    margin-bottom: 24px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 16px;
}

.control-group {
    margin-bottom: 16px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 4px;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #2563EB;
    margin-top: -6px;
    box-shadow: 0 1px 3px rgba(0, 0 ,0, 0.3);
    cursor: pointer;
}

input[type=range].accent-green::-webkit-slider-thumb {
    background: #16A34A;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #cbd5e1;
    border-radius: 2px;
}

.toggle-section {
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.checkbox-label:hover {
    color: #2563EB;
}

.energy-panel {
    background-color: #ffffff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-top: 24px;
}

.energy-panel h3 {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px 0;
}

.graph-container {
    height: 128px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0 8px;
    border-bottom: 1px solid #cbd5e1;
    position: relative;
}

.grid-lines {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.grid-lines .line {
    width: 100%;
    height: 1px;
    background-color: #f1f5f9;
}

.bar-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    z-index: 1;
}

.bar {
    width: 100%;
    border-radius: 2px 2px 0 0;
    transition: height 0.1s ease;
}

.bar-column span {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
}

.bar-column.total-column {
    border-left: 1px solid #e2e8f0;
    padding-left: 4px;
}

.bar-green { background-color: #22c55e; }
.bar-blue { background-color: #60a5fa; }
.bar-cyan { background-color: #22d3ee; }
.bar-yellow { background-color: #eab308; }

.bold { font-weight: 700; }

.icon-blue { color: #2563EB; }
.icon-small { width: 16px; height: 16px; }

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    color: #334155;
    cursor: pointer;
    transition: background-color 0.2s;
}

.icon-btn:hover { background-color: #f8fafc; }
.btn-orange { color: #ea580c; }

.main-area {
    flex: 1;
    position: relative;
    background-color: #f8fafc;
    cursor: default;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.overlay-instruction {
    position: absolute;
    top: 16px;
    left: 16px;
    pointer-events: none;
    opacity: 0.5;
    font-size: 0.875rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cursor-grab { cursor: grab !important; }
.cursor-grabbing { cursor: grabbing !important; }