:root {
  --studio-bg: #f6f7f4;
  --studio-ink: #151712;
  --studio-muted: #65705f;
  --studio-line: rgba(21, 23, 18, 0.14);
  --studio-panel: #ffffff;
  --studio-accent: #1d6f5f;
  --studio-accent-soft: #dcefe9;
  --studio-warm: #f0b35a;
  --studio-bottom-bar-clearance: 88px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(29, 111, 95, 0.10), transparent 36%),
    linear-gradient(180deg, #fbfcf9, var(--studio-bg));
  color: var(--studio-ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--studio-ink);
  color: #fff;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.studio-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  align-items: center;
}

.studio-panel {
  background: var(--studio-panel);
  border: 1px solid var(--studio-line);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(21, 23, 18, 0.08);
}

.studio-launch {
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 22px;
}

.studio-kicker {
  margin: 0 0 6px;
  color: var(--studio-accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.02;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.6rem);
}

h2 {
  font-size: clamp(1.65rem, 4vw, 3.5rem);
}

.studio-login {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.studio-login label {
  display: grid;
  gap: 6px;
  color: var(--studio-muted);
}

.studio-login input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--studio-line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--studio-ink);
}

.studio-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--studio-muted);
}

.studio-app {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.studio-topbar {
  position: sticky;
  top: 12px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.studio-slot {
  min-width: 0;
  min-height: 72px;
  padding: 10px;
  display: grid;
  grid-template-columns: 46px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-content: center;
  text-align: left;
  background: #fff;
  color: var(--studio-ink);
  border: 1px solid var(--studio-line);
}

.studio-slot.is-active {
  background: var(--studio-accent);
  color: #fff;
  border-color: var(--studio-accent);
}

.studio-slot span {
  font-size: 0.76rem;
  color: inherit;
  opacity: 0.72;
}

.studio-slot strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-slot__thumb {
  grid-row: 1 / span 2;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(21, 23, 18, 0.08);
  opacity: 1;
}

.studio-slot__thumb img,
.studio-slot__thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.studio-slot__thumb.is-pending {
  display: grid;
  place-items: center;
}

.studio-slot__thumb.is-pending .studio-spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.studio-slot__thumb.is-empty::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(21, 23, 18, 0.10), rgba(21, 23, 18, 0.02));
}

.studio-lane {
  min-height: 100%;
  display: none;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--studio-line);
  border-radius: 8px;
}

.studio-lane.is-active {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 22px;
}

.studio-lane__header {
  display: grid;
  gap: 4px;
}

.studio-asset-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  align-content: start;
}

.studio-product-row,
.studio-personal-row,
.studio-personal-placeholder-row {
  display: contents;
}

.studio-result-row,
.studio-result-placeholder-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.studio-result-row .studio-asset {
  flex: 0 0 min(320px, 82vw);
  min-width: min(320px, 82vw);
  scroll-snap-align: start;
}

.studio-result-placeholder-row .studio-asset {
  flex: 0 0 min(360px, 90vw);
  min-width: min(360px, 90vw);
  scroll-snap-align: start;
}

.studio-personal-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.studio-file-control {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--studio-line);
  border-radius: 8px;
  background: #fff;
  color: var(--studio-muted);
}

.studio-file-control input {
  max-width: 220px;
}

.studio-camera {
  width: min(420px, 100%);
  overflow: hidden;
  border: 1px solid var(--studio-line);
  border-radius: 8px;
  background: #0d0f0c;
}

.studio-camera video {
  width: 100%;
  display: block;
}

.studio-empty,
.studio-asset {
  min-height: 220px;
  border: 1px solid var(--studio-line);
  border-radius: 8px;
  background: #f9faf7;
}

.studio-empty {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 20px;
  color: var(--studio-muted);
  text-align: center;
}

.studio-asset {
  display: grid;
  position: relative;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  cursor: pointer;
}

.studio-asset img,
.studio-asset video {
  width: 100%;
  height: 100%;
  min-height: 170px;
  object-fit: contain;
  background: #eef2ed;
}

.studio-upload-pending {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  min-height: 170px;
  padding: 20px;
  background: #eef2ed;
  color: var(--studio-muted);
  text-align: center;
}

