/* Meydn Web (1A) — visual identity from web/index.html + web/legal/legal.css */

:root {
  --bg: #0c0c0a;
  --bg-elevated: #131210;
  --ink: #f3ede2;
  --ink-dim: #a8a094;
  --ink-quiet: #6b665c;
  --accent: #c9a66b;
  --rule: rgba(243, 237, 226, 0.08);
  --rule-strong: rgba(243, 237, 226, 0.18);
  --err: #ff8080;
  --warn: #f4c150;

  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Motion language — must match EASE/DUR in motion.js exactly. */
  --ease-settle: cubic-bezier(0.2, 0, 0.2, 1);   /* arriving / resolving */
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);       /* leaving */
  --dur-1: 120ms;   /* micro: hovers, toggles, repeated actions */
  --dur-2: 220ms;   /* standard: most transitions */
  --dur-3: 400ms;   /* deliberate: entrances, seam dissolves */
  --dur-4: 640ms;   /* cinematic: signatures only */

  --glass-bg: rgba(19, 18, 16, 0.72);                 /* ~--bg-elevated, translucent */
  --glass-blur: 12px;                                 /* solid glass chrome (tool bar, pills) */
  --glass-blur-soft: 8px;                             /* gradient-fade headers (landing + workspace) */
  --glass-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* film grain (marketing-page surfaces only — toggled by body class) */
body.grain::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* — typography vocabulary, matching web/index.html — */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.015em;
}

.logo {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.eyebrow-rule {
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow-rule::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--ink-dim);
}

.muted { color: var(--ink-dim); }
.quiet { color: var(--ink-quiet); }
.small { font-size: 13px; }

/* — pill button — matches nav-cta on the marketing site — */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  padding: 10px 18px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--dur-2) var(--ease-settle);
  font-weight: 400;
}
.pill:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.pill:disabled {
  opacity: 0.5;
  cursor: default;
}
.pill:disabled:hover {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}
.pill.pill-accent {
  border-color: var(--accent);
  color: var(--accent);
}
.pill.pill-accent:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.pill-ghost {
  background: transparent;
  color: var(--ink-dim);
  border: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 0;
  transition: color var(--dur-2) var(--ease-settle);
}
.pill-ghost:hover { color: var(--ink); }

/* Header action pills: glass, icon + label. */
.header-actions .pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--rule-strong);
  box-shadow: var(--glass-shadow);
}
.header-actions .pill .pill-icon { display: inline-flex; width: 15px; height: 15px; }
.header-actions .pill .pill-icon svg { width: 100%; height: 100%; }
.header-actions .pill.pill-accent { border-color: var(--accent); color: var(--accent); }
.header-actions .pill:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.header-actions .pill.pill-accent:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* — empty state — */

.empty-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, rgba(12,12,10,0.85) 0%, rgba(12,12,10,0) 100%);
  backdrop-filter: blur(var(--glass-blur-soft));
  -webkit-backdrop-filter: blur(var(--glass-blur-soft));
}

.empty-state {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 120px 40px 80px;
}

.empty-eyebrow {
  margin-bottom: -8px;
}

.empty-headline {
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 84px);
  line-height: 1.0;
  letter-spacing: -0.025em;
  font-weight: 400;
  color: var(--ink);
  text-align: center;
  max-width: 18ch;
}
.empty-headline em {
  font-style: italic;
}

.empty-sub {
  font-family: var(--sans);
  font-size: clamp(15px, 1.3vw, 17px);
  color: var(--ink-dim);
  text-align: center;
  max-width: 52ch;
  margin-top: -16px;
}

/* Staged entrance: the landing composes itself top-down with the base settle
   curve. Targets the five meaningful children individually so #status (empty)
   never animates. Reduced-motion strips the transform via the global pass. */
