:root {
  --bg: #0f1114;
  --bg-2: #171a1f;
  --panel: rgba(21, 23, 28, 0.86);
  --panel-solid: #16181d;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eef0f3;
  --muted: #9097a3;
  --accent: #ff8000;
  --accent-ink: #1a0e00;
  --danger: #ff5a5f;
  --radius: 18px;
  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--text);
  background: radial-gradient(120% 90% at 50% 20%, #1c2027 0%, var(--bg) 60%) fixed, var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

#view {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(130% 100% at 50% 40%, transparent 55%, rgba(0,0,0,.45) 100%);
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  pointer-events: none;
  z-index: 5;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
}
.chip {
  border: 1px solid var(--line-2);
  background: rgba(20,22,26,.7);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: rgba(255,255,255,.28); }

/* ---------- several prints ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.prints-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 46vw; }
.prints-chip span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prints-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 600; background: var(--accent); color: var(--accent-ink);
}
.prints-dlg { width: min(420px, calc(100vw - 32px)); }
.prints-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prints-head h3 { margin: 0; }
.prints-list { display: grid; gap: 8px; margin: 4px 0 12px; max-height: min(52vh, 420px); overflow-y: auto; }
.print-row { display: flex; align-items: stretch; gap: 6px; border: 1px solid var(--line-2); border-radius: 14px; background: rgba(255,255,255,.02); }
.print-row.current { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.print-go { flex: 1; min-width: 0; display: grid; grid-template-columns: 12px 1fr; gap: 4px 10px; align-items: center; padding: 10px 4px 10px 12px; text-align: left; background: none; border: 0; color: inherit; cursor: pointer; font: inherit; }
.print-row.current .print-go { cursor: default; }
.print-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.print-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-title small { font-weight: 500; color: var(--accent); margin-left: 6px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.print-sub { grid-column: 2; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-bar { grid-column: 2; height: 3px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.print-bar i { display: block; height: 100%; background: var(--accent); }
.print-act { display: grid; place-items: center; width: 40px; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 12px; }
.print-act:hover { color: var(--text); background: rgba(255,255,255,.05); }
.prints-add { width: 100%; }
.prints-split { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.prints-split.hidden { display: none; }
@media (hover: none) { .print-act.newtab { display: none; } }

/* a pane of the split view: the outer page shows the brand */
body.embed .brand { display: none; }
body.embed .topbar { justify-content: flex-end; }

/* split view (laptops): 2 or 3 prints side by side, each pane a full printsim page */
body.split-mode > :not(.split-bar):not(.split-grid) { display: none !important; }
.split-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 5;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-bottom: 1px solid var(--line-2); background: var(--panel-solid);
}
.split-bar .brand { margin-right: auto; font-size: 15px; }
.split-bar .brand span { color: var(--muted); font-weight: 500; font-family: var(--body, inherit); font-size: 13px; margin-left: 6px; }
.split-grid { position: fixed; top: 44px; left: 0; right: 0; bottom: 0; display: grid; gap: 1px; background: var(--line-2); }
.split-grid iframe { width: 100%; height: 100%; border: 0; display: block; background: #0f1114; }

/* ---------- landing ---------- */
.landing {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 80px 16px calc(24px + var(--safe-b));
  z-index: 3;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(15,17,20,.35), rgba(15,17,20,.75) 70%);
}
.landing-inner { width: 100%; max-width: 460px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.landing h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(32px, 8vw, 46px); line-height: 1.02; letter-spacing: -0.035em;
  margin: 0 0 14px;
}
.lede { margin: 0 0 26px; color: #c3c8d0; font-size: 16px; line-height: 1.5; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 18px;
  border: 1.5px dashed rgba(255,255,255,.22);
  border-radius: var(--radius);
  background: rgba(255,255,255,.035);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  text-align: center;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(255,255,255,.06); }
.drop.over { transform: scale(1.01); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { color: var(--accent); margin-bottom: 4px; }
.drop strong { font-size: 16px; font-weight: 600; }
.fine { font-size: 12.5px; color: var(--muted); text-align: center; margin: 6px 0 26px; }
.linkbtn {
  display: block; margin: 14px auto 0; padding: 6px 10px;
  background: none; border: 0; cursor: pointer;
  color: var(--text); font-size: 14px; font-weight: 500;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent);
  text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: s; }
.steps li {
  counter-increment: s;
  display: flex; gap: 12px; align-items: baseline;
  font-size: 14px; color: #c3c8d0;
}
.steps li::before {
  content: counter(s);
  flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 12px var(--display);
  background: rgba(255,255,255,.08); color: var(--text);
}
.steps b { color: var(--text); font-weight: 600; }

