/* Pattern Studio — interface styles. Colours are tokens; both themes redefine them. */

:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --bg-2: #0f1115;
  --surface: #14161b;
  --surface-2: #1a1d24;
  --surface-3: #242832;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #eef0f4;
  --text-2: #b6bcc8;
  --muted: #7f8795;
  --accent: #f4b860;
  --accent-2: #ffd08a;
  --accent-ink: #1b1305;
  --accent-soft: rgba(244, 184, 96, 0.13);
  --ok: #5bd6a0;
  --bad: #ff8076;
  --sel: #8ccaff;
  --stage: radial-gradient(120% 90% at 50% 40%, #171a21 0%, #0b0c0f 70%);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.42), 0 2px 6px rgba(0, 0, 0, 0.3);
  --frame-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 40px 90px -30px rgba(0, 0, 0, 0.85), 0 18px 36px -18px rgba(0, 0, 0, 0.7);
  --ambient: 0.42;
  --radius: 14px;
  --radius-sm: 10px;
  --side-w: 264px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2ed;
  --bg-2: #ebe8e1;
  --surface: #ffffff;
  --surface-2: #f6f4ef;
  --surface-3: #e9e6df;
  --line: rgba(28, 24, 16, 0.09);
  --line-2: rgba(28, 24, 16, 0.17);
  --text: #1b1a18;
  --text-2: #4a4843;
  --muted: #7d7a72;
  --accent: #b5620c;
  --accent-2: #d9831f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(181, 98, 12, 0.1);
  --ok: #1c9460;
  --bad: #cf4338;
  --sel: #1a73d1;
  --stage: radial-gradient(120% 90% at 50% 40%, #fbfaf7 0%, #e9e6df 75%);
  --shadow: 0 12px 30px rgba(50, 38, 14, 0.13), 0 2px 6px rgba(50, 38, 14, 0.08);
  --frame-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 40px 80px -34px rgba(50, 38, 14, 0.55), 0 16px 30px -18px rgba(50, 38, 14, 0.4);
  --ambient: 0.5;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; border-radius: 6px; }
svg { display: block; }

/* ---------- shell ---------- */

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100vh; transition: grid-template-columns 0.28s cubic-bezier(0.3, 0.7, 0.2, 1); }
.app[data-collapsed="true"] { --side-w: 68px; }

.sidebar {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 14px 12px 12px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 4px; }
.logo { width: 28px; height: 28px; flex: none; filter: drop-shadow(0 2px 6px rgba(244, 184, 96, 0.25)); }
.brand-name { font: 600 17px/1 var(--display); letter-spacing: 0.005em; white-space: nowrap; flex: 1; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; width: 100%;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-weight: 550;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary {
  border-color: transparent; color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -8px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn.primary:hover { filter: brightness(1.06); }

.side-label { display: flex; justify-content: space-between; padding: 8px 6px 0; font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.project-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.project-list::-webkit-scrollbar, .tab-body::-webkit-scrollbar { width: 8px; }
.project-list::-webkit-scrollbar-thumb, .tab-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }

.project { position: relative; display: flex; align-items: center; border-radius: 11px; transition: background 0.15s; }
.project:hover { background: var(--surface-2); }
.project[aria-current="true"] { background: var(--surface-3); }
.project[aria-current="true"]::before { content: ""; position: absolute; left: -4px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--accent); }
.project-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 7px 6px; border: 0; background: none; text-align: left; border-radius: 11px; }
.thumb { width: 40px; height: 40px; flex: none; border-radius: 9px; object-fit: cover; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line-2); }
.p-text { display: flex; flex-direction: column; min-width: 0; }
.p-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project .more { opacity: 0; margin-right: 4px; width: 28px; height: 28px; }
.project:hover .more, .project .more:focus-visible, .project .more[aria-expanded="true"] { opacity: 1; }
.empty-list { padding: 14px 8px; color: var(--muted); font-size: 13px; }

