.stellart-preview { position: relative; margin: 0 0 1em; background: #f5f5f5; border-radius: 6px; overflow: hidden; }
.stellart-preview img { display: block; width: 100%; height: auto; }
/* themes often set position on blocks; sticky has to win */
.stellart-preview.stellart-preview--sticky { position: -webkit-sticky !important; position: sticky !important; top: calc(var(--wp-admin--admin-bar--height, 0px) + 16px); z-index: 100; }
.stellart-fields { margin: 0 0 1em; }
.stellart-fields .stellart-field { margin: 0 0 .8em; }
.stellart-counter { display: block; text-align: right; font-size: .8em; opacity: .7; margin-top: .2em; }
.stellart-counter.is-full { opacity: 1; color: #b00; }
/* several lines: a textarea like the text inputs, with the Enter hint under it */
.stellart-fields textarea.stellart-multiline { width: 100%; max-width: 100%; box-sizing: border-box; resize: vertical; line-height: 1.4; font: inherit; }
.stellart-lines-hint { display: block; font-size: .8em; opacity: .7; margin-top: .2em; }
.stellart-fields label { display: block; font-weight: 600; margin-bottom: .25em; }
.stellart-fields input[type="text"], .stellart-fields select { width: 100%; max-width: 100%; box-sizing: border-box; }

/* floating mini preview (always visible on stacked layouts) */
/* sits at the bottom of the visible area (above the phone keyboard) */
.stellart-mini { position: fixed; right: 12px; bottom: auto; top: calc(var(--stellart-vv-top, 0px) + var(--stellart-vv-height, 100vh) - 12px);
  translate: 0 -100%; z-index: 99990; width: min(42vw, 240px); padding: 4px; border: 0; border-radius: 8px;
  background: #f5f5f5; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .2s, transform .2s; }
.stellart-mini.is-visible { opacity: 1; transform: none; pointer-events: auto; }
/* while typing, move to the top of the visible area so it never covers the field */
.stellart-mini.is-top { top: calc(var(--stellart-vv-top, 0px) + 12px); translate: 0 0; }
.stellart-mini img { display: block; width: 100%; height: auto; max-height: 30vh; object-fit: contain; }

/* full-screen button and view */
.stellart-fullscreen-button { position: absolute; top: 8px; right: 8px; z-index: 2; width: 36px; height: 36px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: #222; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer; }
.stellart-fullscreen-button:hover, .stellart-fullscreen-button:focus-visible { background: #fff; }
/* sized to the visible area, so the preview keeps the space left by the phone keyboard */
.stellart-overlay { display: none; position: fixed; left: 0; right: 0; top: var(--stellart-vv-top, 0px); height: var(--stellart-vv-height, 100%); z-index: 100000; background: #f5f5f5; color: #222;
  grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: 100%; font-size: 16px; }
.stellart-overlay.is-open { display: grid; }
.stellart-overlay__preview { display: grid; place-items: center; min-height: 0; overflow: hidden; }
/* sized by stellart-product.js from the design's proportions */
.stellart-overlay__preview img { display: block; max-width: none; }
.stellart-overlay__panel { background: #fff; padding: 24px; overflow-y: auto; box-shadow: -2px 0 12px rgba(0, 0, 0, .08); display: flex; flex-direction: column; }
.stellart-overlay__panel h2 { margin: 0 0 16px; font-size: 1.3em; }
.stellart-overlay__fields { flex: 1; }
.stellart-overlay__fields label { display: block; font-weight: 600; margin: 0 0 .3em; }
.stellart-overlay__fields .stellart-field { margin: 0 0 1em; }
.stellart-overlay__fields input[type="text"], .stellart-overlay__fields select { width: 100%; box-sizing: border-box; padding: .6em .7em;
  font: inherit; color: inherit; background: #fff; border: 1px solid #c8c8c8; border-radius: 4px; }
.stellart-overlay__fields abbr { text-decoration: none; color: #b00; }
.stellart-overlay__done { width: 100%; margin-top: 16px; padding: .8em 1em; font: inherit; font-weight: 600; color: #fff; background: #111;
  border: 0; border-radius: 4px; cursor: pointer; }
html.stellart-noscroll { overflow: hidden; }
@media (max-width: 782px) {
  /* preview on top takes all the space the panel leaves (at least about a third); the panel scrolls */
  .stellart-overlay.is-open { display: flex; flex-direction: column; }
  .stellart-overlay__preview { flex: 1 1 auto; min-height: 33%; }
  .stellart-overlay__panel { flex: 0 1 auto; max-height: 62%; min-height: 0; padding: 16px; box-shadow: 0 -2px 12px rgba(0, 0, 0, .08); }
  .stellart-overlay__panel h2 { font-size: 1.1em; margin-bottom: 10px; }
  .stellart-overlay__done { margin-top: 10px; }
}
/* little visible height (e.g. phone keyboard open): no panel title, more room for the preview */
html.stellart-tight .stellart-overlay__panel h2 { display: none; }
@media (max-width: 782px) {
  html.stellart-tight .stellart-overlay__preview { min-height: 48%; }
  html.stellart-tight .stellart-overlay__panel { padding: 10px 16px; }
}

/* admin viewer */
.stellart-viewer-grid { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 720px); gap: 24px; margin-top: 16px; align-items: start; }
.stellart-viewer-side select, .stellart-viewer-side input[type="text"] { width: 100%; }
.stellart-viewer-side > select { margin: 4px 0 16px; }
@media (max-width: 782px) { .stellart-viewer-grid { grid-template-columns: 1fr; } }

/* font picker: a dropdown showing the customer's text in each font */
.stellart-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stellart-font-picker { position: relative; }
.stellart-font-current { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px;
  padding: 6px 12px; border: 1px solid #c8c8c8; border-radius: 4px; background: #fff; color: #222; cursor: pointer; text-align: left; }
.stellart-font-current__text { font-size: 22px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stellart-font-current__arrow { flex: none; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-3px); }
.stellart-font-current[aria-expanded="true"] .stellart-font-current__arrow { transform: rotate(-135deg) translateY(-2px); }
.stellart-font-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; margin: 0; padding: 4px; list-style: none;
  max-height: min(320px, 50vh); overflow-y: auto; background: #fff; border: 1px solid #c8c8c8; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); outline: none; }
.stellart-font-tile { padding: 8px 12px; border-radius: 4px; font-size: 22px; line-height: 1.3; color: #222; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stellart-font-tile:hover, .stellart-font-tile.is-active { background: #f2f2f2; }
.stellart-font-tile[aria-selected="true"] { box-shadow: inset 3px 0 0 #111; }

/* groups: a text and its Options dropdown */
.stellart-group { margin: 0 0 1em; }
.stellart-group > .stellart-field { margin-bottom: .4em; }
.stellart-options { position: relative; }
.stellart-options__toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 1px solid #c8c8c8; border-radius: 4px;
  background: #fff; color: #222; font: inherit; font-size: .9em; cursor: pointer; text-align: left; }
.stellart-options__what { flex: 1; min-width: 0; color: #777; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stellart-options__toggle[aria-expanded="true"] .stellart-font-current__arrow { transform: rotate(-135deg) translateY(-2px); }
.stellart-options__panel { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 70; padding: 12px 12px 4px; background: #fff;
  border: 1px solid #c8c8c8; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.stellart-options__panel[hidden] { display: none; }
.stellart-options__panel select { min-height: 48px; padding: 6px 12px; border: 1px solid #c8c8c8; border-radius: 4px; background-color: #fff; font: inherit; }

/* inputs of parts hidden by the customer's choices */
.stellart-fields [hidden] { display: none !important; }

/* extra prices */
.stellart-total { margin: 12px 0; display: flex; flex-direction: column; gap: 2px; }
.stellart-total strong { font-size: 1.15em; }
.stellart-total__extra { font-size: .875em; opacity: .75; }
.stellart-font-tile__extra { display: block; font-family: inherit; font-size: 12px; opacity: .7; }
.stellart-font-tile .stellart-font-tile__extra { font-family: system-ui, sans-serif; }
.stellart-font-tile__name { display: block; font: 12px/1.3 system-ui, sans-serif; opacity: .7; }
.si-extra { font-size: .8em; opacity: .75; white-space: nowrap; }

/* note and files */
.stellart-notes { margin: 0 0 1em; }
.stellart-notes .stellart-field { margin: 0 0 .8em; }
.stellart-notes label { display: block; font-weight: 600; margin-bottom: .25em; }
.stellart-notes textarea { width: 100%; box-sizing: border-box; }
.stellart-attach__hint { display: block; font-size: .85em; opacity: .7; margin-top: .25em; }
.stellart-attach__list { list-style: none; margin: .4em 0 0; padding: 0; }
.stellart-attach__list li { display: flex; align-items: center; gap: .5em; padding: .2em 0; font-size: .9em; }
.stellart-attach__list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stellart-attach__remove { background: none; border: 0; padding: 0 .3em; font-size: 1.2em; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.stellart-attach__remove:hover { opacity: 1; }
.stellart-attach__error { display: block; color: #b32d2e; font-size: .85em; }
.stellart-attach__error:empty { display: none; }
.stellart-notes [hidden] { display: none !important; }

/* 3D preview: the customer's 2D / 3D switch (the design's "Shop preview" is the first view) */
.stellart-3d[hidden], .stellart-preview img[hidden], .stellart-overlay__preview img[hidden] { display: none !important; }
.stellart-preview--3d .stellart-3d { position: relative; width: 100%; aspect-ratio: 1 / 1; touch-action: none; cursor: grab; }
.stellart-views { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; padding: 2px; border-radius: 999px;
  background: rgba(255, 255, 255, .9); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.stellart-views button { min-width: 40px; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: #222;
  font: 600 13px/1 system-ui, sans-serif; cursor: pointer; }
.stellart-views button[aria-pressed="true"] { background: #222; color: #fff; }
.stellart-views button:focus-visible { outline: 2px solid #222; outline-offset: 1px; }
/* full screen: the 3D view takes the whole preview area */
.stellart-overlay__preview { position: relative; }
/* pinned to the area's edges: in the grid its row would grow to the canvas's own height */
.stellart-overlay__preview .stellart-3d { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.stellart-3d canvas { display: block; width: 100%; height: 100%; }
.stellart-3d__hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 4px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; pointer-events: none; transition: opacity .3s; }
.stellart-3d--touched .stellart-3d__hint { opacity: 0; visibility: hidden; }
.stellart-3d__reset { position: absolute; right: 8px; bottom: 8px; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(0, 0, 0, .15); background: rgba(255, 255, 255, .92); color: #333; cursor: pointer; }
.stellart-3d__reset svg { width: 22px; height: 22px; }
.stellart-preview--3d #stellart-preview-img { display: none; }
