body {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  background: #000;
  overflow: hidden;
  font-family: 'Space Mono', monospace;
  font-size: clamp(.7rem, 2vw, 13px);
  text-transform: uppercase;
  box-sizing: border-box;
}

.container {
  padding: 5vmin;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
}

/* Header */
.header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 10;
  margin-bottom: 2vh;
  flex-shrink: 0;
}

.header-left {
  color: #9aa;
}

.header-right {
  color: #9aa;
  position: absolute;
  right: 0;
}

.header-center {
  color: #fff;
  font-weight: 500;
}

/* Canvas container */
.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
  margin-top: 2vh;
  flex-shrink: 0;
}

.footer-left {
  color: #9aa;
}

.footer-right {
  color: #9aa;
}

#help {
  position: fixed;
  left: 12px;
  bottom: 12px;
  color: #9aa;
  line-height: 1.2;
  font-size: 12px;
  background: #000a;
  padding: 8px 10px;
  border-radius: 8px;
}
#help b {
  color: #cfe;
}

/* Tweakpane Custom Styling */
.tp-dfwv {
  font-family: 'Space Mono', monospace !important;
  text-transform: uppercase !important;
  font-size: clamp(.6rem, 1.5vw, 11px) !important;
  /* Position in bottom-right within 5% margin */
  position: fixed !important;
  bottom: 5vmin !important;
  right: 5vmin !important;
  top: auto !important;
  left: auto !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  max-height: 80vh !important;
  overflow-y: auto !important;
  z-index: 1000 !important;
}

.tp-rotv {
  background-color: rgba(0, 0, 0, 0.8) !important;
  border: 1px solid #333 !important;
}

.tp-lblv_l {
  color: #9aa !important;
  font-family: 'Space Mono', monospace !important;
  text-transform: uppercase !important;
  font-size: clamp(.6rem, 1.5vw, 11px) !important;
}

/* Hide only RGB text inputs, keep color swatches visible */
.tp-dfwv .tp-coltxtv,
.tp-dfwv .tp-colswv_t,
.tp-dfwv .tp-coltxtv_m,
.tp-dfwv .tp-coltxtv_ms,
.tp-dfwv .tp-colv .tp-txtv,
.tp-dfwv .tp-colv_t {
  display: none !important;
}

/* Make color chips and clickable area wider */
.tp-dfwv .tp-colswv_b {
  width: 100% !important;
  min-width: 100% !important;
  height: 24px !important;
}

/* Make the color container use full width */
.tp-dfwv .tp-colv_c {
  width: 100% !important;
}

.tp-btnv_b {
  background-color: #222 !important;
  border: 1px solid #444 !important;
  color: #9aa !important;
  font-family: 'Space Mono', monospace !important;
  text-transform: uppercase !important;
  font-size: clamp(.6rem, 1.5vw, 10px) !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  cursor: pointer !important;
  outline: none !important;
  pointer-events: auto !important;
}

.tp-btnv_b:hover {
  background-color: #333 !important;
  border-color: #666 !important;
}

.tp-btnv_b:active {
  background-color: #444 !important;
  border-color: #777 !important;
}

.tp-btnv_t {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  pointer-events: none !important;
}

/* Force all Tweakpane button children to not block clicks */
.tp-btnv_b * {
  pointer-events: none !important;
  user-select: none !important;
}

/* Ensure button wrapper allows clicks */
.tp-btnv {
  pointer-events: auto !important;
}

/* Custom Tooltip System */
.has-tooltip {
  position: relative !important;
}

.has-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 8px 12px;
  background: white;
  color: black;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  text-transform: none;
  white-space: nowrap;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  animation: tooltip-fade-in 0.2s ease-out forwards;
  pointer-events: none;
  width: 90%;
  max-width: 90%;
  white-space: normal;
  text-align: center;
}

/* Advanced Tooltip System with HTML content */
.tooltip-container {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 8px 12px;
  background: white;
  color: black;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: none;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  width: 150px;
  max-width: 150px;
  white-space: normal;
  text-align: center;
  transition: opacity 0.2s ease-out;
  line-height: 1.3;
}

.tooltip-container.visible {
  opacity: 1;
  pointer-events: auto;
}

.tooltip-container::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: white;
}

.tooltip-container a {
  color: #0066cc;
  text-decoration: underline;
  cursor: pointer;
}

.tooltip-container a:hover {
  color: #0044aa;
}

.has-tooltip:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  border: 6px solid transparent;
  border-top-color: white;
  z-index: 10000;
  opacity: 0;
  animation: tooltip-fade-in 0.2s ease-out forwards;
  pointer-events: none;
}

@keyframes tooltip-fade-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.tp-tabv_t {
  background-color: #111 !important;
  border-bottom: 1px solid #333 !important;
  color: #9aa !important;
  font-family: 'Space Mono', monospace !important;
  text-transform: uppercase !important;
  font-size: clamp(.6rem, 1.5vw, 10px) !important;
}

.tp-tabv_t.tp-tabv_t-sel {
  background-color: #222 !important;
  color: #fff !important;
}

.tp-coltxtv_t {
  font-family: 'Space Mono', monospace !important;
  font-size: clamp(.6rem, 1.5vw, 10px) !important;
}

.tp-sldv_t {
  background-color: #222 !important;
  border: 1px solid #444 !important;
}

.tp-sldv_k {
  background-color: #666 !important;
}

/* Preloader Styles */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease-in-out;
}

.preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

.preloader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.preloader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.preloader-text {
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