.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.ghost { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); }
.ghost:hover { background: var(--surface-3); color: var(--text); }
.ghost svg { width: 15px; height: 15px; }
.foot-note { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.app[data-collapsed="true"] .brand-name,
.app[data-collapsed="true"] .new span,
.app[data-collapsed="true"] .side-label,
.app[data-collapsed="true"] .p-text,
.app[data-collapsed="true"] .more,
.app[data-collapsed="true"] .foot-note,
.app[data-collapsed="true"] #themeLabel,
.app[data-collapsed="true"] .logo { display: none; }
.app[data-collapsed="true"] .brand { justify-content: center; padding: 0; }
.app[data-collapsed="true"] .new { padding: 0; }
.app[data-collapsed="true"] .project-main { justify-content: center; padding: 6px 0; }
.app[data-collapsed="true"] .side-foot { justify-content: center; }
.app[data-collapsed="true"] .ghost { padding: 0 8px; }

.menu {
  position: fixed; z-index: 50; min-width: 168px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow);
  animation: pop 0.14s ease-out;
}
.menu button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; }
.menu button:hover { background: var(--surface-3); }
.menu button.danger { color: var(--bad); }
.menu p { padding: 6px 10px 8px; color: var(--text-2); font-size: 13px; }

/* ---------- main ---------- */

.main { min-width: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.welcome {
  flex: 1; display: grid; place-items: center; padding: 40px 28px; overflow: auto; position: relative;
  background:
    radial-gradient(40% 50% at 12% 8%, rgba(244, 184, 96, 0.16), transparent 70%),
    radial-gradient(38% 46% at 92% 16%, rgba(63, 182, 201, 0.15), transparent 70%),
    radial-gradient(46% 50% at 70% 100%, rgba(226, 96, 122, 0.13), transparent 70%),
    var(--bg);
}
.welcome-inner { width: min(680px, 100%); text-align: center; animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.welcome h1 { margin-top: 14px; font: 600 clamp(30px, 4.6vw, 46px)/1.08 var(--display); letter-spacing: -0.015em; text-wrap: balance; }
.lede { margin: 16px auto 0; max-width: 54ch; color: var(--text-2); font-size: 16px; text-wrap: pretty; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; margin-top: 30px; padding: 34px 20px 30px;
  border: 1.5px dashed var(--line-2); border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); box-shadow: 0 18px 50px -24px var(--accent); }
.drop-icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 6px; border-radius: 18px; color: var(--accent-ink); background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 10px 26px -10px var(--accent); }
.drop-icon svg { width: 30px; height: 30px; }
.drop-title { font-size: 18px; font-weight: 650; }
.drop-sub { color: var(--muted); }

.samples { margin-top: 30px; }
.samples-label { font-size: 13px; color: var(--muted); }
.sample-row { display: flex; justify-content: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.sample {
  position: relative; width: 148px; height: 100px; padding: 0; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface-3);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.sample img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sample span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; font-size: 12.5px; font-weight: 600; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, 0.72)); }
.sample:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }

