/* color — palette picker for the Pokrov sites. Mobile first; wider screens get two columns.
   The page chrome uses its own neutral tokens (--ui-*); the preview uses palette tokens (--p-*)
   set from app.js through the CSSOM (allowed by the strict CSP). */
:root {
  --ui-bg: #f6f4ef;
  --ui-surface: #ffffff;
  --ui-ink: #1f1f1f;
  --ui-muted: #5e5e5e;
  --ui-line: #e3e0d8;
  --ui-focus: #1f4e8c;
  --p-bg: #f4f1ea; --p-surface: #fbf9f4; --p-ink: #10262d; --p-muted: #4f666c;
  --p-accent: #073b4c; --p-accent2: #82c0c7; --p-line: #d6e0df; --p-onAccent: #f4f1ea;
  --serif: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root { --ui-bg: #121212; --ui-surface: #1b1b1b; --ui-ink: #ededed; --ui-muted: #a6a6a6; --ui-line: #2c2c2c; --ui-focus: #8fb3e0; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ui-bg);
  color: var(--ui-ink);
  font: 17px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  padding: 0 16px 40px;
  max-width: 1100px;
  margin: 0 auto;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; }
h1 { font-size: 26px; margin: 20px 0 6px; }
h2 { font-size: 21px; margin: 0 0 8px; }
.lead, .note { color: var(--ui-muted); margin: 0 0 8px; font-size: 15.5px; }
button { font: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }

/* Palette chips: all nine visible at once (wrapping), nothing hidden behind a sideways swipe */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 12px; }
.chip {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 6px 14px 6px 8px;
  border: 2px solid var(--ui-line); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-ink); cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--ui-ink); font-weight: 600; }
.chip .dots { display: flex; }
.chip .dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); margin-left: -5px; }
.chip .dot:first-child { margin-left: 0; }
.chip .heart { color: #b3261e; }

.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 2px 0 14px; }
.seg { display: flex; border: 1px solid var(--ui-line); border-radius: 12px; overflow: hidden; }
.seg-btn, .fav-btn, .primary, .link-btn {
  min-height: 48px; padding: 10px 16px; border: 0; cursor: pointer;
  background: var(--ui-surface); color: var(--ui-ink);
}
.seg-btn[aria-pressed="true"] { background: var(--ui-ink); color: var(--ui-bg); }
.fav-btn { border: 1px solid var(--ui-line); border-radius: 12px; }
.fav-btn[aria-pressed="true"] { border-color: #b3261e; color: #b3261e; font-weight: 600; }
.primary { background: var(--ui-ink); color: var(--ui-bg); border-radius: 12px; font-weight: 600; width: 100%; }
.link-btn { background: transparent; text-decoration: underline; padding-left: 0; }

section { margin: 0 0 22px; }
.about h2 { margin-bottom: 4px; }

/* Preview — painted only with palette tokens */
.preview {
  background: var(--p-bg); color: var(--p-ink);
  border: 1px solid var(--ui-line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
}
.pv-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--p-accent); color: var(--p-onAccent);
}
.pv-logo { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.pv-menu { font-size: 22px; }
.pv-hero { text-align: center; padding: 28px 18px 22px; }
.pv-cross { width: 56px; height: auto; fill: var(--p-accent); }
.pv-title { font-size: 24px; margin: 16px auto 0; max-width: 18ch; }
.pv-rule { width: 56px; height: 3px; border-radius: 2px; background: var(--p-accent2); margin: 16px auto; }
.pv-text { color: var(--p-muted); margin: 0 auto 18px; max-width: 32ch; }
.pv-btn {
  display: inline-block; padding: 12px 20px; border-radius: 10px;
  background: var(--p-accent); color: var(--p-onAccent); font-weight: 600;
}
.pv-card {
  margin: 0 14px 16px; padding: 14px; border-radius: 12px;
  background: var(--p-surface); border: 1px solid var(--p-line);
}
.pv-card-title { font-family: var(--serif); font-weight: 600; font-size: 18px; margin-bottom: 8px; }
.pv-row { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--p-line); }
.pv-row:first-of-type { border-top: 0; }
.pv-day { font-weight: 700; color: var(--p-accent); min-width: 2ch; }
/* Wednesday/Friday: marked by a frame, not by colour alone (father Leonid's request) */
.pv-fast { outline: 2px solid var(--p-ink); outline-offset: -2px; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.pv-fast em { color: var(--p-muted); font-style: italic; }
.pv-foot { text-align: center; color: var(--p-muted); font-style: italic; padding: 4px 16px 20px; margin: 0; }

/* Contrast list */
.contrast { list-style: none; padding: 0; margin: 0 0 8px; }
.contrast li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--ui-line); border-radius: 10px; margin-bottom: 6px;
  background: var(--ui-surface);
}
.badge { font-weight: 700; white-space: nowrap; }
.badge.ok { color: #1b7a3a; }
.badge.mid { color: #9a6700; }
.badge.bad { color: #b3261e; }

/* Own choice: what to change + tap-to-pick swatches + saved pairs */
.target { margin: 6px 0 12px; width: 100%; }
.target .seg-btn { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; font-size: 15px; }
.tgt-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); flex: 0 0 auto; }
.grid-sw { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.gsw {
  aspect-ratio: 1 / 1; min-height: 44px; border-radius: 10px; cursor: pointer;
  border: 2px solid rgba(0,0,0,.12);
}
.gsw[aria-pressed="true"] { border: 3px solid var(--ui-ink); box-shadow: 0 0 0 2px var(--ui-bg) inset; }
.row-btns { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 4px 0 10px; }
.sub { font-size: 18px; margin: 14px 0 8px; }
.pairs { list-style: none; padding: 0; margin: 0 0 6px; }
.pairs li {
  display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 6px;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface);
}
.pair-show { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; min-height: 44px; border: 0; background: transparent; color: var(--ui-ink); cursor: pointer; text-align: left; padding: 0; }
.pair-prev { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); }
.pair-prev i { display: block; width: 22px; height: 22px; border-radius: 6px; }
.pair-del { min-width: 44px; min-height: 44px; border: 1px solid var(--ui-line); border-radius: 10px; background: transparent; color: var(--ui-ink); cursor: pointer; }
.pick { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.pick input { width: 64px; height: 44px; border: 1px solid var(--ui-line); border-radius: 8px; padding: 2px; background: var(--ui-surface); }

.sw-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sw-list li { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); font-size: 14px; }
.sw { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(0,0,0,.15); flex: 0 0 auto; }
.sw-list code { font-size: 13px; color: var(--ui-muted); }

.foot { color: var(--ui-muted); font-size: 13px; text-align: center; margin-top: 8px; }

/* Wider screens: preview on the left, controls on the right */
@media (min-width: 900px) {
  body { display: grid; grid-template-columns: 1.1fr 1fr; column-gap: 32px; }
  .top, .chips, .bar, .about, .foot { grid-column: 1 / -1; }
  .preview { grid-column: 1; grid-row: span 4; align-self: start; position: sticky; top: 16px; }
  .check, .custom, .swatches, .send { grid-column: 2; }
  .primary { width: auto; }
}
