/* Frame Check. Golden Hour's style bible (projects/mini-panel: docs/house-ui-rules.md, app/web/style.css): dark and
   quiet by default with a light variant, amber accent, the system font at 13 px, 8 px radius, the same token names
   and button, field and segment styles. Copied here, never linked. The page itself never scrolls, only its panes. */

:root {
  --bg: #121315;
  --surface: #1a1b1e;
  --surface-2: #222327;
  --surface-3: #2a2c31;
  --line: #2c2e33;
  --line-strong: #3a3d43;
  --text: #e9eaed;
  --dim: #9b9ea6;
  --faint: #6d7078;
  --accent: #f0a23a;
  --accent-ink: #1d1304;
  --accent-soft: rgba(240, 162, 58, 0.13);
  --accent-line: rgba(240, 162, 58, 0.45);
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, 0.12);
  --warn: #f1c056;
  --warn-soft: rgba(241, 192, 86, 0.12);
  --bad: #ff6b5e;
  --bad-soft: rgba(255, 107, 94, 0.12);
  --pasteboard: #0b0b0c;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  /* Motion: the page's only durations and easings (Golden Hour's uilint motion-tokens). */
  --motion-feedback: 150ms; /* the screenshot tip showing; hover feedback, 150 ms at most */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* Emil Kowalski's strong ease-out */
  color-scheme: dark;
}

/* Light when the system is light, unless a host page says dark; and whenever a host page says light. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ececef;
    --surface: #f8f8fa;
    --surface-2: #ffffff;
    --surface-3: #e6e6ea;
    --line: #d9d9df;
    --line-strong: #c4c4cc;
    --text: #1c1d21;
    --dim: #5c5f67;
    --faint: #8a8d95;
    --accent: #b86600;
    --accent-ink: #ffffff;
    --accent-soft: rgba(184, 102, 0, 0.1);
    --accent-line: rgba(184, 102, 0, 0.45);
    --ok: #1d8a55;
    --ok-soft: rgba(29, 138, 85, 0.1);
    --warn: #9a6400;
    --warn-soft: rgba(154, 100, 0, 0.1);
    --bad: #d2392c;
    --bad-soft: rgba(210, 57, 44, 0.08);
    --pasteboard: #d4d4da;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #ececef;
  --surface: #f8f8fa;
  --surface-2: #ffffff;
  --surface-3: #e6e6ea;
  --line: #d9d9df;
  --line-strong: #c4c4cc;
  --text: #1c1d21;
  --dim: #5c5f67;
  --faint: #8a8d95;
  --accent: #b86600;
  --accent-ink: #ffffff;
  --accent-soft: rgba(184, 102, 0, 0.1);
  --accent-line: rgba(184, 102, 0, 0.45);
  --ok: #1d8a55;
  --ok-soft: rgba(29, 138, 85, 0.1);
  --warn: #9a6400;
  --warn-soft: rgba(154, 100, 0, 0.1);
  --bad: #d2392c;
  --bad-soft: rgba(210, 57, 44, 0.08);
  --pasteboard: #d4d4da;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
/* The window never scrolls or bounces, only its panes do (Golden Hour's uilint root-scroll). */
html, body { margin: 0; height: 100%; overflow: clip; }
html { overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
input, select, textarea { user-select: text; -webkit-user-select: text; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
h3 { font-size: 11px; font-weight: 600; margin: 0 0 8px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
p { margin: 0 0 8px; }
.dim { color: var(--dim); }
[hidden] { display: none !important; }

/* ---- Buttons and fields (Golden Hour) ---- */
button {
  font: inherit;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 5px 12px;
}
button:hover:not(:disabled) { border-color: var(--faint); }
button:disabled { opacity: 0.45; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: transparent; }
button.quiet { background: transparent; border-color: transparent; color: var(--dim); }
button.quiet:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
button.small { padding: 3px 9px; font-size: 12px; }
button.big { width: 100%; padding: 10px 14px; font-size: 14px; }

input[type=text], input[type=number], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 5px 8px;
  min-width: 0;
  min-height: 30px;
}
input::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.field > label, .field-label { font-size: 11px; color: var(--dim); font-weight: 500; }
textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.style-row { display: flex; gap: 6px; align-items: center; }
.style-row select { flex: 1; }
.style-row input[type=number] { width: 64px; }
.note { color: var(--dim); font-size: 12px; margin: 10px 0 0; }
.note:empty { display: none; }
.warn { color: var(--warn); }
.chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-strong); white-space: nowrap; }
.chip.ok { border-color: var(--ok); color: var(--ok); }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip.bad { border-color: var(--bad); color: var(--bad); }