.or { display: flex; align-items: center; gap: 14px; margin: 30px 0 22px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.describe { padding: 22px 22px 18px; border: 1px solid var(--line-2); border-radius: 20px; background: color-mix(in srgb, var(--surface) 72%, transparent); text-align: left; }
.describe-title { display: block; font: 600 21px/1.2 var(--display); letter-spacing: -0.01em; }
.describe-sub { margin-top: 6px; color: var(--text-2); font-size: 14px; text-wrap: pretty; }
.describe-row { display: flex; gap: 8px; margin-top: 14px; }
.describe-row input, .words-edit {
  flex: 1; min-width: 0; height: 42px; padding: 0 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 550;
}
.describe-row input::placeholder { color: var(--muted); font-weight: 450; }
.describe-row input:focus, .words-edit:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.describe-row .btn { width: auto; height: 42px; padding: 0 20px; flex: none; }
.words-edit { display: block; width: 100%; height: auto; min-height: 62px; padding: 9px 11px; line-height: 1.4; resize: none; }
.look-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.look {
  height: 30px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.look:hover { background: var(--surface-2); color: var(--text); }
.look[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.tab-body .look-row { margin-top: 2px; }
.tab-body .look { height: 28px; padding: 0 10px; font-size: 12.5px; }
.example-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.example { height: 28px; padding: 0 11px; border: 0; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.example:hover { color: var(--text); background: var(--accent-soft); }
.can-draw { margin-top: 14px; font-size: 13px; color: var(--text-2); }
.can-draw summary { cursor: pointer; color: var(--accent); font-weight: 600; width: fit-content; }
.can-draw dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0 0; }
.can-draw dt { color: var(--muted); font-weight: 600; }
.can-draw dd { margin: 0; text-wrap: pretty; }
.can-draw p { margin-top: 10px; color: var(--muted); text-wrap: pretty; }
.app[data-kind="design"] .only-photo, .app[data-kind="photo"] .only-design { display: none !important; }
@media (max-width: 560px) {
  .describe { padding: 18px 16px 16px; }
  .describe-row { flex-direction: column; }
  .describe-row input { flex: none; width: 100%; }
  .describe-row .btn { width: 100%; }
  .can-draw dl { grid-template-columns: 1fr; gap: 2px; }
  .can-draw dd { margin-bottom: 8px; }
}

.workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.topbar { flex: none; display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.menu-btn { display: none; }
.app[data-collapsed="true"] .menu-btn { display: inline-grid; }
.title-input {
  flex: 0 1 240px; min-width: 90px; height: 34px; padding: 0 9px;
  border: 1px solid transparent; border-radius: 9px; background: transparent;
  font: 600 16px/1 var(--font); letter-spacing: -0.01em; text-overflow: ellipsis;
}
.title-input:hover { background: var(--surface-2); }
.title-input:focus { background: var(--surface-2); border-color: var(--line-2); outline: none; }

.kpis { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; overflow: hidden; }
.kpi {
  display: inline-flex; align-items: baseline; gap: 6px; flex: none; height: 32px; padding: 0 11px; line-height: 32px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); white-space: nowrap;
}
.kpi b { font-weight: 680; font-variant-numeric: tabular-nums; }
.kpi i { font-style: normal; font-size: 12.5px; color: var(--muted); }
.kpi.good b { color: var(--ok); }
.kpi.warn b { color: var(--accent); }
.kpi.pulse { animation: pulse 0.5s ease-out; }

.content { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 348px; }

/* ---------- stage ---------- */

.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--stage); }
.ambient { position: absolute; inset: -12%; background-size: cover; background-position: center; filter: blur(80px) saturate(1.6); opacity: 0; transform: scale(1.1); transition: opacity 0.8s; pointer-events: none; }
.ambient.on { opacity: var(--ambient); }
.frame-wrap { position: absolute; inset: 26px 70px 106px; display: grid; place-items: center; }
.frame {
  position: relative; overflow: hidden; border-radius: 5px; background: #0d0d0f; touch-action: none;
  box-shadow: var(--frame-shadow);
  transition: width 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), height 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.frame svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame.pinning svg { cursor: crosshair; }
.frame .fade-in { animation: fade 0.35s ease-out both; }

.progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; overflow: hidden; opacity: 0; transition: opacity 0.2s 0.15s; z-index: 3; }
.progress i { position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: slide 1s linear infinite; }
.stage.busy .progress { opacity: 1; }

.dock {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 6px; padding: 6px; max-width: calc(100% - 24px);
  border: 1px solid var(--line-2); border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow);
}
.dock-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 2px; }
.dock-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border: 0; border-radius: 10px; background: none; color: var(--text-2); white-space: nowrap; font-weight: 550; }
.dock-btn svg { width: 17px; height: 17px; flex: none; }
.dock-btn:hover { background: var(--surface-3); color: var(--text); }
.dock-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-weight: 560; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--line); }
.seg.small button { height: 24px; padding: 0 9px; font-size: 12.5px; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; padding: 0 6px; height: 32px; }

.piece-card {
  position: absolute; z-index: 5; left: 72px; top: 18px; max-height: calc(100% - 136px); overflow: auto;
  border: 1px solid var(--line-2); border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow); animation: pop 0.18s ease-out;
}
.piece-card { width: 256px; padding: 12px 14px 13px; }
.piece-card.right { left: auto; right: 72px; }
.pc-head { display: flex; align-items: center; gap: 10px; }
.pc-swatch { width: 34px; height: 34px; border-radius: 9px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3), inset 0 10px 14px -8px rgba(255, 255, 255, 0.45); }
.pc-title { font-weight: 680; font-size: 15px; }
.pc-sub { font-size: 12.5px; color: var(--muted); }
.pc-close { margin-left: auto; width: 26px; height: 26px; }
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 12px; }
.pc-grid div { display: flex; flex-direction: column; }
.pc-grid span { font-size: 11.5px; color: var(--muted); }
.pc-grid b { font-weight: 620; font-variant-numeric: tabular-nums; }
.pc-flag { margin-top: 11px; padding: 9px 10px; border-radius: 9px; font-size: 12.5px; background: var(--accent-soft); color: var(--text); }
.pc-flag.advice { background: var(--surface-3); }
.pc-flag .msg { display: flex; gap: 7px; }
.pc-flag .msg svg { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--accent); }
.pc-flag.advice .msg svg { color: var(--muted); }
.pc-fix { display: block; margin: 8px 0 0 22px; height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 12.5px; }
.pc-fix:hover { filter: brightness(1.08); }
.pc-note { margin-top: 11px; font-size: 12.5px; color: var(--muted); }
.pc-label { margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.pc-glass { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pc-glass button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 8px 10px -7px rgba(255, 255, 255, 0.5); }
.pc-glass button[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.pc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.pc-actions button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface-2); color: var(--text); font-weight: 580; font-size: 12.5px; }
.pc-actions button:hover { background: var(--surface-3); }
.pc-actions svg { width: 14px; height: 14px; }
.pc-ok { margin-top: 11px; font-size: 12.5px; color: var(--ok); }

