/* Modescope Mixer — Design System
   ----------------------------------
   Direction: playful fashion-tech, color, micro-animations, app feel
   Type: Instrument Serif (editorial) + Geist (UI) + Geist Mono (labels)
   Palette: warm cream, rich ink, orchid accent — all oklch
*/

:root {
  /* Surfaces */
  --canvas: oklch(0.975 0.008 85);           /* warm cream */
  --canvas-2: oklch(0.965 0.012 80);
  --panel: oklch(0.99 0.006 85);             /* near-white */
  --panel-2: oklch(0.94 0.014 80);
  --ink: oklch(0.19 0.01 270);               /* rich ink */
  --ink-2: oklch(0.32 0.008 270);
  --ink-3: oklch(0.52 0.008 270);
  --ink-4: oklch(0.72 0.006 270);
  --rule: oklch(0.89 0.008 80);
  --rule-2: oklch(0.82 0.01 80);

  /* Accents — shared chroma/lightness, varied hue */
  --orchid: oklch(0.68 0.22 340);            /* primary accent */
  --orchid-2: oklch(0.78 0.18 340);
  --orchid-wash: oklch(0.95 0.04 340);
  --lime: oklch(0.88 0.16 120);              /* secondary pop */
  --butter: oklch(0.92 0.08 95);             /* soft */
  --sky: oklch(0.85 0.06 230);
  --peach: oklch(0.88 0.07 50);

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 270 / 0.06);
  --shadow-md: 0 6px 24px -8px oklch(0.2 0.01 270 / 0.12), 0 1px 2px oklch(0.2 0.01 270 / 0.04);
  --shadow-lg: 0 24px 60px -20px oklch(0.2 0.01 270 / 0.22), 0 2px 6px oklch(0.2 0.01 270 / 0.04);
  --shadow-pop: 0 40px 100px -30px oklch(0.35 0.18 340 / 0.35);

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* Type */
  --font-serif: "Instrument Serif", "Times New Roman", serif;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", "SFMono-Regular", ui-monospace, monospace;

  /* Motion */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img { -webkit-user-drag: none; user-select: none; }

/* ——————— Typography utilities ——————— */
.t-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.t-serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: -0.01em; }
.t-num   { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.t-mono  { font-family: var(--font-mono); }

/* ——————— App shell ——————— */
.app {
  height: 100vh;
  max-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  grid-template-rows: 60px 1fr;
  grid-template-areas:
    "top top top"
    "side main rail";
  gap: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.95 0.04 340 / 0.5), transparent 55%),
    radial-gradient(900px 500px at -10% 100%, oklch(0.92 0.06 120 / 0.35), transparent 55%),
    var(--canvas);
}

/* ——————— Top bar ——————— */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--rule);
  background: oklch(0.99 0.004 85 / 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: sticky; top: 0; z-index: 30;
  min-height: 56px;
}
.wordmark {
  display: flex; align-items: baseline; gap: 10px;
}
.wordmark .m {
  font-family: var(--font-serif);
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.wordmark .sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.wordmark .dot {
  display:inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--orchid);
  margin-left: 2px; transform: translateY(-6px);
}

.topnav {
  display: flex; gap: 4px; align-items: center;
}
.topnav .chip {
  padding: 7px 12px;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: var(--r-pill);
  transition: background .2s, color .2s;
}
.topnav .chip:hover { background: oklch(0.94 0.008 85); color: var(--ink); }
.topnav .chip.active { background: var(--ink); color: var(--canvas); }
.topnav .divider { width:1px; height: 18px; background: var(--rule); margin: 0 6px; }

.topactions { display:flex; gap: 10px; align-items:center; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: oklch(0.96 0.008 85);
  color: var(--ink);
  transition: transform .25s var(--ease-spring), background .2s;
}
.iconbtn:hover { background: oklch(0.93 0.012 85); transform: translateY(-1px); }
.iconbtn .badge {
  position: absolute; transform: translate(14px, -12px);
  background: var(--orchid); color: white;
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 6px; border-radius: 999px;
  box-shadow: 0 2px 6px oklch(0.35 0.2 340 / 0.4);
}
.iconbtn.wrap { position: relative; }
.iconbtn-avatar { padding: 0; overflow: hidden; background: var(--canvas-2); }
.iconbtn-avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 50%;
}
.iconbtn-avatar:hover img { transform: none; }
.mobile-only-flex { display: none; }
@media (max-width: 1000px) {
  .mobile-only-flex { display: grid; }
  .iconbtn-avatar { box-shadow: 0 0 0 2px var(--orchid); }
}

/* Mobile sidebar drawer */
.navmenu .item-mobile-only { display: none; }
@media (max-width: 1000px) {
  .navmenu .item-mobile-only { display: flex; }
}