@keyframes meydn-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.empty-eyebrow,
.empty-headline,
.empty-sub,
#upload-form,
#sample-form {
  animation: meydn-rise var(--dur-3) var(--ease-settle) both;
}
.empty-eyebrow { animation-delay: 0ms; }
.empty-headline { animation-delay: 60ms; }
.empty-sub { animation-delay: 120ms; }
#upload-form { animation-delay: 180ms; }
#sample-form { animation-delay: 240ms; }

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 520px;
  max-width: 90vw;
  height: 220px;
  border: 1px dashed var(--rule-strong);
  background: rgba(243, 237, 226, 0.02);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color var(--dur-2) var(--ease-settle), background var(--dur-2) var(--ease-settle);
  position: relative;
}
.drop-zone::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  pointer-events: none;
  transition: border-color var(--dur-2) var(--ease-settle);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(201, 166, 107, 0.05);
}
.drop-zone:hover::before, .drop-zone.drag-over::before {
  border-color: rgba(201, 166, 107, 0.2);
}
.drop-zone-main {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  color: var(--ink);
}
.drop-zone-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* — workspace — */

/* Floating glass header over the top of the image (gradient fade, like the landing). */
.workspace-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  /* Above #preparing (z-7) so the logo/brand stays visible over the opaque
     "Initializing Meydn" loader (which sits above the tool bar at z-6). */
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* padding tuned so the .logo lands at the SAME (x=40, y=24) as the landing
     .empty-header — the taller action pills nudge the centered logo up ~1.5px,
     so 22.5px top (vs the landing's 24px) cancels it and the logo doesn't jump
     across the landing→workspace transition. */
  padding: 22.5px 40px;
  background: linear-gradient(to bottom, rgba(12,12,10,0.82) 0%, rgba(12,12,10,0) 100%);
  -webkit-backdrop-filter: blur(var(--glass-blur-soft));
  backdrop-filter: blur(var(--glass-blur-soft));
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}

/* Workspace page fills exactly the viewport: header + workspace + roll stack in
   a flex column so the roll sits at the bottom instead of being pushed below the
   fold. The workspace (flex:1, min-height:0) shrinks to make room for the roll;
   min-height:0 is required or the grid child refuses to shrink below its content. */
body.workspace-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Edge-to-edge: the canvas fills the whole workspace; header + tool bar float over it. */
.workspace {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
.workspace > .canvas-wrap { position: absolute; inset: 0; }

.canvas-wrap {
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
#preview-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  cursor: grab;
  /* No CSS transition — the JS compare-animation drives the transform
     directly per frame via applyViewportZoom, lerped by compareStrength.
     A CSS transition here would fight that loop and produce the
     "collapse to the side and back" stutter. */
}
#preview-canvas:active { cursor: grabbing; }

/* Reveal overlay — vanishing-point construction + corner readouts shown
   on first load while the raw image is on screen. Positioned absolute
   like the canvas; their CSS transform is set imperatively in lockstep
   with #preview-canvas's transform so the overlay tracks the viewport
   zoom. Default opacity 0 so they're invisible until the reveal
   sequence fades them in. */
#reveal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-settle);
}
#reveal-overlay .reveal-ray {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.25;
  /* Non-scaling-stroke keeps lines at 1.25 CSS pixels regardless of the
     canvas's CSS transform, so they don't get thick when the viewport
     zooms in. */
  vector-effect: non-scaling-stroke;
  opacity: 0.7;
}
#reveal-overlay .reveal-vp {
  fill: var(--accent);
  opacity: 0.85;
}
#reveal-readouts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-settle);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.reveal-readout {
  position: absolute;
  padding: 6px 10px;
  white-space: pre;
}
.reveal-readout.reveal-tl { top: 16px; left: 20px; }
.reveal-readout.reveal-tr { top: 16px; right: 20px; text-align: right; }
.reveal-readout.reveal-bl { bottom: 16px; left: 20px; }
.reveal-readout.reveal-br { bottom: 16px; right: 20px; text-align: right; }

.reveal-on #reveal-overlay,
.reveal-on #reveal-readouts { opacity: 1; }

/* Lines-only mode used by the click-hold compare gesture: rays show,
   readouts do not — the readouts are a "look at this measurement"
   beat that belongs only to the initial reveal. */
