/* Salon v4 design system.
   Token layer first; every component is styled only against tokens so that
   light, dark and the data-theme override all fall out of one place. */

/* ================= Tokens ================= */

:root {
  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);

  --background: oklch(0.985 0.004 80);
  --foreground: oklch(0.16 0.008 60);
  --card: oklch(1 0 0);
  --card-foreground: var(--foreground);
  --popover: oklch(1 0 0);
  --popover-foreground: var(--foreground);
  --primary: oklch(0.21 0.01 60);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.965 0.006 80);
  --secondary-foreground: var(--primary);
  --muted: oklch(0.965 0.006 80);
  --muted-foreground: oklch(0.55 0.012 60);
  --accent: oklch(0.955 0.008 80);
  --accent-foreground: var(--primary);
  --brand: oklch(0.52 0.11 45);
  --brand-contrast: oklch(0.985 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --success: oklch(0.52 0.09 155);
  --success-contrast: oklch(0.99 0 0);
  --border: oklch(0.915 0.008 80);
  --input: var(--border);
  --ring: oklch(0.70 0.02 60);

  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.05);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.05), 0 1px 3px oklch(0 0 0 / 0.06);
  --shadow-md: 0 2px 4px oklch(0 0 0 / 0.05), 0 8px 20px oklch(0 0 0 / 0.08);
  --shadow-lg: 0 4px 10px oklch(0 0 0 / 0.06), 0 18px 44px oklch(0 0 0 / 0.11);
  --shadow-2xl: 0 10px 24px oklch(0 0 0 / 0.14), 0 34px 80px oklch(0 0 0 / 0.20);

  /* Photo wells and measuring overlays: literal, they sit on top of imagery. */
  --stage-bg: oklch(0.18 0.004 60);
  --shade: rgba(10, 10, 10, 0.55);
  --guide: oklch(0.66 0.23 350);
  --calib: oklch(0.66 0.16 250);
  --tag-bg: rgba(18, 17, 16, 0.86);
  --tag-fg: #fff;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --duration-stagger: 40ms;
  --duration-micro: 80ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-medium: 350ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.36, 0.64, 1);

  --tabbar-h: 66px;
  --chrome-h: 57px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --background: oklch(0.15 0.006 60);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0.006 60);
    --card-foreground: var(--foreground);
    --popover: oklch(0.215 0.006 60);
    --popover-foreground: var(--foreground);
    --primary: oklch(0.92 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.27 0.006 60);
    --secondary-foreground: var(--foreground);
    --muted: oklch(0.27 0.006 60);
    --muted-foreground: oklch(0.71 0.01 60);
    --accent: oklch(0.31 0.007 60);
    --accent-foreground: var(--foreground);
    --brand: oklch(0.70 0.12 48);
    --brand-contrast: oklch(0.18 0.01 60);
    --destructive: oklch(0.70 0.19 25);
    --success: oklch(0.74 0.13 158);
    --success-contrast: oklch(0.18 0.02 158);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.55 0.02 60);

    --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.4);
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4), 0 1px 3px oklch(0 0 0 / 0.35);
    --shadow-md: 0 2px 4px oklch(0 0 0 / 0.4), 0 8px 20px oklch(0 0 0 / 0.45);
    --shadow-lg: 0 4px 10px oklch(0 0 0 / 0.45), 0 18px 44px oklch(0 0 0 / 0.5);
    --shadow-2xl: 0 10px 24px oklch(0 0 0 / 0.55), 0 34px 80px oklch(0 0 0 / 0.6);
    --stage-bg: oklch(0.12 0.004 60);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --background: oklch(0.15 0.006 60);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0.006 60);
  --card-foreground: var(--foreground);
  --popover: oklch(0.215 0.006 60);
  --popover-foreground: var(--foreground);
  --primary: oklch(0.92 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.27 0.006 60);
  --secondary-foreground: var(--foreground);
  --muted: oklch(0.27 0.006 60);
  --muted-foreground: oklch(0.71 0.01 60);
  --accent: oklch(0.31 0.007 60);
  --accent-foreground: var(--foreground);
  --brand: oklch(0.70 0.12 48);
  --brand-contrast: oklch(0.18 0.01 60);
  --destructive: oklch(0.70 0.19 25);
  --success: oklch(0.74 0.13 158);
  --success-contrast: oklch(0.18 0.02 158);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.55 0.02 60);
  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4), 0 1px 3px oklch(0 0 0 / 0.35);
  --shadow-md: 0 2px 4px oklch(0 0 0 / 0.4), 0 8px 20px oklch(0 0 0 / 0.45);
  --shadow-lg: 0 4px 10px oklch(0 0 0 / 0.45), 0 18px 44px oklch(0 0 0 / 0.5);
  --shadow-2xl: 0 10px 24px oklch(0 0 0 / 0.55), 0 34px 80px oklch(0 0 0 / 0.6);
  --stage-bg: oklch(0.12 0.004 60);
}