/* ---------- shopping list, build steps, print ---------- */

.btn.small { width: auto; height: 32px; padding: 0 11px; gap: 6px; font-size: 13px; border-radius: 9px; }
.btn.small svg { width: 15px; height: 15px; }
.spec-head.first { margin-top: 16px; align-items: center; }

.buy-list { display: flex; flex-direction: column; }
.buy-head { margin: 12px 0 2px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.buy-head:first-child { margin-top: 2px; }
.buy { display: grid; grid-template-columns: 34px minmax(0, 1fr) 66px 58px; align-items: center; gap: 9px; padding: 6px 6px; margin: 0 -6px; border-radius: 10px; transition: background 0.15s; }
.buy[data-colour]:hover { background: var(--surface-2); }
.buy.have { grid-template-columns: 34px minmax(0, 1fr); padding: 3px 6px; }
.buy.have .s-icon { height: 26px; background: none; color: var(--muted); }
.buy.have .s-icon svg { width: 15px; height: 15px; }
.buy .g-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buy:not([data-colour]) .g-name { white-space: normal; }
.buy.have .g-sub { white-space: normal; }
.b-price { display: flex; align-items: center; height: 30px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); }
.b-price:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.b-price i { font-style: normal; font-size: 12.5px; color: var(--muted); }
.b-price input { width: 100%; min-width: 0; border: 0; background: none; padding: 0 0 0 3px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; -moz-appearance: textfield; appearance: textfield; }
.b-price input:focus { outline: none; }
.b-price input::-webkit-outer-spin-button, .b-price input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.b-cost { text-align: right; font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; }
.buy-total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); font-weight: 650; }
.buy-total b { font-size: 20px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.buy-save { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.opts { display: flex; flex-direction: column; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; }
.opt > span:first-child { display: flex; flex-direction: column; }
.opt b { font-weight: 600; }
.opt small { font-size: 12.5px; color: var(--muted); }
.pct, .cur { flex: none; display: flex; align-items: center; width: 68px; height: 32px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); font-weight: 600; }
.pct:focus-within, .cur:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pct input { width: 100%; min-width: 0; border: 0; background: none; padding: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.pct input:focus { outline: none; }
.pct input::-webkit-outer-spin-button, .pct input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pct i { font-style: normal; margin-left: 3px; color: var(--muted); }
.cur { text-align: center; }

.phases { display: flex; flex-direction: column; gap: 6px; }
.phase { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.phase summary { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 14px; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; border-radius: 12px; }
.phase summary::-webkit-details-marker { display: none; }
.phase summary::after { content: ""; width: 7px; height: 7px; border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted); transform: rotate(-45deg); transition: transform 0.18s; justify-self: center; }
.phase[open] summary::after { transform: rotate(45deg) translate(-2px, -2px); }
.phase summary i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-style: normal; font-weight: 700; font-size: 12.5px; }
.phase summary span { font-weight: 620; }
.phase summary small { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.phase ol { list-style: none; margin: 0; padding: 0 12px 6px; }
.step { padding: 9px 0 10px; border-top: 1px solid var(--line); border-radius: 6px; }
.step div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.step b { font-weight: 620; }
.step small { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.step p { margin-top: 3px; font-size: 12.5px; color: var(--text-2); text-wrap: pretty; }
.step .tip { display: flex; gap: 7px; margin-top: 6px; padding: 7px 9px; border-radius: 8px; background: var(--accent-soft); color: var(--text); }
.step .tip svg { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--accent); }
.step[data-colour], .step[data-pieces] { cursor: default; }

.tile-plan { display: block; width: 100%; max-height: 240px; margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.tp-lines { fill: none; stroke: var(--text-2); stroke-width: 0.9px; vector-effect: non-scaling-stroke; stroke-linejoin: round; opacity: 0.75; }
.tp-page { fill: color-mix(in srgb, var(--accent) 7%, transparent); stroke: var(--accent); stroke-width: 1.2px; vector-effect: non-scaling-stroke; stroke-dasharray: 5 3; }
.tp-name { fill: var(--accent); font-weight: 700; font-family: var(--font); }
.docs { display: flex; flex-direction: column; margin-top: 14px; }
.doc { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.doc b { display: block; font-weight: 620; }
.doc small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); text-wrap: pretty; }
.doc-btns { flex: none; display: flex; flex-direction: column; gap: 6px; }
.doc-btns .btn { width: 82px; }
.print-note { display: flex; gap: 9px; margin-top: 8px; padding: 11px 12px; border-radius: 11px; background: var(--accent-soft); font-size: 12.5px; color: var(--text-2); text-wrap: pretty; }
.print-note svg { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--accent); }
.print-note b { color: var(--text); font-weight: 650; }

/* ---------- editing ---------- */

.tools, .zoom {
  position: absolute; z-index: 4; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px;
  border: 1px solid var(--line-2); border-radius: 15px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow);
}
.tools { left: 14px; }
.zoom { right: 14px; }
.tool { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 11px; background: none; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.tool svg { width: 19px; height: 19px; }
.tool span { display: none; }
.tool:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.tool[aria-pressed="true"], .tool[aria-pressed="true"]:hover { background: var(--accent); color: var(--accent-ink); }
.tool:disabled { opacity: 0.32; cursor: default; }
.tools-sep { width: 22px; height: 1px; margin: 3px 0; background: var(--line-2); }
.zoom-fit { width: 40px; height: 24px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.zoom-fit:hover { background: var(--surface-3); color: var(--text); }
.hint {
  position: absolute; z-index: 4; left: 50%; bottom: 76px; transform: translateX(-50%);
  max-width: calc(100% - 28px); padding: 4px 13px; border: 1px solid var(--line-2); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.edit-note { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 12.5px; color: var(--text-2); text-wrap: pretty; }
.edit-note b { color: var(--text); font-weight: 650; }

/* ---------- inspector ---------- */

.inspector { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.tabs { flex: none; display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { position: relative; height: 38px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-weight: 620; border-radius: 8px 8px 0 0; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-dot { display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.tab-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 18px 28px; }

.group { padding: 16px 0 17px; border-bottom: 1px solid var(--line); }
.group.last { border-bottom: 0; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; margin-bottom: 10px; }
h3 { font-size: 13px; font-weight: 680; letter-spacing: 0.01em; }
.value { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--accent); }
.help { margin-top: 9px; font-size: 12.5px; color: var(--muted); text-wrap: pretty; }
.help b { color: var(--text-2); font-weight: 600; }

.size-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.app[data-kind="design"] .size-row { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field span { font-size: 12px; color: var(--muted); }
.field input {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); font-weight: 600; font-variant-numeric: tabular-nums;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lock { height: 38px; width: 34px; }
.lock[aria-pressed="true"] { color: var(--accent); }
.lock[aria-pressed="false"] .shackle { transform: translate(-3px, -1.5px) rotate(-24deg); transform-origin: 13px 9px; }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; --pct: 50%; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--pct), var(--surface-3) var(--pct)); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.12); transition: transform 0.12s;
}
.range:active::-webkit-slider-thumb { transform: scale(1.14); }
.range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-3); }
.range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.chip { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px 6px; border: 1px solid var(--line-2); border-radius: 10px; background: none; color: var(--text-2); transition: background 0.15s, border-color 0.15s, color 0.15s; }
.chip b { font-size: 12.5px; font-weight: 620; }
.chip i { font-style: normal; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.chip[aria-pressed="true"] i { color: var(--accent); }

.swatches { display: flex; gap: 4px; margin-top: 12px; height: 26px; }
.swatches span { flex: 1; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28), inset 0 9px 10px -7px rgba(255, 255, 255, 0.5); animation: fade 0.3s ease-out both; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; }
.switch-row b { font-weight: 600; }
.switch-row small { font-size: 12.5px; color: var(--muted); }
.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 40px; height: 24px; margin: 0; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); transition: background 0.2s; cursor: pointer; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.2, 1.3); }
.switch:checked { background: var(--accent); box-shadow: none; }
.switch:checked::after { transform: translateX(16px); }
.pins-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); font-size: 13px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ---------- build spec ---------- */

