html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f5f5f5;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
}

#flatSvg {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  overflow-y: auto;
  overflow-x: auto;
}

body:not(.light-mode) #flatSvg {
  background: #f5f5f5;
}

body.flat-layout-active #c {
  display: none;
}

body.flat-layout-active #flatSvg {
  display: block;
}

#panelControls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  display: none;
  z-index: 20;
  gap: 8px;
  align-items: center;
}

body:not(.light-mode) #panelControls {
  background: rgba(0, 0, 0, 0.7);
  color: #eee;
  border: none;
}

#panelControls label {
  margin-right: 4px;
}

#moveValue {
  width: 80px;
  padding: 2px 4px;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  text-align: right;
  cursor: ns-resize;
}

body:not(.light-mode) #moveValue {
  background: #222;
  color: #eee;
  border: 1px solid #555;
}

#okButton {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #999;
  background: #e0e0e0;
  color: #333;
  cursor: pointer;
}

#okButton:hover {
  background: #d0d0d0;
}

body:not(.light-mode) #okButton {
  background: #444;
  color: #fff;
  border: 1px solid #888;
}

body:not(.light-mode) #okButton:hover {
  background: #666;
}

/* Top button cluster */
#topButtons {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 30;
  align-items: center;
}

.top-button {
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid #888;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.2;
  color: #fff;
  background: #4a90e2;
  min-width: 90px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.top-button:hover {
  filter: brightness(1.07);
}

body:not(.light-mode) .top-button {
  border: 1px solid #666;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

#flatLayoutButton {
  background: #0a9f7c;
  border-color: #0b8a6c;
}

#flatLayoutButton.active {
  background: #0a7;
  border-color: #0c9;
}

#importJsonButton {
  background: #4a6ee2;
  border-color: #365ac0;
}

#examplesButton {
  background: #f5a524;
  border-color: #d4881a;
  color: #2d1b00;
}

.examples-menu {
  position: absolute;
  z-index: 31;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  min-width: 160px;
}

.examples-menu button {
  padding: 6px 10px;
  background: #f5f5f5;
  color: #333;
  border-radius: 4px;
  border: 1px solid #ddd;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}

.examples-menu button:hover {
  background: #e0e0e0;
}

body:not(.light-mode) .examples-menu {
  background: #222;
  border: 1px solid #555;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

body:not(.light-mode) .examples-menu button {
  background: #333;
  color: #eee;
  border: 1px solid #555;
}

body:not(.light-mode) .examples-menu button:hover {
  background: #444;
}

#exportMenu {
  position: relative;
  z-index: 30;
}

#exportMenuButton {
  min-width: 110px;
}

#exportMenuButton:hover {
  background: #d0d0d0;
}

body:not(.light-mode) #exportMenuButton {
  background: #444;
  color: #fff;
  border: 1px solid #888;
}

body:not(.light-mode) #exportMenuButton:hover {
  background: #666;
}

#exportMenuList {
  display: none;
  position: absolute;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  padding: 6px;
  min-width: 170px;
  z-index: 30;
}

#exportMenuList.open {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#exportMenuList button {
  padding: 6px 10px;
  background: #f5f5f5;
  color: #333;
  border-radius: 4px;
  border: 1px solid #ddd;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}

#exportMenuList button:hover {
  background: #e0e0e0;
}

body:not(.light-mode) #exportMenuList {
  background: #222;
  border: 1px solid #555;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

body:not(.light-mode) #exportMenuList button {
  background: #333;
  color: #eee;
  border: 1px solid #555;
}

body:not(.light-mode) #exportMenuList button:hover {
  background: #444;
}

/* Design tree panel */
#designTree {
  position: absolute;
  top: 60px;
  right: 10px;
  bottom: 10px;
  width: 230px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 8px;
  color: #333;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  z-index: 15;
  overflow-y: auto;
  box-sizing: border-box;
}

#designTree .tree-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

#designTree .tree-controls button {
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  background: #4a90e2;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

#designTree .tree-controls button:hover {
  background: #3a78bf;
}

body:not(.light-mode) #designTree {
  background: rgba(0, 0, 0, 0.6);
  color: #eee;
  border: none;
}

#designTree .tree-header {
  font-weight: 600;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  padding-bottom: 4px;
}

body:not(.light-mode) #designTree .tree-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.plane-item {
  padding: 4px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.plane-item:hover {
  background: rgba(0, 0, 0, 0.1);
}

body:not(.light-mode) .plane-item {
  background: rgba(255, 255, 255, 0.05);
}

body:not(.light-mode) .plane-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

.plane-main {
  font-weight: 500;
  padding-right: 56px; /* leave room for delete button */
}

.plane-meta {
  font-size: 11px;
  opacity: 0.8;
}

.plane-item.editing {
  outline: 1px solid #ffcc66;
  background: rgba(255, 204, 102, 0.15);
}