/* ================= Base ================= */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
img, svg, canvas { display: block; }
::selection { background: color-mix(in oklch, var(--brand) 24%, transparent); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; font-variation-settings: 'opsz' 40; }
h1 { font-size: clamp(26px, 4.4vw, 32px); line-height: 1.14; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 1.2; margin: 30px 0 14px; }
h3 { font-size: 16px; line-height: 1.3; }

.sub { color: var(--muted-foreground); font-size: 14px; }
.hint { color: var(--muted-foreground); font-size: 12.5px; }
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted-foreground);
}
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.vstack { display: grid; gap: 18px; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px calc(48px + var(--tabbar-h) + env(safe-area-inset-bottom));
}
main.wide { max-width: 1400px; }

/* ================= Motion ================= */

@keyframes route-in {
  from { opacity: 0; transform: translateX(8px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes route-out {
  from { opacity: 1; transform: none; filter: none; }
  to { opacity: 0; transform: translateX(-8px); filter: blur(3px); }
}
@keyframes stagger-in {
  from { opacity: 0; transform: translateY(12px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes step-in {
  from { opacity: 0; transform: translateY(8px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes step-out {
  from { opacity: 1; transform: none; filter: none; }
  to { opacity: 0; transform: translateY(-8px); filter: blur(4px); }
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes dialog-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(12px) scale(0.98); }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { from { transform: none; } to { transform: translateY(100%); } }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 16px) scale(0.97); filter: blur(2px); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); filter: none; }
}
@keyframes toast-out {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to { opacity: 0; transform: translate(-50%, 10px) scale(0.98); }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { to { transform: rotate(360deg); } }

.route-enter { animation: route-in var(--duration-fast) var(--ease-smooth-out) both; }
.route-exit { animation: route-out var(--duration-quick) var(--ease-smooth-out) both; }
.stagger > * {
  animation: stagger-in var(--duration-medium) var(--ease-smooth-out) both;
  animation-delay: calc(var(--i, 0) * var(--duration-stagger));
}

/* ================= Chrome ================= */

.chrome {
  position: sticky; top: 0; z-index: 60;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in oklch, var(--background) 88%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.demobar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  font-size: 12.5px;
  background: color-mix(in oklch, var(--brand) 12%, var(--background));
  color: color-mix(in oklch, var(--brand) 72%, var(--foreground));
  border-bottom: 1px solid color-mix(in oklch, var(--brand) 22%, transparent);
}
.demobar[hidden] { display: none; }
.demobar .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: 0 0 auto;
}
.demobar .db-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demobar button, .demobar a {
  border: 0; background: none; font-size: 12.5px; font-weight: 500;
  color: inherit; text-decoration: underline; text-underline-offset: 2px;
  padding: 2px 2px; border-radius: var(--radius-sm); white-space: nowrap;
  transition: opacity var(--duration-quick) ease;
}
.demobar button:hover, .demobar a:hover { opacity: 0.7; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 20px;
  max-width: 1400px; margin: 0 auto;
}

.brand {
  font-family: var(--font-display); font-weight: 600; font-size: 20px;
  display: inline-flex; align-items: center; gap: 9px; letter-spacing: -0.01em;
}
.brand-ico { width: 26px; height: 26px; border-radius: var(--radius-sm); }

.topnav { display: none; position: relative; padding: 3px; background: var(--muted); border-radius: var(--radius-lg); }
.topnav a {
  position: relative; z-index: 1;
  padding: 0 14px; height: 30px; display: inline-flex; align-items: center;
  border-radius: var(--radius-md); font-size: 13.5px; font-weight: 500;
  color: var(--muted-foreground);
  transition: color var(--duration-quick) ease;
}
.topnav a.active { color: var(--foreground); }
.topnav a:hover { color: var(--foreground); }
.nav-pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0;
  background: var(--background); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              width var(--duration-fast) var(--ease-smooth-out);
}
.nav-pill.no-anim { transition: none; }

.nav-gear {
  color: var(--muted-foreground); width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  transition: background var(--duration-quick) ease, color var(--duration-quick) ease;
}
.nav-gear:hover { background: var(--accent); color: var(--foreground); }
.nav-gear.active { background: var(--accent); color: var(--foreground); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-around;
  background: color-mix(in oklch, var(--background) 88%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabbar .tab-pill {
  position: absolute; top: 8px; left: 0; width: 0; height: 44px;
  background: var(--accent); border-radius: var(--radius-lg);
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              width var(--duration-fast) var(--ease-smooth-out);
}
.tabbar .tab-pill.no-anim { transition: none; }
.tabbar a {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 500; color: var(--muted-foreground);
  min-width: 66px; height: 44px; border-radius: var(--radius-lg);
  transition: color var(--duration-quick) ease;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.active { color: var(--foreground); }
.tabbar a:active { transform: scale(0.96); }

@media (min-width: 760px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  :root { --tabbar-h: 0px; }
}

/* ================= Button ================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; line-height: 1;
  white-space: nowrap; user-select: none;
  background: var(--secondary); color: var(--secondary-foreground);
  transition: background var(--duration-quick) ease, color var(--duration-quick) ease,
              border-color var(--duration-quick) ease, box-shadow var(--duration-quick) ease,
              transform var(--duration-micro) ease;
}
.btn:hover { background: color-mix(in oklch, var(--secondary) 80%, var(--foreground) 6%); }
.btn:active { transform: scale(0.97); transition-duration: 120ms; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

.btn.primary { background: var(--primary); color: var(--primary-foreground); }
.btn.primary:hover { background: color-mix(in oklch, var(--primary) 90%, var(--brand)); }
.btn.brand { background: var(--brand); color: var(--brand-contrast); }
.btn.brand:hover { background: color-mix(in oklch, var(--brand) 88%, black); }
.btn.outline {
  background: var(--card); color: var(--foreground);
  border-color: var(--border); box-shadow: var(--shadow-xs);
}
.btn.outline:hover { background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--accent); }
.btn.danger { background: transparent; color: var(--destructive); border-color: transparent; }
.btn.danger:hover { background: color-mix(in oklch, var(--destructive) 12%, transparent); }
.btn.destructive { background: var(--destructive); color: oklch(0.99 0 0); }
.btn.destructive:hover { background: color-mix(in oklch, var(--destructive) 88%, black); }
.btn.link { background: none; height: auto; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.big { height: 40px; padding: 0 20px; font-size: 15px; }
.btn.icon { width: 36px; padding: 0; }
.btn.full { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: 0.5; pointer-events: none; }

:where(.btn, .tabbar a, .topnav a, .seg-btn, .frame-chip, .lc, .card, .wall-card, .j-step, .choice, .matdot, .tray-item, .ac, .hl-grab):focus-visible,
:where(input, select, textarea):focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.spin {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid color-mix(in oklch, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}

/* ================= Surfaces ================= */

.card-s {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm); padding: 24px;
}
.card-s + .card-s { margin-top: 0; }
.card-s h3 { margin-bottom: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-2xl); padding: 20px;
}
.stat .l { color: var(--muted-foreground); font-size: 12px; font-weight: 500; }
.stat .v {
  font-family: var(--font-display); font-size: 28px; font-weight: 500;
  line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums;
  font-variation-settings: 'opsz' 30;
}

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 2px 8px; font-size: 12px; font-weight: 500; line-height: 1.4;
  background: color-mix(in oklch, var(--muted-foreground) 15%, transparent);
  color: var(--muted-foreground);
}
.badge.green {
  background: color-mix(in oklch, var(--success) 15%, transparent);
  color: color-mix(in oklch, var(--success) 88%, var(--foreground));
  border-color: color-mix(in oklch, var(--success) 22%, transparent);
}
.badge.frame {
  background: color-mix(in oklch, var(--brand) 15%, transparent);
  color: color-mix(in oklch, var(--brand) 85%, var(--foreground));
  border-color: color-mix(in oklch, var(--brand) 22%, transparent);
}
.badge.sold {
  background: color-mix(in oklch, var(--destructive) 15%, transparent);
  color: color-mix(in oklch, var(--destructive) 82%, var(--foreground));
  border-color: color-mix(in oklch, var(--destructive) 22%, transparent);
}

.skeleton {
  background: var(--accent); border-radius: var(--radius-md);
  animation: pulse 1s ease-in-out infinite;
}

.empty {
  text-align: center; padding: 56px 24px; color: var(--muted-foreground);
  border: 1px dashed var(--border); border-radius: var(--radius-2xl);
  display: grid; gap: 6px; justify-items: center;
}
.empty svg { width: 30px; height: 30px; color: var(--muted-foreground); opacity: 0.7; margin-bottom: 6px; }
.empty .big { font-family: var(--font-display); font-size: 20px; font-weight: 500; color: var(--foreground); }
.empty .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

.list { display: grid; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 48px; padding: 12px 16px; font-size: 14px;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  transition: background var(--duration-quick) ease;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: color-mix(in oklch, var(--muted) 50%, transparent); }
.list.boxed {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); overflow: hidden;
}
.list-item img.mini {
  width: 44px; height: 44px; object-fit: contain; flex: 0 0 auto;
  filter: drop-shadow(0 1px 3px oklch(0 0 0 / 0.2));
}
.x {
  border: 0; background: none; color: var(--muted-foreground);
  width: 26px; height: 26px; border-radius: var(--radius-sm); font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--duration-quick) ease, color var(--duration-quick) ease;
}
.x:hover { background: var(--accent); color: var(--foreground); }

/* ================= Form ================= */

.form { display: grid; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row3 { grid-template-columns: 1fr 1fr; } .row3 > :last-child { grid-column: span 2; } }

label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted-foreground); }
input[type='text'], input[type='password'], input[type='number'], input[type='date'], input:not([type]), select, textarea {
  height: 36px; width: 100%;
  border: 1px solid var(--input); border-radius: var(--radius-md);
  background: transparent; color: var(--foreground);
  padding: 0 11px; font-size: 15px; box-shadow: var(--shadow-xs);
  transition: border-color var(--duration-quick) ease, box-shadow var(--duration-quick) ease;
}
input[type='file'] { font-size: 13px; color: var(--muted-foreground); }
select { appearance: none; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input::placeholder { color: var(--muted-foreground); opacity: 0.7; }
.checkline { display: flex; gap: 9px; align-items: center; font-size: 14px; cursor: pointer; }
.checkline input { width: 17px; height: 17px; accent-color: var(--brand); box-shadow: none; flex: 0 0 auto; }

.seg {
  position: relative; display: inline-flex; align-items: center;
  background: var(--muted); border-radius: var(--radius-lg);
  padding: 3px; height: 36px; border: 0;
}
.seg-pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0;
  background: var(--background); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              width var(--duration-fast) var(--ease-smooth-out);
}
.seg-pill.no-anim { transition: none; }
.seg-btn {
  position: relative; z-index: 1; border: 0; background: transparent;
  height: 30px; padding: 0 13px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; color: var(--muted-foreground);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--duration-quick) ease, opacity var(--duration-quick) ease;
}
.seg-btn.is-active { color: var(--foreground); }
/* The row this sits in already dims; dimming again here compounds to 0.16. */
.seg[data-disabled='true'] { pointer-events: none; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================= Home ================= */

.home-hero { margin: 4px 0 22px; }
.home-hero h1 { font-size: clamp(28px, 6vw, 36px); margin-top: 4px; }

.journey { display: grid; gap: 10px; }
.j-step {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xs);
  padding: 14px 16px; cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              box-shadow var(--duration-fast) var(--ease-smooth-out),
              border-color var(--duration-quick) ease;
}
.j-step:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.j-step:active { transform: scale(0.99); }
.j-step .jnum {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); font-size: 12.5px; font-weight: 600;
  color: var(--muted-foreground); font-variant-numeric: tabular-nums;
}
.j-step.done { opacity: 0.6; }
.j-step.done .jnum { background: var(--success); border-color: var(--success); color: var(--success-contrast); }
.j-step.locked { opacity: 0.6; cursor: pointer; }
.j-step .jt { font-weight: 600; font-size: 14.5px; }
.j-step .jd { color: var(--muted-foreground); font-size: 13px; }
.j-step .go { color: var(--brand); font-weight: 600; font-size: 13px; flex: 0 0 auto; }