/* ——————— Sidebar ——————— */
.sidebar {
  grid-area: side;
  padding: 22px 18px 22px 22px;
  display: flex; flex-direction: column; gap: 22px;
  border-right: 1px solid var(--rule);
}
.profile {
  display: flex; flex-direction: column; gap: 14px;
  flex-shrink: 0;
  padding: 18px 16px;
  background: var(--panel);
  border-radius: var(--r-lg);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.profile::before {
  content: "";
  position: absolute; inset: -40% -20% auto auto;
  width: 160px; height: 160px;
  background: radial-gradient(circle, var(--orchid-wash) 0%, transparent 70%);
  pointer-events: none;
}
.profile .row { display: flex; align-items:center; gap: 12px; position: relative; }
.profile-link { color: inherit; text-decoration: none; flex-direction: column; cursor: pointer; transition: transform .2s var(--ease-out); }
.profile-link:hover { transform: translateY(-1px); }
.profile-link:hover .name { color: var(--orchid); }
.profile-link:hover img.avatar { box-shadow: 0 0 0 2px var(--orchid), 0 8px 18px -6px oklch(0.55 0.22 340 / .35); }
.profile img.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 2px var(--orchid);
}
.profile .name {
  font-family: var(--font-serif); font-size: 22px; line-height: 1;
  letter-spacing: -0.01em;
}
.profile .sub {
  font-size: 12px; color: var(--ink-3); margin-top: 3px;
  font-family: var(--font-mono); letter-spacing: 0.04em;
}
.profile .statbar {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; position: relative;
  padding-top: 14px; border-top: 1px dashed var(--rule);
}
.profile .stat { text-align: left; }
.profile .stat .n {
  font-family: var(--font-serif); font-size: 22px; line-height: 1;
}
.profile .stat .l {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
}

.navmenu { display: flex; flex-direction: column; gap: 2px; }
.navmenu .item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--ink-2);
  transition: background .18s, color .18s;
  cursor: pointer;
}
.navmenu .item:hover { background: oklch(0.94 0.008 85); color: var(--ink); }
.navmenu .item.active { background: var(--ink); color: var(--canvas); }
.navmenu .item .count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px;
  color: inherit; opacity: .55;
}
.navmenu .item svg { flex-shrink: 0; }

.looks-mini { display: flex; flex-direction: column; gap: 10px; }
.looks-mini h4 {
  margin: 0 4px 0 4px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.looks-mini .strip {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.looks-mini .chip {
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  font-size: 11.5px;
  cursor: pointer;
  transition: all .18s;
  display: flex; align-items: center; gap: 6px;
}
.looks-mini .chip:hover { border-color: var(--ink); }
.looks-mini .chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c, var(--orchid));
}

/* ——————— Main / Mixer ——————— */
.main {
  grid-area: main;
  padding: 14px 20px 20px 20px;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
}
.top-title {
  display: flex; align-items: center; gap: 10px;
  margin-right: 10px;
  font-family: var(--font-serif);
}
.top-title .tt-main { font-size: 18px; letter-spacing: -0.01em; line-height: 1; }
.top-title .tt-main em { font-style: italic; background: linear-gradient(100deg, var(--orchid), oklch(0.72 0.2 30)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-title .tt-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 5px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
}
.top-title .tt-pill .led { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); border: 2px solid var(--panel); box-shadow: 0 0 0 1px oklch(0.8 0.14 120); }
@media (max-width: 720px) {
  .topbar { padding: 0 10px; }
  .wordmark .m { font-size: 22px; }
  .wordmark .sub { display: none; }
  .topnav { display: none; }
  .topactions { gap: 6px; }
  .iconbtn { width: 34px; height: 34px; }
  .top-title { gap: 6px; margin-right: 4px; flex: 1; min-width: 0; }
  .top-title .tt-main { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-title .tt-pill { padding: 2px 6px 2px 4px; font-size: 8px; gap: 4px; flex-shrink: 0; }
  .top-title .tt-pill .led { width: 7px; height: 7px; border-width: 1.5px; }
}

.studio-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}
.studio-head .title-row {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.studio-head .title {
  font-family: var(--font-serif);
  font-size: 28px; line-height: 1;
  letter-spacing: -0.015em;
  margin: 0;
}
.studio-head .title em {
  font-style: italic;
  background: linear-gradient(100deg, var(--orchid) 0%, oklch(0.72 0.2 30) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.studio-head .meta {
  display: flex; align-items: center; gap: 14px;
}
.studio-head .pill {
  display:inline-flex; align-items:center; gap:6px;
  padding: 6px 10px 6px 6px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.studio-head .pill .led {
  width: 16px; height: 16px; border-radius:50%;
  background: var(--lime);
  border: 3px solid var(--panel);
  box-shadow: 0 0 0 1px oklch(0.8 0.14 120);
}

/* mixer stage */
.stage-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 18px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.stage {
  position: relative;
  border-radius: var(--r-xl);
  background:
    linear-gradient(to bottom, oklch(0.99 0.005 85) 0%, oklch(0.96 0.012 80) 100%);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  padding: 10px 14px;
  display: flex; flex-direction: column;
  min-height: 0;
}
.stage .slices { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr 1fr 0.67fr; }
.stage .slices .slice { height: 100% !important; min-height: 0; width: 100%; }
.stage .slices .slice .card img { height: auto !important; }
.stage .slices .slice[data-layer="top"] .card img    { max-height: 92% !important; }
.stage .slices .slice[data-layer="mid"] .card img    { max-height: 94% !important; }
.stage .slices .slice[data-layer="bottom"] .card img { max-height: 70% !important; }

.stage .rulers {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, oklch(0.88 0.008 80 / 0.45) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 50%, transparent 90%);
  opacity: .6;
}

.stage .stage-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px 0 8px;
  position: relative; z-index: 5;
  gap: 12px;
  flex-shrink: 0;
}
.stage .brand-crest {
  display: flex; align-items: center; gap: 10px;
}
.stage .brand-crest .glyph {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--ink); color: var(--canvas);
  display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 22px; font-style: italic;
}
.stage .brand-crest .txt .n {
  font-family: var(--font-serif); font-size: 19px; line-height: 1;
}
.stage .brand-crest .txt .s {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3);
  margin-top: 3px;
}
.stage-tools {
  display: flex; gap: 6px;
}
.stage-tools .tool {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--rule);
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: transform .25s var(--ease-spring), color .15s, border-color .15s;
}
.stage-tools .tool:hover { color: var(--ink); border-color: var(--ink); transform: rotate(-6deg); }
.stage-tools .tool.active { background: var(--ink); color: var(--canvas); border-color: var(--ink); }

