:root {
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --neutral: #9C9C9C;
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --text-primary: #0A0A0A;
  --text-secondary: #6B6B6B;
  --border: #E8E8EC;
  --error: #EF4444;
  --font-display: "General Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-code: "JetBrains Mono", monospace;
}

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

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-group {
  display: flex;
  gap: 8px;
}

button {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms, background 120ms;
}

button:hover {
  transform: translateY(-1px);
  background: #F3F3FF;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  width: 100%;
  height: 38px;
}

button.primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

.grid-scroll {
  flex: 1;
  overflow: auto;
  background: var(--bg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-block {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 120ms;
}

.section-block.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.section-header .section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-right: auto;
}

.section-header input[type="text"] {
  width: 110px;
  padding: 4px 8px;
  font-size: 12px;
}

.section-header button {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

.section-canvas-wrap {
  padding: 16px;
  overflow-x: auto;
}

.section-canvas-wrap canvas {
  display: block;
  outline: none;
}

.section-canvas-wrap canvas:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.sidebar {
  width: 300px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

input[type="text"] {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-code);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

textarea {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-primary);
  resize: vertical;
  min-height: 100px;
  width: 100%;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.slot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}

.slot-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.slot-list li:hover {
  background: #F3F3FF;
}

.slot-list .slot-name {
  font-weight: 500;
  font-size: 13px;
}

.slot-list .slot-chars {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text-secondary);
}

.slot-list .slot-delete {
  border: none;
  background: none;
  color: var(--error);
  font-size: 12px;
  height: auto;
  padding: 2px 6px;
}

.slot-list .slot-delete:hover {
  background: transparent;
  transform: none;
  text-decoration: underline;
}

.statusbar {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 24px;
  display: flex;
  gap: 24px;
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text-secondary);
}

#status-hint {
  font-family: var(--font-body);
  margin-left: auto;
}
