/* Squint Test: a designer's blur test for visual hierarchy.
 * One Page Toys tool family, self-contained, theme-aware (light/dark).
 * Light is a studio wall: warm paper, graphite ink, one burnt-orange signal. Dark is a dim review room. */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@75..125,500..800&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700;800&display=swap");

:root{
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ink: #1c1a22;
  --bg: #efede8;
  --surface: #fbfaf7;
  --surface-2: #f0ede6;
  --stagebg: #e4e1d9;
  --muted: #5d5a66;
  --line: #dcd8cf;
  --line-strong: #bdb8ab;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: rgba(194, 65, 12, 0.11);
  --on-accent: #ffffff;
  --warn: #b6452c;
  --warn-soft: rgba(182, 69, 44, 0.12);
  --radius: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(30, 28, 24, 0.07);
  --shadow-md: 0 10px 26px rgba(30, 28, 24, 0.12);
}
:root[data-theme="dark"]{
  --ink: #ece9f2;
  --bg: #0e0d12;
  --surface: #17161d;
  --surface-2: #201e28;
  --stagebg: #0a090d;
  --muted: #9b97a8;
  --line: #27242f;
  --line-strong: #3a3645;
  --accent: #ff8a5c;
  --accent-hover: #ffa482;
  --accent-soft: rgba(255, 138, 92, 0.14);
  --on-accent: #1a0d06;
  --warn: #ff9a7a;
  --warn-soft: rgba(255, 154, 122, 0.14);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ -webkit-tap-highlight-color: transparent; }