.reveal-lines #reveal-overlay { opacity: 1; }

/* Advanced controls parked for v1 (spec 2026-06-01). Markup + JS wiring kept
   intact so this is a one-line revert. */
#advanced { display: none; }
/* Diagnostics + reset are dev-facing; hidden from the product. Kept in the DOM
   so app.js writes to the meta readouts and the reset button never throw. */
#detection-meta { display: none; }
#reset-btn { display: none; }

.callout {
  background: rgba(244, 193, 80, 0.06);
  border: 1px solid rgba(244, 193, 80, 0.28);
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 3px;
  color: var(--warn);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
}

.banner {
  background: rgba(201, 166, 107, 0.06);
  border: 1px solid var(--rule);
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 3px;
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 13px;
}
.banner.err {
  background: rgba(255, 128, 128, 0.06);
  border-color: rgba(255, 128, 128, 0.3);
  color: var(--err);
}

#status:not(:empty) {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
}
#status .banner {
  background: var(--bg-elevated);
  border: 1px solid var(--rule-strong);
  padding: 14px 22px;
  margin: 0;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* — unsupported / not-supported page — */

.unsupported {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
  padding: 120px 40px 80px;
}
.unsupported h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 400;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.unsupported p {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink-dim);
  max-width: 50ch;
}

.cta-app-store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--bg);
  padding: 16px 32px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all var(--dur-3) var(--ease-settle);
  border: 1px solid var(--ink);
}
.cta-app-store:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* Model-initializing loader. Fills the canvas (opaque --bg) so the image is
   hidden until the model is ready, then fades out as the image fades in.
   Shown/hidden by toggling .is-on (opacity), not display, so it can cross-fade. */
#preparing {
  position: absolute; inset: 0; z-index: 7; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-3) var(--ease-settle);
}
#preparing.is-on { opacity: 1; }
.preparing-label { font-family: var(--serif); font-size: 22px; color: var(--ink); }
.preparing-track {
  width: 240px; height: 3px; background: var(--rule);
  border-radius: 2px; overflow: hidden;
}
.preparing-fill { height: 100%; width: 0%; background: var(--accent); transition: width .15s linear; }
.preparing-pct { font-family: var(--mono); font-size: 12px; color: var(--ink-quiet); min-height: 1em; }
/* Cached model: no real byte progress, so slide an indeterminate sliver. */
#preparing.indeterminate .preparing-fill {
  width: 38%; transition: none;
  animation: meydn-indet 1.1s ease-in-out infinite;
}
@keyframes meydn-indet {
  0%   { margin-left: -38%; }
  100% { margin-left: 100%; }
}

/* Analyzing progress bar — over the faded-in image (metaball shimmer behind).
   The fill width is driven per-frame from JS (fast→slow easing), so no width
   transition here. Shown/hidden via .is-on opacity. */
#analyzing {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 34px 54px;
  /* Soft scrim so the indicator stays legible centered over any image content
     (the metaball already dims the photo; this is insurance over bright skies). */
  background: radial-gradient(62% 62% at 50% 50%, rgba(12, 12, 10, 0.55), rgba(12, 12, 10, 0) 72%);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-3) var(--ease-settle);
}
#analyzing.is-on { opacity: 1; }
.analyzing-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}
.analyzing-track {
  width: 240px; height: 3px; background: rgba(0, 0, 0, 0.4);
  border-radius: 2px; overflow: hidden; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
.analyzing-fill { height: 100%; width: 0%; background: var(--accent); }

/* — camera roll — */
.roll { border-top: 1px solid var(--rule-strong); background: #0a0a08; flex: 0 0 auto; }
/* Reserve the populated height (thumb 66 + scroller padding 24) so an empty
   scroller — e.g. the server-rendered first paint before JS adds tiles — doesn't
   collapse to the +-panel height and then jump when the first tile appears. */
.roll-body { display: flex; align-items: stretch; min-height: 90px; }
.roll-scroller { display: flex; align-items: center; gap: 9px; overflow-x: auto;
  padding: 12px 14px; flex: 1; scroll-behavior: smooth; scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent; }
.roll-scroller::-webkit-scrollbar { height: 8px; }
.roll-scroller::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 4px; }
.roll-thumb { position: relative; flex: 0 0 auto; width: 88px; height: 66px;
  border-radius: 6px; overflow: hidden; cursor: pointer; background: var(--bg-elevated);
  box-shadow: inset 0 0 0 1px var(--rule);
  transition: transform var(--dur-1) var(--ease-settle), filter var(--dur-1) var(--ease-settle); }
.roll-thumb:hover { transform: scale(1.03); filter: brightness(1.07); z-index: 1; }
/* Absolutely positioned so the corrected image can cross-fade in OVER the raw
   preview before the raw one is removed. */
.roll-thumb img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; }
/* Raw preview (shown while detecting): a plain fade-in, dimmed + desaturated to
   echo the fullscreen "thinking" look. */