.studio-upload-pending strong {
  color: var(--studio-ink);
}

.studio-dressme-tools {
  width: min(520px, 100%);
  display: grid;
  gap: 10px;
}

.studio-dressme-tools textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--studio-line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--studio-ink);
  background: #fff;
}

.studio-dressme-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.studio-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(29, 111, 95, 0.18);
  border-top-color: var(--studio-accent);
  border-radius: 999px;
  animation: studio-spin 0.8s linear infinite;
}

@keyframes studio-spin {
  to {
    transform: rotate(360deg);
  }
}

.studio-asset.is-current {
  border-color: var(--studio-accent);
  box-shadow: 0 0 0 3px var(--studio-accent-soft);
}

.studio-asset--placeholder {
  cursor: default;
}

.studio-asset__meta {
  padding: 12px;
  display: grid;
  gap: 4px;
}

.studio-asset__meta strong,
.studio-asset__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-asset__meta span {
  color: var(--studio-muted);
  font-size: 0.9rem;
}

.studio-asset__actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: min(42%, 112px);
  pointer-events: auto;
  touch-action: manipulation;
}

.studio-asset__action {
  border: 1px solid var(--studio-line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--studio-ink);
  padding: 7px 9px;
  font-size: 0.78rem;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(34, 28, 20, 0.12);
  touch-action: manipulation;
  user-select: none;
}

.studio-asset__action--primary {
  border-color: rgba(198, 139, 43, 0.5);
  background: var(--studio-warm);
  color: #2b1d08;
  font-weight: 800;
}

.studio-asset__action--danger {
  border-color: rgba(150, 46, 28, 0.28);
  color: #8a2f1f;
  background: #fff5ef;
}

.studio-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-actions button[data-action="checkout"],
.studio-actions button[data-action="continue-shopping"],
.studio-actions button[data-action="settings"] {
  margin-left: auto;
  background: var(--studio-warm);
  color: #2b1d08;
}

.studio-actions button[data-action="continue-shopping"],
.studio-actions button[data-action="settings"] {
  margin-left: 0;
  background: #fff8ec;
}

.studio-action-menu {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: end center;
  padding: 18px 18px calc(18px + var(--studio-bottom-bar-clearance) + env(safe-area-inset-bottom));
  background: rgba(18, 14, 10, 0.18);
}

.studio-action-menu[hidden] {
  display: none;
}

.studio-action-menu__panel {
  width: min(440px, 100%);
  max-height: min(74vh, 560px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--studio-line);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 24px 70px rgba(34, 24, 14, 0.24);
}

.studio-action-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.studio-action-menu__header button {
  min-height: 34px;
  padding: 0 12px;
}

.studio-action-menu__list {
  display: grid;
  gap: 8px;
}

.studio-action-menu__item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(41, 30, 22, 0.12);
  border-radius: 14px;
  background: #fff;
  color: var(--studio-ink);
  text-align: left;
}

.studio-action-menu__item span {
  color: var(--studio-muted);
  font-size: 0.86rem;
}

.studio-action-menu__item--danger {
  border-color: rgba(150, 46, 28, 0.24);
  color: #8a2f1f;
  background: #fff5ef;
}

.studio-paste-panel {
  position: fixed;
  inset: 0;
  z-index: 82;
  display: grid;
  place-items: end center;
  padding: 18px 18px calc(18px + var(--studio-bottom-bar-clearance) + env(safe-area-inset-bottom));
  background: rgba(18, 14, 10, 0.2);
}

.studio-paste-panel__panel {
  width: min(440px, 100%);
  padding: 14px;
  border: 1px solid var(--studio-line);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 24px 70px rgba(34, 24, 14, 0.24);
}

.studio-paste-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.studio-paste-panel__header button {
  min-height: 34px;
  padding: 0 12px;
}

.studio-paste-panel p {
  margin: 0 0 12px;
  color: var(--studio-muted);
}

.studio-paste-target {
  min-height: 96px;
  padding: 12px;
  border: 1px dashed rgba(29, 111, 95, 0.38);
  border-radius: 14px;
  background: #fff;
  color: var(--studio-ink);
  outline: none;
  overflow-wrap: anywhere;
}

