:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --ink: #111111;
  --muted: #5c5c5c;
  --line: #e6e6e6;
  --accent: #171a3a;
  --card: #ffffff;
  font-family: "Manrope", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  font-size: 32px;
  font-weight: 650;
  margin: 0 0 8px;
}

.lede {
  margin: 0 0 28px;
  color: var(--muted);
  max-width: 42rem;
}

.panel,
figure {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.panel {
  padding: 16px;
  margin-bottom: 20px;
}

.upload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.upload input {
  display: none;
}

.frames {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.frame {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
}

.frame img {
  width: 100%;
  height: 48px;
  object-fit: contain;
  display: block;
}

.frame span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}

.frame.active {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

.status {
  margin: 12px 0 0;
  color: #8a2b2b;
  font-size: 14px;
}

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

figure {
  margin: 0;
  padding: 12px;
  min-height: 280px;
}

figcaption {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

figure img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 48px 8px;
  text-align: center;
}

.h2 {
  font-size: 18px;
  font-weight: 650;
  margin: 0 0 12px;
}

textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 13px/1.4 ui-monospace, Consolas, monospace;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}

.copy {
  margin-top: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--card);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

body.embed {
  background: var(--card);
}

body.embed main {
  max-width: 520px;
  padding: 16px;
}

.preview-single {
  grid-template-columns: 1fr;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.tryon-main {
  max-width: 720px;
}

.tryon-head h1 {
  font-size: 24px;
}

.mirror {
  position: relative;
  background: #14110e;
  border-radius: 12px;
  overflow: hidden;
  min-height: 380px;
  margin-bottom: 16px;
}

#camera {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#stage {
  width: 100%;
  display: block;
  min-height: 380px;
  object-fit: cover;
}

.mirror #start {
  position: static;
  transform: none;
  margin-top: 8px;
}

.idle-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #f4f1ea;
  text-align: center;
  padding: 16px;
  z-index: 2;
  pointer-events: none;
}

.idle-hint .copy {
  pointer-events: auto;
}

.idle-hint[hidden] {
  display: none;
}

.idle-hint p {
  margin: 0 0 12px;
}

.mirror-status {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  margin: 0;
  color: #f4f1ea;
  text-align: center;
}

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

.upload.compact {
  min-height: 40px;
  padding: 0 14px;
  flex: 1;
}

.tryon-panel {
  margin-bottom: 0;
}

html.embed-mode .consent {
  position: absolute;
}

.consent {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(17, 17, 17, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.consent[hidden] {
  display: none;
}

.consent-card {
  background: #fff;
  color: #111;
  max-width: 420px;
  width: 100%;
  padding: 24px;
  border-radius: 12px;
}

.consent-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.consent-card p {
  color: #555;
  margin: 0 0 16px;
  line-height: 1.4;
}

.consent-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.consent-actions .ghost-btn {
  background: #eee;
  color: #111;
  border-color: #ddd;
}

html.embed-mode body.tryon main {
  max-width: 520px;
  padding: 12px;
}

html.embed-mode .tryon-head h1 {
  font-size: 20px;
}

body.studio {
  background: #111;
  min-height: 100vh;
}

.studio-shell {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: 100vh;
  max-height: 100vh;
  background: #fff;
}

.studio-stage {
  position: relative;
  background: #1a1a1a;
  overflow: hidden;
}

.studio-stage #camera {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.studio-stage #stage {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
}

.ar-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ar-preview canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

body.engine-deepar #stage,
body.engine-deepar #camera {
  visibility: hidden;
}

.studio-mark {
  position: absolute;
  left: 14px;
  top: 14px;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 500;
  z-index: 3;
  pointer-events: none;
}

.face-guide {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(42vw, 280px);
  height: min(42vw, 280px);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  pointer-events: none;
}

.stage-tools {
  position: absolute;
  left: 16px;
  bottom: 20px;
  z-index: 4;
  display: flex;
  gap: 8px;
}

.ghost-btn,
.file-btn {
  border: 1px solid #fff;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.file-btn input {
  display: none;
}

