/* Phone first, used at the easel: picture first, one main action per screen,
   big targets, short text (more behind "More help"). Fonts are self-hosted so
   the app works offline and tells no one else who opened it. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/inter.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 500 600; font-display: swap; src: url(fonts/fraunces.woff2) format('woff2'); }
:root {
  --bg: #1b1a17; --panel: #262420; --panel-2: #2f2c27; --field: #14130f; --line: #3a372f; --text: #f1ede4; --muted: #b3ab9c;
  --accent: #e0a64a; --on-accent: #1b1a17; --bad: #e8806b; --ok: #8fd19e;
  --r: 14px; --r-lg: 22px;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Fraunces, Georgia, "Times New Roman", serif;
  --bottom-ui: 0px; /* height of the fixed bar at the bottom (tabs or step buttons) */
}
body.tabs { --bottom-ui: calc(64px + env(safe-area-inset-bottom)); }
body.step-bar { --bottom-ui: calc(78px + env(safe-area-inset-bottom)); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--sans); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
p a, li a { text-decoration: underline; text-decoration-color: rgba(224,166,74,.45); text-underline-offset: 3px; }
#bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: baseline;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px; background: rgba(27,26,23,.94); backdrop-filter: blur(8px); }
#home { font: 600 1.25rem/1.2 var(--serif); text-decoration: none; color: var(--text); }
#crumb { color: var(--muted); font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 8px 16px 16px; padding-bottom: calc(96px + var(--bottom-ui)); max-width: 820px; margin: 0 auto; }
h1 { font: 500 1.75rem/1.15 var(--serif); letter-spacing: -.3px; margin: 4px 0 14px; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 26px 0 10px; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.warn { color: var(--bad); }
.ok { color: var(--ok); }

button, .btn { font: 500 1rem/1.2 var(--sans); min-height: 48px; padding: 10px 18px; border-radius: var(--r); border: 1px solid transparent;
  background: var(--panel-2); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; transition: transform .08s ease, background-color .15s ease, opacity .15s; -webkit-tap-highlight-color: transparent; }
button:active, .btn:active { transform: scale(.97); }
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.big, button.big { min-height: 56px; width: 100%; font-size: 1.06rem; border-radius: 16px; }
.btn.light, button.light { background: var(--text); color: var(--on-accent); font-weight: 600; }
button.danger { color: var(--bad); background: transparent; border-color: var(--line); }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); padding-inline: 6px; }
button:disabled { opacity: .45; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
input, select, textarea { font: inherit; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--field); color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
select { -webkit-appearance: none; appearance: none; padding-right: 40px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b3ab9c' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center; }
input[type=number] { width: 6.5em; }
input[type=checkbox], input[type=radio] { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; min-height: 0; padding: 0; margin: 0;
  flex: none; border: 2px solid #6b665b; background: transparent; display: inline-grid; place-items: center; cursor: pointer; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox] { border-radius: 7px; }
input[type=radio]:checked { border-color: var(--accent); }
input[type=radio]:checked::after { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ''; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2.5px 2.5px 0; transform: translate(0, -1px) rotate(45deg); }
input[type=range] { -webkit-appearance: none; appearance: none; min-height: 0; height: 32px; padding: 0; border: 0; background: transparent; width: 100%; max-width: 320px; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--text); border: 0; }
label { display: inline-flex; gap: 10px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.field > span { color: var(--muted); font-size: .9rem; font-weight: 500; }

.card { background: var(--panel); border: 1px solid transparent; border-radius: 18px; padding: 14px 16px; margin: 12px 0; }
details.card > summary { list-style: none; font-weight: 500; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: ''; margin-left: auto; width: 9px; height: 9px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
details.card[open] > summary::after { transform: rotate(-135deg); }
details.card[open] > summary { margin-bottom: 8px; }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list > li > .grow { flex: 1; min-width: 0; }

.sw { width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); flex: none; }
.sw.big { width: 64px; height: 64px; border-radius: 16px; }

/* ---------- bottom tabs (Paint · Tubes · Kit · More) ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: none; grid-template-columns: repeat(4, minmax(0, 1fr));
  height: var(--bottom-ui); padding-bottom: env(safe-area-inset-bottom); background: rgba(31,29,26,.97); border-top: 1px solid #2f2c27; }
body.tabs #tabs { display: grid; }
#tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .72rem; font-weight: 500; }
#tabs a.on { color: var(--accent); font-weight: 600; }
#tabs svg { width: 24px; height: 24px; }

/* ---------- home ---------- */
.hello { color: var(--muted); font-size: .95rem; margin: 6px 0 2px; }
.continue { display: block; background: var(--panel); border-radius: var(--r-lg); overflow: hidden; color: var(--text); text-decoration: none; margin: 4px 0 16px; }
.continue img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--panel-2); }
.continue .meta { display: flex; align-items: center; gap: 14px; padding: 14px 16px 16px; }
.continue .meta > div { flex: 1; min-width: 0; }
.continue strong { display: block; font-size: 1.06rem; }
.continue .next { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue .play { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: .78rem; color: var(--muted); }
.bar > div { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > div > div { height: 100%; background: var(--accent); border-radius: 3px; }
.thumbs { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.thumb-card { flex: none; width: 128px; display: flex; flex-direction: column; gap: 6px; color: var(--text); font-size: .85rem; text-decoration: none; }
.thumb-card img, .thumb-card .add { width: 128px; height: 96px; border-radius: 14px; object-fit: cover; background: var(--panel-2); display: block; }
.thumb-card .add { border: 1.5px dashed #4a463d; background: transparent; display: grid; place-items: center; color: var(--muted); }
.thumb-card span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 10px; }
.section-head h2 { margin: 0; }
.todo { display: flex; flex-direction: column; gap: 8px; }
.todo a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--panel); border-radius: 16px; color: var(--text); text-decoration: none; }
.todo a .n { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-size: .85rem; font-weight: 600; flex: none; }
.todo a small { display: block; color: var(--muted); }
.menu { display: flex; flex-direction: column; background: var(--panel); border-radius: 18px; overflow: hidden; margin: 10px 0; }
.menu > a, .menu > label { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); cursor: pointer; }
.menu > :last-child { border-bottom: 0; }
.menu .grow { flex: 1; }
.menu small { color: var(--muted); }
.sw.pair { display: grid; grid-template-rows: 1fr 1fr; overflow: hidden; padding: 0; }
.swatches { display: flex; flex-direction: column; gap: 8px; }
.swatch-row { display: flex; gap: 10px; align-items: center; }
.swatch-row > div, .list > li > .grow { min-width: 0; overflow-wrap: anywhere; }
.recipe { font-size: .95rem; }
.score { font-size: .8rem; padding: 1px 6px; border-radius: 6px; background: #11100e; color: var(--muted); }
.score.bad { color: var(--bad); }
.num { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: #1a55c0; color: #fff;
  align-items: center; justify-content: center; font-weight: 700; flex: none; }

.family { margin: 12px 0; }
.family h3 { font-size: .95rem; color: var(--muted); margin: 0 0 6px; text-transform: capitalize; }
.family .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { width: 58px; height: 58px; min-height: 0; border-radius: 10px; border: 2px solid transparent; padding: 0; overflow: hidden;
  display: block; background: none; }
.chip > div { height: 27px; width: 100%; } /* fixed: fr rows inside a <button> came out empty */
.chip.sel { border-color: var(--accent); }
.chip.out { box-shadow: inset 0 0 0 3px var(--bad); }

.photo-box { position: relative; display: inline-block; max-width: 100%; touch-action: manipulation; }
.photo-box img, .photo-box canvas { display: block; max-width: 100%; height: auto; }
.photo-box .mark { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 2px #000; pointer-events: none; font-size: 11px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.photo-box .mark.sheet { background: rgba(70,140,255,.6); }
.photo-box .mark.sheet.guess { background: transparent; border: 2px dashed rgba(70,140,255,.9); } /* the worked-out 4th corner */
.photo-box .mark.canvas { background: rgba(224,166,74,.75); }
.photo-box .mark.key { background: rgba(26,85,192,.85); }
.photo-box .croprect { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.55); pointer-events: none; }
.highlight { position: absolute; inset: 0; pointer-events: none; }

.stage-card .thumb { margin: 8px 0; border-radius: 6px; overflow: hidden; background: #fff; }
.stage-card ol, .stage-card ul { margin: 6px 0; padding-left: 20px; }
.stage-card .actions { display: flex; gap: 8px; margin-top: 10px; }
.stage-card .actions > * { flex: 1; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(14px + max(var(--bottom-ui), env(safe-area-inset-bottom))); padding: 14px 16px;
  border-radius: 16px; background: #34312b; box-shadow: 0 8px 24px rgba(0,0,0,.45); color: var(--text); border: 1px solid var(--line); display: none; z-index: 50; }
#toast.on { display: block; animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

.busy { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.busy::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- projector ---------- */
#proj { position: fixed; inset: 0; background: #000; z-index: 100; overflow: hidden; touch-action: none; }
#proj .stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#proj .handle { position: fixed; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  border: 2px solid #ff0; background: rgba(255,255,0,.15); touch-action: none; z-index: 3; }
#proj .handle::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: #ff0; border-radius: 50%; }
#proj .edge { position: absolute; inset: 0; outline: 2px solid #f0f; outline-offset: -2px; pointer-events: none; }
#proj .controls { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 4;
  background: rgba(30,30,30,.92); border-radius: var(--r); padding: 8px; display: flex; flex-wrap: wrap; gap: 6px 12px;
  align-items: center; font-size: 14px; color: #eee; }
#proj .controls button, #proj .controls select { min-height: 38px; padding: 4px 10px; font-size: 14px; }
#proj .title { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 8px; z-index: 4; color: #ccc; font-size: 14px;
  background: rgba(0,0,0,.6); padding: 4px 8px; border-radius: 6px; }
#proj .rotate { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; text-align: center;
  color: #fff; font-size: 20px; padding: 30px; background: #000; z-index: 10; }
#proj.idle .controls, #proj.idle .handle, #proj.idle .title { opacity: 0; pointer-events: none; }
#proj.idle .edge { display: none; }
#proj.locked .handle { display: none; }

/* ---------- guide + print ---------- */
.guide-stage { background: #fff; display: inline-block; position: relative; max-width: 100%; }
.guide-stage .keypt { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: #e0a64a; border: 2px solid #000; color: #000; font: 700 10px/14px system-ui; text-align: center; pointer-events: none; }
.ruler { font-size: .8rem; color: var(--muted); }
table.cm { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.cm td, table.cm th { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; }

@media print {
  @page { margin: 10mm; }
  :root { --bg: #fff; --panel: #fff; --text: #000; --muted: #444; --line: #bbb; }
  #bar, #toast, .no-print, button { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { border: none; padding: 0; break-inside: avoid; }
  .guide-stage { max-width: 100%; }
  .sw { border-color: #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .num, .chip, canvas, .stage { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- step by step ---------- */
.small { font-size: .85rem; }
.progress { height: 6px; border-radius: 3px; margin-top: 4px; background: var(--line); overflow: hidden; margin-bottom: 8px; }
.progress > div { height: 100%; background: var(--accent); }
.step h1 { font-size: 1.5rem; }
.step-picture { border-radius: 8px; overflow: hidden; background: #fff; margin: 8px 0; display: inline-block; max-width: 100%; }
.step-photo { display: block; width: 100%; max-width: 560px; border-radius: 8px; margin: 8px 0; }
.recipe-card .ingredients { list-style: none; padding: 0; margin: 12px 0 6px; }
.recipe-card .ingredients li { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 1.1rem; border-top: 1px solid var(--line); }
.recipe-card .parts { font-size: 1.5rem; font-weight: 700; min-width: 1.4em; text-align: right; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); flex: none; }
.step-lines { padding-left: 20px; font-size: 1.05rem; }
.step-lines li { margin: 6px 0; }
details.card summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.all-steps { padding-left: 26px; }
.all-steps li.here { font-weight: 700; }
.step-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(27,26,23,.96); backdrop-filter: blur(8px); z-index: 6; }
.step-nav > * { flex: 1; min-height: 56px; font-size: 1.06rem; border-radius: 16px; }
.step-nav > :first-child { flex: 0 0 56px; padding: 0; border: 1px solid var(--line); background: #222019; }
.step-nav > .skip { flex: 0 0 auto; padding: 0 18px; background: transparent; border: 1px solid var(--line); }
.choice { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 10px 0; }
.choice a { display: block; text-decoration: none; color: var(--text); }
.choice a strong { display: block; font-size: 1.1rem; color: var(--accent); }
@media (min-width: 560px) { .choice { grid-template-columns: 1fr 1fr; } }
@media print { .step-nav, .progress { display: none !important; } }

/* ---------- tools ---------- */
.tool-pic { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto 4px; background: #efe9dd; border-radius: 8px; }
.tool-card h2 { margin-top: 8px; }
.tool-card .tip { border-left: 3px solid var(--accent); padding-left: 10px; color: var(--muted); }
.tool-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 10px 0; }
.tool-tile { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .85rem; text-align: center; }
.tool-mini { display: block; width: 100%; min-width: 0; height: auto; background: #efe9dd; border-radius: 6px; }
.brush-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.brush-link svg { width: 72px; height: auto; background: #efe9dd; border-radius: 6px; }

/* Webcam panel for "Take a photo" on a laptop. */
.camera { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.camera video { max-width: 100%; max-height: calc(100% - 80px); }

/* Out of reach: the badge opens why, and what would fix it. */
button.score.why { min-height: 0; padding: 1px 6px; font-size: .8rem; border: 0; border-radius: 6px; background: #11100e; text-decoration: underline dotted; }
.reach-wrap { display: inline; }
.reach { display: block; margin: 6px 0; padding: 8px 10px; border-left: 3px solid var(--bad); background: var(--panel); border-radius: 0 var(--r) var(--r) 0; font-size: .95rem; }
.reach[hidden] { display: none; }
.reach .swatch-row { margin: 6px 0; }

/* My kit: tools from photos. */
.kit-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; }
.kit-photo { display: block; max-width: 100%; max-height: 40vh; margin: 0 auto 10px; border-radius: 8px; }
.kit-badge { font-size: .75rem; font-weight: 400; color: var(--bad); margin-left: 8px; }
.kit-badge.ok { color: var(--ok); }
.tool-tile .kit-badge { margin: 0; }
.tool-tile.missing { opacity: .7; }
button.tool-tile { font: inherit; color: var(--text); background: var(--panel); border: 2px solid transparent; cursor: pointer; min-height: 0; }
button.tool-tile.sel { border-color: var(--accent); }
.tool-mini.own { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; color: #1b1a17; font-size: 1.6rem; font-weight: 700; }
.kit-mini { aspect-ratio: 4 / 3; object-fit: cover; }
.brush-photo { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex: none; }
.reach-warn { border-left: 4px solid var(--bad); }
.reach-warn ul { margin: 4px 0 10px; padding-left: 20px; }
.colour-view { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0; }
.colour-view button { min-height: 36px; padding: 4px 12px; }
.buy-list { padding-left: 22px; margin: 6px 0; }
.buy-list li { margin: 6px 0; }

/* Subjects and detail steps. */
.subjects .row { gap: 6px; }
button.chip-toggle { min-height: 40px; padding: 4px 14px; border-radius: 20px; font-size: .9rem; border: 1px solid var(--line); background: #222019; }
button.chip-toggle.on { border-color: var(--accent); color: var(--accent); }
.step-photo.tappable { cursor: crosshair; }
.detail-zoom { display: block; width: 100%; height: auto; border-radius: 8px; margin: 8px 0; background: var(--panel); }
.detail-lines { list-style: none; padding: 0; margin: 10px 0; counter-reset: dl; }
.detail-lines li { margin: 10px 0; }
.detail-lines li.with-frame { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 12px; align-items: start; }
.detail-lines li p { margin: 0; font-size: 1.05rem; }
.detail-lines li.note p { color: var(--muted, #666); }
.detail-frame { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); }
@media (max-width: 420px) { .detail-lines li.with-frame { grid-template-columns: 1fr; } }
.frame-mixes { margin-top: 6px; }
.frame-mixes .swatch-row { margin: 4px 0; gap: 8px; }
.frame-mixes .swatch-row .pair, .frame-mixes .swatch-row > :first-child { transform: scale(.8); transform-origin: left center; }
.warn-card { border-color: #c98a1a; } .warn-card p { margin: 0 0 8px; }
.detail-frame { cursor: pointer; }
.finished-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.finished-pair figure { margin: 0; }
.finished-pair figcaption { font-size: .85rem; color: var(--muted, #888); text-align: center; margin-top: 4px; }
.draw-wrap { position: relative; }
.draw-wrap > img, .draw-wrap > canvas:first-child { display: block; width: 100%; }
.draw-overlay { position: absolute; left: 0; top: 0; pointer-events: none; }
.check-wrap { position: relative; touch-action: manipulation; }
.check-photo { display: block; width: 100%; border-radius: 6px; }
.check-dots { position: absolute; inset: 0; pointer-events: none; }
.check-dot { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; background: #ffd400; color: #000; font: bold 13px sans-serif; display: grid; place-items: center; box-shadow: 0 0 0 2px #000; }
.check-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.check-pair figure { margin: 0; }
.check-pair figcaption { font-size: .85rem; color: var(--muted, #888); text-align: center; margin-top: 4px; }
.check-pic { width: 100%; height: auto; display: block; border-radius: 4px; }
.check-list li { margin: 8px 0; }

/* Creative colours: one row per part of the picture */
.scheme-row { border-top: 1px solid var(--line, #444); padding: 8px 0; }
.scheme-row .row { flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch-pair { display: inline-flex; gap: 2px; }
.swatch-pair .dot, .chip-toggle .dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #0006; vertical-align: middle; }
.harmony { margin-top: 12px; }
.pending-remix { border-color: var(--accent); }
button.card.route, label.card.route { display: block; text-align: left; cursor: pointer; font: inherit; color: inherit; }
button.card.route strong, label.card.route strong { display: block; margin-bottom: 4px; }
button.card.route.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.colours-card .choice { margin: 4px 0 10px; }
[hidden] { display: none !important; }
.scheme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.scheme-card { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.scheme-preview { width: 100%; height: auto; border-radius: 6px; image-rendering: auto; }
button.scheme-card { justify-content: flex-start; align-items: stretch; }
.scheme-card .swatch-pair { display: flex; margin-top: 4px; }
.steps-card .btn { margin-top: 8px; }
.mix-guide { margin: 8px 0; }
.mix-guide summary { cursor: pointer; color: var(--accent); }
.mix-dabs { width: 100%; max-width: 420px; height: auto; display: block; margin: 8px 0 4px; }
.mix-guide ol { padding-left: 20px; margin: 6px 0; }
.mix-guide li { margin: 4px 0; }
.stroke-demo { margin: 12px 0; }
.stroke-demo canvas { width: 100%; height: auto; border-radius: 6px; display: block; }
.reach.deep { border-left-color: var(--muted); }

/* QA notes from the phone (web/qa.js) */
#qa-btn { backdrop-filter: blur(6px); position: fixed; right: 12px; bottom: calc(10px + max(var(--bottom-ui), env(safe-area-inset-bottom))); z-index: 20; min-height: 0;
  padding: 6px 10px; font-size: .8rem; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); opacity: .85; }
#qa-btn[hidden] { display: none; }
#qa-sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
#qa-sheet .qa-box { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--panel); border-radius: var(--r) var(--r) 0 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
#qa-sheet textarea { width: 100%; font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
#qa-sheet .qa-pic { display: flex; align-items: center; gap: 8px; }
#qa-sheet .qa-pic img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 4px; }

/* The way back to the lesson (app.js wayBack) and the step's stroke link */
.back-bar { display: block; margin: 0 0 12px; text-align: left; }
a.card.stroke-link { display: block; text-decoration: none; color: var(--text); }
a.card.stroke-link strong { color: var(--accent); }
.stroke-video { display: block; width: 100%; border-radius: 8px; margin: 0 0 10px; background: #000; }
.stroke-video[hidden] { display: none; }
.stroke-demo.wrong canvas { outline: 2px solid var(--bad); outline-offset: -2px; }

/* Check my mix (web/mix-check.js) */
.mix-check-box { margin: 10px 0 4px; }
.mix-check-box > summary { cursor: pointer; color: var(--accent); }
.mix-shot { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
table.proportions { border-collapse: collapse; margin: 6px 0 2px; font-size: .9rem; }
table.proportions th, table.proportions td { padding: 2px 10px 2px 0; text-align: left; }
table.proportions td:not(:first-child), table.proportions th:not(:first-child) { text-align: right; }
.save-mix input { flex: 1; min-width: 0; }
canvas.sheet-view { width: 100%; height: auto; display: block; border-radius: 8px; }

/* Edit a tube or kit item in place, under its row. */
li.edit-form { display: block; background: var(--bg); border-radius: var(--r); padding: 10px 12px; }
li.edit-form .field input:not([type=color]):not([type=number]) { width: 100%; }
/* After adding: what was added, and Add another. */
.card.added { border-left: 3px solid var(--ok); }

/* ---------- shared redesign pieces (ui.js: pageHead, roundBtn, segmented, sheet) ---------- */
.icon { display: inline-flex; flex: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.page-head h1 { margin: 0; }
.round { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: var(--panel-2); color: var(--text); border: 0; }
.round.primary { background: var(--accent); color: var(--on-accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: var(--panel); margin: 0 0 16px; }
.seg button { min-height: 40px; padding: 0 10px; border-radius: 12px; background: transparent; color: var(--muted); font-size: .92rem; }
.seg button.on { background: var(--text); color: var(--on-accent); font-weight: 600; }
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--panel); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -10px; background: var(--panel); padding: 8px 0; z-index: 1; }
.sheet-head h2 { margin: 0; font: 500 1.35rem/1.2 var(--serif); }
.sheet .round { background: var(--panel-2); }
.sheet input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=number]) { width: 100%; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
button.danger.wide { width: 100%; margin-top: 16px; }
button.danger.armed { background: var(--bad); color: #1b1a17; border-color: var(--bad); }
body.tabs #crumb { display: none; }

/* ---------- tubes and palettes ---------- */
.tube-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .tube-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tube-tile { min-height: 0; padding: 14px 8px 12px; border-radius: 18px; background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--text); position: relative; border: 2px solid transparent; }
.tube-tile .blob { width: 56px; height: 56px; border-radius: 50%; flex: none; box-shadow: inset 0 -4px 8px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.1); }
.tube-tile .nm { font-size: .84rem; line-height: 1.25; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.tube-tile .cd { font-size: .74rem; color: var(--muted); margin-top: -4px; }
.tube-tile .count { position: absolute; top: 8px; right: 8px; font-size: .7rem; background: var(--panel-2); border-radius: 10px; padding: 1px 7px; color: var(--muted); }
.tube-tile.pick.on { border-color: var(--accent); }
.tube-tile.pick.on::after { content: ''; position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b1a17' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 14px no-repeat; }
.tube-tile.pick:not(.on) .blob { opacity: .4; }
.palette-card { background: var(--panel); border-radius: 20px; padding: 16px; margin: 0 0 12px; display: block; width: 100%; text-align: left; color: var(--text); border: 0; }
.palette-card .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; }
.palette-card strong { font: 500 1.2rem/1.2 var(--serif); }
button.palette-card { flex-direction: column; align-items: stretch; }
.blobs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 2px; }
.blobs span { width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .btn { margin-top: 14px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: #3a2a1f; color: #f3c9a6; font-size: .92rem; margin: 10px 0; }
.notice .btn, .notice button { margin-top: 8px; }

/* ---------- kit and add screens ---------- */
.tool-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .tool-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tool-tile, button.tool-tile { padding: 10px 8px 12px; border-radius: 18px; background: var(--panel); border: 2px solid transparent; gap: 6px; font-size: .84rem; line-height: 1.25; }
.tool-mini { border-radius: 12px; }
.tool-tile .small { font-size: .74rem; }
.tool-card { background: transparent; padding: 0; margin: 0; }
.tool-card .tool-pic { max-width: 100%; border-radius: 16px; margin-bottom: 10px; }
.tool-card .tip { border-left: 0; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); color: var(--text); }
.kit-badge { margin: 0; }
p.kit-badge { margin: 0 0 8px; font-size: .85rem; }
.add-photo { padding: 18px 16px; }
.add-photo .row > * { flex: 1; }
.tip-more { margin-top: 12px; color: var(--muted); font-size: .92rem; }
.tip-more summary { color: var(--accent); cursor: pointer; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0 4px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
input[type=search] { width: 100%; }
.kit-photo { border-radius: 16px; }
.add-photo .row > * { white-space: nowrap; padding-inline: 10px; }

/* ---------- project page ---------- */
.photo-box.hero { display: block; width: fit-content; max-width: 100%; margin: 0 auto; border-radius: var(--r-lg); overflow: hidden; background: var(--panel-2); }
.photo-box.hero img { width: auto; max-width: 100%; max-height: 52vh; transition: opacity .2s; }
.photo-box.hero.loading img { opacity: .45; }
.stage-chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.stage-chips button { flex: none; min-height: 38px; padding: 0 14px; border-radius: 19px; font-size: .88rem; background: var(--panel); color: var(--muted); }
.stage-chips button.on { background: var(--text); color: var(--on-accent); font-weight: 600; }
.blob-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; justify-items: center; }
.paint-blob { width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 50%; border: 0; box-shadow: inset 0 -4px 8px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.12); }
.paint-blob.sel { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }
.paint-blob.out { box-shadow: inset 0 -4px 8px rgba(0,0,0,.25), 0 0 0 2px var(--bad); }
.paint-blob.out.sel { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--bad); }
.colour-detail { background: var(--panel); border-radius: 18px; padding: 14px 16px; margin: 14px 0 6px; }
.colour-detail .recipe { margin: 10px 0 4px; }
.more-help summary { color: var(--accent); cursor: pointer; min-height: 36px; display: flex; align-items: center; }
details.section > summary { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
details.section > summary small { display: block; color: var(--muted); font-weight: 400; font-size: .84rem; }
details.section .colours-card { background: transparent; padding: 0; margin: 0; }
.stage-card { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.stage-card h3 { margin: 0 0 8px; }
.project .section-head { margin-top: 22px; }
.seg-say { margin: -10px 0 4px; } .colours-card .field > .seg { margin-bottom: 14px; } .tube-chips { gap: 6px; } .chip-toggle .dot { margin-right: 4px; }

/* ---------- new painting ---------- */
.photo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 260px; padding: 24px; border-radius: var(--r-lg); border: 1.5px dashed #4a463d; color: var(--muted); margin-bottom: 14px; }
.photo-empty strong { color: var(--text); font: 500 1.3rem/1.2 var(--serif); }
.new-project .picker .row > * { flex: 1; }
.new-project .picker.again { order: 2; }
.new-project .picker.again .row > * { min-height: 40px; font-size: .9rem; background: transparent; border: 1px solid var(--line); color: var(--text); }
.new-project .picker.again { margin-bottom: 12px; }
.preview { position: relative; }
.photo-box.hero.paint { width: 100%; display: flex; justify-content: center; background: transparent; }
.quick-paint { display: block; height: auto; border-radius: var(--r-lg); image-rendering: auto; filter: blur(.6px) saturate(1.05); }
.preview-badge { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 6px 12px; border-radius: 16px; background: rgba(20,19,16,.85); font-size: .8rem; font-weight: 500; pointer-events: none; }
.preview-badge .icon { color: var(--ok); }
.overlay-seg { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; border-radius: 22px; background: rgba(20,19,16,.85); }
.overlay-seg button { min-height: 36px; padding: 0 16px; border-radius: 18px; background: transparent; color: var(--text); font-size: .88rem; }
.overlay-seg button.on { background: var(--text); color: var(--on-accent); font-weight: 600; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.fit-switch .seg { margin: 12px 0 0; }
.shift-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.shift-row input { flex: 1; max-width: none; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select { position: relative; display: inline-flex; flex-direction: column; gap: 0; padding: 6px 34px 6px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); min-height: 52px; justify-content: center; max-width: 100%; }
.chip-select .chip-label { font-size: .7rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.chip-select select { min-height: 0; padding: 0; border: 0; background: transparent; font-weight: 500; font-size: .95rem; position: static; max-width: 100%; text-overflow: ellipsis; }
.chip-select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.chip-select select:focus { outline: none; }
.chip-select:focus-within { outline: 2px solid var(--accent); }
.go-bar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); margin-top: 8px; }
.new-project .tip-more .field input { width: 100%; }

/* ---------- step by step (lean) ---------- */
body.step-bar #bar { display: none; }
.step-top { display: flex; align-items: center; gap: 12px; padding-top: calc(4px + env(safe-area-inset-top)); margin-bottom: 10px; }
.step-top .progress { flex: 1; margin: 0; }
.step-top .round { background: transparent; color: var(--text); margin-left: -10px; }
.step-kicker { margin: 4px 0 0; font-size: .78rem; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--accent); }
.step h1 { font-size: 1.65rem; margin: 2px 0 12px; }
.step-picture { border-radius: var(--r-lg); display: block; width: fit-content; margin: 0 auto 6px; }
.hl-note { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.hl-swatch { width: 14px; height: 14px; border-radius: 4px; border: 2px solid #ffd400; flex: none; }
.recipe-card.compact { background: var(--panel); border-radius: 18px; padding: 12px 14px; margin: 12px 0; }
.recipe-top { display: flex; align-items: center; gap: 12px; }
.recipe-top .sw.big { width: 52px; height: 52px; }
.parts-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.part-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 16px; background: var(--panel-2); font-size: .9rem; }
.part-chip .dot { width: 20px; height: 20px; }
.part-chip:not(:has(.dot)) { padding-left: 12px; }
.recipe-card .brush-link { margin-top: 8px; }
.step-lines { font-size: 1.05rem; line-height: 1.5; padding-left: 22px; }
.more-card summary { color: var(--text); }
.step-nav .icon { pointer-events: none; }
.guide-part { margin: 12px 0; }
.guide-part p { margin: 4px 0 0; }
.guide-steps { padding-left: 20px; }
.guide-steps li { margin: 6px 0; }
/* Art movements */
.mv-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.mv-chip { border-radius: 999px; padding: 8px 14px; background: var(--panel-2); border: 1px solid var(--line); }
.mv-chip.on { background: var(--accent); color: #1b1a17; border-color: var(--accent); }
.movement-card { background: var(--panel); border-radius: var(--r); padding: 14px 16px; margin: 8px 0 14px; }
.movement-card p { margin: 8px 0; }
.mv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mv-head strong { font-family: var(--serif); font-size: 1.15rem; }
.mv-label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); margin-bottom: 2px; }
.mv-lesson { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.mv-lesson ul { margin: 6px 0 0; padding-left: 20px; }
.movement-tip { background: var(--panel); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.movement-tip .mv-label { margin-bottom: 4px; }
.mv-painting { margin: 10px 0; }
.mv-painting img { width: 100%; border-radius: 10px; display: block; }
.mv-painting figcaption { margin-top: 6px; }
/* Mixing lab */
.lab-result { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0 10px; }
.lab-swatches { display: flex; gap: 12px; }
.lab-swatches figure { margin: 0; flex: 1; text-align: center; }
.lab-sw { height: 96px; border-radius: var(--r); border: 1px solid var(--line); }
.lab-sw.empty { background: repeating-linear-gradient(45deg, var(--panel), var(--panel) 8px, var(--panel-2) 8px, var(--panel-2) 16px) !important; }
.lab-swatches figcaption { margin-top: 4px; font-size: .85rem; color: var(--muted); }
.lab-hints { margin: 8px 0 0; padding-left: 20px; }
.lab-recipe { margin: 6px 0 12px; }
.lab-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.lab-row .dot { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.lab-row .round { width: 40px; height: 40px; font-size: 1.3rem; }
.lab-n { min-width: 1.6em; text-align: center; }
.lab-tubes { margin-top: 10px; }
.lab-photo { width: 100%; border-radius: 10px; margin-top: 8px; touch-action: manipulation; }

/* Hold a picture to compare with the one before (QA 2026-11-12) */
.compare { position: relative; -webkit-touch-callout: none; user-select: none; }
.compare img { -webkit-user-drag: none; }
.compare-tag, .compare-hint { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px; font-size: 12px; pointer-events: none;
  background: rgba(20, 18, 16, .72); color: #f1ede4; }
.compare-tag { background: var(--accent, #e3a93b); color: #1b1a17; font-weight: 600; }
.compare-hint[hidden], .compare-tag[hidden] { display: none; }
