/* A large photo and a single glass drawer keep the try-on simple. */
body[data-screen='editor'] {
  --ink: #292339;
  --muted: #686176;
  --line: #392b6017;
  --sheet-height: clamp(332px, 44dvh, 440px);
  height: 100dvh;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
  background: #f7f7fb;
}
body[data-screen='editor']::before {
  background: radial-gradient(ellipse at 88% 0%, #ddc6ff45, transparent 40%), #f7f7fb;
}
body[data-screen='editor'] .topbar {
  height: 64px;
  max-width: 1280px;
  margin: max(8px, env(safe-area-inset-top)) auto 0;
  padding: 0 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body[data-screen='editor'] .brand img { width: 40px; height: 45px; }
body[data-screen='editor'] #savedTop { background: transparent; border: 0; box-shadow: none; color: #514364; }
body[data-screen='editor'] main {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 72px - env(safe-area-inset-top));
  max-width: 1280px;
  padding: 12px 28px 24px;
  min-height: 0;
}
body[data-screen='editor'] .workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(350px, 1fr);
  gap: 28px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
body[data-screen='editor'] .preview-panel {
  position: relative;
  top: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body[data-screen='editor'] .preview-top {
  min-height: 44px;
  margin: 0 0 8px;
  flex-shrink: 0;
  gap: 12px;
}
body[data-screen='editor'] .photo-label { font-size: 12px; color: #686176; }
body[data-screen='editor'] .photo-label i { background: #a83db9; box-shadow: none; }
body[data-screen='editor'] .preview-top .quiet-button {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #7030ad;
  font-size: 14px !important;
}
body[data-screen='editor'] .photo-stage,
body[data-screen='editor'].comparing .photo-stage {
  flex: 1;
  height: auto;
  min-height: 100px;
  max-height: none;
  border: 0;
  border-radius: 24px;
  background: #eeedf2;
}
.photo-surface { position: absolute; left: 50%; top: 50%; transform-origin: center; will-change: transform; }
body[data-screen='editor'] .photo-surface canvas,
body[data-screen='editor'].comparing .photo-surface #overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none !important;
  object-fit: fill;
  display: block;
}
body[data-screen='editor'] .photo-surface #overlay { touch-action: none; cursor: grab; }
body[data-screen='editor'] .editing .photo-surface #overlay { cursor: crosshair; }
body[data-screen='editor'] .stage-caption { display: none; }
body[data-screen='editor'] #toggleOutlines,
body[data-screen='editor'] .compare {
  position: absolute;
  top: 12px;
  z-index: 4;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid #ffffffb3;
  border-radius: 22px;
  background: #ffffffdf;
  color: #392b4e;
  box-shadow: 0 3px 14px #2918390c;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 13px;
  font-weight: 600;
}
body[data-screen='editor'] #toggleOutlines { left: 12px; }
body[data-screen='editor'] .compare { right: 12px; gap: 6px; }
body[data-screen='editor'] .compare svg { width: 16px; height: 16px; }
body[data-screen='editor'] .editing .compare { display: none; }
body[data-screen='editor'] .edit-badge {
  top: auto;
  bottom: 14px;
  left: 14px;
  width: auto;
  max-width: calc(100% - 182px);
  transform: none;
  padding: 9px 11px;
  border-radius: 12px;
  font-size: 12px;
  text-align: left;
  white-space: normal;
}
.zoom-tools {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: none;
  align-items: center;
  border: 1px solid #ffffffcc;
  border-radius: 16px;
  background: #ffffffed;
  box-shadow: 0 3px 15px #21133814;
}
body[data-editor-tab='fit'] .zoom-tools { display: flex; }
.zoom-tools button { min-width: 44px; min-height: 44px; padding: 7px; font-size: 20px; }
.zoom-tools #zoomReset { min-width: 48px; font-size: 12px; }
body[data-screen='editor'] .preview-actions {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  padding-top: 12px;
  flex-shrink: 0;
}
body[data-screen='editor'] .preview-actions #undo { background: #eae6f2; border: 0; box-shadow: none; }
body[data-screen='editor'] .preview-actions #saveProject {
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(115deg, #a92fb7, #763bdf);
  color: #fff;
  box-shadow: 0 5px 16px #8f36c31a;
  font-size: 15px;
  font-weight: 650;
}
body[data-editor-tab='fit'] .preview-actions,
body[data-screen='editor'] .preview-disclaimer,
body[data-screen='editor'] .project-state { display: none; }
body[data-screen='editor'] .controls-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0 20px 12px;
  border: 1px solid #ffffff;
  border-radius: 28px;
  background: linear-gradient(145deg, #ffffffed, #f9f6ffe8);
  box-shadow: 0 12px 40px #52377c0b, inset 0 1px #fff;
  backdrop-filter: blur(28px) saturate(120%);
  -webkit-backdrop-filter: blur(28px) saturate(120%);
}
.sheet-top { display: flex; align-items: center; min-width: 0; flex-shrink: 0; }
.sheet-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 64px;
  padding: 12px 0;
  text-align: left;
  touch-action: none;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.4px;
}
.sheet-handle i, .sheet-handle > span:last-child:not(#sheetColorName) { display: none; }
#sheetColorName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-screen='editor'] #sheetCustom {
  min-height: 44px;
  padding: 8px 0 8px 12px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
  color: #8b32ba;
}
body[data-screen] .editor-tabs {
  position: static;
  inset: auto;
  display: flex;
  flex-shrink: 0;
  margin: 0 0 12px;
  padding: 3px;
  gap: 2px;
  border: 0;
  border-radius: 16px;
  background: #eee9f4;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body[data-screen] .editor-tabs button {
  min-height: 44px;
  padding: 7px 12px;
  flex-direction: row;
  gap: 7px;
  border-radius: 13px;
  font-size: 14px;
  color: #665a74;
}
body[data-screen] .editor-tabs button.active { background: #fff; color: #7330ae; box-shadow: 0 2px 7px #3c205b0b; }
body[data-screen] .editor-tabs button[data-tab='saved'],
body[data-screen] .editor-tabs button[data-tab='fit'],
body[data-editor-tab='fit'] .editor-tabs { display: none; }
body[data-screen] #backToColors {
  flex-shrink: 0;
  min-height: 44px;
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(115deg, #a92fb7, #763bdf);
  color: #fff;
  font-size: 15px;
}
.sheet-content { overflow-y: auto; overscroll-behavior: contain; min-width: 0; min-height: 0; flex: 1; padding: 0 2px 12px; scrollbar-width: thin; scrollbar-color: #c9b5de transparent; }
body[data-screen='editor'] #colorsPanel > .section-heading,
body[data-screen='editor'] #colorsPanel > .selected-color { display: none; }
body[data-screen='editor'] .search {
  margin: 0 0 8px;
  padding: 0 12px;
  border: 1px solid #4f315812;
  border-radius: 14px;
  background: #ebe8f17d;
}
body[data-screen='editor'] .search input { min-height: 44px; padding: 10px 0; font-size: 16px; }
.finish-tools, .edge-tools, .retry-tools { display: flex; gap: 6px; margin: 8px 0; }
.finish-tools { padding: 3px; border-radius: 13px; background: #ebe7f06e; }
.finish-tools button, .edge-tools button {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #695c77;
  font-size: 14px;
}
.finish-tools button[aria-pressed='true'], .edge-tools button[aria-pressed='true'] { color: #7930ad; background: #fff; box-shadow: 0 2px 6px #55307c0c; font-weight: 650; }
.edge-tools { padding: 3px; background: #ede7f4; border-radius: 15px; }
body[data-screen='editor'] .color-filter { margin: 6px 0 3px; padding-bottom: 4px; gap: 5px; }
body[data-screen='editor'] .color-filter button { min-height: 44px; padding: 9px 13px; border: 0; background: transparent; color: #685c74; font-size: 13px; }
body[data-screen='editor'] .color-filter button.active { background: #f1e4fa; color: #8430a9; box-shadow: none; }
body[data-screen='editor'] .color-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: none; overflow: visible; gap: 14px 8px; padding: 10px 2px 12px; }
body[data-screen='editor'] .color-card { min-height: 99px; padding: 5px 1px; gap: 10px; }
body[data-screen='editor'] .color-card i { width: 45px; height: 55px; border-radius: 22px 22px 16px 16px; }
body[data-screen='editor'] .color-card span { max-width: 96px; min-height: 32px; font-size: 12px; line-height: 1.35; color: #5b5268; }
body[data-screen='editor'] .color-card.active i { outline: 2px solid #a43bc0; outline-offset: 4px; }
body[data-screen='editor'] .color-card.active span { color: #822aae; font-weight: 700; }
body[data-screen='editor'] .custom-colors { margin-top: 16px; border: 1px solid #b098c32b; background: #ffffff80; box-shadow: none; }
body[data-screen='editor'] .discovery-launch { background: transparent; border: 1px solid #cbbad74d; box-shadow: none; color: #745185; }
body[data-screen='editor'] .shade-tools button { border: 0; background: #eee9f370; box-shadow: none; font-size: 13px; }
body[data-screen='editor'] #compareColors { border: 1px solid #c8b5d833; background: transparent; box-shadow: none; }
body[data-screen='editor'] .section-heading { margin: 6px 0 12px; }
body[data-screen='editor'] .section-heading h2 { font-size: 24px; letter-spacing: -.7px; }
body[data-screen='editor'] .section-heading .eyebrow { display: none; }
body[data-screen='editor'] .style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body[data-screen='editor'] .style-card { border: 1px solid #b599c826; background: #fff8; box-shadow: none; }
body[data-screen='editor'] .style-card.active { border-color: #b267d5; background: #f6eafa; box-shadow: none; }
body[data-screen='editor'] .fit-instruction { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
body[data-screen='editor'] #fitPanel > .section-heading { display: none; }
#edgeConfidence { margin: 10px 0; color: #73501a; font-size: 13px; line-height: 1.45; }
#edgeConfidence:empty { display: none; }
body[data-screen='editor'] #brushSizeRow { margin: 10px 0; }
#brushSize { width: 100%; min-height: 44px; }
.retry-tools button { flex: 1; padding: 8px; font-size: 13px; }
#advancedFit { border-top: 1px solid var(--line); margin-top: 14px; }
#advancedFit > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; list-style: none; font-size: 14px; color: #665573; font-weight: 600; cursor: pointer; }
#advancedFit > summary::-webkit-details-marker { display: none; }
#advancedFit > summary::after { content: '+'; font-size: 22px; font-weight: 400; }
#advancedFit[open] > summary::after { content: '−'; }
body[data-screen='editor'] #advancedFit .helper { font-size: 13px; }
body[data-screen='editor'] #fineTune { margin-top: 14px; }
body[data-screen='editor'] .comparison-bar { flex-shrink: 0; padding: 7px 10px; border-color: #c7b2d837; background: #eee7f580; box-shadow: none; }
body[data-screen='editor'] .comparison-bar > p { display: none; }
body[data-screen='editor'] .photo-status { flex-shrink: 0; min-height: 44px; margin: 0 0 8px; padding: 7px 12px; border: 0; border-radius: 12px; background: #eee6f4; color: #684876; font-size: 13px; }
body[data-screen='editor'] #qualityCard { flex-shrink: 0; border: 0; background: #f0ecf5; box-shadow: none; }

@media (max-width: 900px) and (min-width: 701px) {
  body[data-screen='editor'] .topbar { padding: 0 20px; }
  body[data-screen='editor'] main { padding: 10px 20px 20px; }
  body[data-screen='editor'] .workspace { grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); gap: 18px; }
  body[data-screen='editor'] .controls-panel { padding: 0 14px 10px; }
  body[data-screen='editor'] .color-grid { gap: 12px 5px; }
}
@media (max-width: 700px) {
  body[data-screen='editor'].sheet-expanded { --sheet-height: 62dvh; }
  body[data-screen='editor'] .topbar { height: 52px; margin: env(safe-area-inset-top) 0 0; padding: 0 16px; }
  body[data-screen='editor'] .brand img { width: 32px; height: 38px; }
  body[data-screen='editor'] .top-actions button { padding: 8px 0 8px 10px; }
  body[data-screen='editor'] main { height: calc(100dvh - 52px - env(safe-area-inset-top)); max-width: none; padding: 0 0 env(safe-area-inset-bottom); }
  body[data-screen='editor'] .workspace { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
  body[data-screen='editor'] .preview-panel { flex: 1; min-height: 154px; margin: 0; width: 100%; }
  body[data-screen='editor'] .preview-top { min-height: 38px; height: 38px; margin: 0 16px 2px; }
  body[data-screen='editor'] .preview-top .quiet-button { min-height: 38px; padding: 5px 0 5px 10px; font-size: 13px !important; }
  body[data-screen='editor'] .photo-label { font-size: 11px; gap: 6px; }
  body[data-screen='editor'] .photo-stage,
  body[data-screen='editor'].comparing .photo-stage { min-height: 60px; border-radius: 0; }
  body[data-screen='editor'] #toggleOutlines,
  body[data-screen='editor'] .compare { top: 10px; min-height: 44px; padding: 9px 12px; font-size: 12px; }
  body[data-screen='editor'] #toggleOutlines { left: 12px; }
  body[data-screen='editor'] .compare { right: 12px; }
  body[data-screen='editor'] .preview-actions { padding: 8px 12px 0; gap: 9px; grid-template-columns: 44px minmax(0, 1fr); }
  body[data-screen='editor'] .preview-actions #saveProject { min-height: 44px; font-size: 14px; border-radius: 14px; }
  body[data-screen='editor'] .preview-actions #undo { min-width: 44px; min-height: 44px; border-radius: 14px; }
  body[data-screen='editor'] .controls-panel {
    height: var(--sheet-height);
    max-height: calc(100% - 164px);
    width: calc(100% - 16px);
    min-width: 0;
    margin: 0 8px;
    padding: 0 14px 3px;
    flex-shrink: 0;
    border-radius: 26px 26px 0 0;
    background: linear-gradient(145deg, #fffffff2, #faf7fff2);
    box-shadow: 0 -5px 25px #5432780b;
    transition: height .2s ease;
  }
  .sheet-handle { min-height: 48px; padding: 15px 0 6px; font-size: 17px; }
  .sheet-handle i { display: block; position: absolute; top: 6px; left: calc(50% - 14px); width: 28px; height: 3px; border-radius: 3px; background: #cdbed8; }
  body[data-screen='editor'] #sheetCustom { min-height: 44px; padding: 12px 0 4px 10px; font-size: 13px; }
  body[data-screen] .editor-tabs { margin-bottom: 8px; padding: 2px; border-radius: 13px; }
  body[data-screen] .editor-tabs button { min-height: 40px; padding: 6px 10px; font-size: 14px; border-radius: 11px; }
  body[data-screen] #backToColors { min-height: 44px; margin-bottom: 8px; }
  .sheet-content { padding: 0 1px 12px; }
  body[data-screen='editor'] .search { margin-bottom: 6px; border-radius: 12px; }
  body[data-screen='editor'] .search input { min-height: 42px; padding: 9px 0; }
  .finish-tools { margin: 6px 0; padding: 2px; }
  .finish-tools button { min-height: 40px; padding: 7px; font-size: 13px; }
  body[data-screen='editor'] .color-filter { margin: 4px 0 0; padding-bottom: 2px; gap: 3px; }
  body[data-screen='editor'] .color-filter button { min-height: 40px; padding: 8px 12px; font-size: 13px; }
  body[data-screen='editor'] .color-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; padding: 9px 2px 10px; }
  body[data-screen='editor'] .color-card { min-height: 94px; padding: 5px 1px; gap: 8px; }
  body[data-screen='editor'] .color-card i { width: 43px; height: 52px; }
  body[data-screen='editor'] .color-card span { font-size: 12px; min-height: 32px; }
  body[data-screen='editor'] .photo-status { margin: 0 12px 6px; padding: 6px 10px; min-height: 40px; font-size: 12px; }
  body[data-screen='editor'] #qualityCard { margin: 0 12px 6px; padding: 0 10px; }
  body[data-screen='editor'] #qualityCard[open] { position: absolute; top: 56px; left: 0; right: 0; z-index: 8; max-height: 45dvh; overflow: auto; box-shadow: 0 8px 22px #45276a20; }
  body[data-screen='editor'] #qualityCard summary { min-height: 36px; font-size: 12px; }
  body[data-screen='editor'] .comparison-bar { margin: 6px 12px 0; padding: 5px 7px; }
  body[data-screen='editor'] .comparison-heading { top: 1px; }
  body[data-screen='editor'] .comparison-modes button { min-height: 36px; font-size: 12px; }
  body[data-screen='editor'] #splitControl { min-height: 34px; font-size: 12px; }
  body[data-screen='editor'] #splitPosition { min-height: 30px; }
  body[data-screen='editor'] .fit-instruction { font-size: 13px; }
  body[data-screen='editor'] .edit-badge { left: 10px; bottom: 12px; max-width: calc(100% - 168px); font-size: 11px; }
  .zoom-tools { right: 10px; bottom: 10px; border-radius: 14px; }
  .zoom-tools button { min-width: 44px; min-height: 44px; }
  .zoom-tools #zoomReset { min-width: 44px; }
}
@media (max-width: 360px) {
  body[data-screen='editor'] .controls-panel { padding-left: 10px; padding-right: 10px; }
  body[data-screen='editor'] .color-grid { gap: 12px 5px; }
  body[data-screen='editor'] .color-card i { width: 40px; height: 49px; }
  body[data-screen='editor'] .color-card span { font-size: 11px; }
  .sheet-handle { font-size: 16px; }
}
/* Short phones can scroll the page instead of compressing the nail photo. */
@media (max-width: 700px) and (max-height: 650px),
       (min-width: 701px) and (max-width: 959px) and (max-height: 500px) {
  body[data-screen='editor'] { height: auto; min-height: 100dvh; overflow-y: auto; }
  body[data-screen='editor'] main { height: auto; min-height: 0; }
  body[data-screen='editor'] .workspace { flex: none; }
}
@media (max-width: 700px) and (max-height: 650px) {
  body[data-screen='editor'] { --sheet-height: 380px; }
  body[data-screen='editor'].sheet-expanded { --sheet-height: 480px; }
  body[data-screen='editor'] .controls-panel { max-height: none; margin-bottom: 8px; }
  body[data-screen='editor'] .preview-panel { flex: none; min-height: 0; }
  body[data-screen='editor'] .photo-stage,
  body[data-screen='editor'].comparing .photo-stage { flex: none; height: clamp(220px, 75vw, 320px); }
  body[data-screen='editor'] .preview-top { min-height: 34px; height: 34px; }
  body[data-screen='editor'] .preview-top .quiet-button { min-height: 34px; }
  .sheet-handle { min-height: 44px; font-size: 16px; }
  body[data-screen] .editor-tabs { margin-bottom: 6px; }
  body[data-screen='editor'] .color-grid { padding-top: 7px; }
}
@media (min-width: 701px) and (max-width: 959px) and (max-height: 500px) {
  body[data-screen='editor'] .workspace { height: 440px; }
}
@media (prefers-reduced-motion: reduce) { body[data-screen='editor'] .controls-panel { transition: none; } }
@media (prefers-reduced-transparency: reduce) {
  body[data-screen='editor'] .controls-panel,
  body[data-screen='editor'] #toggleOutlines,
  body[data-screen='editor'] .compare,
  .zoom-tools { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Keep nail selection easy to reach while the detailed geometry stays folded. */
.touchup-nail-label { display:flex; align-items:center; justify-content:space-between; gap:12px; color:#685c74; font-size:14px; }
.touchup-nail-label select { min-height:44px; min-width:140px; border:1px solid #d9cce3; border-radius:12px; background:#fff; color:#392b4e; padding:8px 12px; font-size:16px; }
#undoTouchUp { display:flex; align-items:center; justify-content:center; gap:7px; }
#toggleOutlines.needs-check::after { content:''; display:inline-block; width:7px; height:7px; margin-left:2px; border-radius:50%; background:#ad39b2; }