.roll-thumb img[data-kind="raw"] { animation: roll-fade-in var(--dur-2) var(--ease-settle) both; }
.roll-thumb.detecting img { filter: brightness(0.5) saturate(0.85); }
@keyframes roll-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* SIGNATURE: the corrected thumb arrives slightly off-true and settles to
   plumb — the product's whole job, re-enacted on every save. */
.roll-thumb img[data-kind="corrected"] { animation: roll-settle-plumb var(--dur-3) var(--ease-settle) both; }
@keyframes roll-settle-plumb {
  from { opacity: 0; transform: rotate(1.2deg) scale(1.05); }
  to   { opacity: 1; transform: rotate(0deg) scale(1); }
}
.roll-thumb.active { outline: 2px solid var(--accent); outline-offset: 2px;
  animation: roll-select var(--dur-2) var(--ease-settle); }
@keyframes roll-select { from { outline-offset: 6px; } to { outline-offset: 2px; } }
/* "Saved to the roll" pulse: a one-shot gold ring as the corrected thumb lands. */
.roll-thumb.just-saved { animation: roll-saved 900ms ease-out; }
@keyframes roll-saved {
  0%   { box-shadow: inset 0 0 0 1px var(--rule),   0 0 0 0   rgba(201,166,107,0); }
  35%  { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px rgba(201,166,107,.5); }
  100% { box-shadow: inset 0 0 0 1px var(--rule),   0 0 0 0   rgba(201,166,107,0); }
}
/* Detecting shimmer: a few drifting, blurred gold blobs that glow over the
   dimmed raw photo — a CSS evocation of the fullscreen metaball "thinking" flow. */
.roll-thumb.detecting::after { content: ""; position: absolute; inset: -20%; pointer-events: none;
  background:
    radial-gradient(40% 50% at 30% 40%, rgba(201,166,107,.50), transparent 70%),
    radial-gradient(45% 55% at 68% 58%, rgba(201,166,107,.42), transparent 72%),
    radial-gradient(34% 44% at 50% 78%, rgba(201,166,107,.34), transparent 70%);
  mix-blend-mode: screen; filter: blur(5px);
  animation: roll-shimmer 2.2s ease-in-out infinite; }
@keyframes roll-shimmer {
  0%   { opacity: .45; transform: translate(-3px,  1px) scale(1.00); }
  50%  { opacity: .95; transform: translate( 3px, -1px) scale(1.08); }
  100% { opacity: .45; transform: translate(-3px,  1px) scale(1.00); }
}
.roll-thumb.error { outline: 1.5px solid var(--err); }
.roll-thumb.error::after { content: "!"; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: var(--err);
  font-family: var(--mono); font-size: 18px; }
.roll-remove { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: var(--ink);
  font-size: 12px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s; }
