* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: Georgia, 'Times New Roman', Times, serif; background: #2b2418; color: #d4c5a9; }
.container { display: flex; height: 100vh; }
.toolbar { width: 300px; background: #3a3024; padding: 16px; overflow-y: auto; border-right: 2px solid #1f1a12; }
.toolbar h2 { margin-bottom: 16px; color: #c9a961; font-size: 18px; font-weight: bold; text-align: center; padding-bottom: 10px; border-bottom: 2px solid #5a4a32; letter-spacing: 1px; font-variant: small-caps; }
.tool-section { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #5a4a32; }
.tool-section h3 { margin-bottom: 8px; font-size: 13px; color: #c9a961; font-weight: bold; font-variant: small-caps; letter-spacing: 0.5px; }
.tool-btn { display: block; width: 100%; padding: 8px 10px; margin: 4px 0; background: #2b2418; border: 1px solid #5a4a32; color: #d4c5a9; cursor: pointer; font-family: Georgia, serif; font-size: 14px; text-align: left; transition: background 0.15s; }
.tool-btn:hover { background: #3d3428; border-color: #c9a961; }
.tool-btn.active { background: #4a3f32; border-color: #c9a961; color: #c9a961; }
.action-btn { display: block; width: 100%; padding: 8px; margin: 4px 0; background: #2b2418; border: 1px solid #5a4a32; color: #d4c5a9; cursor: pointer; font-family: Georgia, serif; font-size: 13px; transition: background 0.15s; }
.action-btn:hover { background: #3d3428; border-color: #c9a961; }
.action-btn.danger { border-color: #6b2e2e; color: #c9897a; }
.action-btn.danger:hover { background: #4a1f1f; }
.sides-list { margin-bottom: 8px; }
.side-item { display: flex; align-items: center; padding: 6px 8px; margin: 4px 0; background: #2b2418; border: 1px solid #5a4a32; cursor: pointer; transition: border-color 0.15s; }
.side-item:hover { border-color: #c9a961; }
.side-item.active { border-color: #c9a961; background: #3d3428; }
.side-color { width: 18px; height: 18px; margin-right: 8px; border: 1px solid #1f1a12; }
.side-name { flex: 1; font-size: 14px; }
.side-editor { background: #2b2418; padding: 10px; margin-top: 8px; border: 1px solid #5a4a32; }
.side-editor h4 { margin-bottom: 8px; color: #c9a961; font-size: 13px; font-variant: small-caps; }
.side-editor input[type="text"] { width: 100%; padding: 6px 8px; margin-bottom: 8px; background: #1f1a12; border: 1px solid #5a4a32; color: #d4c5a9; font-family: Georgia, serif; font-size: 13px; }
.side-editor input[type="text"]:focus { outline: none; border-color: #c9a961; }
.color-picker { display: flex; gap: 5px; margin-bottom: 8px; }
.color-btn { width: 28px; height: 28px; border: 2px solid #5a4a32; cursor: pointer; transition: transform 0.15s; }
.color-btn:hover { transform: scale(1.1); }
.color-btn.selected { border-color: #c9a961; }
.editor-buttons { display: flex; flex-direction: column; gap: 4px; }
.current-side { margin-top: 8px; }
.current-side label { display: block; margin-bottom: 4px; font-size: 12px; color: #b8a88a; }
.styled-select { width: 100%; padding: 6px 8px; background: #1f1a12; color: #d4c5a9; border: 1px solid #5a4a32; font-family: Georgia, serif; font-size: 13px; margin-bottom: 4px; }
.styled-select:focus { outline: none; border-color: #c9a961; }
.styled-select:disabled { opacity: 0.4; cursor: not-allowed; }
.unit-controls, .arrow-controls, .fortification-controls, .building-controls, .mark-controls, .text-controls, .terrain-controls { margin-top: 8px; padding: 8px; background: #2b2418; border: 1px solid #5a4a32; }
.unit-controls label, .arrow-controls label, .fortification-controls label, .building-controls label, .mark-controls label, .text-controls label, .terrain-controls label { display: flex; align-items: center; gap: 6px; margin: 6px 0 3px 0; font-size: 12px; color: #b8a88a; }
input[type="range"] { flex: 1; min-width: 0; accent-color: #c9a961; }
input[type="number"] { width: 52px; padding: 2px 4px; background: #1f1a12; border: 1px solid #5a4a32; color: #d4c5a9; font-family: Georgia, serif; font-size: 12px; text-align: center; }
input[type="number"]:focus { outline: none; border-color: #c9a961; }
input[type="range"]:disabled, input[type="number"]:disabled { opacity: 0.35; cursor: not-allowed; }
.rotation-display { text-align: center; margin-top: 6px; font-size: 13px; color: #c9a961; font-variant: small-caps; }
.fort-angles { margin-top: 8px; }
.fort-angle-item { display: flex; align-items: center; gap: 6px; margin: 4px 0; font-size: 11px; color: #b8a88a; }
.fort-angle-item label { flex: 0 0 auto; margin: 0; }
.fort-angle-item input[type="range"] { flex: 1; min-width: 0; }
.fort-angle-item input[type="number"] { width: 46px; }
.preview-box { margin-top: 10px; padding: 8px; background: #2b2418; border: 1px solid #5a4a32; }
.preview-box h4 { margin-bottom: 6px; color: #c9a961; font-size: 11px; text-align: center; font-variant: small-caps; }
.preview-box canvas { display: block; margin: 0 auto; background: #e8dfc5; border: 1px solid #5a4a32; }
.preview-box textarea { width: 100%; padding: 6px; background: #1f1a12; border: 1px solid #5a4a32; color: #d4c5a9; font-family: Georgia, serif; font-size: 13px; resize: vertical; margin-bottom: 8px; }
.preview-box textarea:focus { outline: none; border-color: #c9a961; }
.text-format-buttons, .text-align-buttons { display: flex; gap: 4px; margin: 6px 0; }
.format-btn, .align-btn { flex: 1; padding: 6px; background: #1f1a12; border: 1px solid #5a4a32; color: #d4c5a9; cursor: pointer; font-family: Georgia, serif; font-size: 14px; transition: all 0.15s; }
.format-btn:hover, .align-btn:hover { background: #3d3428; border-color: #c9a961; }
.format-btn.active, .align-btn.active { background: #4a3f32; border-color: #c9a961; color: #c9a961; }
.canvas-container { flex: 1; overflow: auto; background: #1f1a12; padding: 20px; display: flex; justify-content: center; align-items: center; }
#canvas-wrapper { position: relative; transform-origin: center center; }
#battle-canvas { background: #e8dfc5; border: 3px solid #3a3024; cursor: crosshair; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
#cursor-overlay { cursor: none; }
.toolbar::-webkit-scrollbar { width: 8px; }
.toolbar::-webkit-scrollbar-track { background: #2b2418; }
.toolbar::-webkit-scrollbar-thumb { background: #5a4a32; }