.studio {
  min-height: 100vh;
  background: #0f172a;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal {
  width: min(860px, 100%);
  min-height: min(860px, 100vh - 48px);
  background: #fff;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
}
.modal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.modal-brand .brand-word {
  font-size: 15px;
}
.modal-head a, .modal-head button { color: var(--text-secondary); }
.studio-body { flex: 1; padding: 24px 48px 48px; display: flex; flex-direction: column; }
.studio-hero { text-align: center; margin: 16px 0 28px; }
.studio-hero h1 { font-size: 40px; letter-spacing: -0.03em; margin: 0 0 8px; }
.panel-kicker { margin: 0 0 6px; color: var(--blue-600); font-size: 12px; font-weight: 600; }
.product-context {
  width: min(560px, 100%);
  margin: 0 auto 18px;
  padding: 10px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--gray-50);
}
.product-context img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; background: #fff; }
.product-context.no-image { grid-template-columns: 1fr; padding: 14px 16px; }
.product-context.no-image img { display: none; }
.product-context span { display: block; color: var(--text-muted); font-size: 11px; }
.product-context strong { display: block; margin-top: 2px; overflow: hidden; color: var(--text-primary); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.photo-guide { width: min(560px, 100%); margin: 0 auto 18px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.photo-guide span { padding: 5px 9px; border-radius: 999px; background: var(--blue-100); color: var(--blue-800); font-size: 11px; }
.photo-guide.compact { margin-top: 12px; margin-bottom: 0; }
.photo-guide.compact span { background: var(--gray-100); color: var(--text-secondary); }
.privacy-note,
.result-note { max-width: 600px; margin: 18px auto 0; color: var(--text-muted); font-size: 11px; line-height: 1.9; text-align: center; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 560px; margin: 0 auto; }
.choice a, .choice button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: #fff; color: inherit; text-align: start; cursor: pointer; min-height: 120px;
}
.choice a:hover, .choice button:hover { border-color: var(--blue-600); }
.drop {
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  min-height: 280px; display: grid; place-items: center; text-align: center; padding: 32px;
  cursor: pointer; transition: border-color 160ms ease, background 160ms ease;
}
.drop:hover, .drop.dragover { border-color: var(--blue-600); background: var(--blue-100); }
.drop.has-file { padding: 12px; cursor: default; background: var(--gray-50); }
.drop.has-file:hover { background: var(--gray-50); }
.file-btn { margin-top: 16px; }
.preview-img { width: 100%; max-height: 360px; object-fit: contain; background: var(--gray-50); border-radius: var(--radius-md); display: none; }
.drop.has-file .preview-img { display: block; }
.drop.has-file .drop-hint { display: none; }
.camera {
  position: relative; background: #0b1220; border-radius: var(--radius-md);
  min-height: 420px; display: grid; place-items: center; overflow: hidden; color: #fff;
}
.guide {
  position: absolute; inset: 40px 80px; border: 1px dashed rgba(255,255,255,.35); border-radius: 40% / 48%;
  pointer-events: none;
}
.process {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center;
  max-width: 720px; margin: 0 auto 32px;
}
.process img { width: 100%; height: 280px; object-fit: cover; border-radius: var(--radius-md); display: block; }
.plus {
  position: relative;
  color: var(--blue-600);
  font-size: 28px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  z-index: 1;
}
.plus-ring {
  position: absolute; inset: -8px;
  border: 1px solid rgba(37, 99, 235, .35);
  border-radius: 50%;
  animation: pulse-ring 1.8s ease-out infinite;
}
.scan {
  position: relative; overflow: hidden; border-radius: var(--radius-md);
}
.scan.working img { animation: breathe 2.8s ease-in-out infinite; }
.scan-beam {
  position: absolute; inset-inline: 0; height: 42%;
  background: linear-gradient(180deg, transparent, rgba(124, 58, 237, .18), rgba(37, 99, 235, .28), transparent);
  animation: scan-move 2.2s ease-in-out infinite;
  pointer-events: none; z-index: 2;
}
.scan-grid {
  position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0;
}
.scan.working .scan-grid {
  opacity: 1;
  background-image:
    linear-gradient(rgba(37,99,235,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,.12) 1px, transparent 1px);
  background-size: 28px 28px;
  animation: grid-shift 4s linear infinite;
  mix-blend-mode: multiply;
}
@keyframes scan-move {
  0% { top: -40%; }
  100% { top: 100%; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.03); filter: saturate(1.08); }
}
@keyframes grid-shift {
  from { background-position: 0 0; }
  to { background-position: 28px 28px; }
}
@keyframes pulse-ring {
  0% { transform: scale(.85); opacity: .7; }
  100% { transform: scale(1.45); opacity: 0; }
}

