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

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: #1e1e1e;
  color: #cccccc;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 50px;
  padding: 0 1rem;
  background: #2d2d30;
  border-bottom: 1px solid #3e3e42;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #569cd6;
  font-size: 0.95rem;
  font-weight: 600;
}

.logo svg {
  width: 20px;
  height: 20px;
}

.controls {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  background: transparent;
  border: 1px solid #3e3e42;
  border-radius: 4px;
  color: #cccccc;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  background: #3e3e42;
  border-color: #569cd6;
}

button svg {
  width: 14px;
  height: 14px;
}

button.play-btn {
  border-color: #4ec9b0;
  color: #4ec9b0;
}

button.play-btn:hover {
  background: rgba(78, 201, 176, 0.1);
}

button.stop-btn {
  border-color: #f48771;
  color: #f48771;
}

button.stop-btn:hover {
  background: rgba(244, 135, 113, 0.1);
}

.timeline {
  position: relative;
  height: 35px;
  overflow: hidden;
  background: #252526;
  border-bottom: 1px solid #3e3e42;
  cursor: pointer;
  user-select: none;
}

.timeline-ruler {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 2px;
  height: 100%;
  background: #4ec9b0;
  box-shadow: 0 0 8px rgba(78, 201, 176, 0.6);
  pointer-events: none;
}

.timeline-sections {
  position: relative;
  display: flex;
  height: 100%;
}

.timeline-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid #3e3e42;
  transition: background 0.2s;
}

.timeline-section:hover {
  background: rgba(86, 156, 214, 0.1);
}

.timeline-section-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #569cd6;
  opacity: 0.05;
}

.timeline-section-label {
  z-index: 2;
  color: #569cd6;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
}

.timeline-section-beats {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  color: #999;
  font-size: 0.65rem;
  pointer-events: none;
}

.timeline-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: #6a6a6a;
  font-size: 0.75rem;
}

.editor-container {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.status-bar {
  display: none;
  padding: 0.5rem 1rem;
  background: #007acc;
  color: white;
  font-size: 0.85rem;
}

.status-bar.visible {
  display: block;
}

.error-bar {
  display: none;
  padding: 0.5rem 1rem;
  background: #f48771;
  color: white;
  font-size: 0.85rem;
}

.error-bar.visible {
  display: block;
}

textarea {
  flex: 1;
  padding: 1.5rem;
  background: #1e1e1e;
  border: none;
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  resize: none;
}

textarea:focus {
  outline: none;
}

textarea::placeholder {
  color: #6a6a6a;
}

textarea::selection {
  background: #264f78;
}

textarea::-webkit-scrollbar {
  width: 14px;
}

textarea::-webkit-scrollbar-track {
  background: #1e1e1e;
}

textarea::-webkit-scrollbar-thumb {
  background: #424242;
  border: 3px solid #1e1e1e;
  border-radius: 10px;
}

textarea::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

.side-panel {
  position: fixed;
  top: 85px;
  right: -400px;
  bottom: 0;
  z-index: 100;
  width: 400px;
  padding: 1.5rem;
  overflow-y: auto;
  background: #252526;
  border-left: 1px solid #3e3e42;
  transition: right 0.3s;
}

.side-panel.open {
  right: 0;
}

.side-panel::-webkit-scrollbar {
  width: 10px;
}

.side-panel::-webkit-scrollbar-track {
  background: #252526;
}

.side-panel::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 5px;
}

.side-panel::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

.side-panel h3 {
  margin-top: 1rem;
  margin-bottom: 1rem;
  color: #569cd6;
  font-size: 0.95rem;
}

.side-panel h4 {
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  color: #4ec9b0;
  font-size: 0.85rem;
}

.side-panel p {
  margin-bottom: 0.5rem;
  color: #cccccc;
  font-size: 0.85rem;
  line-height: 1.6;
}

.side-panel code {
  padding: 0.2rem 0.4rem;
  background: #1e1e1e;
  border-radius: 3px;
  color: #ce9178;
  font-family: 'Consolas', monospace;
  font-size: 0.8rem;
}

.side-panel .note-text {
  margin-bottom: 0.75rem;
  color: #999;
  font-size: 0.8rem;
}

.example-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.example-item {
  padding: 0.75rem;
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.example-item:hover {
  background: #2d2d30;
  border-color: #569cd6;
}

.example-name {
  margin-bottom: 0.25rem;
  color: #4ec9b0;
  font-size: 0.9rem;
  font-weight: 600;
}

.example-desc {
  color: #999;
  font-size: 0.8rem;
}

.code-list {
  max-height: 300px;
  padding: 0.75rem;
  overflow-y: auto;
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 4px;
}

.code-list p {
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.code-list::-webkit-scrollbar {
  width: 14px;
}

.code-list::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.code-list::-webkit-scrollbar-thumb {
  background: #424242;
  border: 3px solid #1e1e1e;
  border-radius: 10px;
}

.code-list::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

.midi-num {
  color: #6a6a6a;
  font-size: 0.75rem;
}

.field-label {
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.4rem;
  color: #999;
  font-size: 0.8rem;
}

.text-input {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 4px;
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.text-input:focus {
  border-color: #569cd6;
  outline: none;
}

.save-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.save-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.75rem;
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.save-option:hover {
  background: #2d2d30;
  border-color: #569cd6;
}

.save-option.busy {
  opacity: 0.5;
  pointer-events: none;
}

.save-name {
  color: #4ec9b0;
  font-size: 0.9rem;
  font-weight: 600;
}

.save-desc {
  color: #999;
  font-size: 0.8rem;
}