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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a1a;
  color: #fff;
  overflow: hidden;
}

/* Setup Screen */
#setup-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.setup-container {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
}

.setup-container h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.setup-description {
  color: #888;
  font-size: 14px;
  margin-bottom: 32px;
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.input-row {
  display: flex;
  gap: 16px;
}

.input-row .input-group {
  flex: 1;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  color: #aaa;
}

.input-group input {
  padding: 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
}

.input-group input:focus {
  outline: none;
  border-color: #4a9eff;
}

.dimension-display {
  font-size: 12px;
  color: #666;
}

#start-editor {
  width: 100%;
  padding: 14px;
  background: #4a9eff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

#start-editor:hover {
  background: #3a8eef;
}

/* Editor Screen */
#toolbar {
  padding: 10px 16px;
  background: #2a2a2a;
  border-bottom: 1px solid #3a3a3a;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

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

#toolbar button {
  padding: 8px 14px;
  background: #4a9eff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

#toolbar button:hover:not(:disabled) {
  background: #3a8eef;
}

#toolbar button:disabled {
  background: #444;
  color: #777;
  cursor: not-allowed;
}

#toolbar button#reset-zoom,
#toolbar button#share-btn,
#toolbar button#load-btn,
#toolbar button#menu-btn,
#toolbar button#remove-floor {
  background: #444;
}

#toolbar button#reset-zoom:hover,
#toolbar button#share-btn:hover,
#toolbar button#load-btn:hover,
#toolbar button#menu-btn:hover,
#toolbar button#remove-floor:hover {
  background: #555;
}

#toolbar button#edit-land.active {
  background: #ff922b;
}

#toolbar button#edit-land.active:hover {
  background: #e8831f;
}

#toolbar button#add-guideline.active {
  background: #e03131;
}

#toolbar button#add-guideline.active:hover {
  background: #c92a2a;
}

#toolbar button#toggle-sun {
  background: #444;
}

#toolbar button#toggle-sun:hover {
  background: #555;
}

#toolbar button#toggle-sun.active {
  background: #ff9500;
}

#toolbar button#toggle-sun.active:hover {
  background: #e88600;
}

#toolbar button#save-land,
#toolbar button#load-land-btn,
#toolbar button#add-guideline {
  background: #444;
}

#toolbar button#save-land:hover,
#toolbar button#load-land-btn:hover,
#toolbar button#add-guideline:hover {
  background: #555;
}

.plan-name-display {
  color: #4a9eff;
  font-size: 13px;
  font-weight: 500;
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 200;
  margin-top: 4px;
}

.dropdown-content.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #3a3a3a;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: #3a3a3a;
}

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

.dropdown-item .delete-plan {
  color: #666;
  margin-left: 8px;
  font-size: 16px;
}

.dropdown-item .delete-plan:hover {
  color: #ff6b6b;
}

.dropdown-empty {
  padding: 12px;
  color: #666;
  font-size: 13px;
  text-align: center;
}

#toolbar .label {
  color: #888;
  font-size: 13px;
}

#toolbar select {
  padding: 8px 12px;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

#toolbar select:focus {
  outline: none;
  border-color: #4a9eff;
}

#toolbar #layout-land-selector {
  max-width: 150px;
}

#toolbar #selected-room {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

#toolbar #zoom-level {
  color: #888;
  font-size: 13px;
  min-width: 45px;
}

#toolbar .info {
  color: #666;
  font-size: 12px;
  margin-left: auto;
}

#canvas-wrapper {
  position: relative;
  width: 100vw;
  height: calc(100vh - 49px);
}

#container {
  width: 100%;
  height: 100%;
  background: #252525;
  cursor: grab;
}

#container:active {
  cursor: grabbing;
}

/* House Total Panel */
#house-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 220px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

#house-panel .panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid #3a3a3a;
}

#house-panel #current-plan-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

#house-panel .panel-stats {
  padding: 12px;
}

/* Room Info Panel */
#room-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 220px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

#room-panel.hidden {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #3a3a3a;
  font-size: 13px;
  font-weight: 500;
  color: #aaa;
}

.panel-header button {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.panel-header button:hover {
  color: #fff;
}

#room-floor-badge {
  background: #4a9eff;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  margin-right: 8px;
}

.panel-content {
  padding: 14px;
}

.panel-field {
  margin-bottom: 16px;
}

.panel-field label {
  display: block;
  font-size: 11px;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-field input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
}

.panel-field input[type="text"]:focus {
  outline: none;
  border-color: #4a9eff;
}

.panel-checkbox {
  margin-bottom: 12px;
}

.panel-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #aaa;
}

.panel-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #4a9eff;
}

.panel-stats {
  display: flex;
  gap: 8px;
}

.stat {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  background: #1a1a1a;
  border-radius: 6px;
  min-width: 0;
}

.stat-value {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-label {
  font-size: 11px;
  color: #666;
}

/* Setup Screen - Wide Layout */
.setup-wide {
  max-width: 800px;
}

.setup-columns {
  display: flex;
  gap: 32px;
}

.setup-section {
  flex: 1;
}

.setup-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #fff;
}

.setup-section h3 {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
}

.setup-section select {
  width: 100%;
  padding: 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.setup-section select:focus {
  outline: none;
  border-color: #4a9eff;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: #4a9eff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.btn-primary:hover {
  background: #3a8eef;
}

.saved-list {
  margin-top: 24px;
}

.list-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #1a1a1a;
}

.list-empty {
  padding: 16px;
  color: #666;
  font-size: 13px;
  text-align: center;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #3a3a3a;
  cursor: pointer;
  font-size: 14px;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: #2a2a2a;
}

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

.list-item .item-delete {
  color: #666;
  font-size: 18px;
  margin-left: 8px;
  line-height: 1;
}

.list-item .item-delete:hover {
  color: #ff6b6b;
}

/* Shortcuts Panel */
#shortcuts-panel {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(42, 42, 42, 0.95);
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 8px 12px;
  z-index: 100;
}

.shortcuts-content {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shortcut-item kbd {
  background: #1a1a1a;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 3px 7px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 11px;
  color: #ccc;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 1px 0 #555;
}

.shortcut-label {
  color: #888;
}

/* Menu links and buttons */
.list-item a.item-name {
  color: #fff;
  text-decoration: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item a.item-name:hover {
  color: #4a9eff;
}

.btn-delete {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.btn-delete:hover {
  color: #ff6b6b;
}

.empty-message {
  padding: 16px;
  color: #666;
  font-size: 13px;
  text-align: center;
}

/* Toolbar link styled as button */
#toolbar a.btn {
  padding: 8px 14px;
  background: #444;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
}

#toolbar a.btn:hover {
  background: #555;
}