.qa-row { display: flex; gap: 10px; flex-wrap: wrap; }

.strip {
  display: flex; gap: 14px; overflow-x: auto;
  padding: 4px 2px 12px; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip .s-item { flex: 0 0 auto; width: 152px; cursor: pointer; scroll-snap-align: start; }
.strip .s-item.wide { width: 250px; }
.strip .s-img {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xs);
  overflow: hidden; height: 124px; padding: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              box-shadow var(--duration-fast) var(--ease-smooth-out);
}
.strip .s-item:hover .s-img { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.strip .s-item:active .s-img { transform: scale(0.98); }
.strip .s-item.wide .s-img { padding: 0; }
.strip .s-item.wide .s-img img { width: 100%; height: 100%; object-fit: cover; }
.strip .s-img img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  filter: drop-shadow(0 2px 6px oklch(0 0 0 / 0.18));
}
.strip .s-cap {
  font-size: 12.5px; color: var(--muted-foreground); margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ================= Collection ================= */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head .tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 20px; }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px; }

.card { cursor: pointer; border: 0; background: none; text-align: left; display: block; width: 100%; }
.card .thumb {
  position: relative;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xs);
  overflow: hidden; aspect-ratio: 1; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  transform-style: preserve-3d;
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              box-shadow var(--duration-fast) var(--ease-smooth-out);
}
.card:hover .thumb { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card:active .thumb { transform: scale(0.98); }
.card .thumb img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  filter: drop-shadow(0 2px 6px oklch(0 0 0 / 0.18));
}
.card .thumb::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%),
              oklch(1 0 0 / 0.28), transparent 55%);
  transition: opacity var(--duration-fast) ease;
}
.card .meta { padding: 10px 2px 0; display: grid; gap: 2px; justify-items: start; }
.card .t { font-weight: 600; font-size: 14px; line-height: 1.3; }
.card .a { color: var(--muted-foreground); font-size: 13px; }
.card .meta .badge { margin-top: 4px; }
.fthumb { display: block; }
.fthumb .p-outer { box-shadow: 0 4px 12px oklch(0 0 0 / 0.22); }

