/* =========================================================
   Random Number Generator — tool-specific styles.
   Layered on /tools/_shared/tool.css. Widget-body styles only;
   all colors reference shared tokens for dark/light theming.
   ========================================================= */

/* ---------- Range row ---------- */
.rng-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.rng-to {
  padding-bottom: 12px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.rng-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rng-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.rng-field input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.rng-field input::-webkit-outer-spin-button,
.rng-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rng-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.rng-count-field { margin-bottom: var(--space-4); }

/* ---------- Options ---------- */
.rng-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.rng-actions { margin-bottom: var(--space-4); }

/* ---------- Error ---------- */
.rng-error {
  margin: 0 0 var(--space-4);
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(220, 60, 60, 0.10);
  border: 1px solid rgba(220, 60, 60, 0.35);
  color: #B4341F;
  font-size: 13px;
  font-weight: 500;
}
:root[data-theme="dark"] .rng-error { color: #F7B0A0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rng-error { color: #F7B0A0; }
}

/* ---------- Output ---------- */
.rng-output {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  min-height: 96px;
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.rng-placeholder { color: var(--text-muted); font-size: 14px; margin: 0; }
.rng-note {
  flex-basis: 100%;
  text-align: center;
  margin: var(--space-2) 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Single number: big and centered. */
.rng-single {
  font-size: clamp(48px, 15vw, 82px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
/* Multiple numbers: chips. */
.rng-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}

/* ---------- Output tools (copy) ---------- */
.rng-output-tools {
  display: flex;
  justify-content: center;
  margin-top: var(--space-3);
}
.rng-output-tools[hidden] { display: none; }
.rng-copy {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 18px;
  cursor: pointer;
  transition: var(--transition-colors);
}
.rng-copy:hover { color: var(--text); border-color: var(--accent); }
.rng-copy.is-copied { color: var(--accent); border-color: var(--accent); }

/* ---------- History ---------- */
.rng-history-wrap {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
  margin-top: var(--space-6);
}
.rng-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}
.rng-clear {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  cursor: pointer;
  transition: var(--transition-colors);
}
.rng-clear:hover { color: var(--text); border-color: var(--accent); }
.rng-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.rng-history li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 13px;
  color: var(--text-secondary);
  padding: 5px 2px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.rng-history li:last-child { border-bottom: none; }
.rng-history .rng-h-range { color: var(--text-muted); flex-shrink: 0; }
.rng-history .rng-h-result { text-align: right; font-weight: 600; color: var(--text); word-break: break-word; }
.rng-history-empty { color: var(--text-muted); font-size: 13px; padding: 6px 2px; }
