:root {
  --bg-primary: #0a0a0c;
  --panel-bg: rgba(18, 18, 22, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f4f4f5;
  --text-muted: #9ca3af;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--text-main);
  user-select: none;
}

#viewport-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Header Bar */
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(228, 226, 220, 0.85) 0%, rgba(228, 226, 220, 0) 100%);
  z-index: 10;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #18181b;
}

.badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.35);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.btn-header {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #18181b;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.2);
}

/* Floating Sidebar Controls */
#configurator-panel {
  position: absolute;
  top: 72px;
  right: 24px;
  width: 320px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 20px;
  z-index: 10;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}

#configurator-panel::-webkit-scrollbar {
  width: 4px;
}
#configurator-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.panel-section {
  margin-bottom: 20px;
}
.panel-section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Preset Themes Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-preset.active {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fff;
}

.preset-swatches {
  display: flex;
  gap: 3px;
}

.swatch-pip {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

/* Variant Toggle */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid var(--panel-border);
}

.segmented-option {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.segmented-option.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Color Pickers List */
.color-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.color-label {
  font-size: 0.82rem;
  color: var(--text-main);
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
}

/* Bottom Controls */
.view-controls {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-ctrl {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ctrl:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-ctrl.active {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.4);
}

/* Loading Overlay */
#loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s ease, visibility 0.4s;
}

#loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(245, 158, 11, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-bar-container {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* About Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 440px;
  background: #141418;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  font-size: 0.88rem;
  color: #d1d5db;
  line-height: 1.55;
}

.spec-table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.spec-table td {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.spec-table td:first-child {
  color: var(--text-muted);
}

.spec-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  color: #fff;
}

.modal-links {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-youtube {
  background: #dc2626;
  color: #fff;
}
.btn-youtube:hover {
  background: #b91c1c;
}

.btn-patreon {
  background: #f97316;
  color: #fff;
}
.btn-patreon:hover {
  background: #ea580c;
}
