html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.oled-mode {
  background: #000;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Everything except the stripe stays black: any lit pixel near the sensor is
   light the meter would pick up. */
.stage {
  position: fixed;
  inset: 0;
  background: #000;
}

.stripe {
  position: absolute;
  left: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* The bars hold the controls. The page measures them to keep the stripe in
   the space between, so the controls never overlap it. */
.bar {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
  pointer-events: none;
}

.bar > * {
  pointer-events: auto;
}

.bar-top {
  top: 0;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-bottom: 12px;
}

.bar-bottom {
  bottom: 0;
  padding-top: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.bar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.oled-button {
  width: 48px;
  height: 48px;
  font-size: 22px;
  flex-shrink: 0;
  -webkit-touch-callout: none;
}

.oled-button:focus-visible {
  outline: 2px solid var(--sundial-accent);
  outline-offset: 2px;
}

.oled-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.row-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-readout {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 6px 0 0;
  color: var(--sundial-text-muted);
}

.row-readout-number {
  min-width: 2ch;
  text-align: right;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(245, 245, 245, 0.8);
}

.row-readout-unit {
  min-width: 4ch;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.modal-lead {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--sundial-text-muted);
}

.modal-footer-note a {
  color: var(--sundial-text);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.settings-note {
  margin: 0;
  font-size: 13px;
  color: var(--sundial-text-muted);
  line-height: 1.4;
}

.settings-warning {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(204, 0, 0, 0.18);
  font-size: 12px;
  line-height: 1.4;
}

/* In-page color picker: the browser's native one is a popup the page can't close. */
button.color-swatch-picker {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

button.color-swatch-picker.selected .color-swatch-preview {
  outline: 2px solid var(--sundial-accent);
  outline-offset: 2px;
}

.color-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.sv-box {
  position: relative;
  height: 150px;
  border-radius: 10px;
  touch-action: none;
  cursor: crosshair;
  background-image:
    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
    linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
}

.sv-thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.hue-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 100%;
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.hue-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.hex-input {
  width: 110px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sundial-text);
  font-size: 14px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.text-button {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sundial-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.text-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

a.text-button {
  text-decoration: none;
}

.text-button.primary {
  background: var(--sundial-accent);
  border-color: var(--sundial-accent);
  color: #fff;
}

.text-button.primary:hover {
  opacity: 0.92;
}

.confirm-text {
  margin: 8px 0 20px;
  font-size: 14px;
  color: var(--sundial-text-muted);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-actions .text-button {
  padding: 10px 20px;
  font-size: 15px;
}
