:root {
  --bg: #000000;
  --panel-bg: #111111;
  --panel-border: #262626;
  --text: #e8e8e8;
  --text-dim: #8a8a8a;
  --accent: #3b82f6;
  --accent-hover: #5a9bff;
  --key-bg: #1e1e1e;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  width: 100vw;
  height: 100vh;
}

#cube-area {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg);
}

#cube-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#cube-canvas:active {
  cursor: grabbing;
}

#hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

#sidebar {
  flex: 0 0 300px;
  width: 300px;
  height: 100%;
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

#sidebar h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}

.panel {
  background: #0c0c0c;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px;
}

.panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 10px 0;
  font-weight: 600;
}

.controls-list {
  list-style: none;
  margin: 0 0 14px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.key {
  display: inline-block;
  min-width: 32px;
  text-align: center;
  background: var(--key-bg);
  border: 1px solid #333;
  border-radius: 5px;
  padding: 2px 7px;
  margin-right: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text);
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-row button {
  flex: 1 1 auto;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.button-row button:hover {
  background: var(--accent-hover);
}

.button-row button:disabled {
  background: #2a2a2a;
  color: #6b6b6b;
  cursor: not-allowed;
}

#btn-reset {
  background: #2a2a2a;
}

#btn-reset:hover:not(:disabled) {
  background: #3a3a3a;
}

#status {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  min-height: 16px;
}

.history-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.history-panel h2 {
  flex: 0 0 auto;
}

#move-count {
  color: var(--text-dim);
  font-weight: 400;
}

#move-history {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 0;
  padding: 0 0 0 0;
  list-style: none;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

#move-history li {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: 5px;
  color: var(--text-dim);
}

#move-history li:first-child {
  color: var(--text);
  background: #17171a;
}

#move-history li .idx {
  color: #555;
  margin-right: 8px;
}

#move-history::-webkit-scrollbar,
#sidebar::-webkit-scrollbar {
  width: 8px;
}

#move-history::-webkit-scrollbar-thumb,
#sidebar::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 4px;
}
