.ar-studio {
  --ink: #312528;
  --muted: #625358;
  --wine: #802c45;
  --border: #dfd2cb;
  --surface: #f9f6f2;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font: 1rem/1.42 "Segoe UI", system-ui, sans-serif;
}
.ar-studio *, .ar-studio *::before, .ar-studio *::after { box-sizing: border-box }
.ar-studio [hidden] { display: none !important }
.ar-studio :is(button, input, select) { font: inherit }
.ar-studio button { cursor: pointer }
.ar-studio :is(button, select, input, a, summary):focus-visible,
.ar-view:focus-visible { outline: 3px solid #a6536c; outline-offset: 3px }
.ar-view:focus-visible { outline-offset: -3px }
.ar-studio button:disabled { opacity: .46; cursor: default }
.ar-header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  max-width: 1320px; margin: auto; padding: 10px clamp(12px, 3vw, 32px);
}
.ar-brand { display: block; flex: 0 1 150px; min-width: 104px }
.ar-brand img { display: block; width: 100%; height: auto; max-height: 50px; object-fit: contain; object-position: left }
.ar-header-tools { display: flex; gap: 12px; align-items: center }
.ar-header-tools .ar-link { font-size: .875rem }
.ar-studio .ar-language { position: relative; display: flex; align-items: center }
.ar-language > span { position: absolute; left: .55rem; pointer-events: none }
.ar-studio .ar-language select { width: auto; min-height: 40px; padding: 4px 6px 4px 1.8rem }
.ar-heading {
  max-width: 1320px; margin: auto; padding: 5px clamp(12px, 3vw, 32px) 12px;
  font: 500 clamp(1.28rem, 4vw, 2.6rem)/1.12 Georgia, serif; letter-spacing: -.035em;
}
.ar-workspace {
  --panel-width: clamp(19rem, 30vw, 25rem);
  display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-width);
  gap: 18px; align-items: start; margin-inline: auto; max-width: 1320px;
  padding: 0 clamp(12px, 3vw, 32px);
}
.ar-workspace:not(.ar-settings-open) .ar-stage { grid-column: 1 / -1; width: calc(100% - var(--panel-width) - 18px); justify-self: center }
.ar-stage, .ar-editor { min-width: 0 }
body:has(.ar-studio) { overflow-x: clip }
.ar-note { color: var(--muted); font-size: .875rem; margin: 4px 0 0 }
.ar-privacy { max-width: 1320px; margin: auto; padding: 12px clamp(12px, 3vw, 32px) 24px }
.ar-view {
  position: relative; isolation: isolate; overflow: hidden; width: 100%;
  aspect-ratio: 4 / 3; max-height: 69svh; background: #302829; border-radius: 14px;
  box-shadow: 0 12px 35px #3425272a; touch-action: pan-y;
}
.ar-view-tools {
  position: absolute; z-index: 1; inset: 9px 9px auto; display: flex; justify-content: space-between;
  align-items: flex-start; gap: 8px; pointer-events: none;
}
.ar-view-badge, .ar-stop {
  display: inline-flex; align-items: center; min-height: 35px; gap: 6px; padding: 6px 10px;
  color: #fff; background: #231c21de; border: 1px solid #ffffff44; border-radius: 999px;
  font-size: .76rem !important; font-weight: 650 !important;
}
.ar-view-badge i { width: 7px; height: 7px; flex: 0 0 7px; background: #e6c9bd; border-radius: 50% }
[data-camera-mode="camera"] .ar-view-badge i { background: #98e4a9 }
.ar-stop { pointer-events: auto; min-height: 40px }
.ar-view[data-pick] { touch-action: none; cursor: crosshair }
.ar-scene { position: absolute; inset: 0; transform: scale(var(--scene-zoom, 1)); transform-origin: center }
.ar-scene > :is(video, img, #ar-frozen, .ar-empty, .ar-decoration, .ar-overlay, .ar-markers),
.ar-decoration > .ar-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.ar-scene > :is(video, img, #ar-frozen) { object-fit: cover }
.ar-empty { display: grid; place-items: center; padding: 20px; background: linear-gradient(130deg, #282023, #473337); color: #f9f6f2; text-align: center }
.ar-empty p { max-width: 24ch; font-size: 1rem }
.ar-decoration {
  pointer-events: none;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.ar-overlay, .ar-flat, .ar-markers { display: block; pointer-events: none }
.ar-flat { position: absolute; inset: 0 auto auto 0; width: 1000px; height: 1000px; transform-origin: 0 0 }
.ar-flat-fabric { position: absolute; display: block }
.ar-marker {
  position: absolute; width: 16px; height: 16px; border: 2px solid white;
  border-radius: 50%; background: var(--wine); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px #1d131dcc;
}
.ar-marker.is-cursor { width: 22px; height: 22px; background: #802c4580 }
.ar-stage-status { display: flex; align-items: center; gap: 8px; padding: 4px 2px; min-height: 34px; overflow-wrap: anywhere }
.ar-stage-feedback { flex: 1; min-width: 0 }
.ar-status { margin: 0; color: var(--muted); font-size: .875rem }
.ar-stage-feedback > .ar-note { font-size: .8125rem }
.ar-studio .ar-stage-status > button { flex: 0 1 auto; max-width: 42%; font-size: .875rem; overflow-wrap: anywhere }
.ar-capture, .ar-actions, .ar-dock { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch }
.ar-capture > button, .ar-dock > button { flex: 1 1 0 }
.ar-actions > button { flex: 1 1 8rem }
.ar-dock { margin-top: 7px }
.ar-primary, .ar-secondary {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px;
  padding: 7px 13px; border-radius: 8px; border: 1px solid transparent; font-weight: 650 !important;
  min-width: 0; max-width: 100%; text-align: center; white-space: normal; overflow-wrap: anywhere;
}
.ar-primary { color: white; background: var(--wine) }
.ar-primary:hover:not(:disabled) { background: #682038 }
.ar-secondary { color: var(--wine); background: #fff; border-color: var(--border) }
.ar-secondary:hover:not(:disabled) { background: #f1e7e4 }
.ar-studio .ar-link { color: var(--wine); font-weight: 600; text-decoration: underline; text-underline-offset: .18em }
.ar-studio button.ar-link { border: 0; background: none; padding: 5px 0; min-height: 38px; text-align: start }
.ar-editor {
  display: grid; gap: 9px; background: #fffcf9; padding: 12px;
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 7px 24px #34252712;
}
.ar-panel-header, .ar-width-title { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.ar-panel-header h2 { font: 500 1.24rem/1.15 Georgia, serif; margin: 0 }
.ar-icon-button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--wine); background: #f3eae6 }
.ar-tabs, .ar-panel-footer { display: grid; gap: 6px; grid-template-columns: repeat(3, minmax(0, 1fr)) }
.ar-tabs button {
  display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px;
  min-width: 0; padding: 5px; background: #f4eeeb; color: var(--ink); border-radius: 9px;
  font-size: .82rem; font-weight: 650; overflow-wrap: anywhere;
}
.ar-tabs button[aria-pressed="true"] { color: #fff; background: var(--wine) }
.ar-tabs button > span { flex-shrink: 0 }
.ar-panel-scroll { max-height: min(53svh, 34rem); overflow-y: auto; padding: 5px; scrollbar-width: thin }
.ar-panel-scroll > .ar-details { margin-top: 12px }
.ar-panel-footer { grid-template-columns: repeat(2, minmax(0, 1fr)) }
.ar-width-control { padding: 8px 10px; border-radius: 10px; background: #f5eeea }
.ar-width-title output { color: var(--wine); font-variant-numeric: tabular-nums }
.ar-width-slider { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; color: var(--wine) }
.ar-width-slider input { min-height: 28px }
.ar-palette { margin: 0; min-width: 0; padding: 0; border: 0 }
.ar-palette legend { padding: 0; margin-bottom: 4px; font-size: .875rem; font-weight: 650 }
.ar-swatches { display: flex; flex-wrap: wrap; gap: 5px }
.ar-swatches label { position: relative; display: grid; width: 44px; height: 44px; place-items: center; cursor: pointer }
.ar-swatches input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit }
.ar-swatch {
  width: 34px; height: 34px; border: 1px solid #463c342e; border-radius: 8px;
  background: var(--swatch); display: grid; place-items: center;
}
.ar-swatch[data-drape-color="linen"] { --swatch: #b7a38e }
.ar-swatch[data-drape-color="cream"] { --swatch: #e6dbcb }
.ar-swatch[data-drape-color="graphite"] { --swatch: #59575e; color: white }
.ar-swatch[data-drape-color="sage"] { --swatch: #a3aa94 }
.ar-swatch > span { opacity: 0 }
.ar-swatches input:checked + .ar-swatch { outline: 2px solid var(--wine); outline-offset: 2px }
.ar-swatches input:checked + .ar-swatch > span { opacity: 1 }
.ar-swatches input:focus-visible + .ar-swatch { outline: 3px solid var(--wine); outline-offset: 3px }
.ar-palette:disabled { opacity: .5 }
.ar-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 9px }
.ar-full { grid-column: 1 / -1 }
.ar-studio label { display: grid; gap: 5px; min-width: 0; color: var(--ink); font-weight: 650; font-size: .875rem; overflow-wrap: anywhere }
.ar-studio :is(select, input[type="number"], input[type="file"]) {
  width: 100%; min-width: 0; min-height: 44px; padding: 7px 9px; color: var(--ink);
  background: white; border: 1px solid var(--border); border-radius: 7px; font-weight: 400;
}
.ar-studio input[type="range"] { width: 100%; min-width: 0; margin-inline: 0; accent-color: var(--wine) }
.ar-studio .ar-zoom { display: none }
.ar-studio:is([data-camera-mode="camera"], [data-camera-mode="photo"], [data-camera-mode="snapshot"]) .ar-zoom {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px;
  margin: 6px auto 0; padding: 0 4px; min-height: 28px; width: min(100%, 28rem);
}
.ar-model-tools { display: flex; flex-wrap: wrap; gap: 8px }
.ar-scale-labels { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .75rem; font-weight: 400 }
.ar-note:empty { display: none }
.ar-details { border-block-start: 1px solid var(--border); padding: 9px 0 4px }
.ar-details summary { cursor: pointer; font-size: .9rem; font-weight: 650; padding-block: 3px }
.ar-details[open] summary { margin-bottom: 9px }
.ar-placement { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px }
.ar-placement-tools { margin-block: 12px 4px }
.ar-publish { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-top: 10px }
.ar-dialog {
  width: min(36rem, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  margin: auto; color: var(--ink); background: #fbf8f5; border: 1px solid var(--border); border-radius: 14px;
}
.ar-dialog::backdrop { background: #281d23aa }
.ar-dialog-inner { padding: 18px; display: grid; gap: 12px }
.ar-dialog-inner h2 { font: 500 1.65rem/1.1 Georgia, serif; margin: 0; color: var(--ink) }
#ar-material-preview { max-width: 100%; max-height: 33vh; justify-self: center; cursor: crosshair; touch-action: none; background: #e3dcd6 }
@media (max-width: 760px) {
  .ar-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px }
  .ar-stage, .ar-editor, .ar-workspace:not(.ar-settings-open) .ar-stage { width: 100% }
  .ar-stage { scroll-margin-top: 4px }
  .ar-view { aspect-ratio: 4 / 5; max-height: min(55svh, 33rem); border-radius: 13px }
  .ar-studio :is(select, input[type="number"], input[type="file"]) { font-size: 16px }
  .ar-capture button, .ar-dock button { font-size: .875rem; padding-inline: 8px }
  .ar-panel-scroll { max-height: min(34svh, 16rem) }
  .ar-settings-open :is(.ar-dock, .ar-capture, label.ar-zoom) { display: none !important }
}
@media (min-height: 740px) and (max-width: 760px) and (orientation: portrait) {
  .ar-settings-open .ar-stage {
    position: sticky; top: 0; z-index: 2; padding-bottom: 6px; background: var(--surface);
  }
}
@media (max-width: 380px) {
  .ar-publish { grid-template-columns: minmax(0, 1fr) }
  .ar-tabs button { font-size: .75rem }
}
@media (max-height: 520px) and (orientation: landscape) {
  .ar-view { max-height: 55svh }
}