.plane-delete {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  color: #333;
  cursor: pointer;
}

.plane-delete:hover {
  background: rgba(255, 230, 230, 0.95);
  border-color: rgba(204, 0, 0, 0.4);
  color: #a00;
}

/* Theme toggle */
#themeToggle {
  position: relative;
  top: 0;
  left: 0;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

body:not(.light-mode) #themeToggle {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border: none;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 22px;
  background: #555;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch.light {
  background: #4CAF50;
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch.light .toggle-slider {
  transform: translateX(22px);
}

/* Left sidebar */
#leftSidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  border-right: 1px solid #ddd;
  transition: transform 0.3s ease;
  z-index: 5;
  padding: 10px;
  box-sizing: border-box;
}

body:not(.light-mode) #leftSidebar {
  background: rgba(0, 0, 0, 0.3);
  border-right: none;
}

#leftSidebar.collapsed {
  transform: translateX(-280px);
}

#sidebarToggle {
  position: absolute;
  top: 10px;
  left: 280px;
  height: 60px;
  width: 24px;
  padding: 0;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #999;
  border-radius: 0 4px 4px 0;
  border-left: none;
  cursor: pointer;
  z-index: 15;
  font-size: 12px;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.3s ease;
  white-space: nowrap;
  writing-mode: vertical-rl;
}

body:not(.light-mode) #sidebarToggle {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border-color: #888;
}

#sidebarToggle:hover {
  background: rgba(255, 255, 255, 1);
}

body:not(.light-mode) #sidebarToggle:hover {
  background: rgba(0, 0, 0, 0.7);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  gap: 8px;
}

#helpButton {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: linear-gradient(135deg, #6ec6ff, #4fb3f6);
  color: #0d2b3f;
  cursor: pointer;
}

#helpButton:hover {
  background: linear-gradient(135deg, #4fb3f6, #1e88e5);
  color: #fff;
}

.sidebar-logo {
  max-height: 28px;
  width: auto;
  flex-shrink: 0;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 50;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  color: #222;
  border-radius: 10px;
  padding: 16px;
  width: min(420px, 90%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-family: system-ui, sans-serif;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
}

.modal-header button {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
}

.modal-body ul {
  padding-left: 18px;
  margin: 0;
  display: grid;
  gap: 6px;
}

body:not(.light-mode) .modal-content {
  background: #222;
  color: #f5f5f5;
}

#leftSidebar.collapsed ~ #sidebarToggle {
  left: 0;
}

#leftSidebar:not(.collapsed) ~ #sidebarToggle {
  left: 280px;
}

/* Increment control */
#incrementControl {
  position: relative;
  top: 0;
  left: 0;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

body:not(.light-mode) #incrementControl {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border: none;
}

.control-block {
  position: relative;
  top: 0;
  left: 0;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

body:not(.light-mode) .control-block {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border: none;
}

#defaultJoinerySelect {
  flex: 1;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
}

body:not(.light-mode) #defaultJoinerySelect {
  background: #222;
  color: #eee;
  border: 1px solid #555;
}

#woodSpeciesSelect {
  flex: 1;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
}

body:not(.light-mode) #woodSpeciesSelect {
  background: #222;
  color: #eee;
  border: 1px solid #555;
}

#incrementValue {
  font-weight: 600;
  width: 55px;
  flex-shrink: 0;
  text-align: right;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12px;
}

body:not(.light-mode) #incrementValue {
  background: #222;
  color: #eee;
  border: 1px solid #555;
}

/* CNC Controls */
#cncControls {
  padding: 10px;
}

#cncControls .control-group {
  position: relative;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body:not(.light-mode) #cncControls .control-group {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border: none;
}

#cncControls label {
  font-weight: 600;
  margin-bottom: 2px;
}

#cncControls input[type="number"] {
  width: 100%;
  padding: 4px 6px;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  box-sizing: border-box;
}

body:not(.light-mode) #cncControls input[type="number"] {
  background: #222;
  color: #eee;
  border: 1px solid #555;
}

#cncControls .unit {
  position: absolute;
  right: 16px;
  top: 32px;
  font-size: 11px;
  color: #999;
  pointer-events: none;
}

body:not(.light-mode) #cncControls .unit {
  color: #666;
}

/* Thickness control */
#thicknessControl {
  position: relative;
  top: 0;
  left: 0;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

body:not(.light-mode) #thicknessControl {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border: none;
}

#thicknessSlider {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

#thicknessValue {
  font-weight: 600;
  width: 55px;
  flex-shrink: 0;
  text-align: right;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12px;
}

body:not(.light-mode) #thicknessValue {
  background: #222;
  color: #eee;
  border: 1px solid #555;
}

/* Wireframe toggle button */
#wireframeToggle {
  position: relative;
  top: 0;
  left: 0;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  z-index: 10;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#wireframeToggle:hover {
  background: rgba(255, 255, 255, 1);
}

