:root {
  color-scheme: light;
  --ink: #20211f;
  --muted: #686b66;
  --paper: #f5f1e8;
  --panel: #fffdf8;
  --line: #ded9ce;
  --accent: #111111;
  --accent-dark: #000000;
  --secondary: #565c59;
  --app-height: 100dvh;
  --controls-mobile-max-height: 48dvh;
  --controls-mobile-result-max-height: 42dvh;
  --model-picker-panel-mobile-height: min(78dvh, 620px);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

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

body.model-picker-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

body.product-entry-mode.model-picker-open::before {
  display: none;
}

button,
input,
select {
  font: inherit;
}

.app {
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  overflow: hidden;
}

.camera {
  position: relative;
  min-height: 0;
  background: #111;
  display: grid;
  place-items: center;
  overflow: hidden;
}

video,
canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

#guideCanvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

#photoCanvas,
#resultCanvas {
  display: none;
}

.has-photo #guideCanvas,
.has-result #guideCanvas {
  display: none;
}

.has-photo #video {
  display: none;
}

.has-photo #photoCanvas {
  display: block;
}

.has-result #photoCanvas,
.has-result #video {
  display: none;
}

.has-result #resultCanvas {
  display: block;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.status-loading .loading-overlay {
  opacity: 1;
}

.favorite-overlay-button {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 7;
  min-width: 38px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  color: #111;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  touch-action: manipulation;
}

.favorite-overlay-button:hover {
  background: white;
}

.favorite-overlay-button:disabled {
  opacity: 0.72;
}

.favorite-overlay-button[hidden] {
  display: none;
}

.favorite-overlay-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorite-overlay-button.is-active svg {
  fill: currentColor;
}

body.product-entry-mode .favorite-overlay-button,
body.product-entry-mode .favorites-open-button,
body.product-entry-mode .favorites-view {
  display: none !important;
}

.loading-spinner {
  width: clamp(72px, 22vw, 132px);
  height: clamp(72px, 22vw, 132px);
  border: clamp(5px, 1.4vw, 9px) solid rgba(255, 255, 255, 0.28);
  border-top-color: white;
  border-radius: 50%;
  animation: status-spinner 0.82s linear infinite;
}

.status {
  min-height: 48px;
  padding: 10px 18px;
  color: white;
  background: #171715;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status::before {
  display: none;
}

.photo-note {
  padding: 11px 18px 12px;
  color: #111;
  background: #fff;
  border-top: 2px solid #111;
  border-bottom: 1px solid #cfcac0;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.35;
}

@keyframes status-spinner {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation-duration: 1.6s;
  }
}

.controls {
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
  overscroll-behavior: contain;
}

.model-picker {
  position: relative;
  z-index: 8;
  margin-bottom: 12px;
}

body.model-picker-open .model-picker {
  z-index: 1000;
}

body.model-picker-open .camera,
body.model-picker-open .status,
body.model-picker-open .photo-note,
body.model-picker-open .controls > :not(.model-picker) {
  pointer-events: none;
}

.model-picker-button {
  width: 100%;
  min-height: 82px;
  border: 1px solid #d6d1c7;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 18px;
  align-content: center;
  justify-items: start;
  gap: 3px 12px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  text-align: left;
}

.model-picker-button:hover,
.model-picker-button[aria-expanded="true"] {
  color: var(--ink);
  background: #f8f6f0;
}

.model-picker-button::after {
  content: "";
  grid-column: 3;
  grid-row: 1 / span 3;
  align-self: center;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.model-picker-button[aria-expanded="true"]::after {
  transform: rotate(225deg);
}

body.product-entry-mode .model-picker-button {
  min-height: 66px;
  grid-template-columns: minmax(0, 1fr);
  cursor: default;
  pointer-events: none;
}

body.product-entry-mode .model-picker-button:hover {
  background: white;
}

body.product-entry-mode .model-picker-button::after,
body.product-entry-mode .model-browser-inline,
body.product-entry-mode .model-picker-panel,
body.product-entry-mode .selected-model-thumb,
body.product-entry-mode .model-picker-label,
body.product-entry-mode .product-card-link {
  display: none;
}

body.product-entry-mode #selectedModelTitle,
body.product-entry-mode #selectedModelMeta {
  grid-column: 1;
}

.model-browser-inline {
  display: none;
  gap: 8px;
  margin-top: 8px;
}