@media (hover: hover) and (pointer: fine) {
  .card.tilt .thumb {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-2px);
    transition: transform var(--duration-quick) ease-out, box-shadow var(--duration-fast) var(--ease-smooth-out);
  }
  .card.tilt .thumb::after { opacity: 1; }
}

/* ================= Wizard ================= */

.wiz-steps { display: flex; gap: 6px; margin: 14px 0 20px; }
.wiz-steps .ws { height: 4px; flex: 1; border-radius: 2px; background: var(--muted); transition: background var(--duration-fast) ease; }
.wiz-steps .ws.on { background: var(--brand); }
.wiz-body.stepping-out { animation: step-out 160ms var(--ease-smooth-out) both; }
.wiz-body.stepping-in { animation: step-in var(--duration-fast) var(--ease-smooth-out) both; }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .choice-row { grid-template-columns: 1fr; } }
.choice {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xs);
  padding: 22px 16px; cursor: pointer; display: grid; gap: 5px;
  justify-items: center; text-align: center; width: 100%;
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              box-shadow var(--duration-fast) var(--ease-smooth-out),
              border-color var(--duration-quick) ease;
}
.choice:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in oklch, var(--brand) 40%, var(--border)); }
.choice:active { transform: scale(0.98); }
.choice svg { width: 26px; height: 26px; color: var(--brand); margin-bottom: 4px; }
.choice b { font-size: 14.5px; }
.choice span { font-size: 12.5px; color: var(--muted-foreground); }

