/* =============================================================================
   controls.css: Per-torch control rows, the shared button system, the hidden
   duration select, the timer row, and the variance stepper.
   ============================================================================= */

/* Controls */
/*----------*/

.torch-controls,
.torch-controls-secondary {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.torch-controls-mode,
.torch-controls-remove {
  display: flex;
  justify-content: center;
  width: 100%;
}
.torch-controls-secondary button {
  font-size: 0.9375rem;
  padding: 0.45rem 0.95rem;
}
.torch-controls-mode button {
  font-size: 0.875rem;
  padding: 0.4rem 0.9rem;
}
.torch-unit.rounds-mode .torch-controls-secondary button {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}
#stage.viewer-mode .btn-add-torch-unit,
#stage.viewer-mode .torch-controls,
#stage.viewer-mode .torch-controls-secondary,
#stage.viewer-mode .torch-controls-mode,
#stage.viewer-mode .torch-controls-remove {
  display: none;
}
#stage.viewer-mode .torch-unit.unlit .torch-timer-display,
#stage.viewer-mode .torch-unit.dead .torch-timer-display {
  cursor: default;
}
#stage.viewer-mode .torch-unit.unlit .torch-timer-display:hover,
#stage.viewer-mode .torch-unit.dead .torch-timer-display:hover {
  color: inherit;
}
#stage.viewer-mode .torch-unit.unlit .torch-timer-display::after,
#stage.viewer-mode .torch-unit.dead .torch-timer-display::after {
  content: none;
}

/* Buttons */
/*---------*/

button {
  cursor: pointer;
  border: 1px solid var(--rb-accent);
  background: transparent;
  color: var(--rb-accent);
  border-radius: var(--rb-radius);
  padding: 0.5rem 1rem;
  font-size: 1rem;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
button:hover:not(:disabled) {
  background: var(--rb-accent);
  color: var(--rb-bg);
  border-color: var(--rb-accent);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible {
  outline: 2px solid var(--rb-accent);
  outline-offset: 2px;
}

.btn-light {
  background: var(--rb-accent);
  border-color: var(--rb-accent);
  color: var(--rb-bg);
  font-weight: 500;
}
.btn-light:hover:not(:disabled) {
  background: var(--rb-accent-hover);
  border-color: var(--rb-accent-hover);
  color: var(--rb-bg);
}

.btn-light.btn-extinguish {
  background: none;
  border-color: #c55;
  color: #c55;
}
.btn-light.btn-extinguish:hover:not(:disabled) {
  background: #c55;
  border-color: #c55;
  color: #fff;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--rb-text-muted);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
}
.btn-remove:hover:not(:disabled) {
  color: #ff5555;
  background: none;
  border-color: transparent;
}

.btn-flame-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid var(--rb-border);
  background: #ffb43c;
  flex-shrink: 0;
}
.btn-flame-color:hover:not(:disabled) {
  border-color: var(--rb-text);
  /* background intentionally not overridden; inline style has the swatch color */
}
.btn-flame-reset {
  background: none;
  border: none;
  color: var(--rb-text-muted);
  font-size: 0.85rem;
  padding: 0;
  line-height: 1;
}
.btn-flame-reset:hover:not(:disabled) {
  color: var(--rb-text);
  background: none;
  border-color: transparent;
}
.flame-color-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Duration select */
/*-----------------*/

.duration-select {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.torch-unit.unlit .duration-select,
.torch-unit.dead .duration-select {
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: pointer;
}
#stage.viewer-mode .torch-unit.unlit .duration-select,
#stage.viewer-mode .torch-unit.dead .duration-select {
  pointer-events: none;
}

/* Torch timer row */
/*-----------------*/

.torch-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding-bottom: 6px;
}

/* Variance stepper */
/*------------------*/

.variance-stepper {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.torch-unit.unlit .variance-stepper,
.torch-unit.dead .variance-stepper {
  display: flex;
}
#stage.viewer-mode .torch-unit.unlit .variance-stepper,
#stage.viewer-mode .torch-unit.dead .variance-stepper {
  display: none;
}
.btn-variance-down,
.btn-variance-up {
  font-size: inherit;
  padding: 3px 8px;
  line-height: 1.3;
  min-width: 0;
}
.btn-variance-down:disabled,
.btn-variance-up:disabled {
  opacity: 0.25;
  cursor: default;
}
.variance-label {
  min-width: 2.5em;
  text-align: center;
  user-select: none;
}