/* ---- Top bar ---- */
/* One row when it holds everything; otherwise Back and Continue take a second row at the right. Nothing in it is
   squeezed or cut off, and nothing sits pinned to the window's bottom (Apple HIG Layout). */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top > *, .top-end > * { flex-shrink: 0; }
.brand { font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.next-why { color: var(--dim); font-size: 12px; flex-shrink: 1; }
.steps { display: flex; gap: 2px; }
.steps button { border: 0; background: transparent; color: var(--dim); padding: 5px 10px 5px 6px; border-radius: 6px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.steps button:hover:not(:disabled) { color: var(--text); }
.steps button[aria-current=step] { color: var(--text); background: var(--surface-3); }
.steps button:disabled { opacity: 0.4; }
.step-n { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); color: var(--dim); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
.steps button[aria-current=step] .step-n { background: var(--accent); color: var(--accent-ink); }
.steps button.done .step-n { background: var(--ok-soft); color: var(--ok); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--dim); padding: 5px 14px; border-radius: 6px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500;
}
.seg button[aria-checked=true] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-strong); display: inline-block; }

/* ---- Pages and panes ---- */
/* Every page is a pane, and so are its stage and inspector: only they scroll (tools/e2e.mjs window checks). */
main { flex: 1; min-height: 0; display: flex; }
.page { flex: 1; min-width: 0; min-height: 0; display: flex; overflow: auto; overscroll-behavior: contain; }
.stage { flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.inspector { width: 360px; flex: none; overflow: auto; overscroll-behavior: contain; padding: 18px; background: var(--surface); border-left: 1px solid var(--line); }
.stage-head, .drop, .cards, #check-note { width: 100%; max-width: 820px; margin-inline: auto; }
.stage-head p { margin: 0; }
.stage-head b { color: var(--text); }

/* ---- Check: the drop target and a card per file ---- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 140px; padding: 18px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); text-align: center;
}
.drop p { margin: 0; }
.drop-say { font-size: 15px; font-weight: 600; }
.drop.over, .drop-hint { border: 1px solid var(--accent); background: var(--accent-soft); }
.drop button { margin-top: 4px; }
.cards { list-style: none; margin-block: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card { border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius); background: var(--surface); padding: 12px 14px; }
.card[data-verdict=pass] { border-left-color: var(--ok); }
.card[data-verdict=warn] { border-left-color: var(--warn); }
.card[data-verdict=block] { border-left-color: var(--bad); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-file { font-weight: 600; min-width: 0; overflow-wrap: anywhere; flex: 1; }
.card-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 22px; align-items: center; margin-top: 10px; }
.code { font-size: 40px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; }
.code .ok { color: var(--ok); }
.code .bad { color: var(--bad); }
.code .sep { color: var(--faint); font-weight: 400; }
.code.none { font-size: 18px; font-weight: 600; color: var(--faint); }
.code-label { font-size: 11px; color: var(--dim); margin-top: 6px; white-space: nowrap; }
.parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.part { display: grid; grid-template-columns: 112px 22px minmax(0, 1fr); gap: 0 6px; align-items: baseline; }
.part-label { color: var(--dim); }
.part-n { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.part.ok .part-n { color: var(--ok); }
.part.bad .part-n { color: var(--bad); }
.part-name { font-weight: 600; }
.part-note { grid-column: 3; color: var(--dim); font-size: 12px; }
.facts { color: var(--dim); font-size: 12px; margin: 10px 0 0; }
.finding { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.finding + .finding { margin-top: 10px; }
.finding p { margin: 0 0 4px; }
.finding-title { font-weight: 600; }
.card[data-verdict=block] .finding-title { color: var(--bad); }
.card[data-verdict=warn] .finding-title { color: var(--warn); }
.fix { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.srgb-box { display: flex; gap: 8px; align-items: baseline; margin-top: 10px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--accent-line); background: var(--accent-soft); font-weight: 500; }
.fix-label { display: block; font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }

/* The viewer question, and the screenshot of the setting: on hover, on focus, or on a tap. */
fieldset.viewer { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.viewer legend { padding: 0; }
.viewer label { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }
.viewer-note { margin: 0 0 6px 21px; }
/* Fixed, so it can be wider than the inspector that holds it (app.mjs placeTip puts it by its button): the
   865-px screenshot reads at 1:1 on a Retina screen at 432 px. */
.tip { margin-top: 10px; }
.tip-card {
  position: fixed; top: 0; left: 0; width: min(448px, calc(100vw - 32px)); z-index: 20; margin: 0; padding: 8px;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden;
}
.tip:focus-within .tip-card, .tip-card.open { opacity: 1; visibility: visible; }
@media (hover: hover) { .tip:hover .tip-card { opacity: 1; visibility: visible; } } /* a tap leaves hover stuck on phones */
.tip-card img { display: block; width: 100%; height: auto; border-radius: 4px; }
.tip-placeholder {
  aspect-ratio: 865 / 255; display: flex; align-items: center; justify-content: center; padding: 12px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: 4px; color: var(--faint); font-size: 12px;
}
.tip-card figcaption { font-size: 11px; color: var(--dim); margin-top: 6px; }
.private { margin-top: 24px; }

/* ---- Layout and Export: the page on a pasteboard ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.canvas-wrap { position: relative; flex: 1; min-height: 160px; display: flex; align-items: center; justify-content: center; background: var(--pasteboard); border-radius: var(--radius); padding: 14px; }
.canvas-wrap canvas { display: block; touch-action: none; outline: none; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); }
.canvas-wrap canvas:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.drop-hint { position: absolute; inset: 14px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 18px; font-weight: 600; pointer-events: none; }
.size { margin-bottom: 16px; min-height: 64px; }
.size-big { font-size: 28px; font-weight: 700; line-height: 1.1; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.size-detail { color: var(--dim); margin: 0; }
.status-bad { color: var(--bad); }

/* ---- Layout: the toolbar, the properties panel and the color control ---- */
.tools { display: inline-flex; gap: 6px; }
.readout {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.pick-status { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-weight: 500; }
.pick-status .swatch { flex: none; }
#pick-hex { font-variant-numeric: tabular-nums; color: var(--dim); min-width: 62px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.panel h3.gap { margin-top: 20px; }
.panel .seg button { padding: 5px 10px; }
.row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.row > .seg { margin-right: auto; }
.row > .field { margin-bottom: 0; }
.grow { flex: 1; min-width: 0; }
.unit, .slider { display: flex; align-items: center; gap: 6px; }
.unit input[type=number] { width: 64px; }
.unit.filename input { flex: 1; }
.slider input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.slider input[type=number] { width: 64px; }
.toggle[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.grid2, .grid3 { display: grid; gap: 6px; margin-bottom: 6px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1fr 1fr 1fr; }
.grid2 button, .grid3 button { padding-inline: 6px; }
.lock-note { margin: 0 0 8px; }
.xywh { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.xywh label { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--dim); font-weight: 600; }
.xywh input { width: 100%; padding-inline: 5px; }
.keys { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: center; margin: 0; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--dim); }
kbd {
  display: inline-block; min-width: 18px; padding: 0 4px; margin-right: 2px; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--surface-2); color: var(--text); font: 600 11px/16px var(--font); text-align: center;
}
.color-row { display: flex; align-items: center; gap: 6px; }
.color-label { flex: 1; min-width: 0; font-size: 11px; color: var(--dim); font-weight: 500; }
.color .hex { width: 84px; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.color .hex::placeholder { text-transform: none; }
.swatch { width: 22px; height: 22px; padding: 0; border-radius: 5px; border: 1px solid var(--line-strong); display: inline-block; }
.swatch.big { width: 30px; height: 28px; }
.swatch.none { background: linear-gradient(to top right, transparent calc(50% - 1px), var(--bad) calc(50% - 1px), var(--bad) calc(50% + 1px), transparent calc(50% + 1px)), var(--surface-2); }
.picker { margin-top: 8px; padding: 10px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.sv {
  position: relative; height: 140px; border-radius: 6px; touch-action: none;
  background: linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #fff, rgba(255, 255, 255, 0)), var(--hue, #f00);
}
.knob { position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); transform: translate(-50%, -50%); pointer-events: none; }
.hue {
  -webkit-appearance: none; appearance: none; width: 100%; height: 14px; margin: 0; border-radius: 7px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.hue::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: transparent; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches:empty { display: none; }

/* At phone width the panes stack, and the page is the one pane that scrolls; the body still never does. */
@media (max-width: 760px) {
  .top { padding: 8px 12px; gap: 6px 10px; }
  .steps button { padding: 4px 6px 4px 4px; }
  .page { flex-direction: column; }
  .stage, .inspector { overflow: visible; flex: none; width: auto; }
  .stage { padding: 16px; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); padding: 16px; }
  .canvas-wrap { flex: none; padding: 8px; }
  .drop-hint { inset: 8px; }
  .code { font-size: 32px; }
  .card-body { grid-template-columns: minmax(0, 1fr); }
  .part { grid-template-columns: 104px 20px minmax(0, 1fr); }
}

/* ---- Motion ----
   Only here, only for people who have not asked for less motion, and only through the tokens in :root. */
@media (prefers-reduced-motion: no-preference) {
  .tip-card { transition: opacity var(--motion-feedback) var(--ease-out), visibility var(--motion-feedback) var(--ease-out); }
}