/* slices stack */
.slices {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: stretch;
  padding: 2px 28px;
  margin-top: 4px;
}
@media (max-width: 1280px) {
  .slices { padding: 2px 10px; }
}

.slice {
  position: relative;
  height: 230px;
  display: grid;
  grid-template-columns: 48px 1fr 48px 200px;
  grid-template-areas: "lft viewport rgt info";
  gap: 10px;
  align-items: center;
  border-top: 1px dashed var(--rule);
}
@media (max-width: 1280px) {
  .slice { height: 210px; grid-template-columns: 40px 1fr 40px 170px; gap: 8px; }
}
@media (max-width: 1100px) {
  .slice { grid-template-columns: 36px 1fr 36px 150px; gap: 6px; }
}
.slice:first-of-type { border-top: 1px dashed transparent; }
.slice + .slice { margin-top: -18px; }

.slice .label {
  position: absolute; left: -52px; top: 14px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-4);
  writing-mode: vertical-rl; transform: rotate(180deg);
}

.slice .arrow {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--rule);
  display: grid; place-items: center;
  color: var(--ink-2); justify-self: center;
  transition: all .2s;
}
.slice .arrow.left { grid-area: lft; }
.slice .arrow.right { grid-area: rgt; }
.slice .arrow:hover { background: var(--ink); color: var(--canvas); border-color: var(--ink); transform: scale(1.07); }
.slice .arrow:active { transform: scale(0.92); }

.slice .viewport {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  grid-area: viewport;
}

.slice .stripe {
  position: absolute; left: 48px; right: calc(200px + 48px + 10px); top: 50%;
  height: 84%; transform: translateY(-50%);
  border-radius: var(--r-lg);
  background: var(--stripe, oklch(0.95 0.02 85));
  opacity: 0.32;
  transition: background .4s ease, left .2s, right .2s;
  pointer-events: none;
  filter: saturate(1.05);
}
/* When info column is small (right-outside tweak), pull stripe further right */
.app[data-info-side="right-outside"] .slice .stripe { right: 48px; }
.app[data-info-side="left-under"] .slice .stripe,
.app[data-info-side="none"] .slice .stripe { right: 48px; }
@media (max-width: 1280px) {
  .slice .stripe { left: 40px; right: calc(170px + 40px + 8px); }
  .app[data-info-side="right-outside"] .slice .stripe { right: 40px; }
  .app[data-info-side="left-under"] .slice .stripe,
  .app[data-info-side="none"] .slice .stripe { right: 40px; }
}
@media (max-width: 1100px) {
  .slice .stripe { left: 36px; right: calc(150px + 36px + 6px); }
  .app[data-info-side="right-outside"] .slice .stripe { right: 36px; }
  .app[data-info-side="left-under"] .slice .stripe,
  .app[data-info-side="none"] .slice .stripe { right: 36px; }
}

.slice .deck { position: relative; width: 100%; height: 100%; }
.slice .card {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: grab;
  touch-action: pan-y;
}
.slice .card:active { cursor: grabbing; }
.slice[data-layer="top"]    .card img { height: 220px; }
.slice[data-layer="mid"]    .card img { height: 235px; }
.slice[data-layer="bottom"] .card img { height: 150px; }
@media (max-width: 1280px) {
  .slice[data-layer="top"]    .card img { height: 195px; }
  .slice[data-layer="mid"]    .card img { height: 210px; }
  .slice[data-layer="bottom"] .card img { height: 130px; }
}

.slice .card img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px oklch(0.25 0.01 270 / 0.25));
  pointer-events: none;
  transition: transform .3s var(--ease-out);
}
.slice .card.enter img { animation: cardIn .6s var(--ease-spring) both; }
@keyframes cardIn {
  0% { transform: scale(.82) translateY(18px); opacity: 0; }
  60%{ transform: scale(1.02); opacity: 1; }
  100%{ transform: scale(1); opacity: 1;}
}

.slice .info {
  grid-area: info;
  align-self: center;
  justify-self: start;
  background: transparent;
  border: none;
  padding: 0 4px;
  display: flex; flex-direction: column; gap: 4px;
  max-width: 220px;
  z-index: 3;
}
.slice .info .brand { font-family: var(--font-serif); font-size: 22px; line-height: 1.05; }
.slice .info .style { font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); letter-spacing: 0.02em; line-height: 1.35; }
.slice .info .prices { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.slice .info .new { font-family: var(--font-serif); font-size: 24px; }
.slice .info .brand {
  font-family: var(--font-serif); font-size: 17px; line-height: 1.05;
}
.slice .info .style {
  font-size: 11px; color: var(--ink-3); line-height: 1.25;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.slice .info .prices {
  display: flex; align-items: baseline; gap: 8px; margin-top: 4px;
}
.slice .info .old {
  text-decoration: line-through;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
}
.slice .info .new {
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--ink);
}
.slice .info .save {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--orchid);
}