.selected-model-thumb {
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 58px;
  height: 58px;
  align-self: center;
  justify-self: center;
  object-fit: contain;
}

.model-picker-label,
#selectedModelMeta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

#selectedModelTitle {
  grid-column: 2;
  max-width: 100%;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.22;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#selectedModelMeta {
  grid-column: 2;
}

.product-card-link {
  min-height: 42px;
  margin-top: 8px;
  border: 1px solid #d6d1c7;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  color: var(--ink);
  background: #f8f6f0;
  font-size: 14px;
  font-weight: 800;
}

.product-card-link:hover {
  background: #efebe2;
}

.product-card-link svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.model-picker-panel {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  left: max(10px, env(safe-area-inset-left));
  z-index: 1001;
  max-height: min(78vh, 620px);
  border: 1px solid #d6d1c7;
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  background: var(--panel);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
}

.model-picker-panel[hidden] {
  display: none;
}

.model-picker-panel-head {
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
}

.model-picker-panel-head strong {
  font-size: 15px;
  line-height: 1.2;
}

.model-picker-close {
  width: 34px;
  min-height: 34px;
  border: 1px solid #d6d1c7;
  padding: 0;
  color: var(--ink);
  background: white;
  font-size: 22px;
  line-height: 1;
}

.model-picker-close:hover {
  color: white;
  background: var(--accent);
}

.collection-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 0 4px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.collection-tab {
  min-height: 34px;
  border: 1px solid #d6d1c7;
  flex: 0 0 auto;
  padding: 0 10px;
  color: var(--ink);
  background: #f8f6f0;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  scroll-snap-align: start;
  touch-action: manipulation;
}