/* ---------- loading ---------- */
.loading {
  position: fixed; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(15,17,20,.8);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-size: 14px; color: #c3c8d0;
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.12); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading .bar { width: 200px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.loading .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }

/* ---------- view controls ---------- */
.viewctl {
  position: fixed; right: 12px; top: calc(62px + var(--safe-t));
  display: flex; flex-direction: column; gap: 8px; z-index: 4;
}
.viewctl button {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  background: rgba(20,22,26,.72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer; color: #cfd4db;
}
.viewctl button[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.legend {
  position: fixed; left: 12px; top: calc(56px + var(--safe-t)); z-index: 4;
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(20,22,26,.72); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 12px; color: #cfd4db;
}
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- sheet ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  max-height: 78vh; overflow-y: auto;
  padding: 6px 16px calc(16px + var(--safe-b));
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--line-2);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,.35);
  overscroll-behavior: contain;
}
.grabber {
  display: block; width: 100%; height: 22px; margin: 0 0 4px;
  border: 0; background: transparent; cursor: pointer; padding: 0;
}
.grabber i { display: block; width: 38px; height: 4px; margin: 8px auto; border-radius: 4px; background: rgba(255,255,255,.22); }
.sheet.collapsed .collapsible,
.sheet.collapsed .scrub,
.sheet.collapsed .stats,
.sheet.collapsed .more,
.sheet.collapsed .file-row .file-text .muted { display: none; }
@media (min-width: 900px) {
  .sheet {
    left: 24px; right: auto; bottom: 24px; width: 400px;
    border-radius: 22px; border: 1px solid var(--line-2);
    max-height: calc(100vh - 110px);
  }
  .grabber { display: none; }
  .viewctl { right: 24px; }
  .legend { left: auto; right: 76px; }
}

.panel { display: flex; flex-direction: column; gap: 16px; }
.label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.file-row { display: flex; gap: 12px; align-items: center; }
.thumb {
  width: 52px; height: 52px; border-radius: 12px; flex: none; overflow: hidden;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-text { min-width: 0; }
.file-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.scrub-head { display: flex; justify-content: space-between; align-items: baseline; }
.scrub .label { margin-bottom: 4px; }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; background: transparent; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 3px solid var(--accent); }