.reveal > * { animation: rise 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.spec-empty { padding: 34px 6px; color: var(--muted); text-align: center; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 0 4px; }
.stat { padding: 12px 13px 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { display: block; margin-top: 2px; font-size: 22px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-2); }
.stat.wide { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.stat.wide b { font-size: 15px; margin: 0; letter-spacing: 0; }
.stat .badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; }
.stat.good .badge { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.stat.warn .badge { background: var(--accent-soft); color: var(--accent); }
.badge svg { width: 16px; height: 16px; }
.skill { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: 3px; }
.skill i { width: 14px; height: 4px; border-radius: 2px; background: var(--surface-3); }
.skill i.on { background: var(--accent); }

.spec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 8px; }
.spec-head span { font-size: 12.5px; color: var(--muted); }
.glass-list { display: flex; flex-direction: column; }
.glass { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 8px 6px; margin: 0 -6px; border: 0; border-radius: 10px; background: none; text-align: left; transition: background 0.15s; }
.glass:hover, .glass.on { background: var(--surface-2); }
.g-swatch { position: relative; width: 34px; height: 34px; border-radius: 9px; overflow: hidden; display: flex; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3); }
.g-swatch i { flex: 1; }
.g-swatch::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255, 255, 255, 0.42), transparent 46%); }
.g-swatch em { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; font: 700 12px/1 var(--font); font-style: normal; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75); }
.g-swatch em.on-pale { color: #2a2118; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6); }
.g-name, .g-sub, .s-name, .s-sub { display: block; }
.g-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-sub { font-size: 12.5px; color: var(--muted); }
.g-buy { text-align: right; font-variant-numeric: tabular-nums; }
.g-buy b { display: block; font-weight: 650; }
.g-buy span { font-size: 12px; color: var(--muted); }

.supply { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 9px 0; }
.supply + .supply { border-top: 1px solid var(--line); }
.s-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); color: var(--accent); }
.s-icon svg { width: 18px; height: 18px; }
.s-name { font-weight: 600; }
.s-sub { font-size: 12.5px; color: var(--muted); }
.s-val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.s-val span { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }

.check { display: flex; gap: 10px; width: 100%; padding: 9px 10px; margin-top: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); text-align: left; transition: border-color 0.15s; }
.check:hover { border-color: var(--line-2); }
.check .dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.check.advice .dot { background: var(--muted); }
.check b { font-weight: 620; }
.check span { display: block; font-size: 12.5px; color: var(--text-2); }
.footnote { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); text-wrap: pretty; }

/* ---------- overlays ---------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 80;
  max-width: min(520px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: pop 0.2s ease-out;
}
.drop-veil { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.drop-veil div { padding: 26px 34px; border: 2px dashed var(--accent); border-radius: 22px; font-size: 18px; font-weight: 650; background: var(--accent-soft); }

/* ---------- motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; } }
.toast { animation-name: fade; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes pulse { 0% { background: var(--accent-soft); border-color: var(--accent); } 100% { background: var(--surface); border-color: var(--line); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- smaller windows ---------- */

@media (max-width: 1180px) {
  .content { grid-template-columns: minmax(0, 1fr) 316px; }
  .dock-btn span { display: none; }
  .dock-btn { padding: 0 9px; }
}
@media (max-width: 980px) {
  .kpi:nth-child(n + 4) { display: none; }
}
/* fingers: larger targets on a tablet */
@media (pointer: coarse) {
  .pc-glass { gap: 7px; }
  .pc-glass button { width: 32px; height: 32px; border-radius: 9px; }
  .pc-actions button { height: 38px; padding: 0 13px; }
  .pc-fix { height: 36px; padding: 0 14px; }
  .pc-close { width: 34px; height: 34px; }
  .zoom-fit { height: 32px; }
  .b-price { height: 36px; }
  .btn.small { height: 38px; }
  .pct, .cur { height: 38px; }
  .phase summary { padding: 13px 12px; }
}
@media (pointer: coarse) and (min-width: 761px) {
  .tool { width: 44px; height: 44px; }
  .zoom-fit { width: 44px; }
  .frame-wrap { inset: 26px 80px 106px; }
  .piece-card { left: 80px; width: 272px; }
  .piece-card.right { right: 80px; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .app, .app[data-collapsed="true"] { grid-template-columns: minmax(0, 1fr); height: auto; }
  .sidebar { display: none; }
  .app[data-drawer="true"] .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 60; box-shadow: var(--shadow); }
  .app[data-drawer="true"] .brand-name, .app[data-drawer="true"] .new span, .app[data-drawer="true"] .side-label, .app[data-drawer="true"] .p-text, .app[data-drawer="true"] .foot-note, .app[data-drawer="true"] #themeLabel, .app[data-drawer="true"] .logo { display: revert; }
  .app[data-drawer="true"] .project-main { justify-content: flex-start; padding: 7px 6px; }
  .menu-btn, .app[data-collapsed="true"] .menu-btn { display: inline-grid; }
  .main { height: auto; overflow: visible; }
  .workspace { min-height: 100vh; }
  .content { display: block; }
  .stage { height: 62vh; min-height: 360px; }
  .frame-wrap { inset: 66px 14px 94px; }
  .tools { top: 10px; left: 50%; transform: translateX(-50%); flex-direction: row; }
  .tools-sep { width: 1px; height: 22px; margin: 0 3px; }
  .tool { width: 38px; height: 38px; }
  .zoom { top: auto; bottom: 68px; right: 10px; transform: none; padding: 3px; }
  .zoom .tool, .zoom[data-zoomed="false"] { display: none; }
  /* a sheet at the foot of the screen, so the piece it describes stays in view */
  .piece-card, .piece-card.right {
    position: fixed; z-index: 40; left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 44vh;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
  }
  .pc-grid { grid-template-columns: repeat(4, auto); justify-content: space-between; }
  .hint { bottom: 64px; }
  .dock { gap: 2px; padding: 5px; bottom: 16px; }
  .dock-sep { display: none; }
  .dock-btn { padding: 0 8px; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
  .tab-body { overflow: visible; }
  .kpi:nth-child(n + 3) { display: none; }
  .title-input { flex: 1; }
  .seg button { padding: 0 8px; font-size: 13px; }
  .welcome { min-height: 100vh; }
}
@media (max-width: 480px) {
  .kpi:nth-child(n + 2) { display: none; }
}

/* ---------- the pattern itself (SVG) ---------- */

.frame svg .l-photo, .frame svg .l-pattern, .frame svg .l-divider { display: none; }
.frame svg[data-view="pattern"] .l-pattern { display: inline; }
.frame svg[data-view="pattern"] .l-glass { display: none; }
.frame svg[data-view="photo"] .l-photo { display: inline; }
.frame svg[data-view="photo"] .l-glass, .frame svg[data-view="photo"] .flags, .frame svg[data-view="photo"] .hits { display: none; }
.frame svg[data-view="compare"] .l-photo, .frame svg[data-view="compare"] .l-divider { display: inline; }
.frame svg[data-view="compare"] { cursor: ew-resize; touch-action: none; }
.frame svg[data-view="compare"] .hits, .frame svg[data-view="compare"] .flags { display: none; }

.l-glass .pieces path { transition: opacity 0.2s; }
.l-glass .tex { mix-blend-mode: soft-light; opacity: 0.5; pointer-events: none; }
.l-glass .grain { mix-blend-mode: multiply; opacity: 0.1; pointer-events: none; }
.l-glass .light { mix-blend-mode: soft-light; pointer-events: none; }
.seam, .edge { fill: none; stroke: #15120f; stroke-linejoin: round; }
.sheen { fill: none; stroke: rgba(255, 255, 255, 0.2); stroke-width: 0.45; stroke-linejoin: round; }
.cutline { fill: none; stroke: #141414; stroke-width: 0.55; stroke-linejoin: round; }
.cutedge { fill: none; stroke: #141414; stroke-width: 1.2; }
.labels text { text-anchor: middle; font-family: var(--font); fill: #141414; pointer-events: none; }
.labels .num { font-weight: 700; }
.labels .code { fill: #6b6b6b; }

.hits path { fill: transparent; pointer-events: all; cursor: pointer; }
.frame.pinning .hits path { cursor: crosshair; }
.hover-outline { fill: rgba(255, 255, 255, 0.13); stroke: rgba(255, 255, 255, 0.92); stroke-width: 0.9; stroke-linejoin: round; pointer-events: none; }
.sel-outline { fill: none; stroke: #fff; stroke-width: 1.7; stroke-linejoin: round; pointer-events: none; filter: drop-shadow(0 0 1.5px var(--sel)) drop-shadow(0 0 5px var(--sel)); }
.frame svg[data-view="pattern"] .hover-outline { fill: rgba(244, 184, 96, 0.28); stroke: #b5620c; }
.frame svg[data-view="pattern"] .sel-outline { stroke: #b5620c; filter: none; fill: rgba(244, 184, 96, 0.38); }
.flag { pointer-events: none; }
.flag circle { fill: #f4b860; stroke: #15120f; stroke-width: 0.8; }
.flag path { fill: none; stroke: #15120f; stroke-width: 1.3; stroke-linecap: round; }
.pin { pointer-events: none; }
.pin circle { fill: rgba(255, 255, 255, 0.28); stroke: #fff; stroke-width: 0.9; }
.pin .core { fill: #fff; stroke: none; }
.l-divider { pointer-events: none; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.7)); }
.l-divider line { stroke: #fff; stroke-width: 0.8; }
.knob circle { fill: #fff; }
.knob path { fill: none; stroke: #222; stroke-width: 0.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- editing the pattern (SVG) ---------- */

.frame[data-tool="split"] svg, .frame[data-tool="split"] .hits path { cursor: crosshair; }
.frame[data-tool="move"] .hits path { cursor: default; }
.frame.panning svg, .frame.panning .hits path { cursor: grabbing; }
.frame.dragging .tex, .frame.dragging .grain { display: none; }
.frame svg[data-view="photo"] .fails, .frame svg[data-view="photo"] .targets, .frame svg[data-view="photo"] .locks, .frame svg[data-view="photo"] .overlay,
.frame svg[data-view="compare"] .fails, .frame svg[data-view="compare"] .targets, .frame svg[data-view="compare"] .locks, .frame svg[data-view="compare"] .overlay { display: none; }

.fails path { fill: rgba(244, 184, 96, 0.14); stroke: #f4b860; stroke-width: 1.4; stroke-linejoin: round; pointer-events: none; filter: drop-shadow(0 0 2.5px #f4b860); animation: glow 1.7s ease-in-out infinite alternate; }
.frame svg[data-view="pattern"] .fails path { fill: rgba(244, 184, 96, 0.32); stroke: #b5620c; filter: none; }
@keyframes glow { from { opacity: 0.5; } to { opacity: 1; } }
.targets path { fill: rgba(255, 255, 255, 0.08); stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.5px; vector-effect: non-scaling-stroke; stroke-dasharray: 5 4; stroke-linejoin: round; pointer-events: none; }
.frame svg[data-view="pattern"] .targets path { fill: rgba(26, 115, 209, 0.1); stroke: #1a73d1; }
.lock-mark { pointer-events: none; }
.lock-mark circle { fill: rgba(20, 18, 15, 0.74); }
.lock-mark rect { fill: #fff; }
.lock-mark path { fill: none; stroke: #fff; stroke-width: 0.7; }

.overlay { pointer-events: none; }
.handles { display: none; }
.frame[data-tool="move"] .handles { display: inline; }
.handle { pointer-events: all; cursor: grab; }
.handle .grab { fill: transparent; }
.handle .dot { fill: #fff; stroke: #15120f; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.handle.via .dot { fill: #f4b860; }
.handle.border .dot { fill: #c9d1dd; }
.handle:hover .dot, .handle.held .dot { fill: #8ccaff; }
.handle.held { cursor: grabbing; }
.frame.blocked .handle.held .dot { fill: #ff8076; }
.draft { fill: none; stroke: #fff; stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-dasharray: 7 5; filter: drop-shadow(0 0 1px #000); }
.preview path { vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.preview .cut { fill: none; stroke: #f4b860; stroke-width: 2.5px; stroke-dasharray: 7 5; filter: drop-shadow(0 0 1px #000); }
.preview .into { fill: rgba(244, 184, 96, 0.3); stroke: #f4b860; stroke-width: 2.5px; }
.flash { pointer-events: none; }
.flash.cut { fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 2px #8ccaff); animation: draw-on 0.8s ease-out forwards; }
.flash.piece { fill: rgba(255, 255, 255, 0.4); stroke: #fff; stroke-width: 1.5; animation: flash-out 0.8s ease-out forwards; }
@keyframes draw-on { 0% { stroke-dashoffset: 1; opacity: 1; } 55% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes flash-out { from { opacity: 1; } to { opacity: 0; } }
