/* Random decision maker. The wheel itself comes from tool.css (.dial, .hub-spin,
   .pointer), this file adds the option colours and the options editor. */

/* The editor comes after the result on every screen, so the Spin button
   stays above the fold. Desktop keeps the wheel beside it, sticky. */
/* minmax(0, 1fr), not 1fr, so no child can widen the column past a small
   phone's screen (the hero hides overflow, so it would clip, not scroll). */
.tool-picker .wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "wheel" "controls" "result" "options"; }
@media (min-width: 900px) {
  .tool-picker .wrap {
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
    grid-template-areas:
      "copy     wheel"
      "controls wheel"
      "result   wheel"
      "options  wheel";
    grid-template-rows: auto auto auto 1fr;
  }
  .tool-picker .t-wheel { align-self: start; position: sticky; top: 96px; }
}
.t-options { grid-area: options; }

/* Four segment colours. Violet is softened so it does not read as a button. */
.seg-c0, .sw-c0, .fill-c0 { fill: var(--quaternary); background: var(--quaternary); }
.seg-c1, .sw-c1, .fill-c1 { fill: var(--secondary); background: var(--secondary); }
.seg-c2, .sw-c2, .fill-c2 { fill: var(--tertiary); background: var(--tertiary); }
.seg-c3, .sw-c3, .fill-c3 { fill: #C4B5FD; background: #C4B5FD; }
.tool-picker .seg-label { letter-spacing: 0; }

/* ---------- Options editor ---------- */

.t-options { padding: 18px 18px 16px; }
.opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.opt-head .field-label { margin: 0; }
.opt-count { font-size: 0.8rem; font-weight: 600; color: var(--muted-fg); }

.opt-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.opt { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; }
.opt-sw { flex: none; width: 14px; height: 14px; border: 1.5px solid var(--foreground); border-radius: var(--r-full); }
.opt-text {
  flex: 1 1 auto; min-width: 0; min-height: 42px; padding: 8px 12px;
  background: var(--input); color: var(--foreground);
  border: var(--bw) solid var(--input-border); border-radius: var(--r-sm);
  font: 600 1rem/1.2 var(--font-body);
}
.opt-text:focus { outline: none; border-color: var(--accent); box-shadow: 3px 3px 0 0 var(--accent); }
.opt-pct { flex: none; min-width: 3.4em; text-align: right; font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.opt-del, .w-btn {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  background: var(--card); color: var(--foreground);
  border: var(--bw) solid var(--foreground); border-radius: var(--r-full); cursor: pointer;
  transition: transform var(--t-bounce), background var(--t-bounce);
}
.opt-del .icon, .w-btn .icon { width: 15px; height: 15px; }
.opt-del:hover:not(:disabled) { background: var(--secondary); transform: rotate(-8deg); }
.w-btn { width: 28px; height: 28px; background: var(--tertiary); }
.w-btn:hover:not(:disabled) { transform: scale(1.1); }
.opt-del:disabled, .w-btn:disabled { background: var(--muted); color: var(--muted-fg); border-color: var(--input-border); cursor: not-allowed; }
.opt-weight { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.w-val { min-width: 1.7em; text-align: center; font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }
/* Narrow phones: weight controls drop to their own line under the option. */
@media (max-width: 480px) {
  .opt { flex-wrap: wrap; row-gap: 6px; }
  .opt-text { flex: 1 1 0; }
  .opt-weight { order: 5; flex-basis: 100%; padding-left: 22px; }
}

.opt-add-row { display: flex; gap: 8px; }
.opt-add-row .input { min-width: 0; }
.opt-add-row .input { min-height: 46px; }
.opt-add-row .btn { flex: none; }
.opt-tip { margin: 8px 0 0; font-size: 0.82rem; color: var(--muted-fg); }

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: var(--bw) dashed var(--border); }
.presets-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 4px; }
.preset {
  min-height: 36px; padding: 4px 14px;
  background: var(--card); color: var(--foreground);
  border: var(--bw) solid var(--foreground); border-radius: var(--r-full);
  font: 700 0.88rem/1 var(--font-body); cursor: pointer;
  transition: background var(--t-bounce), transform var(--t-bounce);
}
.preset:hover { background: var(--tertiary); transform: rotate(-2deg); }

.t-options .t-question { margin-top: 14px; }
.t-options .t-question .input { min-height: 46px; }

/* ---------- Toggles ---------- */

.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 14px 4px 6px;
  background: var(--card); border: var(--bw) solid var(--foreground); border-radius: var(--r-full);
  font-size: 0.92rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .knob { position: relative; width: 40px; height: 24px; border: var(--bw) solid var(--foreground); border-radius: var(--r-full); background: var(--muted); transition: background var(--t-bounce); }
.toggle .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border: 1.5px solid var(--foreground); border-radius: var(--r-full); background: var(--card); transition: transform var(--t-bounce); }
.toggle input:checked + .knob { background: var(--quaternary); }
.toggle input:checked + .knob::after { transform: translateX(16px); }
.toggle input:focus-visible + .knob { outline: 3px solid var(--ring); outline-offset: 2px; }

.edit-jump { display: none; }
@media (max-width: 899px) {
  .tool-picker .toggles { order: 2; justify-content: center; gap: 6px; }
  .toggle { min-height: 40px; gap: 7px; padding: 3px 11px 3px 4px; font-size: 0.84rem; }
  .toggle .knob { width: 34px; height: 22px; }
  .toggle .knob::after { width: 14px; height: 14px; }
  .toggle input:checked + .knob::after { transform: translateX(12px); }
  .edit-jump { display: inline-flex; order: 3; }
}

/* ---------- Result extras ---------- */

.verdict-sub { display: block; margin-top: 4px; font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; color: var(--muted-fg); }
.verdict strong.hl { overflow-wrap: anywhere; }
.elim-note { margin: 12px 0 0; padding: 10px 14px; border: var(--bw) dashed var(--foreground); border-radius: var(--r-md); background: var(--background); font-size: 0.95rem; line-height: 1.5; }
.elim-note .btn { margin-top: 8px; }

/* ---------- Fairness bars, one per option ---------- */

.bars-picker li { grid-template-columns: 7.5em minmax(0, 1fr) auto; }
.bars-picker .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-picker .mid { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--foreground); }
@media (max-width: 560px) {
  .bars-picker li { grid-template-columns: 5.5em minmax(0, 1fr); }
  .bars-picker .val { grid-column: 1 / -1; text-align: left; min-width: 0; margin-top: -8px; }
}