.roll-thumb:hover .roll-remove { opacity: 1; }
.roll-add { flex: 0 0 auto; align-self: center; width: 88px; height: 66px; margin: 0 14px;
  border-radius: 6px; border: 1.5px dashed var(--rule-strong); display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; color: var(--ink-quiet); border-left: 1px solid var(--rule);
  transition: border-color var(--dur-2) var(--ease-settle), color var(--dur-2) var(--ease-settle), background var(--dur-2) var(--ease-settle); }
.roll-add:hover { border-color: var(--accent); color: var(--accent);
  background: rgba(201,166,107,.05); }
.roll-plus { font-size: 26px; font-weight: 200; line-height: 1; }
.roll-add-t { font-family: var(--mono); font-size: 8px; letter-spacing: .08em; }
/* Drag-to-add preview: page-wide, the roll lights up as the drop target and
   shows one ghost tile per dragged file (count known mid-drag; folder = 1). */
body.dragging-files .roll { background: rgba(201,166,107,.05); box-shadow: inset 0 1px 0 0 var(--accent); }
body.dragging-files .roll-add { border-color: var(--accent); color: var(--accent); background: rgba(201,166,107,.05); }
/* The canvas is also a drop target — advertise it during a file drag. */
.canvas-wrap { transition: box-shadow var(--dur-2) var(--ease-settle); }
body.dragging-files .canvas-wrap { box-shadow: inset 0 0 0 2px rgba(201, 166, 107, 0.35); }

/* Floating vertical glass tool bar — crop segment on top, toggles below. */
.canvas-tools {
  position: absolute;
  top: 50%; right: 16px;
  transform: translateY(-50%);
  z-index: 6;
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 6px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: var(--glass-shadow);
}
.ct-crop { display: flex; flex-direction: column; gap: 2px; }
.ct-divider { height: 1px; background: var(--rule); margin: 4px 4px; }
.ct-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: none; border-radius: 8px;
  color: var(--ink-quiet); cursor: pointer;
  transition: color var(--dur-1) var(--ease-settle),
              background var(--dur-1) var(--ease-settle),
              transform var(--dur-1) var(--ease-settle);
}
.ct-btn svg { width: 20px; height: 20px; }
.ct-btn:hover { color: var(--ink); background: rgba(243,237,226,0.06); }
.ct-btn:active { transform: scale(0.94); }
.ct-btn.active { color: var(--accent); background: rgba(201,166,107,0.12); }
/* Tooltip to the LEFT so it doesn't run off the right edge. */
.ct-btn::after {
  content: attr(aria-label);
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  white-space: nowrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: lowercase;
  color: var(--ink); background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--rule); border-radius: 6px; padding: 5px 8px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-1) var(--ease-settle);
}
.ct-btn:hover::after { opacity: 1; }

/* Warnings float at the top-left of the canvas, below the header. */
#callouts { position: absolute; top: 76px; left: 24px; z-index: 4; max-width: 320px; }
#callouts:empty { display: none; }
.roll-ghost { flex: 0 0 auto; width: 88px; height: 66px; border-radius: 6px;
  border: 1.5px dashed var(--accent); background: rgba(201,166,107,.06);
  animation: roll-ghost-in var(--dur-2) var(--ease-settle) both; }
@keyframes roll-ghost-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.header-actions { display: flex; gap: 10px; align-items: center; }
/* Success flash on an action pill — the ✓ settles in via the accent fill. */
.pill.pill-confirmed { background: var(--accent); color: var(--bg); border-color: var(--accent);
  transition: background var(--dur-2) var(--ease-settle), color var(--dur-2) var(--ease-settle),
              border-color var(--dur-2) var(--ease-settle); }
.pill[disabled] { opacity: .5; cursor: default; }

/* Respect prefers-reduced-motion: collapse decorative animations/transitions to
   instant (keyframes jump to their settled end-state, so no transform motion),
   and stop smooth scrolling. JS-driven opacity fades are gentle and kept. */
@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;
  }
  .roll-scroller { scroll-behavior: auto; }
  /* Strip the one decorative hover transform (snapping it instant still leaves
     the scale applied; reduced-motion wants no transform at all). */
  .roll-thumb:hover { transform: none; filter: none; }
}