.studio-paste-target:empty::before {
  content: "Paste image or image URL here";
  color: var(--studio-muted);
}

.studio-notification-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(214, 174, 115, 0.5);
  border-radius: 14px;
  background: #fff7e7;
  color: var(--studio-ink);
}

.studio-notification-callout[hidden] {
  display: none;
}

.studio-notification-callout strong,
.studio-notification-callout span {
  display: block;
}

.studio-notification-callout span {
  margin-top: 2px;
  color: var(--studio-muted);
  font-size: 0.9rem;
}

.studio-home-screen-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid rgba(54, 93, 122, 0.24);
  border-radius: 14px;
  background: #eef7fb;
  color: var(--studio-ink);
}

.studio-home-screen-callout[hidden] {
  display: none;
}

.studio-home-screen-callout strong,
.studio-home-screen-callout span {
  display: block;
}

.studio-home-screen-callout span {
  margin-top: 2px;
  color: var(--studio-muted);
  font-size: 0.9rem;
}

.studio-home-screen-callout__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.studio-home-screen-callout__actions button {
  min-height: 36px;
  padding: 0 12px;
}

.studio-toast {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(47, 35, 24, 0.14);
  border-radius: 14px;
  background: rgba(28, 22, 18, 0.94);
  color: #fff;
  box-shadow: 0 18px 44px rgba(30, 20, 10, 0.24);
  font-weight: 700;
}

.studio-toast[hidden] {
  display: none;
}

.studio-fullscreen-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: rgba(8, 10, 8, 0.96);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.studio-fullscreen-track {
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 180ms ease;
  will-change: transform;
}

.studio-fullscreen-track.is-dragging {
  transition: none;
}

.studio-fullscreen-slide {
  width: 100%;
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.studio-fullscreen-label {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 101;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--studio-ink);
  font-weight: 800;
  font-size: 0.82rem;
}

.studio-fullscreen-viewer img {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
}

.studio-fullscreen-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 101;
  min-height: 38px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--studio-ink);
}