.collection-tab:hover,
.collection-tab.is-active {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.collection-tabs-inline {
  padding-bottom: 2px;
}

.model-quick-list {
  min-height: 86px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.model-thumb {
  width: 86px;
  min-width: 86px;
  min-height: 82px;
  border: 1px solid #d6d1c7;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  gap: 4px;
  padding: 6px;
  color: var(--ink);
  background: white;
  scroll-snap-align: start;
}

.model-thumb:hover,
.model-thumb.is-active {
  border-color: var(--accent);
  color: var(--ink);
  background: #f3f0e8;
}

.model-thumb.is-active {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.model-thumb img {
  width: 100%;
  height: 48px;
  object-fit: contain;
}

.model-thumb-title {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.12;
  text-align: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.model-search {
  min-height: 38px;
  border-radius: 7px;
  font-size: 14px;
}

.model-list {
  min-height: 0;
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 2px;
}

.model-option {
  min-height: 64px;
  border: 1px solid #d6d1c7;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 6px 8px;
  place-items: stretch;
  color: var(--ink);
  background: white;
  text-align: left;
  touch-action: manipulation;
}

.model-option:hover,
.model-option.is-active {
  border-color: var(--accent);
  color: var(--ink);
  background: #f3f0e8;
}

.model-option.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.model-option img {
  width: 44px;
  height: 44px;
  align-self: center;
  object-fit: contain;
}

.model-option-text {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
}

.model-option-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.model-option-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.title span,
.field span {
  color: var(--muted);
}

.title span {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.title strong {
  color: var(--accent-dark);
  font-size: 14px;
  white-space: nowrap;
}

.field {
  display: block;
  margin-bottom: 11px;
}

.field span {
  display: block;
  margin-bottom: 6px;
}

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

select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d6d1c7;
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
}

input[type="range"] {
  min-height: 32px;
  border: 0;
  padding: 0;
  background: transparent;
  accent-color: var(--accent);
  touch-action: pan-y;
}

.wrist-field {
  margin-bottom: 12px;
}

.wrist-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 12px;
  align-items: center;
}

.wrist-value {
  color: var(--ink);
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.wrist-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 3px;
}

button,
.file-fallback {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  cursor: pointer;
}

button:hover,
.file-fallback:hover {
  background: var(--accent-dark);
}

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

.wrist-preset {
  min-height: 34px;
  border: 1px solid #d6d1c7;
  color: var(--ink);
  background: #f8f6f0;
  font-size: 14px;
  font-weight: 700;
}

.wrist-preset:hover {
  color: white;
  background: var(--accent-dark);
}

.wrist-preset.is-active {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.file-fallback {
  margin-top: 10px;
  background: var(--secondary);
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 10px;
}

.upload-actions .file-fallback {
  margin-top: 0;
}

.file-fallback-secondary {
  background: var(--secondary);
}

.file-fallback input {
  display: none;
}

.result-actions {
  display: none;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  margin-top: 10px;
  min-height: 46px;
}

.result-actions.is-ready,
.result-actions.has-retry,
.result-actions.has-favorites,
.has-result .result-actions {
  display: grid;
}

.result-actions.is-ready.has-favorites {
  grid-template-columns: minmax(0, 1fr) minmax(116px, 0.58fr);
}

.result-actions.favorites-only .download-button,
.result-actions.has-retry .download-button,
.result-actions.has-retry .favorites-open-button {
  display: none;
}

.download-button,
.favorites-open-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d6d1c7;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
  text-decoration: none;
}

.download-button:hover,
.favorites-open-button:hover {
  color: var(--ink);
  background: #f3f0e8;
}

.download-button svg,
.favorites-open-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorites-open-button {
  padding: 0 10px;
}

.favorites-open-button[hidden] {
  display: none;
}

.favorites-open-button strong {
  min-width: 23px;
  height: 23px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  color: white;
  background: var(--accent);
  font-size: 12px;
  line-height: 1;
}

.retry-tryon-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: #111;
  font-size: 16px;
  font-weight: 800;
}

.retry-tryon-button:hover {
  background: #2a2723;
}

.retry-tryon-button[hidden] {
  display: none;
}

body.favorites-view-open .app {
  display: none;
}

.favorites-view {
  position: fixed;
  inset: 0;
  z-index: 2000;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  color: var(--ink);
  background: var(--panel);
  overflow: hidden;
}

.favorites-view[hidden] {
  display: none;
}

.favorites-view-head {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  border: 1px solid #d6d1c7;
  border-width: 0 0 1px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: #fffdf8;
}

.favorites-view-head strong {
  overflow: hidden;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.favorites-back-button {
  width: 44px;
  min-height: 44px;
  border: 1px solid #d6d1c7;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: white;
}

.favorites-back-button:hover {
  color: white;
  background: var(--accent);
}

.favorites-back-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorites-view-list {
  grid-row: 2;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 10px;
  align-content: start;
  overflow: auto;
  padding: 12px 14px max(16px, env(safe-area-inset-bottom));
}

.favorites-view-card {
  position: relative;
  min-width: 0;
}

.favorites-view-item {
  width: 100%;
  min-height: 196px;
  border: 1px solid #d6d1c7;
  border-radius: 8px;
  display: grid;
  grid-template-rows: minmax(150px, 1fr) auto;
  gap: 7px;
  padding: 7px;
  color: var(--ink);
  background: white;
  text-align: left;
  touch-action: manipulation;
}

.favorites-view-item:hover,
.favorites-view-card.is-current .favorites-view-item {
  border-color: var(--accent);
  background: #f3f0e8;
}

.favorites-view-item img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  display: block;
  object-fit: cover;
  background: #eee8dc;
}

.favorites-view-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.14;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.favorites-view-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  width: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  color: #111;
  background: rgba(255, 255, 255, 0.92);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.favorites-view-remove:hover {
  background: white;
}

.favorites-empty {
  grid-row: 2;
  grid-column: 1;
  align-self: center;
  justify-self: center;
  margin: 0;
  padding: 24px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.favorites-empty[hidden] {
  display: none;
}

.favorite-preview {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: grid;
  place-items: center;
  padding: max(54px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: #10100f;
}

.favorite-preview[hidden] {
  display: none;
}

.favorite-preview img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  touch-action: pan-y;
}

.favorite-preview-close {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 1;
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 0;
  color: white;
  background: rgba(0, 0, 0, 0.45);
  font-size: 28px;
  line-height: 1;
}

.favorite-preview-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.favorite-preview-nav {
  position: fixed;
  top: 50%;
  z-index: 1;
  width: 44px;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0;
  color: white;
  background: rgba(0, 0, 0, 0.42);
  transform: translateY(-50%);
  touch-action: manipulation;
}

.favorite-preview-nav:hover {
  background: rgba(255, 255, 255, 0.14);
}

.favorite-preview-nav[hidden] {
  display: none;
}

.favorite-preview-nav svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorite-preview-nav-prev {
  left: max(10px, env(safe-area-inset-left));
}

.favorite-preview-nav-next {
  right: max(10px, env(safe-area-inset-right));
}

.favorite-preview-counter {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 1;
  min-height: 30px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  color: white;
  background: rgba(0, 0, 0, 0.48);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  transform: translateX(-50%);
  pointer-events: none;
}

.favorite-preview-counter[hidden] {
  display: none;
}

@media (max-width: 520px) {
  .result-actions.is-ready.has-favorites {
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  .favorites-open-button span {
    display: none;
  }
}

@media (max-width: 859px) {
  body.model-picker-open::before {
    display: none;
  }

  .app {
    grid-template-rows: minmax(270px, 1fr) auto auto auto;
  }

  .camera {
    min-height: 270px;
  }

  .has-result .camera {
    min-height: 320px;
  }

  .controls {
    max-height: var(--controls-mobile-max-height);
    -webkit-overflow-scrolling: touch;
  }

  .has-result .controls {
    max-height: var(--controls-mobile-result-max-height);
  }

  .model-picker-button {
    min-height: 76px;
  }

  body.model-picker-open .model-picker {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100vw;
    height: var(--app-height);
    margin: 0;
    display: grid;
    align-items: end;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: rgba(0, 0, 0, 0.42);
    pointer-events: auto;
  }

  body.model-picker-open .model-picker-button,
  body.model-picker-open .model-browser-inline,
  body.model-picker-open .product-card-link {
    display: none;
  }

  .model-picker-panel {
    position: relative;
    inset: auto;
    width: 100%;
    height: var(--model-picker-panel-mobile-height);
    max-height: none;
    margin: 0;
    overflow: hidden;
  }

  .model-list {
    -webkit-overflow-scrolling: touch;
  }

}

@media (max-width: 859px) and (max-height: 700px) {
  .status {
    min-height: 42px;
    padding: 8px 12px;
    font-size: 14px;
  }

  .photo-note {
    display: none;
  }

  .controls {
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }

  .model-picker {
    margin-bottom: 8px;
  }

  .model-picker-button {
    min-height: 64px;
    padding: 8px 10px;
  }

  .model-browser-inline {
    gap: 6px;
    margin-top: 6px;
  }

  .collection-tab {
    min-height: 30px;
    padding: 0 9px;
    font-size: 12px;
  }

  .model-quick-list {
    min-height: 70px;
  }

  .model-thumb {
    width: 70px;
    min-width: 70px;
    min-height: 68px;
    grid-template-rows: 42px;
    padding: 5px;
  }

  .model-thumb img {
    height: 42px;
  }

  .model-thumb-title {
    display: none;
  }

  .wrist-field {
    margin-bottom: 8px;
  }

  .result-actions {
    margin-top: 8px;
  }

  .result-actions.is-ready.has-favorites {
    grid-template-columns: minmax(0, 1fr) 124px;
  }

  .favorites-open-button span {
    display: none;
  }

  .favorites-view-list {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 8px;
    padding: 10px 10px max(12px, env(safe-area-inset-bottom));
  }

  .favorites-view-item {
    min-height: 178px;
    grid-template-rows: minmax(136px, 1fr) auto;
  }

  .favorites-view-item img {
    min-height: 136px;
  }
}

@media (min-width: 860px) {
  body.model-picker-open::before {
    display: none;
  }

  .app {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 440px);
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .camera {
    grid-column: 1;
    grid-row: 1 / span 3;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .status {
    grid-column: 2;
    grid-row: 1;
    min-height: 64px;
    border-left: 1px solid var(--line);
  }

  .photo-note {
    grid-column: 2;
    grid-row: 2;
    border-left: 1px solid var(--line);
  }

  .controls {
    grid-column: 2;
    grid-row: 3;
    padding: 16px 18px;
    border-top: 0;
    border-left: 1px solid var(--line);
    overflow: auto;
  }

  .model-picker-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    bottom: 16px;
    left: auto;
    z-index: 20;
    width: min(360px, calc(100vw - 500px));
    min-width: 320px;
    max-height: none;
    margin-top: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  }

  .model-picker-panel-head {
    grid-template-columns: minmax(0, 1fr);
    min-height: 22px;
  }

  .model-picker-close {
    display: none;
  }

  .collection-tabs {
    flex-wrap: wrap;
    overflow: visible;
    scroll-snap-type: none;
  }

  .collection-tab {
    flex: 0 0 auto;
  }

  .model-quick-list {
    min-height: 0;
    max-height: 190px;
    flex-wrap: wrap;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: none;
  }

  .model-thumb {
    flex: 0 0 calc(25% - 6px);
    width: auto;
    min-width: 0;
  }
}
