html, body { height: 100%; margin: 0; background:#0f1115; color:#eaecef; }
#app { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; }
header {
  font: 500 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
  padding: 10px 14px; display:flex; gap:10px; align-items:center;
  background: rgba(255,255,255,0.03); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(255,255,255,0.06);
}
header code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 6px; }
canvas { display:block; width:100%; height:100%; }
.btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: inherit; padding: 6px 10px; border-radius: 10px; cursor: pointer;
}
.btn:hover { background: rgba(255,255,255,0.08); }
select {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #eaecef; padding: 6px 10px; border-radius: 10px; cursor: pointer;
  font: inherit;
}
select:hover { background: rgba(255,255,255,0.08); }
select:focus { outline: none; border-color: rgba(255,255,255,0.2); }
select option {
  background: #0f1115;
  color: #eaecef;
  padding: 8px 12px;
}
select option:hover {
  background: rgba(255,255,255,0.08);
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: rgba(15, 17, 21, 0.95);
  backdrop-filter: blur(8px);
  border-left: 1px solid rgba(255,255,255,0.1);
  display: none;
  z-index: 1000;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  font: 500 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
}

/* Dark scrollbar for modal */
.modal-scrollable::-webkit-scrollbar {
  width: 8px;
}

.modal-scrollable::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
}

.modal-scrollable::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.modal-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.modal.show {
  display: block;
  transform: translateX(0);
}

.modal-content {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-shadow: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.modal-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(15, 17, 21, 0.95);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #eaecef;
  font: inherit;
}

.modal-close {
  background: none;
  border: none;
  color: #eaecef;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover {
  background: rgba(255,255,255,0.1);
}

.bone-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  box-sizing: border-box;
}

.bone-group {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 15px;
  width: 100%;
  box-sizing: border-box;
}

.bone-category {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  margin-bottom: 15px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.bone-category-header {
  background: rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 12px 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background-color 0.2s ease;
}

.bone-category-header:hover {
  background: rgba(255,255,255,0.12);
}

.bone-category-title {
  font-weight: 600;
  color: #eaecef;
  font-size: 14px;
  margin: 0;
}

.bone-category-toggle {
  color: #888;
  font-size: 16px;
  transition: transform 0.2s ease;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bone-category.expanded .bone-category-toggle {
  transform: rotate(90deg);
}

.bone-category-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(255,255,255,0.02);
}

.bone-category.expanded .bone-category-content {
  max-height: 2000px;
}

.bone-category-bones {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bone-title {
  font-weight: 600;
  color: #eaecef;
  margin-bottom: 10px;
  font-size: 14px;
  font: inherit;
}

.bone-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.bone-control:last-child {
  margin-bottom: 0;
}

.bone-control label {
  min-width: 20px;
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  font-weight: 500;
  font: inherit;
}

.bone-control input[type="range"] {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.bone-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: #4a9eff;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #1a1a1a;
}

.bone-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #4a9eff;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #1a1a1a;
}

.bone-value {
  min-width: 50px;
  text-align: right;
  font-size: 11px;
  color: #888;
  font-family: monospace;
  font: inherit;
}

.reset-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #eaecef;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  margin-left: 8px;
}

.reset-btn:hover {
  background: rgba(255,255,255,0.1);
}

.hierarchy {
  margin-left: 15px;
}

.hierarchy .bone-group {
  margin-left: 20px;
  border-left: 2px solid rgba(255,255,255,0.1);
  padding-left: 15px;
}

/* Animation Recording Controls */
.animation-controls {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.control-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.control-row .btn {
  font-size: 12px;
  padding: 6px 10px;
  flex: 1;
  min-width: 80px;
}

.timeline-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #888;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 8px;
}

.keyframe-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
}

.keyframe-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 12px;
}

.keyframe-item:last-child {
  border-bottom: none;
}

.keyframe-time {
  color: #4a9eff;
  font-weight: 500;
}

.keyframe-delete {
  background: rgba(255,0,0,0.1);
  border: 1px solid rgba(255,0,0,0.2);
  color: #ff6b6b;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}

.keyframe-delete:hover {
  background: rgba(255,0,0,0.2);
}

.keyframe-actions {
  display: flex;
  gap: 4px;
}

.keyframe-duplicate {
  background: rgba(74, 158, 255, 0.1);
  border: 1px solid rgba(74, 158, 255, 0.2);
  color: #4a9eff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}

.keyframe-duplicate:hover {
  background: rgba(74, 158, 255, 0.2);
}

.keyframe-move {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.2);
  color: #ffc107;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  cursor: move;
}

.keyframe-move:hover {
  background: rgba(255, 193, 7, 0.2);
}

.keyframe-view {
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.2);
  color: #28a745;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}

.keyframe-view:hover {
  background: rgba(40, 167, 69, 0.2);
}

.keyframe-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.keyframe-item.drag-over {
  border-top: 2px solid #4a9eff;
}

/* Speed control slider styling */
#playbackSpeed::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: #4a9eff;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #1a1a1a;
}

#playbackSpeed::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #4a9eff;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #1a1a1a;
}

.hidden {
  display: none;
}

/* Logo overlay */
.logo-overlay {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  pointer-events: none;
}

.logo-overlay img {
  width: 250px;;
  height: auto;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.logo-overlay img:hover {
  opacity: 1;
}