select, .temps input, .resync-input input {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
select { width: 100%; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239097a3' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
select option { background: var(--panel-solid); }
select:focus, .temps input:focus, .resync-input input:focus { border-color: var(--accent); }
.temps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.temps label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.temps input { width: 100%; min-width: 0; font-family: var(--display); font-size: 17px; color: var(--text); padding: 9px 10px; }
.temps span { color: var(--muted); }
.spool-amt { grid-template-columns: minmax(0, 160px); }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.12);
  cursor: pointer; padding: 0; position: relative;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,.25), inset 0 3px 6px rgba(255,255,255,.18);
}
.swatch[aria-checked="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.swatch.custom {
  background: conic-gradient(#ff4d4d, #ffd24d, #4dff88, #4dd2ff, #7a4dff, #ff4dd2, #ff4d4d);
  overflow: hidden;
}
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

.btn {
  border: 1px solid var(--line-2);
  background: rgba(255,255,255,.06);
  border-radius: 14px;
  padding: 11px 14px;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.1); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.icon { padding: 11px 12px; display: grid; place-items: center; }
.btn.big { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px; border-radius: 16px; }
.btn.big span { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.btn.big small { font-weight: 500; font-size: 12.5px; opacity: .8; }

/* ---------- running ---------- */
.banner {
  padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  font-size: 14px; line-height: 1.4;
}
.banner b { display: block; margin-bottom: 2px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.pct { font-family: var(--display); font-weight: 700; font-size: 64px; line-height: .9; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.pct small { font-size: 26px; margin-left: 2px; color: var(--muted); letter-spacing: 0; }
.hero-right { text-align: right; padding-bottom: 4px; }
.remain { font-family: var(--display); font-weight: 600; font-size: 20px; font-variant-numeric: tabular-nums; }
.progress { position: relative; height: 8px; border-radius: 8px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #fff 0%), var(--accent));
  border-radius: 8px;
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 60%, transparent);
}
.progress.startup i { background: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 8px, rgba(255,255,255,.12) 8px 16px); width: 100% !important; animation: slide 1s linear infinite; background-size: 22.6px 22.6px; }
@keyframes slide { to { background-position: 22.6px 0; } }
/* paused: nothing on the bar moves (the warm-up stripes stop sliding) */
.progress.paused i { animation-play-state: paused; opacity: .55; box-shadow: none; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats > div {
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.stats .wide { grid-column: 1 / -1; }
.stats .k { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stats .v { font-family: var(--display); font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }
.actions .btn.icon { flex: 0 0 auto; }
.more { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.more-actions { display: flex; gap: 8px; }
.more-actions .btn { flex: 1; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.done-title { font-family: var(--display); font-size: 28px; letter-spacing: -.03em; margin: 4px 0 0; }
#panel-done p { margin: 0; line-height: 1.5; }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--panel-solid);
  color: var(--text);
  padding: 20px;
  width: min(360px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
dialog h3 { margin: 0 0 6px; font-family: var(--display); font-size: 20px; letter-spacing: -.02em; }
dialog p { margin: 0 0 16px; line-height: 1.45; }
dialog .actions { margin-top: 16px; }
.resync-input { display: flex; align-items: center; gap: 8px; }
.resync-input input { flex: 1; font-family: var(--display); font-size: 34px; font-weight: 700; padding: 8px 14px; text-align: center; }
.resync-input span { font-family: var(--display); font-size: 28px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%);
  z-index: 9;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(30,33,39,.95); border: 1px solid var(--line-2);
  font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) {
  .spinner, .progress.startup i { animation: none; }
}
.banner-actions { display: flex; gap: 8px; margin-top: 10px; }
.banner-actions .btn { flex: 1; padding: 9px 12px; }

/* compact setup on phones */
#panel-setup { gap: 14px; }
#panel-setup .field { margin: 0; }
#panel-setup .collapsible { display: flex; flex-direction: column; gap: 14px; }
#panel-setup .swatches { flex-wrap: nowrap; overflow-x: auto; padding: 4px 2px 6px; margin: -4px -2px -6px; scrollbar-width: none; }
#panel-setup .swatches::-webkit-scrollbar { display: none; }
.swatch { flex: none; }
#btn-start {
  position: sticky; bottom: 0; z-index: 2;
  box-shadow: 0 -6px 14px 2px rgba(22,24,29,.9);
}
#btn-extruding { flex-basis: 100%; }
@media (max-width: 899px) {
  body[data-mode="setup"] .sheet { max-height: 58vh; }
}

/* ---------- timelapse player ---------- */
.player { display: flex; align-items: center; gap: 12px; }
.play {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.play:active { transform: scale(.94); }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.play .i-play { margin-left: 2px; }
.speeds { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.seg button {
  border: 0; background: none; cursor: pointer;
  padding: 6px 10px; border-radius: 9px;
  font: 600 13px var(--display); color: var(--muted); font-variant-numeric: tabular-nums;
}
.seg button[aria-checked="true"] { background: rgba(255,255,255,.14); color: var(--text); }
.pill {
  border: 1px solid var(--line-2); background: none; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted);
}
.pill[aria-pressed="true"] { color: var(--text); border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.speed-note { margin-top: 8px; }
.sheet.collapsed .scrub { display: block; }
.sheet.collapsed .speeds, .sheet.collapsed .speed-note, .sheet.collapsed .warn { display: none; }

/* ---------- support warning ---------- */
.warn {
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 64, 52, .12);
  border: 1px solid rgba(255, 90, 80, .45);
  font-size: 13.5px; line-height: 1.45; color: #ffd9d6;
}
.warn b { display: block; color: #fff; font-size: 14.5px; margin-bottom: 3px; }
.warn .toggle { margin-top: 10px; font-size: 13px; color: #ffd9d6; }
.samples { display: flex; flex-direction: column; align-items: center; }
.linkbtn.subtle { margin-top: 2px; font-size: 13px; color: var(--muted); text-decoration-color: rgba(255,90,80,.6); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two-col select { min-width: 0; }
.material-note { margin-top: -6px; }

.speed-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-top: 10px; }
.speed-row input { width: 80px; background: rgba(255,255,255,.06); border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 9px; font-family: var(--display); font-size: 15px; color: var(--text); outline: none; }
.speed-row input:focus { border-color: var(--accent); }

/* ---------- landing: new-user blurb ---------- */
.about {
  margin: 0 0 22px; padding: 18px 18px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,.03);
}
.about h2 { margin: 0 0 8px; font: 600 17px/1.25 var(--display); letter-spacing: -0.01em; }
.about p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.5; color: #c3c8d0; }
.about p b { color: var(--text); }
.perks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.perks li { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.perks b { color: var(--text); font-size: 13.5px; font-weight: 600; }
.perks b::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 0 7px 2px 0; }
.fine.tail { margin: 22px 0 0; }
@media (max-width: 380px) { .perks { grid-template-columns: 1fr; } }

/* ---------- ghost hint (laptops only; JS also checks) ---------- */
.ghost-hint {
  position: fixed; z-index: 6; transform: translate(6px, -50%); opacity: 0;
  transition: opacity .25s, transform .25s;
  display: flex; align-items: flex-start; gap: 10px;
  width: 270px; padding: 11px 10px 11px 14px; border-radius: 14px;
  background: rgba(30,33,39,.96); border: 1px solid var(--line-2);
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
  font-size: 13px; line-height: 1.4; color: #c3c8d0;
  pointer-events: auto;
}
.ghost-hint.in { opacity: 1; transform: translate(0, -50%); }
.ghost-hint b { color: var(--text); font-weight: 600; }
.ghost-hint::after {
  content: ''; position: absolute; right: -6px; top: 50%; width: 10px; height: 10px;
  background: inherit; border: inherit; border-width: 1px 1px 0 0; transform: translateY(-50%) rotate(45deg);
}
.ghost-hint button {
  flex: none; width: 24px; height: 24px; margin: -3px 0 0; border-radius: 8px; border: 0;
  display: grid; place-items: center; background: none; color: var(--muted); cursor: pointer;
}
.ghost-hint button:hover { color: var(--text); background: rgba(255,255,255,.08); }
@media (max-width: 899px), (hover: none), (pointer: coarse) { .ghost-hint { display: none !important; } }

/* ---------- phones ---------- */
/* landing: centre when it fits, scroll from the top when it doesn't */
.landing { display: flex; place-items: initial; }
.landing-inner { margin: auto; }
/* iOS zooms the page when a focused input's text is under 16px */
.speed-row input { font-size: 16px; }
@media (pointer: coarse) {
  .seg button { padding: 9px 12px; }
  .pill { padding: 9px 13px; }
  .viewctl button { width: 44px; height: 44px; }
  .swatch { width: 34px; height: 34px; }
  .linkbtn { padding: 10px 12px; }
}
@media (max-width: 899px) {
  .landing { padding-top: calc(64px + var(--safe-t)); }
  .landing h1 { font-size: clamp(30px, 8.6vw, 40px); }
  .lede { margin-bottom: 20px; font-size: 15.5px; }
}
@media (max-width: 899px) and (max-height: 700px) {
  .landing .eyebrow { margin-bottom: 6px; }
  .landing h1 { margin-bottom: 10px; }
  .drop { padding: 18px 16px; }
}
/* phone on its side: the bottom sheet would cover the whole view, so it
   becomes a side card like on laptops */
@media (orientation: landscape) and (max-height: 520px) {
  .topbar { padding: calc(8px + var(--safe-t)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .sheet, body[data-mode="setup"] .sheet {
    left: max(10px, env(safe-area-inset-left)); right: auto; bottom: 10px; top: 52px;
    width: min(46vw, 380px); max-height: none;
    border-radius: 18px; border: 1px solid var(--line-2);
    padding-bottom: 12px;
  }
  .grabber { display: none; }
  .viewctl { top: 52px; right: max(10px, env(safe-area-inset-right)); gap: 6px; }
  .viewctl button { width: 38px; height: 38px; }
  .legend { top: 52px; left: auto; right: 60px; }
  .landing { padding: 56px 24px 16px; }
  .landing-inner { max-width: 520px; }
}
/* short phones: tighter run panel so the print keeps most of the screen */
@media (max-width: 899px) and (max-height: 760px) and (orientation: portrait) {
  #panel-run { gap: 12px; }
  .pct { font-size: 52px; }
  .stats { grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
  .stats .wide { grid-column: auto; }
  .stats > div { padding: 8px 10px; }
  .stats .v { font-size: 14.5px; }
  /* warm-up: layer and height say nothing yet, so the printer's status gets the whole row */
  .stats.prep > div:not(.wide) { display: none; }
  .stats.prep .wide { grid-column: 1 / -1; }
}

/* ---------- calendar reminders ---------- */
.cal-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 5px 10px; font-size: 12.5px; }
.cal-pill svg { flex: none; }
@media (pointer: coarse) { .cal-pill { padding: 7px 11px; } }
.cal-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  font-size: 14px;
}
.cal-list li b { font-weight: 600; }
.cal-list li span { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-note:empty { display: none; }
.cal-buttons { display: flex; flex-direction: column; gap: 8px; }
.cal-buttons .btn { text-align: center; text-decoration: none; color: inherit; }
.cal-buttons .btn.primary { color: var(--accent-ink); }
.cal-link { align-self: center; margin-top: 2px; font-size: 13px; color: var(--muted); }
/* short phones: the pill would push the hero taller than the % */
@media (max-width: 899px) and (max-height: 760px) and (orientation: portrait) {
  .cal-pill { margin-top: 5px; }
}

/* ---------- timelapse video ---------- */
.rec-pill { display: inline-flex; align-items: center; gap: 7px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff4d4d; flex: none; }
.rec-pill.recording { color: var(--text); border-color: rgba(255,77,77,.6); background: rgba(255,77,77,.14); }
.rec-pill.recording .rec-dot { animation: rec-blink 1s ease-in-out infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-pill.recording .rec-dot { animation: none; } }
#dlg-video { width: min(420px, calc(100vw - 32px)); }
.video-out { display: block; width: 100%; max-height: 52vh; object-fit: contain; border-radius: 14px; background: #000; margin: 6px 0 8px; }
.video-meta { margin: 0 0 12px; }

/* ---------- More toggle: chevron down when closed, flips up when open ---------- */
.more-toggle .chev { transition: transform .22s cubic-bezier(.3,.7,.3,1); }
.more-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.more-toggle[aria-expanded="true"] { background: rgba(255,255,255,.12); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
@media (prefers-reduced-motion: reduce) { .more-toggle .chev { transition: none; } }
/* collapsed sheet hides the options, so the chevron points down again */
.sheet.collapsed .more-toggle .chev { transform: none; }

/* ---------- landing: the spinning printer never sits behind the text ---------- */
/* phones held upright: the printer gets its own band at the top; the text below
   sits on solid background that scrolls with it (background-attachment: local) */
@media (max-width: 899px) and (orientation: portrait) {
  .landing {
    --stage: max(230px, 34vh);
    padding-top: var(--stage);
    background: linear-gradient(180deg, rgba(15,17,20,0) 0, rgba(15,17,20,0) calc(var(--stage) - 56px), var(--bg) calc(var(--stage) - 6px)) local;
  }
  .landing-inner { margin: 0 auto auto; }
}
/* laptops and phones on their side: text in a column on the left, printer on the right */
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) {
  .landing {
    right: auto; width: min(560px, 48vw);
    padding: 88px 84px 32px 48px;
    background: linear-gradient(90deg, rgba(15,17,20,.96) 0, rgba(15,17,20,.96) calc(100% - 72px), rgba(15,17,20,0));
  }
  .landing-inner { margin: auto 0; max-width: 440px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .landing { width: min(56vw, 480px); padding: 56px 56px 16px max(20px, env(safe-area-inset-left)); }
}

/* landing: still scrolls (wheel, trackpad, touch), without a scrollbar in the middle of the screen */
.landing { scrollbar-width: none; -ms-overflow-style: none; }
.landing::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ---------- resync by time left ---------- */
.resync-left { margin-top: 16px; }
.resync-left .label em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 500; }
.resync-hm { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resync-hm label { display: flex; align-items: center; gap: 8px; }
.resync-hm input {
  width: 100%; min-width: 0; text-align: center;
  font-family: var(--display); font-size: 22px; font-weight: 600;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 10px; outline: none;
}
.resync-hm input:focus { border-color: var(--accent); }
.resync-hm span { font-family: var(--display); font-size: 18px; color: var(--muted); }

/* ---------- when did it finish? ---------- */
.finish-opts { display: flex; flex-direction: column; gap: 8px; }
.finish-opt {
  display: flex; align-items: center; gap: 10px; min-height: 48px;
  padding: 8px 12px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  font-size: 15px; font-weight: 500;
}
.finish-opt:has(input[type=radio]:checked) { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.finish-opt input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.finish-opt input[type=time] {
  margin-left: auto; min-width: 0; color-scheme: dark;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 6px 8px; font-family: var(--display); font-size: 16px; outline: none;
}
.finish-opt input[type=time]:focus { border-color: var(--accent); }
#fin-note:empty { display: none; }
.fin-later { margin-top: 10px; }

/* ---------- which printer (named units) ---------- */
.unit-row { display: flex; gap: 8px; align-items: center; }
.unit-row select { flex: 1; min-width: 0; }
.unit-row .btn.icon { padding: 9px 10px; flex: none; }
.unit-name {
  width: 100%; font-size: 17px; padding: 11px 12px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-2); border-radius: 12px; outline: none;
}
.unit-name:focus { border-color: var(--accent); }