.studio-fullscreen-dots {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 101;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.studio-fullscreen-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.studio-fullscreen-dots span.is-active {
  background: #fff;
}

@media (max-width: 720px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .studio-shell {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    display: block;
    align-items: stretch;
  }

  .studio-login {
    grid-template-columns: 1fr;
  }

  .studio-app {
    display: block;
    min-height: 0;
    height: 100dvh;
  }

  .studio-stage {
    position: fixed;
    top: 86px;
    right: 8px;
    bottom: 78px;
    left: 8px;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .studio-topbar {
    position: fixed;
    top: auto;
    top: 8px;
    left: 8px;
    right: 8px;
    z-index: 10;
    grid-template-columns: repeat(4, minmax(74px, 1fr));
    overflow-x: auto;
    gap: 6px;
    background: rgba(246, 247, 244, 0.94);
    backdrop-filter: blur(10px);
  }

  .studio-slot {
    min-height: 70px;
    padding: 7px;
    grid-template-columns: 42px 1fr;
    gap: 1px 6px;
  }

  .studio-slot__thumb {
    width: 42px;
    height: 52px;
  }

  .studio-slot span:not(.studio-slot__thumb) {
    font-size: 0.68rem;
  }

  .studio-slot strong {
    font-size: 0.76rem;
  }

  .studio-notification-callout {
    position: fixed;
    top: 96px;
    left: 8px;
    right: 8px;
    z-index: 10;
    margin: 0;
    padding: 9px 10px;
    font-size: 0.9rem;
    box-shadow: 0 8px 28px rgba(37, 24, 10, 0.14);
  }

  .studio-lane {
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .studio-lane.is-active {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .studio-lane__header {
    display: none;
  }

  .studio-personal-tools {
    margin: 8px;
    padding: 10px;
    border: 1px solid var(--studio-line);
    border-radius: 8px;
    background: #fff;
  }

  .studio-camera {
    margin: 0 8px;
    max-height: 28dvh;
  }

  .studio-asset-list {
    grid-template-columns: 1fr;
    min-height: 0;
    height: auto;
    flex: 1 1 0;
    padding: 8px;
    position: relative;
    overflow: hidden;
    touch-action: none;
  }

  .studio-asset-list .studio-asset {
    display: none;
  }

  .studio-asset-list .studio-asset.is-current {
    position: absolute;
    inset: 8px;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    box-shadow: none;
    transform: translate(var(--studio-drag-x, 0), var(--studio-drag-y, 0));
    transition: transform 160ms ease;
    z-index: 2;
  }

  .studio-asset-list .studio-asset.is-preview {
    position: absolute;
    inset: 8px;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    transform: translate(var(--studio-preview-x, 0), var(--studio-preview-y, 0));
    transition: transform 160ms ease;
    z-index: 1;
  }

  .is-dragging .studio-asset-list .studio-asset.is-current,
  .is-dragging .studio-asset-list .studio-asset.is-preview {
    transition: none;
  }

  .is-dragging-x .studio-asset-list .studio-asset.is-preview {
    transform: translate(calc(var(--studio-preview-x, 0) + var(--studio-drag-x, 0)), 0);
  }

  .is-dragging-y .studio-asset-list .studio-asset.is-preview {
    transform: translate(0, calc(var(--studio-preview-y, 0) + var(--studio-drag-y, 0)));
  }

  .studio-asset img,
  .studio-asset video {
    min-height: 0;
    height: 100%;
    object-fit: contain;
  }

  .studio-upload-pending {
    min-height: 0;
    height: 100%;
  }

  .studio-empty {
    min-height: 0;
    height: 100%;
  }

  .studio-asset__meta {
    min-height: 58px;
    padding: 10px 12px;
  }

  .studio-actions {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 10;
    padding: 8px;
    border: 1px solid var(--studio-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
  }

  .studio-actions button {
    flex: 1 1 auto;
  }
}

@media (orientation: landscape) and (pointer: coarse), (pointer: coarse) and (min-width: 721px) {
  html,
  body {
    height: 100svh;
    overflow: hidden;
  }

  .studio-shell {
    width: 100%;
    height: 100svh;
    min-height: 100svh;
    padding: 0;
    display: block;
  }

  .studio-app {
    display: grid;
    grid-template-rows: 58px minmax(0, 1fr) 52px;
    gap: 5px;
    position: relative;
    width: 100%;
    min-height: 0;
    height: 100svh;
    max-height: 100svh;
    padding: 6px 8px;
    overflow: hidden;
  }

  .studio-hit-refresh {
    transform: translateZ(0.001px);
  }

  .studio-topbar {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    z-index: 80;
    grid-template-columns: repeat(4, minmax(82px, 1fr));
    gap: 6px;
    background: rgba(246, 247, 244, 0.94);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    touch-action: manipulation;
    transform: translateZ(0);
  }

  .studio-notification-callout,
  .studio-home-screen-callout {
    display: none !important;
  }

  .studio-slot {
    min-height: 0;
    height: 58px;
    padding: 5px;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 1px 6px;
  }

  .studio-slot__thumb {
    width: 38px;
    height: 46px;
  }

  .studio-slot span:not(.studio-slot__thumb) {
    font-size: 0.66rem;
  }

  .studio-slot strong {
    font-size: 0.74rem;
  }

  .studio-stage {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: 1;
    min-height: 0;
    overflow: hidden;
    pointer-events: auto;
  }

  .studio-lane {
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .studio-lane.is-active {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
  }

  .studio-lane__header {
    display: none;
  }

  .studio-asset-list {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    gap: 10px;
    height: 100%;
    min-height: 0;
    padding: 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  .studio-asset-list .studio-asset,
  .studio-asset-list .studio-asset.is-current,
  .studio-asset-list .studio-asset.is-preview {
    position: relative;
    inset: auto;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    transform: none;
    transition: none;
    z-index: auto;
  }

  .studio-product-row,
  .studio-personal-row,
  .studio-result-row,
  .studio-result-placeholder-row {
    display: flex;
    gap: 10px;
    flex: 1 0 100%;
    min-height: 0;
    max-height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
  }

  .studio-product-row .studio-asset,
  .studio-personal-row .studio-asset,
  .studio-result-row .studio-asset {
    flex: 0 0 calc((100% - 20px) / 3);
    min-width: calc((100% - 20px) / 3);
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    scroll-snap-align: start;
  }

  .studio-product-row .studio-asset--has-actions,
  .studio-personal-row .studio-asset--has-actions,
  .studio-result-row .studio-asset--has-actions {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .studio-product-row .studio-asset--has-actions img,
  .studio-product-row .studio-asset--has-actions video,
  .studio-personal-row .studio-asset--has-actions img,
  .studio-personal-row .studio-asset--has-actions video,
  .studio-result-row .studio-asset--has-actions img,
  .studio-result-row .studio-asset--has-actions video,
  .studio-product-row .studio-asset--has-actions .studio-upload-pending,
  .studio-personal-row .studio-asset--has-actions .studio-upload-pending,
  .studio-result-row .studio-asset--has-actions .studio-upload-pending {
    grid-column: 1;
    grid-row: 1;
  }

  .studio-product-row .studio-asset--has-actions .studio-asset__meta,
  .studio-personal-row .studio-asset--has-actions .studio-asset__meta,
  .studio-result-row .studio-asset--has-actions .studio-asset__meta {
    grid-column: 1;
    grid-row: 2;
  }

  .studio-product-row .studio-asset .studio-asset__actions,
  .studio-personal-row .studio-asset .studio-asset__actions,
  .studio-result-row .studio-asset .studio-asset__actions {
    position: relative;
    grid-column: 2;
    grid-row: 1 / 3;
    z-index: 20;
    width: 100%;
    max-width: none;
    display: grid;
    grid-auto-rows: minmax(44px, max-content);
    align-content: start;
    align-items: stretch;
    justify-content: stretch;
    padding: 8px;
    gap: 8px;
    background: rgba(249, 250, 247, 0.94);
    border-left: 1px solid var(--studio-line);
    pointer-events: auto;
    touch-action: manipulation;
  }

  .studio-product-row .studio-asset .studio-asset__action,
  .studio-personal-row .studio-asset .studio-asset__action,
  .studio-result-row .studio-asset .studio-asset__action {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 4px;
    font-size: 0.76rem;
    box-shadow: none;
    touch-action: manipulation;
  }

  .studio-result-placeholder-row .studio-asset {
    flex: 0 0 calc((100% - 20px) / 3);
    min-width: calc((100% - 20px) / 3);
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
  }

  .studio-lane[data-lane="on"] .studio-asset-list {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .studio-lane[data-lane="on"] .studio-personal-row {
    flex: 1 1 0;
    min-height: 120px;
    max-height: none;
  }

  .studio-lane[data-lane="on"] .studio-personal-row:empty {
    display: none;
  }

  .studio-personal-placeholder-row {
    display: flex;
    gap: 10px;
    flex: 0 0 170px;
    min-height: 170px;
    max-height: 220px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px;
  }

  .studio-personal-placeholder-row .studio-asset {
    flex: 0 0 calc((100% - 20px) / 3);
    min-width: calc((100% - 20px) / 3);
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
  }

  .studio-personal-placeholder-row .studio-empty {
    min-height: 0;
    height: 100%;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
  }

  .studio-personal-placeholder-row .studio-empty > strong,
  .studio-personal-placeholder-row .studio-empty > span {
    display: none;
  }

  .studio-personal-tools {
    display: none;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--studio-line);
    border-radius: 8px;
    background: #fff;
    gap: 8px;
  }

  .studio-lane.is-active > .studio-personal-tools {
    display: flex;
    flex: 0 0 auto;
  }

  .studio-personal-placeholder-row .studio-personal-tools {
    display: flex;
  }

  .studio-lane[data-lane="on"] .studio-personal-row .studio-asset {
    flex: 0 0 calc((100% - 20px) / 3);
    min-width: calc((100% - 20px) / 3);
    min-height: 120px;
    height: 100%;
  }

  .studio-lane[data-lane="on"] .studio-personal-row .studio-asset img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 80px;
    object-fit: contain;
  }

  .studio-lane[data-lane="you"] .studio-asset-list,
  .studio-lane[data-lane="live"] .studio-asset-list {
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 14px;
    -webkit-overflow-scrolling: touch;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset {
    flex: 0 0 100%;
    min-height: 160px;
    height: 100%;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset img,
  .studio-result-row .studio-asset img,
  .studio-result-row .studio-asset video,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset img,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset video {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 110px;
    object-fit: contain;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder,
  .studio-result-placeholder-row .studio-asset--placeholder {
    overflow-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder .studio-empty,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder .studio-empty,
  .studio-result-placeholder-row .studio-empty {
    height: auto;
    min-height: 100%;
    padding: 8px;
    gap: 6px;
    align-content: start;
    justify-items: center;
    overflow: visible;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder .studio-empty > strong,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder .studio-empty > strong,
  .studio-result-placeholder-row .studio-empty > strong {
    font-size: 0.9rem;
    line-height: 1.15;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder .studio-empty > span,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder .studio-empty > span,
  .studio-result-placeholder-row .studio-empty > span {
    font-size: 0.76rem;
    line-height: 1.2;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-tools,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-tools,
  .studio-result-placeholder-row .studio-dressme-tools {
    width: min(520px, 100%);
    gap: 6px;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-tools textarea,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-tools textarea,
  .studio-result-placeholder-row .studio-dressme-tools textarea {
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    padding: 6px 8px;
    resize: none;
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-actions,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-actions,
  .studio-result-placeholder-row .studio-dressme-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .studio-lane[data-lane="you"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-actions button,
  .studio-lane[data-lane="live"] .studio-asset-list > .studio-asset--placeholder .studio-dressme-actions button,
  .studio-result-placeholder-row .studio-dressme-actions button {
    min-height: 34px;
    padding: 3px 6px;
    font-size: 0.76rem;
    line-height: 1.05;
    white-space: normal;
  }

  .studio-file-control {
    min-height: 38px;
    padding: 6px 8px;
  }

  .studio-file-control input {
    max-width: 170px;
  }

  .studio-camera {
    max-height: 34dvh;
  }

  .studio-asset-list .studio-asset {
    box-shadow: none;
  }

  .studio-asset img,
  .studio-asset video {
    min-height: 0;
    height: 100%;
    object-fit: contain;
  }

  .studio-upload-pending,
  .studio-empty {
    min-height: 0;
    height: 100%;
  }

  .studio-asset__meta {
    min-height: 42px;
    padding: 7px 9px;
  }

  .studio-asset__meta span {
    font-size: 0.76rem;
  }

  .studio-actions {
    display: flex !important;
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 80;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    height: 52px;
    min-height: 0;
    padding: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--studio-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    touch-action: manipulation;
    transform: translateZ(0);
  }

  .studio-actions button[data-action="checkout"],
  .studio-actions button[data-action="continue-shopping"],
  .studio-actions button[data-action="settings"] {
    margin-left: 0;
  }

  .studio-actions button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 9px;
    white-space: nowrap;
    pointer-events: auto;
  }
}

@media (orientation: landscape) and (pointer: coarse) and (max-width: 980px),
  (orientation: landscape) and (pointer: coarse) and (max-height: 620px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .studio-shell {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    display: block;
    overflow: hidden;
  }

  .studio-app {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    display: block !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .studio-topbar {
    position: fixed !important;
    top: max(4px, env(safe-area-inset-top)) !important;
    left: 8px !important;
    right: 8px !important;
    height: 58px !important;
    z-index: 110 !important;
    pointer-events: auto !important;
    transform: translateZ(0);
  }

  .studio-topbar .studio-slot {
    pointer-events: auto !important;
    touch-action: manipulation;
  }

  .studio-stage {
    position: fixed !important;
    top: calc(max(4px, env(safe-area-inset-top)) + 64px) !important;
    left: 8px !important;
    right: 8px !important;
    bottom: calc(max(4px, env(safe-area-inset-bottom)) + 52px) !important;
    height: auto !important;
    min-height: 0 !important;
    z-index: 1 !important;
    overflow: hidden !important;
  }

  .studio-actions {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: max(4px, env(safe-area-inset-bottom)) !important;
    height: 44px !important;
    max-height: 44px !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
    z-index: 100 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .studio-actions button {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    justify-content: center;
  }

  .studio-action-menu {
    z-index: 120;
    place-items: end center;
    padding: 8px 8px calc(max(4px, env(safe-area-inset-bottom)) + 58px);
  }
}