/* page dots inside slice */
.slice .dots {
  position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 5px;
}
.slice .dots .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--ink-4);
  opacity: .5; transition: all .25s;
}
.slice .dots .dot.active {
  background: var(--ink);
  transform: scale(1.8);
  opacity: 1;
}

/* shuffle + action cluster (inside stage-head, top-right) */
.stage-actions {
  display: flex; gap: 6px; align-items: center;
}
.shuffle-fab {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--orchid); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid oklch(0.58 0.22 340);
  box-shadow: 0 10px 30px -8px oklch(0.55 0.22 340 / 0.55), 0 2px 6px oklch(0.2 0.01 270 / 0.08);
  transition: transform .3s var(--ease-spring), background .2s;
}
.shuffle-fab:hover { background: oklch(0.62 0.24 340); transform: translateY(-2px) rotate(-8deg); }
.shuffle-fab:active { transform: translateY(0) scale(.96); }
.action-fab {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--panel); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-sm);
  transition: all .2s;
}
.action-fab:hover { background: var(--ink); color: var(--canvas); border-color: var(--ink); transform: translateY(-2px); }
.action-fab:active { transform: translateY(0) scale(.94); }
.action-fab.primary {
  background: var(--ink); color: var(--canvas); border-color: var(--ink);
  width: 44px; height: 44px;
}
.action-fab.primary:hover { background: oklch(0.18 0 0); transform: translateY(-2px) scale(1.04); }

/* ——————— Totals Rail (right column of stage-wrap) ——————— */
.totals {
  display: flex; flex-direction: column;
  gap: 14px;
  min-height: 640px;
}

.total-card {
  background: var(--panel);
  border-radius: var(--r-xl);
  border: 1px solid var(--rule);
  padding: 22px 20px 20px 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.total-card::before {
  content: ""; position: absolute; inset: auto auto -40% -20%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--lime) 0%, transparent 70%);
  opacity: .55;
}
.total-card .head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px; position: relative;
}
.total-card .h-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3);
}
.total-card .count {
  font-family: var(--font-mono); font-size: 11px;
  padding: 3px 8px; background: var(--canvas-2);
  border-radius: var(--r-pill); color: var(--ink-3);
}
.total-card .price-row {
  display: flex; align-items: baseline; gap: 10px; position: relative;
  padding: 6px 0 14px 0;
}
.total-card .curr {
  font-family: var(--font-serif); font-size: 36px; line-height: 1;
  color: var(--ink-3);
}
.total-card .total-amount {
  font-family: var(--font-serif); font-size: 64px; line-height: 0.95;
  letter-spacing: -0.02em;
}
.total-card .old-total {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-4); text-decoration: line-through;
  margin-left: auto;
}
.total-card .breakdown {
  display: grid; gap: 6px; padding-top: 10px;
  border-top: 1px dashed var(--rule);
  position: relative;
}
.total-card .line {
  display: flex; justify-content: space-between; font-size: 12px;
  color: var(--ink-2);
}
.total-card .line .k { font-family: var(--font-mono); letter-spacing: 0.03em; color: var(--ink-3); }
.total-card .line .v { font-family: var(--font-mono); }

.cta-add {
  position: relative; overflow: hidden;
  width: 100%;
  padding: 16px 18px;
  background: var(--ink);
  color: var(--canvas);
  border-radius: var(--r-lg);
  font-family: var(--font-serif);
  font-size: 19px;
  letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  transition: transform .2s var(--ease-spring), background .2s;
  box-shadow: var(--shadow-md);
}
.cta-add:hover { background: oklch(0.14 0.015 340); }
.cta-add:active { transform: scale(0.985); }
.cta-add .arrow {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--orchid); color: white;
  display: grid; place-items: center;
  transition: transform .3s var(--ease-spring);
}
.cta-add:hover .arrow { transform: translateX(4px) rotate(-8deg); }
.cta-add .shine {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, oklch(1 0 0 / 0.15) 50%, transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
}
.cta-add:hover .shine { animation: shine 1.1s ease; }
@keyframes shine {
  to { transform: translateX(120%); }
}

.minicta {
  display: flex; gap: 8px;
}
.minicta .mc {
  flex: 1;
  padding: 10px 8px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .18s;
}
.minicta .mc:hover { background: var(--ink); color: var(--canvas); border-color: var(--ink); }

