* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  border-radius: 0 !important;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #181818;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #cfcfcf;
}

#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background-color: #282828;
  border-bottom: 1px solid #323232;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  z-index: 100;
}

.top-bar-left, .top-bar-center, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.flat-btn {
  height: 26px;
  padding: 0 10px;
  background-color: #3d3d3d;
  border: 1px solid #555555;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s;
}

.flat-btn:hover {
  background-color: #4d4d4d;
  border-color: #666666;
}

.flat-btn:active {
  background-color: #2d2d2d;
}

.flat-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background-color: #2a2a2a;
  border-color: #383838;
}

.flat-btn.active {
  background-color: #4a5c78;
  border-color: #5d7599;
}

.flat-btn.highlight {
  background-color: #41553c;
  border-color: #55704f;
}

.flat-btn.highlight:hover {
  background-color: #4d6647;
}

.flat-btn.danger {
  background-color: #5c3c3c;
  border-color: #784e4e;
}

.flat-btn.danger:hover {
  background-color: #6e4747;
}

.flat-btn-small {
  height: 20px;
  padding: 0 6px;
  background-color: #3d3d3d;
  border: 1px solid #555555;
  color: #ffffff;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flat-btn-small:hover {
  background-color: #4d4d4d;
}

.flat-btn-small.danger {
  background-color: #5c3c3c;
  border-color: #784e4e;
}

.tab-btn {
  height: 40px;
  padding: 0 16px;
  background: transparent;
  border: none;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  color: #a3a3a3;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-btn:hover {
  color: #ffffff;
  background-color: #212121;
}

.tab-btn.active {
  color: #ffffff;
  background-color: #181818;
  border-left: 1px solid #323232;
  border-right: 1px solid #323232;
}

.flat-select {
  height: 26px;
  padding: 0 20px 0 6px;
  background: #2b2b2b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a3a3a3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") no-repeat right 6px center;
  background-size: 10px;
  border: 1px solid #555555;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  outline: none;
  cursor: pointer;
  appearance: none;
}

.flat-select:hover {
  background-color: #363636;
}

.flat-select.full-width {
  width: 100%;
}

.flat-divider {
  width: 1px;
  height: 18px;
  background-color: #3d3d3d;
  margin: 0 4px;
}

#main-container {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
}

.workspace {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
}

.workspace.hidden {
  display: none !important;
}

#viewport-container {
  flex-grow: 1;
  height: 100%;
  position: relative;
}

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

#right-panel {
  width: 280px;
  height: 100%;
  background-color: #212121;
  border-left: 1px solid #323232;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-section {
  padding: 12px;
  border-bottom: 1px solid #323232;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-header {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a3a3a3;
  padding-bottom: 4px;
}

.outliner-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.outliner-list-wrapper {
  background: #181818;
  border: 1px solid #323232;
  max-height: 200px;
  overflow-y: auto;
}

#outliner-list {
  list-style: none;
}

.outliner-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid #282828;
  cursor: pointer;
  font-size: 11px;
  gap: 6px;
  height: 24px;
}

.outliner-item:hover {
  background: #282828;
}

.outliner-item.selected {
  background: #384d6b;
  color: #ffffff;
}

.outliner-item-checkbox {
  appearance: none;
  width: 12px;
  height: 12px;
  border: 1px solid #555555;
  background: #2b2b2b;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.outliner-item-checkbox:checked {
  background-color: #4a5c78;
  border-color: #5d7599;
}

.outliner-item-checkbox:checked::after {
  content: "";
  display: block;
  width: 3px;
  height: 6px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translate(-0.5px, -1px);
}

.outliner-item-name {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outliner-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.outliner-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #8c8c8c;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  transition: color 0.1s;
}

.outliner-btn:hover {
  color: #ffffff;
}

.outliner-btn.delete-btn:hover {
  color: #ef4444;
}

.outliner-btn.visibility-btn.hidden-mode {
  color: #444444;
}

.prop-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prop-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

