:root {
  --bg-deep: #060810;
  --bg-panel: rgba(10, 14, 24, 0.92);
  --bg-input: rgba(20, 28, 48, 0.7);
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(245, 166, 35, 0.4);
  --text-primary: #e4e8f0;
  --text-secondary: #7a849a;
  --accent: #f5a623;
  --accent-dim: rgba(245, 166, 35, 0.15);
  --danger: #ef4444;
  --success: #22c55e;
  --disabled: rgba(255, 255, 255, 0.15);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Space Grotesk", sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
}
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}
#panel {
  width: 380px;
  min-width: 380px;
  height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(24px);
  z-index: 10;
}
#panel-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px 24px;
}
.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 20px 0 10px;
}
.section-label:first-child {
  margin-top: 0;
}
.textarea-wrap {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 8px;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.textarea-wrap.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
#svg-input {
  width: 100%;
  height: 130px;
  background: var(--bg-input);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-family: "Courier New", monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}
#svg-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}
.drop-hint {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 9px;
  color: var(--text-secondary);
  opacity: 0.5;
  pointer-events: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}
.btn-accent {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-accent:hover {
  background: #e0951a;
  border-color: #e0951a;
}
.btn-danger {
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}
.element-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition:
    border-color 0.2s,
    opacity 0.3s,
    background 0.3s;
}
.element-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}
.element-card.elem-hidden {
  opacity: 0.35;
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.1);
}
.element-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.color-dot:hover {
  transform: scale(1.2);
}
.element-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.element-desc {
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.color-input-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}
.color-input-wrap input[type="color"] {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 36px;
  height: 36px;
  border: none;
  cursor: pointer;
  background: none;
}
.toggle-btn {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s;
}
.toggle-btn.on {
  background: var(--accent);
}
.toggle-btn::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle-btn.on::after {
  transform: translateX(14px);
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.slider-label {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 90px;
  flex-shrink: 0;
}
.slider-val {
  font-size: 11px;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
  font-weight: 500;
  flex-shrink: 0;
}
input[type="range"] {
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 6px rgba(245, 166, 35, 0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-deep);
}
.bg-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
#preview-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
#placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
  transition: opacity 0.4s;
}
#placeholder.hidden {
  opacity: 0;
}
#placeholder i {
  font-size: 48px;
  color: rgba(255, 255, 255, 0.06);
}
#placeholder p {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.5;
}
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  animation: toastIn 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.toast-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.toast-info {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 166, 35, 0.25);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#stats-bar {
  padding: 8px 22px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
}
#stats-bar span {
  display: flex;
  align-items: center;
  gap: 4px;
}
#stats-bar .val {
  color: var(--accent);
  font-weight: 500;
}
.export-row {
  margin-bottom: 12px;
}
.export-row select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.export-row select:focus {
  border-color: var(--border-focus);
}
#btn-record {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 8px;
}
#btn-record.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}
#record-progress {
  margin-top: 10px;
  display: none;
}
.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}
.progress-text {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  display: block;
}
#export-res {
  flex: 1;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
#export-res:focus {
  border-color: var(--border-focus);
}
.recording-overlay {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--danger);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
  animation: toastIn 0.3s ease-out;
}
.recording-overlay.active {
  display: flex;
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: recBlink 1s infinite;
}
@keyframes recBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
@media (max-width: 860px) {
  body {
    flex-direction: column;
  }
  #panel {
    width: 100%;
    min-width: unset;
    height: 55vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  #preview-area {
    height: 45vh;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
