* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
}

/* 左侧面板 - 3D 魔方 */
.panel-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2a2a4a;
  min-width: 0;
}

.panel-header {
  padding: 12px 16px;
  background: #16162a;
  border-bottom: 1px solid #2a2a4a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: #aaa;
  flex-shrink: 0;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
}

.btn-view {
  padding: 4px 10px;
  border: 1px solid #3a3a5a;
  background: #1e1e3a;
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s;
}

.btn-view:hover {
  background: #2a2a50;
  border-color: #5a5a8a;
}

.btn-input {
  padding: 4px 10px;
  border: none;
  background: #3a5a8a;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}

.btn-input:hover {
  background: #4a6a9a;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #888;
}

.speed-control input[type="range"] {
  width: 100px;
  accent-color: #40916c;
}

#anim-speed-label {
  min-width: 42px;
  color: #aaa;
  font-variant-numeric: tabular-nums;
}

.orientation-info {
  font-size: 12px;
  color: #888;
  flex-shrink: 0;
}

#cube-container {
  flex: 1;
  position: relative;
}

.legend {
  padding: 10px 16px;
  background: #16162a;
  border-top: 1px solid #2a2a4a;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.op-panel {
  padding: 10px 16px;
  background: #12122a;
  border-top: 1px solid #2a2a4a;
}

.op-panel h3 {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.op-grid {
  display: grid;
  grid-template-columns: 36px 40px 40px 40px 36px;
  grid-template-rows: repeat(5, 32px);
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.op-spacer {
  grid-column: span 3;
}

.op-btn {
  width: 40px;
  height: 32px;
  border: 1px solid #3a3a5a;
  background: #1e1e3a;
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}

.op-btn:hover {
  background: #2a2a50;
  border-color: #5a5a8a;
}

.op-btn.side {
  width: 36px;
  background: #1a1a32;
  color: #999;
}

.op-btn:active {
  background: #3a3a6a;
}

/* 右侧面板 - 代码编辑器 */
.panel-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.toolbar {
  padding: 8px 12px;
  background: #16162a;
  border-bottom: 1px solid #2a2a4a;
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

.btn-run {
  background: #2d6a4f;
  color: #fff;
}

.btn-run:hover {
  background: #40916c;
}

.btn-reset {
  background: #3a3a5a;
  color: #ccc;
}

.btn-reset:hover {
  background: #4a4a6a;
}

.toolbar-hint {
  margin-left: auto;
  font-size: 11px;
  color: #666;
}

.editor-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

#line-numbers {
  width: 40px;
  padding: 12px 6px;
  background: #12122a;
  color: #555;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
  overflow: hidden;
  user-select: none;
  border-right: 1px solid #2a2a4a;
  white-space: pre;
}

#code-editor {
  flex: 1;
  padding: 12px;
  background: #0f0f1a;
  color: #d4d4d4;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
  tab-size: 2;
}

.output-panel {
  height: 160px;
  border-top: 1px solid #2a2a4a;
  display: flex;
  flex-direction: column;
}

.output-header {
  padding: 6px 12px;
  background: #16162a;
  font-size: 12px;
  color: #888;
  border-bottom: 1px solid #2a2a4a;
}

#output {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  line-height: 1.6;
}

.output-line {
  padding: 1px 0;
}

.output-log {
  color: #d4d4d4;
}

.output-error {
  color: #f48771;
}

.output-info {
  color: #888;
}

/* API 参考 */
.api-ref {
  padding: 8px 12px;
  background: #12122a;
  border-top: 1px solid #2a2a4a;
  font-size: 11px;
  color: #666;
  line-height: 1.7;
  max-height: 100px;
  overflow-y: auto;
}

.api-ref code {
  color: #9cdcfe;
  background: #1a1a30;
  padding: 1px 4px;
  border-radius: 2px;
}
