/* The settings drawer: Display settings and Help. */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: 400px; max-width: 92vw;
  display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel);
  transform: translateX(105%); transition: transform .25s;
}
.drawer.on { transform: none; box-shadow: -20px 0 40px rgba(0, 0, 0, .4); }
.drawer-head { padding: calc(16px + var(--safe-top)) 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-title-row { display: flex; align-items: center; justify-content: space-between; }
.drawer-title-row h2 { margin: 0; font-size: 18px; font-weight: 650; }
.drawer-tabs { display: flex; gap: 6px; margin-top: 14px; }
.drawer-tabs button { flex: 1; padding: 7px 0; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
.drawer-tabs button.on { border-color: var(--line-focus); background: var(--panel-3); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px calc(30px + var(--safe-bottom)); }
.drawer-body #settings-rerun { margin-bottom: 18px; }

.setting { margin-bottom: 16px; }
.setting > label,
.setting-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.setting > label b { color: var(--text); font-weight: 600; }
.note { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* Colour scheme swatches, used here and in setup. JS paints each one in its own colours. */
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 8px; margin-bottom: 26px; }
.swatch {
  position: relative; height: 56px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 2px solid var(--line); border-radius: 10px; background: var(--panel-2); font: 700 20px Arial, sans-serif;
}
.swatch.on { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.swatch small { position: absolute; left: -4px; right: -4px; bottom: -18px; text-align: center; font: 500 10.5px var(--ui); color: var(--muted); white-space: nowrap; }

.custom-colours { display: flex; gap: 12px; margin-top: 4px; }
.custom-colours label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.custom-colours input[type=color] { width: 100%; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.switch-row small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.switch { position: relative; flex: 0 0 auto; width: 42px; height: 24px; margin-left: 10px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 20px; background: #3A4A4E; transition: .2s; }
.switch i::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--amber); }
.switch input:checked + i::before { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--amber); outline-offset: 2px; }

.help h3 { margin: 18px 0 8px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.help h3:first-child { margin-top: 0; }
.help p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.help table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.help td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.help td:first-child { width: 44%; padding-right: 10px; color: var(--muted); }
.help code { padding: 1px 6px; border-radius: 5px; background: var(--panel-2); color: var(--amber); font-size: 12.5px; }

/* ---------- narrow screens: the drawer becomes a full-screen sheet ---------- */
@media (max-width: 640px) {
  .drawer { width: 100vw; max-width: none; border-left: 0; }
  .drawer-head,
  .drawer-body { padding-left: max(16px, var(--safe-left)); padding-right: max(16px, var(--safe-right)); }
}
