/* Shared UI components: buttons, sliders, tabs, panels, toggles, dials,
   badges, toasts, modals. */

/* ------- Buttons ------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: #2e2731; border-color: #453d4a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--amber); color: #1a1206; border-color: var(--amber); font-weight: 600; }
.btn.primary:hover { background: #ffbb58; }
.btn.small { padding: 2px 8px; font-size: 0.78rem; }
.btn.icon { padding: 5px 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.danger { color: var(--bad); }

/* Segmented control */
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  background: transparent; color: var(--ink-dim); border: none;
  padding: 3px 10px; font-size: 0.78rem; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--hairline); }
.seg button.active { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ------- Chart tabs ------- */
.chart-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-dim);
  padding: 4px 12px 6px;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
}
.chart-tab:hover { color: var(--ink); background: var(--bg-raised); }
.chart-tab.active { color: var(--amber); border-bottom-color: var(--amber); font-weight: 600; }
.chart-tab.locked { color: var(--locked); cursor: default; }
.chart-tab.locked:hover { background: none; color: var(--locked); }
.chart-tab.locked::after { content: " 🔒"; font-size: 0.7em; }

/* ------- Control panel structure ------- */
.panel-section { margin-bottom: 14px; }
.panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 4px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-title::after { content: ""; flex: 1; height: 1px; background: var(--hairline-soft); }

/* ------- Sliders ------- */
.ctl-row { margin-bottom: 10px; }
.ctl-row.locked { opacity: 0.45; pointer-events: none; }
.ctl-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  margin-bottom: 1px;
}
.ctl-head label { color: var(--ink-dim); }
.ctl-head .val {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  width: 74px;
  text-align: right;
  font-size: 0.82rem;
  font-family: var(--mono);
  padding: 0 3px;
}
.ctl-head .val:hover, .ctl-head .val:focus { border-color: var(--hairline); background: var(--bg-inset); outline: none; }
.ctl-head .unit { color: var(--ink-faint); font-size: 0.72rem; margin-left: 2px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: var(--bg-inset);
  border: 1px solid var(--hairline-soft);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #1a1206;
  margin-top: -6px;
  box-shadow: 0 0 0 1px var(--hairline);
}
input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: var(--bg-inset);
  border: 1px solid var(--hairline-soft);
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #1a1206;
}
input[type="range"]:disabled::-webkit-slider-thumb { background: var(--locked); }
input[type="range"]:disabled { cursor: not-allowed; }

/* ------- Select ------- */
select {
  width: 100%;
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

/* ------- Toggles ------- */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; color: var(--ink-dim);
  padding: 3px 0;
}
.toggle-row input { accent-color: var(--amber); }

/* ------- License dial ------- */
.dial {
  position: relative;
  width: 34px; height: 34px;
  flex: none;
}
.dial svg { display: block; transform: rotate(-90deg); }
.dial .dial-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--amber);
}

/* ------- Badges & toasts ------- */
.toast-wrap {
  position: fixed;
  right: 16px; bottom: 40px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60;
}
.toast {
  background: var(--bg-raised);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 10px 16px;
  box-shadow: 0 8px 24px #000a;
  animation: toast-in 0.3s ease;
  max-width: 300px;
  font-size: 0.88rem;
}
.toast .t-title { font-weight: 700; color: var(--amber); }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } }

/* ------- Modals ------- */
.modal-scrim {
  position: fixed; inset: 0;
  background: #0c0a0ecc;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 20px 60px #000c;
  max-width: min(720px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px 26px;
}
.modal-card h2 { margin-top: 0; color: var(--amber); font-size: 1.15rem; }

/* ------- Unit splash ------- */
.unit-splash { width: min(560px, 84vw); text-align: center; }
.unit-splash .us-kicker {
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--copper);
}
.unit-splash .us-title { color: var(--amber); font-size: 1.4rem; margin: 4px 0 8px; }
.unit-splash .us-art { margin: 0 0 10px; }
.unit-splash .us-art svg { width: 100%; height: auto; display: block; }
.unit-splash .us-intro {
  text-align: left; font-size: 0.92rem; line-height: 1.55;
  margin: 0 0 14px;
}
.unit-splash .us-road-head {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
  text-align: left; margin-bottom: 4px;
}
.unit-splash .us-road { list-style: none; margin: 0 0 14px; padding: 0; text-align: left; }
.unit-splash .us-road li {
  display: flex; gap: 9px; align-items: baseline;
  padding: 4px 6px; font-size: 0.85rem;
  border-bottom: 1px dashed var(--hairline);
}
.unit-splash .us-road li:last-child { border-bottom: none; }
.unit-splash .us-icon { flex: none; }
.unit-splash .us-item-title { flex: 1; }
.unit-splash .us-item-type {
  color: var(--ink-faint); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.unit-splash .us-license { font-size: 0.82rem; color: var(--ink-dim); }

/* ------- Stars ------- */
.stars { letter-spacing: 2px; color: var(--amber); }
.stars .off { color: var(--hairline); }

/* ------- Misc ------- */
.chip {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 8px;
  border: 1px solid var(--hairline);
  border-radius: 99px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.chip.amber { border-color: var(--amber); color: var(--amber); }
.kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--bg-inset);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
}