body{
  margin: 0; min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--ink);
  background:
    radial-gradient(70% 40% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select{ font: inherit; color: inherit; }
kbd{ display: inline-block; min-width: 1.5em; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; font-family: var(--font-mono); font-size: 0.72em; font-weight: 500; line-height: 1.5; text-align: center; color: var(--muted); background: var(--surface); }

/* ---------- Top bar (family chrome) ---------- */
.topbar{
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 30px);
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(clamp(16px, 4vw, 30px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 30px), env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand{ display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 0.86rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brand__mark{ width: 1.35em; height: 1.35em; background: url("../../assets/brand-mark-64.png") center / contain no-repeat; }
.topbar__right{ display: inline-flex; align-items: center; gap: 10px; }
.topbar__tag{ font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.iconbtn{ appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; font-size: 1rem; line-height: 1; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }

/* ---------- Stage ---------- */
.stage{
  position: relative; z-index: 2; flex: 1 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 24px;
  padding: clamp(22px, 4vw, 44px) 16px clamp(48px, 6vw, 72px);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(clamp(56px, 7vw, 80px), calc(env(safe-area-inset-bottom) + 40px));
}

/* ---------- Hero ---------- */
.hero{ width: 100%; max-width: 760px; text-align: center; }
.eyebrow{ margin: 0 0 8px; font-family: var(--font-display); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.headline{ margin: 0 0 12px; font-family: var(--font-display); font-weight: 800; font-stretch: 88%; font-variation-settings: "wdth" 88; font-size: clamp(2rem, 6.8vw, 3.35rem); line-height: 1.0; letter-spacing: -0.025em; text-wrap: balance; }
.lede{ margin: 0 auto; max-width: 620px; font-size: clamp(0.95rem, 2.6vw, 1.05rem); line-height: 1.55; color: var(--muted); text-wrap: pretty; }

body.has-image .lede{ display: none; }
body.has-image .headline{ font-size: clamp(1.7rem, 4.6vw, 2.5rem); margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn{
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 22px;
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; letter-spacing: -0.005em;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active{ transform: translateY(0) scale(0.98); }
.btn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.btn--primary{ background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover{ background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ink{ background: var(--ink); border-color: var(--ink); color: var(--bg); touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.btn--ink kbd{ background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 45%, transparent); }
.btn--ghost{ background: transparent; }
.btn--sm{ min-height: 44px; padding: 9px 18px; font-size: 0.88rem; }
.linkbtn{ appearance: none; border: 0; background: transparent; padding: 10px 6px; min-height: 44px; font-weight: 600; font-size: 0.84rem; color: var(--accent); cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; border-radius: 8px; }
.linkbtn:hover{ color: var(--accent-hover); }
.linkbtn:focus-visible{ outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Cards ---------- */
.card{
  position: relative; min-width: 0; width: 100%;
  padding: clamp(14px, 3.4vw, 22px);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.console{ max-width: 1080px; }
.card__title{ margin: 0 0 12px; display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.22rem; font-weight: 800; letter-spacing: -0.015em; }
.tipcard{ max-width: 760px; }

/* ---------- Drop area ---------- */
.drop{
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: clamp(28px, 6vw, 56px) clamp(14px, 4vw, 40px);
  border: 2px dashed var(--line-strong); border-radius: calc(var(--radius) - 4px);
  background: var(--surface-2);
  transition: border-color 160ms ease, background 160ms ease;
}
.drop[hidden]{ display: none; }
.drop.is-over{ border-color: var(--accent); background: var(--accent-soft); }
.drop__art{ width: 120px; margin-bottom: 14px; }
.drop__art svg{ width: 100%; height: auto; }
.drop__art rect{ fill: none; stroke: var(--line-strong); stroke-width: 2; }
.drop__art .d-a{ fill: var(--ink); stroke: none; }
.drop__art .d-b{ fill: var(--line-strong); stroke: none; }
.drop__art .d-c{ fill: var(--accent); stroke: none; }
.drop__art .d-d{ fill: var(--accent-soft); stroke: var(--accent); }
.drop__title{ margin: 0 0 6px; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.3rem, 4vw, 1.7rem); letter-spacing: -0.02em; }
.drop__sub{ margin: 0 0 18px; max-width: 460px; font-size: 0.92rem; line-height: 1.55; color: var(--muted); }
.drop__actions{ display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.privacy{ display: inline-flex; align-items: center; gap: 7px; margin: 18px 0 0; font-size: 0.84rem; font-weight: 500; color: var(--muted); }
.privacy svg{ width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.privacy--small{ margin: 10px 0 0; font-size: 0.78rem; }
.loadnote{ margin: 14px auto 0; max-width: 520px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 0.88rem; font-weight: 600; }
.loadnote[hidden]{ display: none; }

.dropveil{
  position: fixed; inset: 0; z-index: 2147483000; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.dropveil::before{ content: ""; position: absolute; inset: 14px; border: 3px dashed var(--accent); border-radius: 22px; }
.dropveil span{ position: relative; padding: 14px 26px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; box-shadow: var(--shadow-md); }
body.is-dragging .dropveil{ display: flex; }

/* ---------- Workspace ---------- */
.work[hidden]{ display: none; }
.toolbar{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.seg{ display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); }
.seg button{
  appearance: none; border: 0; background: transparent; min-height: 40px; padding: 6px 14px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--muted); cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.seg button kbd{ font-size: 0.68rem; padding: 0 5px; background: transparent; }
.seg button:hover{ color: var(--ink); }
.seg button[aria-pressed="true"]{ background: var(--ink); color: var(--bg); box-shadow: var(--shadow); }
.seg button[aria-pressed="true"] kbd{ color: inherit; border-color: color-mix(in srgb, var(--bg) 45%, transparent); }
.seg button:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.heatbtn{
  appearance: none; display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 6px 16px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface);
  font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.heatbtn i{ width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, #ffee8c 0 22%, #ff9619 48%, #e1372d 72%, #781e6e 100%); box-shadow: 0 0 0 1.5px var(--line-strong); }
.heatbtn:hover{ border-color: var(--ink); }
.heatbtn[aria-pressed="true"]{ background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.heatbtn[aria-pressed="true"] i{ box-shadow: 0 0 0 1.5px var(--on-accent); }
.heatbtn kbd{ font-size: 0.68rem; padding: 0 5px; background: transparent; }
.heatbtn[aria-pressed="true"] kbd{ color: inherit; border-color: color-mix(in srgb, var(--on-accent) 50%, transparent); }
.heatbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }

.viewer{
  display: flex; justify-content: center; align-items: center;
  padding: clamp(8px, 2.4vw, 22px); border-radius: var(--radius-sm);
  background: var(--stagebg); border: 1px solid var(--line);
  min-height: 160px;
}
.viewer__box{ position: relative; display: block; line-height: 0; max-width: 100%; }
#view{
  display: block; max-width: 100%; max-height: max(260px, calc(100vh - 300px)); width: auto; height: auto;
  border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.15), 0 14px 34px -10px rgba(0,0,0,0.4);
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; background: #fff;
}
.viewer.is-split .viewer__box{ cursor: ew-resize; touch-action: pan-y; }
.chip{ position: absolute; top: 10px; padding: 4px 10px; border-radius: var(--radius-pill); background: rgba(16,14,22,0.74); color: #fff; font-family: var(--font-display); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.4; pointer-events: none; }
.chip--l{ left: 10px; } .chip--r{ right: 10px; }
.chip[hidden], .flashbadge[hidden], .splitbar[hidden], .busy[hidden]{ display: none; }
.flashbadge{ position: absolute; top: 10px; left: 10px; padding: 5px 12px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.4; pointer-events: none; }
.busy{ position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 8px 16px; border-radius: var(--radius-pill); background: rgba(16,14,22,0.82); color: #fff; font-size: 0.86rem; font-weight: 600; line-height: 1.4; }

.splitbar{ position: absolute; top: 0; bottom: 0; width: 44px; margin-left: -22px; cursor: ew-resize; touch-action: none; outline: none; }
.splitbar__grip{
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: #14121f; box-shadow: 0 2px 10px rgba(0,0,0,0.4), 0 0 0 2px rgba(20,18,31,0.55);
  transition: box-shadow 140ms ease;
}
.splitbar__line{ position: absolute; left: 50%; top: 0; bottom: 0; width: 0; }
.splitbar__grip svg{ width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.splitbar:focus-visible .splitbar__grip{ box-shadow: 0 2px 10px rgba(0,0,0,0.4), 0 0 0 3px #fff, 0 0 0 6px var(--accent); }

.caption{ margin: 10px 2px 0; min-height: 1.4em; font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); }
.controls{ display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 28px; margin-top: 14px; }
.ctl{ display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctl--squint{ flex: 1 1 280px; max-width: 520px; }
.ctl__k{ font-family: var(--font-display); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.ctl__k b{ margin-left: 8px; font-family: var(--font-mono); font-size: 0.82rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink); }
.ctl__scale{ display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }
.ctl--cmp[hidden]{ display: none; }
.help{ margin: 8px 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--muted); }

input[type="range"]{
  -webkit-appearance: none; appearance: none; width: 100%; height: 34px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track{ height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--line-strong), var(--ink)); }
input[type="range"]::-moz-range-track{ height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--line-strong), var(--ink)); }
input[type="range"]::-webkit-slider-thumb{ -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 1px 6px rgba(0,0,0,0.35); }
input[type="range"]::-moz-range-thumb{ width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 1px 6px rgba(0,0,0,0.35); }
input[type="range"]:focus-visible{ outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb{ box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent); }
input[type="range"]:focus-visible::-moz-range-thumb{ box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent); }

.actions{ display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }

/* ---------- Tips ---------- */
.tips{ margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.tips li{ padding-left: 16px; border-left: 3px solid var(--accent); font-size: 0.92rem; line-height: 1.55; color: var(--muted); }
.tips b{ color: var(--ink); }
.more{ margin: 16px 0 0; font-size: 0.86rem; color: var(--muted); }
.more a{ color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
.more a:hover{ color: var(--accent-hover); }
.more a:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- Toast + back link ---------- */
.toast{
  position: fixed; z-index: 2147483100; left: 50%; bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  transform: translate(-50%, 20px); opacity: 0;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 8px 20px; min-height: 44px;
  border-radius: var(--radius-pill); background: #1c1a22; color: #f1eff5;
  box-shadow: 0 14px 34px rgba(0,0,0,0.3); font-size: 0.9rem; font-weight: 600;
  transition: transform 240ms cubic-bezier(.2, 1.2, .4, 1), opacity 200ms ease;
}
:root[data-theme="dark"] .toast{ background: #ece9f2; color: #121018; }
.toast[hidden]{ display: none; }
.toast.is-on{ transform: translate(-50%, 0); opacity: 1; }
.backlink{ font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; padding: 10px 0; transition: color 140ms ease, border-color 140ms ease; }
.backlink:hover{ color: var(--ink); border-bottom-color: var(--accent); }
.backlink:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Responsive ---------- */
.coarse-only{ display: none; }
@media (pointer: coarse){ .seg button kbd, .heatbtn kbd, .btn kbd{ display: none; } .fine-only{ display: none; } .coarse-only{ display: inline; } }
@media (max-width: 560px){
  .toolbar{ flex-direction: column; align-items: stretch; }
  .seg--views{ display: grid; grid-template-columns: repeat(5, 1fr); }
  .seg--views button{ padding: 6px 2px; justify-content: center; font-size: 0.78rem; }
  .seg--views button kbd, .btn kbd{ display: none; }
  .heatbtn{ justify-content: center; }
  .actions .btn{ flex: 1 1 auto; }
}
@media (orientation: landscape) and (max-height: 500px){
  .stage{ gap: 16px; }
  #view{ max-height: max(200px, calc(100vh - 150px)); }
}
@media (prefers-reduced-motion: reduce){
  .btn, .iconbtn, .seg button, .heatbtn, .toast, .drop, .splitbar__grip{ transition: none; }
}