.photo-drop {
  border: 1px dashed var(--border); border-radius: var(--radius-xl);
  background: var(--card); padding: 40px 20px; text-align: center;
  color: var(--muted-foreground); cursor: pointer;
  display: grid; gap: 8px; justify-items: center; width: 100%;
  transition: border-color var(--duration-quick) ease, background var(--duration-quick) ease;
}
.photo-drop:hover { border-color: var(--brand); background: var(--accent); }
.photo-drop svg { width: 32px; height: 32px; color: var(--muted-foreground); }
.photo-drop b { color: var(--foreground); font-size: 14.5px; }

.crop-wrap {
  position: relative; touch-action: none; user-select: none; -webkit-user-select: none;
  border-radius: var(--radius-xl); overflow: hidden; background: var(--stage-bg);
}
.crop-wrap canvas { width: 100%; display: block; }
.crop-shade { position: absolute; background: var(--shade); pointer-events: none; }
.crop-rect {
  position: absolute; border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4); cursor: move; touch-action: none;
}
.crop-h { position: absolute; width: 28px; height: 28px; transform: translate(-50%, -50%); touch-action: none; }
.crop-h::after {
  content: ''; position: absolute; inset: 6px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.crop-tools { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }

/* ================= Piece detail ================= */

.detail { display: grid; gap: 30px; grid-template-columns: 1fr; }
@media (min-width: 880px) { .detail { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } }
.artwrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-2xl); box-shadow: var(--shadow-sm);
  padding: clamp(18px, 5vw, 46px);
  display: flex; align-items: center; justify-content: center;
}
.artwrap canvas, .artwrap img { max-width: 100%; height: auto; }
@media (min-width: 880px) { .artwrap { position: sticky; top: calc(var(--chrome-h) + 20px); } }

