* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, sans-serif;
}

body {
  min-height: 100vh;
  background: #050505;
  color: #f5f5f5;
  overflow: hidden;
}

body.cursor-hidden,
body.cursor-hidden * {
  cursor: none !important;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #050505;
}

#app:fullscreen,
#app:-webkit-full-screen,
#app:-moz-full-screen {
  width: 100%;
  height: 100%;
}

#uiOverlay > header,
#uiOverlay > footer {
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(15, 15, 15, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
}

#uiOverlay > header {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

#uiOverlay > footer {
  margin-top: auto;
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.35);
}

h1 {
  font-size: clamp(1.4rem, 2vw, 2rem);
  margin-bottom: 0.75rem;
}

#uiOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: min(460px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: clamp(1rem, 3vw, 1.75rem);
  padding-right: clamp(1.25rem, 3vw, 2rem);
  z-index: 20;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.84), rgba(6, 6, 6, 0.75));
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  overflow-y: auto;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#uiOverlay::-webkit-scrollbar {
  width: 6px;
}

#uiOverlay::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 140, 0.35);
  border-radius: 3px;
}

#uiOverlay.ui-hidden {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.panel-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  background: linear-gradient(180deg, rgba(18, 18, 20, 0.9), rgba(12, 12, 14, 0.88));
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}

.panel {
  background: rgba(20, 20, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.panel-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  font-size: 0.9rem;
  color: #d5d5d5;
  border-radius: 0;
}

.metric-sub {
  margin-left: 0.4rem;
  font-size: 0.78em;
  color: rgba(220, 220, 220, 0.6);
}

.panel-body label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.panel-body label.disabled {
  opacity: 0.45;
}

.range-with-output {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-with-output input[type="range"] {
  flex: 1;
  height: 8px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(90deg, #3a3a3a, #555);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.range-with-output input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.range-with-output input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  border: none;
}

.range-with-output output {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  min-width: 3.5rem;
  text-align: right;
}

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4a90e2;
}

.checkbox-control .checkbox-label {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.panel-body output {
  font-variant-numeric: tabular-nums;
  color: #8ddcff;
}

.panel-body input[type="range"] {
  width: 100%;
}

.panel-body input[type="color"] {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 0.5rem;
  padding: 0;
  background: none;
  cursor: pointer;
}

.panel-body select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(40, 40, 44, 0.65);
  color: #f3f3f3;
  font-size: 0.9rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.control-group:first-of-type {
  border-top: none;
  padding-top: 0;
}

.control-group h3 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  color: rgba(255, 255, 255, 0.65);
}

.toggle {
  flex-direction: row !important;
  align-items: center;
  gap: 0.6rem !important;
}

.toggle span {
  flex: 1;
}

.panel-body.debug {
  gap: 0.3rem;
}

.panel-body.debug p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.panel-body.debug .label {
  color: #8d8d8d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.panel-body.debug .note {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: #666;
}

.file-input {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: #222;
  border-radius: 0.75rem;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.file-input input {
  display: none;
}

button,
input[type="range"] {
  appearance: none;
  border: none;
  outline: none;
}

button {
  padding: 0.5rem 1.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #2d8cf0, #6c2df0);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
}

.slider {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #bbb;
}

input[type="range"] {
  width: 150px;
  background: transparent;
}

main {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#gpuCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #050505;
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hidden {
  display: none !important;
}

#status {
  color: #888;
  font-size: 0.875rem;
}

.floating-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.75rem;
  z-index: 40;
  pointer-events: auto;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

.floating-controls button {
  padding: 0.2rem 0.5rem;
  font-size: 0.65rem;
  backdrop-filter: blur(6px);
  min-width: auto;
  background: rgba(40, 40, 40, 0.5);
  color: rgba(80, 80, 80, 0.8);
  border: 1px solid rgba(60, 60, 60, 0.3);
}

.floating-controls.auto-hidden {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}
#status {
  color: #888;
  font-size: 0.875rem;
}

.signature {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  opacity: 0.25;
  font-size: 0.6rem;
  background: rgba(0, 0,0, 0.5);
}