.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 {
  position: relative;
  display: grid;
  grid-template-rows: minmax(390px, 58vh) auto;
  min-height: var(--stable-height);
  background: var(--paper);
}

.entry__visual {
  position: relative;
  overflow: hidden;
  background: #a84d27;
}

.entry__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.025);
  animation: entry-image 900ms cubic-bezier(.2,.8,.2,1) both;
}

.entry__visual::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background: linear-gradient(to top, var(--paper), transparent);
}

.entry__copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 12px;
  margin-top: -38px;
  padding: 0 22px calc(24px + var(--safe-bottom));
}

.entry__eyebrow,
.section-label {
  margin: 0;
  color: var(--amber-deep);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.entry h1 {
  max-width: 330px;
  margin: 0;
  font-family: var(--editorial-font);
  font-size: clamp(38px, 11vw, 52px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .94;
}

.entry__intro {
  max-width: 330px;
  margin: 0 0 8px;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.45;
}

.entry__actions {
  display: grid;
  gap: 9px;
}

.entry-button,
.sheet-button {
  min-height: 56px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-raised);
  font-weight: 720;
  text-align: left;
}

.entry-button--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.entry__terms {
  margin: 2px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.entry__preference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch);
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: .86rem;
}

.studio {
  min-height: 100%;
  background: var(--paper);
}

.canvas {
  position: relative;
  height: clamp(390px, 57vh, 570px);
  overflow: hidden;
  background: #2b2721;
}

.canvas__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 360ms ease, opacity 260ms ease, transform 900ms ease;
}

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

.canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.28), transparent 22%, transparent 65%, rgba(0,0,0,.5));
}

.version-path {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: flex;
  gap: 8px;
  align-items: end;
  overflow-x: auto;
  scrollbar-width: none;
}

.version-path::-webkit-scrollbar {
  display: none;
}

.version-node {
  position: relative;
  flex: 0 0 58px;
  height: 70px;
  padding: 0;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 13px;
  background: #28231e;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
}

.version-node img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.version-node span {
  position: absolute;
  inset: auto 0 0;
  padding: 12px 4px 4px;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.version-node.is-current {
  border-color: #fff;
  transform: translateY(-4px);
}

.version-node.is-pending::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  background: rgba(25,22,18,.72);
}

.version-node.is-pending::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -11px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.studio-panel {
  position: relative;
  z-index: 4;
  display: grid;
  gap: 10px;
  margin-top: -2px;
  padding: 12px 12px 18px;
  border-radius: 20px 20px 0 0;
  background: var(--paper);
}

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

.tool-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-raised);
  font-size: 16px;
  font-weight: 730;
  letter-spacing: -.01em;
  text-align: left;
}

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

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

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

.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__value {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 730;
}

.references {
  display: flex;
  gap: 7px;
  min-height: 0;
  overflow-x: auto;
}

.reference-chip {
  position: relative;
  flex: 0 0 54px;
  height: 54px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper-soft);
}

.reference-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-chip button {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(19,16,13,.78) 0 12px, transparent 13px);
  color: #fff;
  font-size: 14px;
}

.composer {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
  align-items: center;
  min-height: 56px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 29px;
  background: var(--paper-raised);
  box-shadow: 0 7px 24px rgba(30,25,19,.06);
}

.composer__button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
}

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

.composer__button--mic {
  background: transparent;
  color: var(--ink-muted);
  touch-action: none;
  transition: transform 140ms ease, border-radius 140ms ease, background 140ms ease;
}

.composer.is-recording {
  border-color: color-mix(in srgb, var(--danger) 48%, transparent);
}

.composer.is-recording .composer__button--mic {
  border-radius: 50%;
  background: var(--danger);
  transform: scale(1.08);
}

.composer__button--submit {
  background: var(--amber);
  color: #20170d;
  transition: opacity 140ms ease, transform 140ms ease;
}

.composer__button--submit:active:not(:disabled) {
  transform: scale(.94);
}

.composer__button--submit:disabled {
  opacity: .3;
}

.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 132px;
  padding: 11px 4px 9px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.35;
}

.recording-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 26px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.review-local-note {
  margin: -4px 0 10px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.35;
}

.recording-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: breathe-dot 900ms ease-in-out infinite;
}

.sheet-layer {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(16,14,12,.42);
  backdrop-filter: blur(3px);
  animation: veil-in 160ms ease-out;
}

.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__price {
  grid-column: 3;
  align-self: center;
  font-size: 16px;
  font-weight: 760;
}

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

.choice-row.is-selected::after {
  content: "✓";
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  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 {
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 15px;
  font-weight: 680;
}

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

.review-media {
  display: flex;
  gap: 7px;
  margin-bottom: 14px;
  overflow-x: auto;
}

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

.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;
}

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

.gallery-card {
  position: relative;
  min-height: 224px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: var(--paper-soft);
}

.gallery-card:first-child {
  grid-row: span 2;
  min-height: 456px;
}

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

.gallery-card span {
  position: absolute;
  inset: auto 8px 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(19,16,13,.68);
  color: #fff;
  backdrop-filter: blur(12px);
  font-size: 11px;
  text-align: left;
}

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

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

.profile-balance span {
  color: var(--ink-faint);
  font-size: 12px;
}

.profile-balance strong {
  font-family: var(--editorial-font);
  font-size: 38px;
  font-weight: 500;
}

.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: 14px;
}

.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.08); }
}

@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) {
  .canvas {
    height: 49vh;
  }

  .studio-panel {
    padding-top: 9px;
  }
}

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