/* AI Stylist card */
.ai-card {
  background: linear-gradient(155deg, oklch(0.22 0.06 300) 0%, oklch(0.18 0.04 270) 100%);
  color: var(--canvas);
  border-radius: var(--r-xl);
  padding: 18px 18px 14px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.ai-card::before {
  content: "";
  position: absolute; inset: -30% -20% auto auto;
  width: 240px; height: 240px;
  background: radial-gradient(circle, var(--orchid) 0%, transparent 65%);
  opacity: .35;
  animation: float 8s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(-6%, 6%) scale(1.1); }
}
.ai-card .row1 {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: oklch(0.95 0.04 340);
}
.ai-card .row1 .orb {
  width: 10px; height: 10px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--orchid), var(--sky), var(--lime), var(--orchid));
  animation: spin 3s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-card h3 {
  font-family: var(--font-serif);
  font-size: 22px; line-height: 1.1;
  margin: 6px 0 8px 0;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.ai-card h3 em { font-style: italic; color: oklch(0.88 0.14 340); }
.ai-card .suggestions {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 10px;
}
.ai-card .sugg {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: oklch(1 0 0 / 0.08);
  border: 1px solid oklch(1 0 0 / 0.1);
  border-radius: var(--r-md);
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}
.ai-card .sugg:hover { background: oklch(1 0 0 / 0.14); }
.ai-card .sugg .title { font-weight: 500; }
.ai-card .sugg .hint { color: oklch(0.75 0.02 270); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.02em;}
.ai-card .sugg svg { margin-left: auto; opacity: .6; }

/* ——————— Right rail (looks + matched) ——————— */
.rail {
  grid-area: rail;
  border-left: 1px solid var(--rule);
  padding: 22px 22px 22px 18px;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

.rail-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px; letter-spacing: -0.01em; line-height: 1;
}
.rail-head p {
  margin: 6px 0 0 0; color: var(--ink-3); font-size: 12px;
}

.looks {
  display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.look {
  position: relative;
  padding: 10px 10px 8px 10px;
  border-radius: var(--r-lg);
  border: 1px solid var(--rule);
  background: var(--panel);
  cursor: pointer;
  transition: transform .25s var(--ease-spring), box-shadow .2s, border-color .2s;
  overflow: hidden;
}
.look:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.look .name {
  font-family: var(--font-serif);
  font-size: 16px; line-height: 1; margin: 0 0 2px 0;
}
.look .mood {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.look .thumbs {
  position: relative;
  height: 78px;
  border-radius: var(--r-md);
  background: var(--bg, oklch(0.96 0.012 85));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.look .thumbs img {
  position: absolute;
  max-height: 72%;
  filter: drop-shadow(0 4px 6px oklch(0.2 0.01 270 / 0.2));
}
.look .thumbs .t1 { left: 10%; top: 4px; max-height: 62%; z-index: 1; transform: rotate(-4deg);}
.look .thumbs .t2 { left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; max-height: 86%;}
.look .thumbs .t3 { right: 6%; bottom: 2px; max-height: 52%; z-index: 2; transform: rotate(4deg);}

.look .price {
  font-family: var(--font-mono);
  font-size: 11px; margin-top: 8px; color: var(--ink-2);
  display: flex; justify-content: space-between;
}
.look .price .save { color: var(--orchid); }

/* matched items from wardrobe */
.matched h4 {
  margin: 0 0 10px 0; font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.strip-h {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}
.strip-h::-webkit-scrollbar { height: 4px; }
.strip-h::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 4px; }
.strip-h .thumb {
  flex: 0 0 auto;
  width: 78px; height: 96px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--rule);
  display: grid; place-items: center;
  padding: 6px;
  position: relative;
  cursor: pointer;
  transition: all .18s;
}
.strip-h .thumb:hover { transform: translateY(-2px); border-color: var(--ink); }
.strip-h .thumb img { max-height: 72%; max-width: 80%; }
.strip-h .thumb .p {
  position: absolute; bottom: 4px; left: 0; right: 0;
  text-align: center; font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.05em; color: var(--ink-3);
}

/* ——————— Wear (try-on) modal ——————— */
.wear-backdrop {
  position: fixed; inset: 0;
  background: oklch(0.18 0.01 270 / 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: shareFadeIn .25s var(--ease-out);
}
.wear-modal {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-xl);
  padding: 28px 28px 18px;
  width: 100%;
  max-width: 720px;
  display: flex; flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-lg);
  animation: sharePop .4s var(--ease-spring);
}
.wear-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: transparent; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--ease-out);
}
.wear-close:hover { background: var(--canvas-2); color: var(--ink); }

.wear-header { display: flex; flex-direction: column; gap: 4px; }
.wear-title {
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}

.wear-body {
  display: grid;
  grid-template-columns: 1fr 56px;
  grid-template-rows: auto 1fr;
  gap: 14px;
  min-height: 0;
}

.wear-main { display: contents; }
.wear-upload-row {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}
.wear-upload { justify-self: start; }
.wear-credits {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  line-height: 1.4;
  text-wrap: pretty;
}
.wear-credits-n {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--orchid);
  margin: 0 2px;
  vertical-align: -2px;
}
.wear-canvas-grid-placement { /* unused, marker only */ }
.wear-canvas { grid-column: 1; grid-row: 2; }
.wear-side  { grid-column: 2; grid-row: 2; }

.wear-upload {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  padding: 10px 16px 10px 12px;
  border-radius: var(--r-pill);
  background: var(--canvas-2);
  border: 1px dashed var(--ink-3);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: all .2s var(--ease-out);
}
.wear-upload:hover {
  border-style: solid;
  border-color: var(--orchid);
  color: var(--orchid);
  transform: translateY(-1px);
}
.wear-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--rule);
}
.wear-upload:hover .wear-upload-icon {
  border-color: var(--orchid);
  color: var(--orchid);
}