label {
  font-size: 10px;
  color: #8c8c8c;
  text-transform: uppercase;
}

.flat-input {
  width: 100%;
  height: 24px;
  padding: 0 6px;
  background: #181818;
  border: 1px solid #555555;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  outline: none;
}

.flat-input:focus {
  border-color: #7c7c7c;
}

.flat-palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.flat-swatch {
  height: 22px;
  cursor: pointer;
  border: 1px solid #323232;
  transition: border-color 0.1s;
}

.flat-swatch:hover {
  border-color: #ffffff;
}

.flat-swatch.active {
  border: 2px solid #ffffff !important;
}

.split-left {
  flex-grow: 1;
  height: 100%;
  background-color: #111111;
  position: relative;
}

.split-right {
  width: 280px;
  height: 100%;
  background-color: #212121;
  border-left: 1px solid #323232;
  display: flex;
  flex-direction: column;
}

#shape-editor-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.editor-info-box {
  background: #181818;
  border: 1px solid #323232;
  padding: 8px;
  font-size: 10px;
  color: #8c8c8c;
  line-height: 1.4;
}

.gap-row {
  flex-direction: row;
  gap: 6px;
}

#workspace-paint {
  flex-direction: column;
}

#paint-tools-overlay {
  height: 36px;
  background-color: #282828;
  border-bottom: 1px solid #323232;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 15px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-group label {
  font-size: 10px;
  color: #a3a3a3;
  margin-right: 4px;
}

.tool-group #brush-color-palette {
  display: flex;
  gap: 3px;
}

.brush-swatch {
  width: 16px;
  height: 16px;
}

.flat-range {
  appearance: none;
  height: 6px;
  background: #3d3d3d;
  outline: none;
  width: 120px;
}

.flat-range::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  background: #a3a3a3;
  cursor: pointer;
}

.flat-range::-webkit-slider-thumb:hover {
  background: #ffffff;
}

#brush-size-val {
  font-size: 11px;
  color: #ffffff;
  min-width: 36px;
}

.paint-split-container {
  flex-grow: 1;
  display: flex;
  width: 100%;
  height: calc(100% - 36px);
  background-color: #111111;
}

.paint-split-left {
  flex: 1;
  height: 100%;
  border-right: 1px solid #323232;
  display: flex;
  flex-direction: column;
}

.paint-split-right {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.split-header {
  height: 24px;
  background: #212121;
  border-bottom: 1px solid #323232;
  color: #a3a3a3;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.texture-canvas-wrapper, .texture-viewport-wrapper {
  flex-grow: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #111111;
}

#paint-2d-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #ffffff;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  cursor: crosshair;
  display: block;
}

#paint-3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.context-menu {
  position: fixed;
  z-index: 9999;
  background: #222222;
  border: 1px solid #555555;
  padding: 2px;
  min-width: 160px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

.context-menu.hidden {
  display: none;
}

.menu-item {
  width: 100%;
  background: transparent;
  border: none;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 11px;
  color: #cfcfcf;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.menu-item:hover {
  background: #3d3d3d;
  color: #ffffff;
}

.menu-item.danger {
  color: #ef4444;
}

.menu-item.danger:hover {
  background: #5c3c3c;
}

.menu-divider {
  height: 1px;
  background: #3a3a3a;
  margin: 2px 0;
}

.hidden-item {
  display: none !important;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: #181818;
}

::-webkit-scrollbar-thumb {
  background: #3d3d3d;
}

::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

.outliner-item-rename-input {
  flex-grow: 1;
  background: #111111;
  border: 1px solid #555555;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  padding: 0 4px;
  height: 20px;
  outline: none;
}

.hidden-object {
  opacity: 0.35;
}

#shape-editor-3d-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.flat-range.full-width {
  width: 100%;
}

.marquee-box {
  position: absolute;
  border: 1px dashed #6b8cba;
  background: rgba(74, 92, 120, 0.12);
  pointer-events: none;
  z-index: 10;
}
