.icon-button {
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 16, 14, 0.46);
  backdrop-filter: blur(16px);
  color: #fff;
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entry-button, .sheet-button {
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-raised);
  font-weight: 650;
}
.entry-button--primary {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper);
}
.entry--status { padding: 40px 24px; }
.entry--status h1 { font-size: 24px; }
.entry__eyebrow { display: none; }
.entry__intro { color: var(--ink-muted); line-height: 1.5; }
.canvas--empty { background: var(--paper); }
.canvas--empty::after { display: none; }
.settings-done { width: 100%; margin-top: 20px; }
.profile-links { display: flex; gap: 24px; }
.profile-links a { display: flex; align-items: center; min-height: 44px; color: var(--ink-muted); font-size: 15px; }

.studio {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}

.canvas {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--paper-soft);
  touch-action: pan-y;
}

.canvas__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 360ms ease, opacity 260ms ease;
}

.canvas__image.is-empty {
  opacity: .32;
  filter: grayscale(1);
}

.canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: none;
}

.version-path {
  position: absolute;
  z-index: 3;
  right: 50%;
  bottom: 8px;
  display: grid;
  grid-template-columns: 44px auto 44px;
  align-items: center;
  min-height: 44px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
  transform: translateX(50%);
}

.version-path button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 50%;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.65));
}

.version-path button:active:not(:disabled) {
  background: rgba(255,255,255,.12);
}

.version-path button:disabled {
  opacity: .32;
}

.version-path button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.version-path > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
}

.version-path[aria-busy="true"] > span {
  font-size: 0;
}

.version-path[aria-busy="true"] > span::after {
  content: "…";
  font-size: 18px;
}

.studio-panel {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-rows: 44px auto;
  gap: 8px;
  margin-top: -2px;
  padding: 4px 12px max(12px, var(--safe-bottom));
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  min-width: 0;
  width: 100%;
}

.editor-tools {
  display: grid;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.editor-tools.has-orders {
  grid-template-columns: minmax(0, 1fr) auto;
}

.tool-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}
.tool-button--settings > svg { flex: 0 0 20px; width: 20px; height: 20px; }

.tool-button:active {
  transform: scale(.985);
}

.tool-button:not(.tool-button--model) {
  gap: 4px;
  padding-inline: 9px;
}

.tool-button--aspect {
  justify-content: center;
  width: 52px;
  min-width: 52px;
  padding-inline: 0;
}

.tool-button--orders {
  justify-content: center;
  min-width: 92px;
  font-size: 13px;
  white-space: nowrap;
}

.tool-button__icon,
.choice-row__icon {
  display: grid;
  flex: 0 0 26px;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--amber-deep);
}

.tool-button--model .tool-button__icon {
  flex-basis: 22px;
  width: 22px;
  height: 22px;
}

.choice-row__icon {
  flex-basis: 42px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--paper-soft);
}

.tool-button svg,
.choice-row__icon svg,
.review-summary__button svg,
.result-action svg,
.sheet__close svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-button__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-button--model .tool-button__label {
  letter-spacing: -.025em;
}

.tool-button__value {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.sheet-layer {
  position: fixed;
  z-index: 70;
  top: var(--frame-visual-offset-top, 0px);
  right: 0;
  bottom: auto;
  left: 0;
  height: var(--frame-sheet-height, var(--frame-visual-height, var(--layout-height)));
  display: grid;
  align-items: end;
  background: rgba(16,14,12,.42);

  animation: veil-in 160ms ease-out;
}

.sheet {
  max-height: var(--frame-sheet-max-height, min(82vh, 720px));
  padding: 8px 14px calc(18px + var(--safe-bottom));
  overflow-y: auto;
  border-radius: 28px 28px 0 0;
  background: var(--paper-raised);
  box-shadow: var(--shadow-sheet);
  animation: sheet-in 230ms cubic-bezier(.22,.85,.24,1);
}

.sheet__handle {
  width: 42px;
  height: 4px;
  margin: 2px auto 16px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet__header {
  display: grid;
  grid-template-columns: 1fr var(--touch);
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet__header h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 760;
  letter-spacing: -.025em;
}

.sheet__header p {
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.4;
}

.sheet__close {
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper-soft);
  color: var(--ink-muted);
}

.sheet-list {
  display: grid;
  gap: 8px;
}

.choice-row {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--paper);
  text-align: left;
}

.choice-row__copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.choice-row strong {
  font-size: 17px;
  letter-spacing: -.01em;
}

.choice-row__copy > span {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-row__meta {
  grid-column: 3;
  display: grid;
  justify-items: end;
  gap: 3px;
  align-self: center;
  font-variant-numeric: tabular-nums;
}

.choice-row__meta strong {
  font-size: 16px;
  font-weight: 760;
}

.choice-row__meta span {
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.2;
}

.choice-row.is-selected {
  padding-right: 34px;
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}

.choice-row.is-selected::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--amber);
  color: #21170d;
  font-size: 12px;
  font-weight: 900;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 4px;
  border-radius: 18px;
  background: var(--paper-soft);
}

.segmented button {
  display: grid;
  grid-template-rows: 26px auto;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-height: 64px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 15px;
  font-weight: 680;
}

.segmented button::before {
  width: var(--ratio-width, 20px);
  height: var(--ratio-height, 16px);
  border: 1.5px solid currentColor;
  border-radius: 2px;
  content: "";
}

.segmented button[data-ratio="1:1"] {
  --ratio-width: 18px;
  --ratio-height: 18px;
}