.frame-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.frame-chip {
  border: 1px solid var(--border); background: var(--card); color: var(--foreground);
  border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
  padding: 0 12px 0 7px; height: 34px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500;
  transition: border-color var(--duration-quick) ease, background var(--duration-quick) ease,
              transform var(--duration-micro) ease;
}
.frame-chip:hover { background: var(--accent); }
.frame-chip:active { transform: scale(0.97); }
.frame-chip .sw { width: 18px; height: 18px; border-radius: var(--radius-sm); border: 1px solid oklch(0 0 0 / 0.14); }
.frame-chip.sel { border-color: var(--brand); background: color-mix(in oklch, var(--brand) 10%, var(--card)); }

.matdot {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); padding: 0;
  transition: transform var(--duration-micro) ease;
}
.matdot:hover { transform: scale(1.08); }
.matdot.sel { outline: 2px solid var(--brand); outline-offset: 2px; }

.inline-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ================= Walls ================= */

.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.wall-card {
  display: block; border-radius: var(--radius-xl); overflow: hidden;
  border: 1px solid var(--border); background: var(--card);
  box-shadow: var(--shadow-xs); cursor: pointer; width: 100%; text-align: left;
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              box-shadow var(--duration-fast) var(--ease-smooth-out);
}
.wall-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.wall-card:active { transform: scale(0.99); }
.wall-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.wall-card .meta { padding: 12px 14px 14px; display: grid; gap: 2px; }
.wall-card .meta .n { font-weight: 600; font-size: 14px; }

.calib-wrap {
  position: relative; touch-action: none; user-select: none;
  border-radius: var(--radius-xl); overflow: hidden; background: var(--stage-bg);
}
.calib-wrap img { width: 100%; height: auto; pointer-events: none; }
.calib-line {
  position: absolute; height: 2px; background: var(--calib);
  transform-origin: 0 50%; box-shadow: 0 0 0 1px oklch(1 0 0 / 0.6);
}
.calib-handle {
  position: absolute; width: 28px; height: 28px; border-radius: 50%;
  background: var(--calib); border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%); cursor: grab; touch-action: none;
}
.calib-handle:active { cursor: grabbing; transform: translate(-50%, -50%) scale(1.1); }

/* ================= Planner ================= */

.planner-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.planner-bar .title { display: grid; gap: 1px; min-width: 0; }
.planner-bar .title b { font-size: 15px; }

.layout-chips { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.layout-chips .lc {
  border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground);
  border-radius: 999px; padding: 0 14px; height: 30px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-xs);
  transition: background var(--duration-quick) ease, color var(--duration-quick) ease,
              border-color var(--duration-quick) ease, transform var(--duration-micro) ease;
}
.layout-chips .lc:hover { background: var(--accent); color: var(--foreground); }
.layout-chips .lc:active { transform: scale(0.97); }
.layout-chips .lc.sel { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }

.stage-wrap {
  position: relative; border-radius: var(--radius-2xl); overflow: hidden;
  box-shadow: var(--shadow-lg); background: var(--stage-bg);
}
.stage { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage > img.wallphoto { width: 100%; height: auto; pointer-events: none; }
.placed { position: absolute; cursor: grab; touch-action: none; transition: box-shadow var(--duration-quick) ease; }
.placed.dragging { cursor: grabbing; z-index: 10; transform: scale(1.02); }
.placed.settling { transition: transform var(--duration-fast) var(--ease-bounce); transform: scale(1); }
.p-outer { width: 100%; height: 100%; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.38); }
.placed.dragging .p-outer { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
img.art { width: 100%; height: 100%; object-fit: cover; }
.placed img.art { pointer-events: none; }
.placed.sel { outline: 2px solid var(--brand); outline-offset: 3px; }
.placed .size-tag {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: -28px;
  background: var(--tag-bg); color: var(--tag-fg); font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.guide { position: absolute; background: var(--guide); z-index: 8; pointer-events: none; }
.guide.v { width: 1.5px; top: 0; bottom: 0; }
.guide.h { height: 1.5px; left: 0; right: 0; }

.tray {
  display: flex; gap: 12px; overflow-x: auto;
  padding: 16px 4px 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tray::-webkit-scrollbar { display: none; }
.tray .tray-item { flex: 0 0 auto; width: 72px; text-align: center; cursor: pointer; border: 0; background: none; padding: 0; }
.tray .tray-item.used { opacity: 0.35; }
.tray .tray-item .tt {
  width: 72px; height: 72px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; padding: 8px;
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              box-shadow var(--duration-fast) var(--ease-smooth-out);
}
.tray .tray-item:hover .tt { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tray .tray-item:active .tt { transform: scale(0.96); }
.tray .tray-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tray .tray-item .tl {
  font-size: 11px; color: var(--muted-foreground); margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sel-tools {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md);
  padding: 12px 14px; margin-top: 14px;
  position: sticky; bottom: 16px; z-index: 30;
  animation: stagger-in var(--duration-fast) var(--ease-smooth-out) both;
}
/* Inputs default to width:100%, which would give each select its own flex row
   and grow the bar until it covered the wall. */
.sel-tools select { height: 32px; font-size: 13px; width: auto; max-width: 168px; }
.sel-tools .selname { font-size: 13px; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 760px) {
  .sel-tools {
    position: fixed; left: 8px; right: 8px; margin: 0;
    bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom));
    border-radius: var(--radius-2xl); box-shadow: var(--shadow-2xl);
  }
  .sel-tools .selname { max-width: 100%; width: 100%; }
  /* No arrow keys on a phone, and the line costs a whole row over the wall. */
  .sel-tools .hint { display: none; }
}

.nudge { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(2, 27px); gap: 3px; }
.nudge button {
  border: 1px solid var(--border); background: var(--card); color: var(--foreground);
  border-radius: var(--radius-sm); font-size: 13px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--duration-quick) ease, transform var(--duration-micro) ease;
}
.nudge button:hover { background: var(--accent); }
.nudge button:active { transform: scale(0.92); }
.nudge .nu-u { grid-column: 2; grid-row: 1; }
.nudge .nu-l { grid-column: 1; grid-row: 2; }
.nudge .nu-d { grid-column: 2; grid-row: 2; }
.nudge .nu-r { grid-column: 3; grid-row: 2; }

.render-result img { width: 100%; border-radius: var(--radius-xl); box-shadow: var(--shadow-md); }

/* ================= Auto layout ================= */

/* The hang line: where the arrangement centres, draggable by the grip.
   The line itself takes no pointers, so pieces lying across it stay draggable. */
.hangline {
  position: absolute; left: 0; right: 0; height: 0; z-index: 9;
  border-top: 1.5px dashed var(--brand);
  pointer-events: none;
}
.hangline .hl-grab {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  cursor: grab; touch-action: none; pointer-events: auto;
  transition: transform var(--duration-micro) ease;
}
.hangline .hl-grab::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; }
.hangline.is-dragging .hl-grab { cursor: grabbing; transform: translateY(-50%) scale(1.12); }

.arrange h2 { margin-top: 0; }
.arrange-controls {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.arrange-foot { margin-top: 14px; }

.arrange-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.ac {
  display: block; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--card); box-shadow: var(--shadow-xs); padding: 8px;
  transition: transform var(--duration-fast) var(--ease-smooth-out),
              box-shadow var(--duration-fast) var(--ease-smooth-out),
              border-color var(--duration-quick) ease;
}
.ac:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ac:active { transform: scale(0.98); }
.ac.is-applied { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.ac .ac-n { font-size: 13.5px; font-weight: 600; margin: 8px 2px 1px; }
.ac .ac-r { font-size: 12px; color: var(--muted-foreground); line-height: 1.35; margin: 0 2px; }
.ac .ac-no { display: none; }
.ac.nofit { cursor: default; opacity: 0.45; }
.ac.nofit:hover, .ac.nofit:active { transform: none; box-shadow: var(--shadow-xs); }
.ac.nofit .ac-no {
  display: block; margin: 0 2px; font-size: 12px; font-weight: 500; color: var(--muted-foreground);
}
.ac.nofit .ac-r { display: none; }

.ap-wall {
  position: relative; overflow: hidden; width: 100%;
  border-radius: var(--radius-md); background: var(--stage-bg);
}
.ap-wall img { width: 100%; height: 100%; object-fit: cover; }
.ap-wall.is-nofit img { filter: grayscale(1) brightness(0.8); }
.ap-piece { position: absolute; pointer-events: none; }
.ap-piece .p-outer { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }

/* Phone: a scroll-snap row of cards, and a sheet short enough to leave the
   wall and its hang line in view. */
@media (max-width: 759px) {
  .modal-back.side .modal { max-height: 66vh; }
  .arrange-cards {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    padding-bottom: 6px; scrollbar-width: none;
  }
  .arrange-cards::-webkit-scrollbar { display: none; }
  .ac { flex: 0 0 63%; scroll-snap-align: start; }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes panel-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateX(16px); }
}