.wear-canvas {
  position: relative;
  flex: 1;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 60vh;
  border-radius: var(--r-md);
  background: oklch(0.1 0.005 270);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wear-canvas-sweep {
  position: absolute;
  left: 0; right: 0;
  height: 28%;
  top: -28%;
  background:
    linear-gradient(180deg,
      transparent 0%,
      oklch(0.92 0.03 340 / 0.04) 25%,
      oklch(0.88 0.18 340 / 0.55) 50%,
      oklch(0.92 0.03 340 / 0.04) 75%,
      transparent 100%);
  filter: blur(2px);
  animation: wear-sweep 4s ease-in-out infinite alternate;
}
@keyframes wear-sweep {
  0%   { top: -28%; }
  100% { top: 100%; }
}
.wear-canvas-hint {
  position: relative;
  z-index: 1;
  color: oklch(0.85 0.01 270 / 0.55);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.wear-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.wear-side-btn {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  background: var(--canvas-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--ease-out);
}
.wear-side-btn:hover {
  background: var(--ink);
  color: var(--canvas);
  border-color: var(--ink);
  transform: translateY(-1px);
}

.wear-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 6px;
  border-top: 1px solid var(--rule);
}
.wear-foot-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orchid);
  box-shadow: 0 0 10px var(--orchid);
  animation: wear-pulse 1.8s ease-in-out infinite;
}
@keyframes wear-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1); }
}

@media (max-width: 540px) {
  .wear-modal { padding: 24px 18px 14px; }
  .wear-title { font-size: 24px; }
  .wear-body { grid-template-columns: 1fr 48px; }
  .wear-side-btn { width: 48px; height: 48px; }
}

/* ——————— Share Modal ——————— */
.share-backdrop {
  position: fixed; inset: 0;
  background: oklch(0.18 0.01 270 / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: shareFadeIn .25s var(--ease-out);
  padding: 20px;
}
@keyframes shareFadeIn { from { opacity: 0 } to { opacity: 1 } }

.share-modal {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-xl);
  padding: 32px 28px 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: sharePop .35s var(--ease-spring);
}
@keyframes sharePop {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.share-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--ease-out);
}
.share-close:hover { background: var(--canvas-2); color: var(--ink); }

.share-eyebrow {
  margin-bottom: 8px;
}
.share-title {
  font-size: 28px;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0 0 6px;
}
.share-sub {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 22px;
  text-wrap: pretty;
}

.share-targets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.share-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px 12px;
  border-radius: var(--r-md);
  background: var(--canvas-2);
  border: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink-2);
  transition: all .2s var(--ease-out);
  cursor: pointer;
}
.share-target:hover {
  transform: translateY(-3px);
  background: var(--bg);
  color: var(--fg);
  border-color: var(--bg);
  box-shadow: var(--shadow-md);
}
.share-iconwrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}
.share-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.share-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--canvas);
}
.share-link-url {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-copy {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--canvas);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: background .2s;
}
.share-copy:hover { background: oklch(0.12 0.02 340); }

@media (max-width: 480px) {
  .share-modal { padding: 28px 20px 20px; border-radius: var(--r-lg); }
  .share-title { font-size: 22px; }
  .share-targets { grid-template-columns: repeat(2, 1fr); }
  .share-target { padding: 12px 6px; }
}

/* ——————— Item detail modal ——————— */
.modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(0.2 0.01 270 / 0.55);
  backdrop-filter: blur(6px);
  z-index: 60;
  display: grid; place-items: center;
  padding: 30px;
  animation: fadeIn .3s var(--ease-out);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(920px, 100%);
  max-height: 92vh;
  background: var(--panel);
  border-radius: var(--r-xl);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  box-shadow: var(--shadow-lg);
  animation: popIn .5s var(--ease-spring);
}
@keyframes popIn {
  from { transform: scale(.9) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal .gallery {
  background: var(--m-bg, oklch(0.94 0.015 85));
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.modal .gallery .big { max-width: 100%; max-height: 72vh; object-fit: contain; }
.modal .gallery .dots {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px;
}
.modal .gallery .dots .d {
  width: 8px; height: 8px; border-radius: 50%;
  background: oklch(0.9 0.008 80); border: 1px solid oklch(0.7 0.01 270);
  cursor: pointer; transition: all .2s;
}
.modal .gallery .dots .d.active { background: var(--ink); border-color: var(--ink); width: 22px; border-radius: 4px; }

.modal .copy {
  padding: 28px 28px 24px 28px;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}
.modal .eyebrow { display:flex; justify-content: space-between; align-items:center; }
.modal .brand {
  font-family: var(--font-serif); font-size: 34px;
  line-height: 1; letter-spacing: -0.015em; margin: 0;
}
.modal .style { color: var(--ink-3); font-size: 13px; margin: -4px 0 2px 0; }
.modal .desc {
  font-size: 13.5px; line-height: 1.55; color: var(--ink-2);
}
.modal .prices {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 0 6px 0; border-top: 1px dashed var(--rule); margin-top: 8px;
}
.modal .prices .new { font-family: var(--font-serif); font-size: 32px; line-height: 1; }
.modal .prices .old { text-decoration: line-through; color: var(--ink-4); font-family: var(--font-mono); font-size: 13px; }
.modal .prices .save {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--orchid);
  padding: 4px 8px; background: var(--orchid-wash); border-radius: var(--r-pill);
}

.modal .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.modal .tags .tag {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.06em; padding: 3px 8px;
  background: var(--canvas-2); border-radius: var(--r-pill); color: var(--ink-3);
}
.modal .action-row { display: flex; gap: 8px; margin-top: auto; }
.modal .action-row .primary {
  flex: 1;
  padding: 14px;
  background: var(--ink); color: var(--canvas);
  border-radius: var(--r-md);
  font-family: var(--font-serif); font-size: 17px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.modal .action-row .primary:hover { background: oklch(0.12 0.015 340); }
.modal .action-row .secondary {
  width: 48px; height: 48px; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--rule);
  display: grid; place-items: center; color: var(--ink-2);
}
.modal .action-row .secondary:hover { color: var(--ink); border-color: var(--ink); }

.modal .close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--rule);
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: all .2s;
}
.modal .close:hover { background: var(--ink); color: var(--canvas); border-color: var(--ink); transform: rotate(90deg);}