.segmented button[data-ratio="4:5"] {
  --ratio-width: 15.2px;
  --ratio-height: 19px;
}

.segmented button[data-ratio="16:9"] {
  --ratio-width: 24px;
  --ratio-height: 13.5px;
}

.segmented button[data-ratio="9:16"] {
  --ratio-width: 13.5px;
  --ratio-height: 24px;
}

.segmented button.is-selected {
  background: var(--paper-raised);
  box-shadow: 0 4px 14px rgba(25,20,15,.08);
}

.review-media-block {
  position: relative;
  margin-bottom: 14px;
}

.review-media-block.has-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 4px;
}

.review-media {
  display: flex;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
}

.review-media img {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 13px;
}

.review-local-info {
  position: relative;
  align-self: start;
}

.review-local-info__button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--paper-soft) 0 13px, transparent 14px);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 800;
}

.review-local-info__button[aria-expanded="true"] {
  color: var(--ink);
}

.review-local-info__tooltip {
  position: absolute;
  z-index: 3;
  top: 44px;
  right: 0;
  width: min(244px, calc(100vw - 40px));
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper-raised);
  box-shadow: 0 12px 30px rgba(25,20,15,.14);
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.4;
}

.review-local-info__tooltip[hidden] {
  display: none;
}

.review-prompt {
  margin: 0 0 14px;
  padding: 13px;
  border-radius: 16px;
  background: var(--paper-soft);
  font-size: 16px;
  line-height: 1.45;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.review-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
}

.review-summary__button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--paper);
  font-size: 16px;
  font-weight: 700;
}

.review-summary__button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-cta {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: var(--amber);
  color: #21170d;
  font-size: 17px;
  font-weight: 800;
}

.review-balance {
  margin: 7px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
}

.subview {
  min-height: var(--stable-height);
  padding: calc(var(--safe-top) + 78px) 14px calc(var(--tabbar-height) + var(--safe-bottom) + 24px);
  background: var(--paper);
}

.subview h1 {
  margin: 0 0 6px;
  font-family: var(--editorial-font);
  font-size: 38px;
  font-weight: 520;
  letter-spacing: -.045em;
}

.subview__intro {
  margin: 0 0 22px;
  color: var(--ink-muted);
  font-size: 14px;
}

.subview--gallery {
  padding-inline: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
}

.gallery-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--paper-soft);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card--new {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  color: var(--ink-muted);
}

.gallery-card--new svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.gallery-card--new[data-action="start-new"] {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  color: var(--ink-muted);
}

.gallery-card--new[data-action="start-new"] svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.gallery-card--loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(24, 21, 18, .36);

}

.gallery-card--loading > span {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  left: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 720;
  text-align: left;
}

.gallery-card--loading .price-scene {
  width: 100%;
  height: 100%;
}

.order-row .choice-row__meta span {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-empty {
  grid-column: 1 / -1;
  margin: 32px 18px;
  color: var(--ink-muted);
  text-align: center;
}

.profile-stack {
  display: grid;
  gap: 10px;
}

.profile-balance {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 108px;
  padding: 20px;
  border-radius: 22px;
  background: var(--ink);
  color: var(--paper);
}

.profile-balance span {
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1.2;
}

.profile-balance strong {
  font-family: var(--editorial-font);
  font-size: 38px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.profile-balance button {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: 52px;
  height: 52px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
}

.profile-balance button svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.profile-price-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-raised);
  font-size: 16px;
}

.profile-row strong {
  font-variant-numeric: tabular-nums;
}

.switch {
  position: relative;
  width: 52px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.switch::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 2px;
  left: 2px;
  height: 28px;
  border-radius: 999px;
  background: var(--paper-soft);
  transition: background 180ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 11px;
  left: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper-raised);
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
  transition: transform 180ms ease;
}

.switch[aria-checked="true"] {
  background: transparent;
}

.switch[aria-checked="true"]::before {
  background: var(--amber);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

@keyframes entry-image {
  from { opacity: .68; transform: scale(1.055); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes breathe-dot {
  50% { opacity: .28; }
}

@keyframes slow-pulse {
  50% { transform: scale(.96); opacity: .8; }
}

@keyframes veil-in {
  from { opacity: 0; }
}

@keyframes sheet-in {
  from { transform: translateY(28px); opacity: .5; }
}

@media (max-height: 700px) {
  .studio-panel {
    padding-top: 9px;
  }
}

@supports selector(body:has(textarea:focus)) {
  body:has([data-prompt-input]:focus) .tabbar {
    display: none;
  }
}

.app[data-prompt-focus="true"] .topbar__gallery,
.app[data-prompt-focus="true"] .balance-button,
.app[data-prompt-focus="true"] .editor-tools,
.app[data-prompt-focus="true"] .version-path {
  display: none !important;
}

.app[data-prompt-focus="true"] .studio-panel {
  padding-top: 8px;
}

.app[data-prompt-focus="true"] .composer {
  grid-row: 1;
}

.app[data-prompt-focus="true"] .references {
  grid-row: 2;
}

.model-choice { grid-template-columns: minmax(0, 1fr) auto; }
.model-choice .choice-row__copy { min-width: 0; }
.model-choice:disabled { opacity: .5; cursor: default; }
.model-choice .choice-row__copy strong { white-space: nowrap; font-size: 16px; }
.model-choice .choice-row__meta { padding-right: 10px; }
.section-label { color: var(--ink-muted); font-size: 14px; margin: 22px 0 12px; }