.ai-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}
.ai-line li {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  position: relative;
  transition: color .35s ease;
}
.ai-line li + li::before {
  content: "";
  position: absolute;
  inset-inline-end: calc(100% - 4px);
  width: 12px;
  height: 1px;
  background: var(--border);
  top: 50%;
}
.ai-line li.done + li::before,
.ai-line li.active + li::before { background: var(--blue-600); }
.ai-dot {
  width: 18px; height: 18px; flex: 0 0 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  position: relative;
  background: #fff;
  transition: border-color .3s ease, background .3s ease, transform .3s ease;
}
.ai-line li.active { color: var(--blue-700); }
.ai-line li.active .ai-dot {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.ai-line li.active .ai-dot::after {
  content: "";
  position: absolute; inset: 3px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--blue-600);
  animation: spin .8s linear infinite;
}
.ai-line li.done { color: var(--status-success); }
.ai-line li.done .ai-dot {
  background: var(--status-success);
  border-color: var(--status-success);
  transform: scale(1);
}
.ai-line li.done .ai-dot::before,
.ai-line li.done .ai-dot::after { content: none; }
.ai-line li.done .ai-dot {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
  animation: pop .35s cubic-bezier(.2,1.4,.3,1);
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop {
  0% { transform: scale(.6); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.scan.done .scan-beam, .scan.done .scan-grid { display: none; }
.scan.done img { animation: none; }
.result-frame { position: relative; max-width: 520px; margin: 0 auto; }
.result-frame img { width: 100%; height: 560px; object-fit: cover; border-radius: var(--radius-md); }
.ba {
  position: relative; max-width: 520px; margin: 0 auto; overflow: hidden; border-radius: var(--radius-md);
  height: 560px; user-select: none;
}
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba .after { clip-path: inset(0 50% 0 0); }
.ba input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; }
.ba .line { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #fff; }
.sticky-cta {
  position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: center;
  padding: 16px 0 0; background: linear-gradient(transparent, #fff 30%);
}
.powered { text-align: center; margin-top: 16px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--violet-600); }
.panel { display: none; }
.panel.on { display: block; }
.status-msg { text-align: center; color: var(--text-secondary); min-height: 24px; margin: 12px 0 0; font-weight: 500; }
.status-msg.err { color: var(--status-error); }
.stage {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-50);
  min-height: 420px;
}
.stage img, .stage video {
  width: 100%; height: 520px; object-fit: contain; display: block; background: var(--gray-50);
}
.result-badge {
  position: absolute; top: 14px; right: 14px;
  background: var(--violet-600); color: #fff; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; font-size: 12px;
}
.busy-veil {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .28);
  backdrop-filter: blur(3px);
}
.busy-veil span {
  background: #fff; color: var(--text-primary); font-weight: 600;
  padding: 10px 16px; border-radius: 999px; font-size: 14px;
}
.hidden { display: none !important; }
.progress-box { max-width: 520px; margin: 20px auto 0; }
.progress-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; margin-bottom: 10px; }
.progress-live {
  color: var(--blue-700);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 3.2em;
  text-align: left;
  direction: ltr;
}
.track { height: 8px; border-radius: 999px; background: var(--gray-200); overflow: hidden; }
.fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-600), #60a5fa);
  transition: width 420ms ease;
}
.fill.working {
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
  animation: progress-pulse 1.6s ease-in-out infinite;
}
.fill.done {
  width: 100% !important;
  background: var(--status-success);
  animation: none;
}
@keyframes progress-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}
@media (max-width: 640px) {
  .studio { padding: 0; }
  .modal { min-height: 100vh; border-radius: 0; width: 100%; }
  .modal-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .studio-body { padding: 16px 16px 28px; }
  .studio-hero { margin: 10px 0 22px; }
  .studio-hero h1 { font-size: 28px; line-height: 1.45; }
  .choice { grid-template-columns: 1fr; }
  .choice a, .choice button { min-height: 96px; padding: 18px; }
  .drop { min-height: 240px; padding: 20px; }
  .camera, .camera video { min-height: 440px; height: 440px !important; }
  .guide { inset: 30px 48px; }
  .process { gap: 10px; margin-bottom: 24px; }
  .process img { height: 190px; }
  .plus { width: 32px; height: 32px; font-size: 22px; }
  .ai-line { flex-wrap: wrap; white-space: normal; }
  .ai-line li { flex: 1 1 42%; font-size: 12px; }
  .stage { min-height: 360px; }
  .stage img, .stage video { height: min(58vh, 520px); }
  .sticky-cta { position: sticky; bottom: 0; margin-inline: -16px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; background: #fff; border-top: 1px solid var(--border); }
  .sticky-cta .btn-primary { width: 100%; }
  .sticky-cta .btn-secondary, .sticky-cta .btn-ghost { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-beam,
  .scan-grid,
  .scan.working img,
  .plus-ring,
  .fill.working { animation: none !important; }
}

html.embed, html.embed body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
html.embed .studio {
  min-height: 100%;
  height: 100%;
  padding: 0;
  background: #fff;
  display: block;
}
html.embed .modal {
  width: 100%;
  min-height: 100%;
  height: 100%;
  border-radius: 0;
}
html.embed .studio-body {
  overflow: auto;
  min-height: 0;
}
