:root {
  color-scheme: light dark;
  --bg: light-dark(#f4f1ea, #151515);
  --fg: light-dark(#252525, #f2f2f2);
  --muted: light-dark(#65605a, #aaa49c);
  --panel: light-dark(rgba(255, 255, 255, 0.82), rgba(34, 34, 34, 0.86));
  --border: light-dark(rgba(31, 31, 31, 0.16), rgba(255, 255, 255, 0.14));
  --accent: light-dark(#1d6fd8, #75b7ff);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.viewer {
  position: relative;
  min-height: 62svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 10%, light-dark(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.05)), transparent 32%),
    var(--bg);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 62svh;
  touch-action: none;
}

.viewer-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.control-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(10px);
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

select,
button,
input[type="range"] {
  width: 100%;
}

select,
button {
  min-height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: light-dark(#fff, #242424);
  color: var(--fg);
  font: inherit;
}

button {
  cursor: pointer;
}

input[type="range"] {
  accent-color: var(--accent);
}

.toggle-row {
  display: grid;
  grid-template-columns: auto auto minmax(5rem, 1fr);
  gap: 0.65rem;
  align-items: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.checkbox-label input {
  accent-color: var(--accent);
}

@media (max-width: 820px) {
  .control-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toggle-row {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .viewer,
  #scene {
    min-height: 66svh;
  }

  .control-panel {
    gap: 0.65rem;
    padding: 0.65rem;
  }

  .toggle-row {
    grid-template-columns: 1fr 1fr;
  }

  .toggle-row button {
    grid-column: 1 / -1;
  }
}