/* ——————— Modal mobile (bottom sheet) ——————— */
/* AI Stylist bridge — mobile only, between mixer and rail */
.ai-mobile-bridge { display: none; }

@media (max-width: 680px) {
  .totals .ai-card { display: none; }

  .ai-mobile-bridge {
    display: block;
    padding: 0 12px;
    margin-bottom: 4px;
  }
  .ai-mobile-bridge .ai-card .suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .ai-mobile-bridge .ai-card .sugg {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .ai-mobile-bridge .ai-card .sugg svg { margin-left: 0; margin-top: 4px; }
}

@media (max-width: 680px) {
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    animation: sheetUp .4s var(--ease-spring);
  }
  @keyframes sheetUp {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .modal .gallery {
    padding: 20px 24px 16px;
    height: 36vh;
    min-height: 180px;
  }
  .modal .gallery .big { max-height: 100%; }
  .modal .copy {
    overflow-y: auto;
    padding: 20px 22px 36px;
    -webkit-overflow-scrolling: touch;
  }
  .modal .brand { font-size: 26px; }
  .modal .prices .new { font-size: 26px; }
  .modal .close { top: 10px; right: 10px; }
}

/* ——————— Zoom toggle button ——————— */
.zoom-toggle {
  position: absolute;
  bottom: 12px; right: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  background: oklch(0.18 0.01 270 / 0.52);
  color: oklch(1 0 0 / 0.9);
  border: 1px solid oklch(1 0 0 / 0.18);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background .15s;
}
.zoom-toggle:hover { background: oklch(0.18 0.01 270 / 0.82); }

/* Zoomed modal — gallery fills full width */
.modal.zoomed {
  grid-template-columns: 1fr;
  max-width: min(680px, 100%);
}
.modal.zoomed .gallery { padding: 32px; }
.modal.zoomed .gallery .big { max-height: 80vh; }
.modal.zoomed .copy { display: none; }

@media (max-width: 680px) {
  .modal.zoomed .gallery { height: 84vh; min-height: unset; }
  .modal.zoomed .gallery .big { max-height: 100%; }
}

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: var(--canvas);
  padding: 12px 16px; border-radius: var(--r-pill);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; z-index: 80;
  box-shadow: var(--shadow-lg);
  animation: toastIn .35s var(--ease-spring);
}
@keyframes toastIn {
  from { transform: translate(-50%, 30px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
.toast .bullet { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }

/* small screen fallback — keep usable */
@media (max-width: 1400px) {
  .app { grid-template-columns: 220px 1fr 260px; }
  .stage-wrap { grid-template-columns: 1fr 220px; }
}
@media (max-width: 1200px) {
  .app { grid-template-columns: 200px 1fr 230px; }
  .stage-wrap { grid-template-columns: 1fr 210px; gap: 12px; }
  .main { padding: 16px 14px; }
  .slice { grid-template-columns: 40px 1fr 40px; gap: 4px; }
  .slice .arrow { width: 36px; height: 36px; }
  .slice .label { left: -40px; font-size: 9px; }
  .slice .info { right: 6px; max-width: 170px; padding: 10px 12px; }
}
/* compact info under the garment — only on mobile */
.slice .info-mini { display: none; }

/* external info chip — beyond the right arrow */
.slice .info-outside {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  white-space: nowrap;
}
.slice .info-outside .brand {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1;
  letter-spacing: -0.01em;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slice .info-outside .price {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.slice .info-outside .save {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(0.55 0.22 340);
  background: oklch(0.55 0.22 340 / 0.1);
  padding: 2px 5px;
  border-radius: 4px;
  margin-top: 2px;
}

/* Tweak: hide the side info card */
.app[data-hide-info="1"] .slice .info { display: none; }

/* Tweak: where to put the brand+price */
.app[data-info-side="right-outside"] .slice {
  grid-template-columns: 48px 1fr 48px 92px;
  grid-template-areas: "lft viewport rgt outside";
}
.app[data-info-side="right-outside"] .slice .info-outside {
  display: flex;
  grid-area: outside;
  margin-left: 4px;
  align-self: center;
}
@media (max-width: 1280px) {
  .app[data-info-side="right-outside"] .slice {
    grid-template-columns: 40px 1fr 40px 84px;
    grid-template-areas: "lft viewport rgt outside";
  }
}

.app[data-info-side="left-under"] .slice .info {
  display: flex !important;
  position: absolute;
  left: 60px; bottom: 6px;
  background: transparent; border: none; padding: 0;
  flex-direction: row; align-items: baseline; gap: 8px;
  max-width: none;
  z-index: 3;
}
.app[data-info-side="left-under"] .slice .info .style,
.app[data-info-side="left-under"] .slice .info .save,
.app[data-info-side="left-under"] .slice .info .old { display: none; }
.app[data-info-side="left-under"] .slice .info .brand { font-size: 17px; }
.app[data-info-side="left-under"] .slice .info .new { font-size: 14px; font-family: var(--font-mono); color: var(--ink-2); }
.app[data-info-side="left-under"] .slice .info .prices { margin: 0; }

.app[data-info-side="none"] .slice .info,
.app[data-info-side="none"] .slice .info-outside { display: none !important; }

@media (max-width: 1000px) {
  .app {
    height: auto;
    max-height: none;
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto auto auto auto;
    grid-template-areas: "top" "main" "ai" "rail" "side";
  }
  .sidebar, .rail { border: none; border-top: 1px solid var(--rule); max-height: none; }
  .main { padding: 4px 6px 8px 6px; height: calc(100vh - 56px); display: flex; flex-direction: column; }
  .stage-wrap { display: flex !important; flex-direction: column; flex: 1; min-height: 0; margin-top: 0; gap: 0; }
  .stage { flex: 1; min-height: 0; height: auto; }
  .totals { display: none; }
  .ai-mobile-bridge { grid-area: ai; }

  /* hide redundant chrome on mobile but KEEP the action cluster visible */
  .stage .stage-head { padding: 4px 6px 6px 6px; }
  .stage .stage-head .brand-crest { display: none; }
  .stage .stage-head .stage-actions { margin-left: auto; gap: 4px; }
  .stage { padding: 4px; }
  .slice .label { display: none; }
  .slice .info { display: none; }
  .slice .dots { display: none; }

  /* keep tweak override working on mobile too */
  .app[data-info-side="right-outside"] .slice {
    grid-template-columns: 36px 1fr 36px 70px;
    grid-template-areas: "lft viewport rgt outside";
  }
  .app[data-info-side="right-outside"] .slice .info-outside .brand { font-size: 12px; max-width: 70px; }
  .app[data-info-side="right-outside"] .slice .info-outside .price { font-size: 10px; }
  .app[data-info-side="right-outside"] .slice .info-outside .save { font-size: 8px; padding: 1px 4px; }

  /* 3 slices fill viewport — shoe slice ~2/3 height of others (ratio 1:1:0.67) */
  .slices { padding: 0; margin-top: 0; gap: 0; flex: 1; min-height: 0; display: grid; grid-template-rows: 1fr 1fr 0.67fr; }
  .slice {
    grid-template-columns: 36px 1fr 36px;
    grid-template-areas: "lft viewport rgt";
    gap: 0;
    height: 100%;
    min-height: 0;
  }
  .slice + .slice { margin-top: 0; }
  .slice:first-of-type { border-top: none; }
  .slice .arrow { width: 36px; height: 36px; }
  .slice .stripe { left: 6%; right: 6%; height: 86%; }

  /* huge garments — fill the available height */
  .slice .card img {
    height: auto !important;
    max-height: 92% !important;
    max-width: 80% !important;
    width: auto;
  }
  .slice[data-layer="top"]    .card img { max-height: 94% !important; }
  .slice[data-layer="mid"]    .card img { max-height: 95% !important; }
  .slice[data-layer="bottom"] .card img { max-height: 90% !important; }

  .shuffle-fab { width: 40px; height: 40px; }
  .action-fab { width: 36px; height: 36px; }
  .action-fab.primary { width: 40px; height: 40px; }
}

/* ─── Virtual Try-On additions ─────────────────────────────────────────── */

/* Garment layer selector */
.wear-layer-selector {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.wear-layer-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--canvas-2);
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.wear-layer-thumb img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.wear-layer-thumb--on {
  border-color: var(--orchid);
  background: color-mix(in srgb, var(--orchid) 8%, var(--canvas));
  color: var(--orchid);
}
.wear-layer-thumb:hover:not(.wear-layer-thumb--on) {
  border-color: var(--ink-3);
}

/* Generate button */
.wear-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 18px;
  background: var(--orchid);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.wear-generate-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.wear-generate-btn:not(:disabled):hover  { opacity: 0.85; }
.wear-generate-btn:not(:disabled):active { transform: scale(0.97); }

/* User photo thumbnail inside upload button when photo is loaded */
.wear-upload--done { gap: 10px; }
.wear-user-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--orchid);
}

/* Result image fills the canvas */
.wear-canvas--done .wear-canvas-sweep,
.wear-canvas--done .wear-canvas-hint { display: none; }
.wear-result-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Error state */
.wear-error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--orchid);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.wear-retry {
  background: none;
  border: 1px solid var(--orchid);
  color: var(--orchid);
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}
.wear-retry:hover { background: color-mix(in srgb, var(--orchid) 10%, transparent); }