body:not(.light-mode) #wireframeToggle {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border: none;
}

body:not(.light-mode) #wireframeToggle:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* Dimensions control */
#dimensionsControl {
  position: relative;
  top: 0;
  left: 0;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  z-index: 10;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body:not(.light-mode) #dimensionsControl {
  background: rgba(0, 0, 0, 0.5);
  color: #eee;
  border: none;
}

.dimension-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dimension-row label {
  width: 15px;
  font-weight: 600;
}

.dimension-row input[type="number"] {
  font-weight: 600;
  width: 50px;
  text-align: right;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12px;
}

body:not(.light-mode) .dimension-row input[type="number"] {
  background: #222;
  color: #eee;
  border: 1px solid #555;
}

.dim-slider {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.dim-link-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
  color: #999;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.dim-link-toggle:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: #aaa;
  color: #666;
}
.dim-link-toggle.linked {
  background: rgba(74, 144, 226, 0.2);
  border-color: #4a90e2;
  color: #4a90e2;
}
.dim-link-toggle.linked:hover {
  background: rgba(74, 144, 226, 0.35);
}
body:not(.light-mode) .dim-link-toggle {
  background: rgba(255, 255, 255, 0.08);
  border-color: #555;
  color: #777;
}
body:not(.light-mode) .dim-link-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #888;
  color: #aaa;
}
body:not(.light-mode) .dim-link-toggle.linked {
  background: rgba(74, 144, 226, 0.25);
  border-color: #4a90e2;
  color: #6ab0ff;
}
body:not(.light-mode) .dim-link-toggle.linked:hover {
  background: rgba(74, 144, 226, 0.4);
}

/* Position readout tooltip */
#positionReadout {
  position: absolute;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #666;
  color: #fff;
  border-radius: 3px;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  z-index: 1000;
  display: none;
  white-space: nowrap;
}

body:not(.light-mode) #positionReadout {
  background: rgba(0, 0, 0, 0.8);
  border: none;
}

/* Panel tree items */
.panels-list {
  margin-left: 12px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.panel-item {
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  position: relative;
  transition: background 0.2s;
}

.panel-item:not(.editing):hover {
  background: rgba(0, 0, 0, 0.1);
}

body:not(.light-mode) .panel-item {
  background: rgba(255, 255, 255, 0.03);
}

body:not(.light-mode) .panel-item:not(.editing):hover {
  background: rgba(255, 255, 255, 0.15);
}

.panel-label {
  font-size: 11px;
  font-weight: 500;
  color: #0066cc;
}

body:not(.light-mode) .panel-label {
  color: #66aaff;
}

.panel-item.editing {
  outline: 1px solid #66aaff;
  background: rgba(102, 170, 255, 0.15);
}

.panel-joinery-btn {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 1px 4px;
  color: #666;
  transition: background 0.15s, color 0.15s;
}
.panel-joinery-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}
body:not(.light-mode) .panel-joinery-btn {
  border-color: rgba(255, 255, 255, 0.2);
  color: #aaa;
}
body:not(.light-mode) .panel-joinery-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ddd;
}

/* Panel editor */
.panel-editor {
  margin-top: 6px;
  margin-left: 12px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ccc;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: calc(100% - 12px);
  box-sizing: border-box;
}

body:not(.light-mode) .panel-editor {
  background: rgba(0, 0, 0, 0.6);
  border-color: #555;
}

.panel-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 4px;
  margin-bottom: 2px;
}

body:not(.light-mode) .panel-editor-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.panel-editor-title {
  font-weight: 600;
  font-size: 11px;
  flex: 1;
}

.panel-editor-info {
  font-size: 11px;
  font-style: italic;
  opacity: 0.7;
  padding: 2px 0;
}

.panel-editor-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  padding: 2px 0;
}

.panel-editor-row label {
  font-size: 10px;
  opacity: 0.8;
}

.joinery-select {
  width: 100%;
  padding: 3px 4px;
  font-size: 10px;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
}

body:not(.light-mode) .joinery-select {
  background: #222;
  color: #eee;
  border-color: #555;
}

.panel-editor-close {
  padding: 3px 8px;
  font-size: 10px;
  background: #e0e0e0;
  border: 1px solid #999;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

.panel-editor-close:hover {
  background: #d0d0d0;
}

body:not(.light-mode) .panel-editor-close {
  background: #444;
  border-color: #666;
}

body:not(.light-mode) .panel-editor-close:hover {
  background: #555;
}

/* Trimming mode */
#trimmingControl {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trim-mode-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.trim-mode-label {
  width: 80px;
  text-align: center;
}

#trimmingControl button {
  width: 100%;
}

.trim-direction-button {
  width: 100%;
  padding: 8px;
  background: linear-gradient(135deg, #ffb199 0%, #ff8a65 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.trim-direction-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