@media (min-width: 760px) {
  .modal-back.side {
    background: transparent; backdrop-filter: none;
    align-items: stretch; justify-content: flex-end;
    padding: 0; pointer-events: none; animation: none;
  }
  .modal-back.side .modal {
    pointer-events: auto;
    width: 392px; max-width: 100%;
    margin-top: var(--chrome-h); height: calc(100% - var(--chrome-h)); max-height: none;
    border-radius: 0; border-top: 0; border-right: 0; border-bottom: 0;
    padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
    overflow-y: auto;
    animation: panel-in var(--duration-fast) var(--ease-smooth-out) both;
  }
  .modal-back.side.is-closing .modal { animation: panel-out var(--duration-quick) var(--ease-smooth-out) both; }
  /* Make room rather than cover: the wall stays whole beside the panel. */
  main { transition: padding-right var(--duration-fast) var(--ease-smooth-out); }
  body.arrange-open main.wide { padding-right: calc(392px + 24px); }
}

/* ================= Dialog / sheet ================= */

.modal-back {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px) saturate(140%);
  display: flex; align-items: flex-end; justify-content: center;
  animation: overlay-in var(--duration-fast) var(--ease-smooth-out) both;
}
.modal-back.is-closing { animation: overlay-in var(--duration-quick) var(--ease-smooth-out) reverse both; }
.modal {
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-top-left-radius: var(--radius-3xl);
  border-top-right-radius: var(--radius-3xl);
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-2xl);
  animation: sheet-in var(--duration-slow) var(--ease-smooth-out) both;
}
.modal-back.is-closing .modal { animation: sheet-out var(--duration-quick) var(--ease-smooth-out) both; }
.modal h2 { margin-top: 0; font-size: 19px; }
.modal h2:first-child { margin-bottom: 6px; }
.sheet-grip { display: flex; justify-content: center; padding: 2px 0 12px; margin: -6px 0 0; cursor: grab; touch-action: none; }
.sheet-grip::before {
  content: ''; width: 40px; height: 6px; border-radius: 999px;
  background: color-mix(in oklch, var(--muted-foreground) 40%, transparent);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

@media (min-width: 641px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal {
    border-radius: var(--radius-3xl);
    animation: dialog-in var(--duration-fast) var(--ease-smooth-out) both;
  }
  .modal-back.is-closing .modal { animation: dialog-out var(--duration-quick) var(--ease-smooth-out) both; }
  .sheet-grip { display: none; }
}

#toast {
  position: fixed; left: 50%; z-index: 120;
  bottom: calc(24px + var(--tabbar-h) + env(safe-area-inset-bottom));
  transform: translate(-50%, 0);
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 10px 16px; font-size: 14px; max-width: min(440px, 92vw);
  display: none;
}
#toast.show { display: block; animation: toast-in var(--duration-medium) var(--ease-smooth-out) both; }
#toast.hide { display: block; animation: toast-out var(--duration-fast) var(--ease-smooth-out) both; }

/* ================= Sign in / public ================= */

.signin { max-width: 380px; margin: 8vh auto 0; text-align: center; display: grid; gap: 14px; justify-items: center; }
.signin img { width: 72px; height: 72px; border-radius: var(--radius-2xl); box-shadow: var(--shadow-lg); }
.signin h1 { font-size: 40px; }
.signin p { color: var(--muted-foreground); }
.signin input { text-align: center; height: 42px; font-size: 16px; }

.pub-hero { text-align: center; margin: 30px 0 36px; }
.pub-hero .eyebrow { margin-bottom: 10px; }
.pub-hero h1 { font-size: clamp(30px, 6vw, 46px); }
.pub-wall { margin-bottom: 36px; }
.pub-wall img.main { width: 100%; border-radius: var(--radius-2xl); box-shadow: var(--shadow-lg); }
.pub-foot { text-align: center; color: var(--muted-foreground); font-size: 13px; margin-top: 52px; }

/* ================= Reduced motion ================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover .thumb, .j-step:hover, .choice:hover, .wall-card:hover,
  .strip .s-item:hover .s-img, .tray .tray-item:hover .tt, .ac:hover { transform: none; }
  .ac:active { transform: none; }
  .hangline.is-dragging .hl-grab { transform: translateY(-50%); }
  .btn:active, .card:active .thumb, .choice:active, .wall-card:active { transform: none; }
  .card.tilt .thumb { transform: none; }
  .card .thumb::after { display: none; }
  .placed.dragging { transform: none; }
  .skeleton { animation: none; opacity: 0.7; }
  .modal, .modal-back { animation: none !important; }
  #toast.show, #toast.hide { animation: none !important; }
}