.cart-btn {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 4;
  border: 0;
  background: #111;
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.studio-rail {
  background: #fff;
  border-left: 1px solid #e8e8e8;
  padding: 18px 16px 24px;
  overflow: auto;
}

.rail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.rail-head h1 {
  font-size: 22px;
  margin: 0;
}

.rail-head p {
  margin: 4px 0 0;
  color: #666;
}

.icon-x {
  border: 0;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.rail-label {
  margin: 18px 0 8px;
  font-size: 13px;
}

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

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #ddd;
  cursor: pointer;
  padding: 0;
}

.swatch.on {
  outline: 2px solid #111;
  outline-offset: 2px;
}

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

.related-item {
  border: 1px solid transparent;
  background: #fff;
  text-align: left;
  padding: 8px;
  cursor: pointer;
}

.related-item.on {
  background: #ececec;
  border-color: #ccc;
}

.related-item img {
  width: 100%;
  height: 72px;
  object-fit: contain;
}

.related-item span,
.related-item small {
  display: block;
  font-size: 12px;
}

.related-item small {
  color: #777;
}

.rail-foot {
  margin-top: 16px;
  font-size: 11px;
  color: #888;
}

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

.angle-item {
  border: 1px solid #ddd;
  background: #fafafa;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  width: 64px;
  height: 48px;
}

.angle-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.icon-x[hidden] {
  display: none;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.admin-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.admin-form .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.admin-form .check-row input {
  width: auto;
}

.listing-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.listing-card .lede {
  margin: 4px 0;
}

.path-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.path-btn p {
  margin: 8px 0 0;
  color: var(--muted);
}

.path-btn.on {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

.studio-stage .idle-hint {
  z-index: 3;
}

.studio-stage .mirror-status {
  bottom: 64px;
}

@media (max-width: 800px) {
  .studio-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 56svh 1fr;
    height: auto;
    max-height: none;
    min-height: 100svh;
  }

  .studio-stage {
    min-height: 56svh;
  }

  .studio-mark {
    font-size: 9px;
    left: 10px;
    top: 10px;
  }

  .face-guide {
    width: min(60vw, 240px);
    height: min(60vw, 240px);
  }

  .stage-tools {
    left: 12px;
    bottom: 14px;
  }

  .cart-btn {
    right: 12px;
    bottom: 14px;
    padding: 10px 18px;
  }

  .studio-stage .mirror-status {
    bottom: 58px;
    font-size: 13px;
  }

  .studio-rail {
    border-left: 0;
    border-top: 1px solid #e8e8e8;
    padding: 14px 14px 28px;
  }

  .rail-head h1 {
    font-size: 19px;
  }

  .related {
    grid-template-columns: repeat(3, 1fr);
  }

  main {
    padding: 20px 14px 48px;
  }

  h1 {
    font-size: 24px;
  }
}

@media (max-width: 720px) {
  .preview,
  .split {
    grid-template-columns: 1fr;
  }
}

.sell-body {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #d8efe9 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #e8eef5 0%, transparent 50%),
    var(--bg);
}

.sell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 20px 0;
}

.sell-logo {
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
}

.sell-top nav {
  display: flex;
  gap: 16px;
}

.sell-top a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.sell-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.sell-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  max-width: 16ch;
}

.sell-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
}

.sell-foot {
  margin-top: 8px;
}

.upload-preview {
  margin: 8px 0 12px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.upload-preview img {
  max-height: 120px;
  width: auto;
  display: block;
  object-fit: contain;
}

.listing-card img {
  width: 88px;
  height: 64px;
  object-fit: contain;
  background: #f7f7f7;
  border-radius: 8px;
}

.listing-card .badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eee;
  color: var(--muted);
  margin: 4px 0 8px;
}

.listing-card .badge.on {
  background: #d1fae5;
  color: #065f46;
}

.listing-card .price-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  margin: 8px 0;
}

.listing-card .price-row input {
  max-width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.listing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* Seller dashboard */
.seller-body {
  background: #f4f5f7;
}

.seller-top {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 24px 20px 0;
}

.seller-top-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.seller-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.seller-tabs {
  max-width: 1100px;
  margin: 20px auto 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 0;
}

.seller-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.seller-tab.is-on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-badge {
  display: inline-flex;
  min-width: 1.25rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 0 6px;
  margin-left: 4px;
}

.seller-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.seller-panel[hidden] {
  display: none !important;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.stat-card p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: 22px;
  font-weight: 750;
}

.seller-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seller-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.seller-row-head .h2 {
  margin: 0;
}

.panel.is-unread {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

@media (max-width: 720px) {
  .seller-top-inner {
    flex-direction: column;
  }
}
