/* Mintera template-first Studio. Scoped to #studio to preserve the atelier site. */
#studio .studio-frame.ts-ready { overflow: visible; }
#studio .studio-frame.ts-ready .app { align-items: stretch; min-height: 780px; }
#studio .studio-frame.ts-ready .app-main { padding: 0; background: #f8f4eb; overflow: hidden; }
#studio .studio-frame.ts-ready .engine-row { margin-top: 18px; padding: 13px 14px; border: 1px solid rgba(38,33,27,.13); background: #fffdf8; }
#studio .studio-frame.ts-ready .engine-row > * { display: none; }
#studio .studio-frame.ts-ready .engine-row .ts-side-security { display: block; }
.ts-side-security strong { display: block; color: #2b261f; font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; }
.ts-side-security span { display: block; margin-top: 5px; color: #756c60; font-size: .74rem; line-height: 1.5; }
.ts-sr { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.ts-template-lock { margin: 15px 0; padding: 14px; border: 1px solid rgba(166,124,51,.26); background: linear-gradient(135deg,#fffdf8,#f1e8d5); }
.ts-template-lock label { display: block; margin-bottom: 7px; color: #806129; font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.ts-template-lock select { width: 100%; }
.ts-template-lock small { display: block; margin-top: 7px; color: #766c5e; line-height: 1.4; }

.ts-main { min-width: 0; color: #2a251e; }
.ts-command { display: flex; justify-content: space-between; gap: 22px; align-items: center; padding: 22px 25px; border-bottom: 1px solid rgba(38,33,27,.12); background: #fffdf8; }
.ts-command-copy { min-width: 0; }
.ts-kicker { margin: 0 0 5px; color: #9b7737; font-size: .67rem; font-weight: 750; letter-spacing: .18em; text-transform: uppercase; }
.ts-command h3 { margin: 0; font-family: var(--serif, Georgia, serif); font-size: clamp(1.2rem,2vw,1.65rem); font-weight: 400; }
.ts-command p:not(.ts-kicker) { margin: 6px 0 0; color: #776e62; font-size: .8rem; line-height: 1.5; }
.ts-provider-stack { display: grid; gap: 7px; flex: 0 0 auto; }
.ts-provider { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid rgba(38,33,27,.13); background: #fff; color: #665d51; font-size: .69rem; white-space: nowrap; }
.ts-provider i { width: 7px; height: 7px; border-radius: 50%; background: #a9a196; box-shadow: 0 0 0 3px rgba(169,161,150,.14); }
.ts-provider.ready i { background: #3f815d; box-shadow: 0 0 0 3px rgba(63,129,93,.14); }
.ts-provider.pending i { background: #bb8c36; box-shadow: 0 0 0 3px rgba(187,140,54,.15); }
.ts-tabs { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; padding: 6px; border-bottom: 1px solid rgba(38,33,27,.12); background: #ede4d4; }
.ts-tab { min-height: 48px; border: 0; background: transparent; color: #746a5d; font: inherit; font-size: .71rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; cursor: pointer; }
.ts-tab:hover { background: rgba(255,255,255,.55); color: #2a251e; }
.ts-tab.on { background: #fffdf8; color: #8c682b; box-shadow: 0 2px 10px rgba(38,33,27,.06); }
.ts-pane { padding: 23px; }
.ts-pane[hidden] { display: none !important; }
.ts-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 17px; }
.ts-section-head h4 { margin: 0; color: #2b261f !important; font-family: var(--serif,Georgia,serif); font-size: 1.32rem !important; font-weight: 400 !important; letter-spacing: 0 !important; text-transform: none !important; }
.ts-section-head p { max-width: 560px; margin: 5px 0 0; color: #756c61; font-size: .78rem; line-height: 1.55; }
.ts-button { min-height: 42px; padding: 0 16px; border: 1px solid #9e7938; background: #191611; color: #ead39d; font: inherit; font-size: .7rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; transition: .18s ease; }
.ts-button:hover:not(:disabled) { transform: translateY(-1px); background: #2b241a; }
.ts-button:disabled { cursor: not-allowed; opacity: .45; }
.ts-button.light { background: #fffdf8; color: #6d5224; }
.ts-button.ghost { border-color: rgba(38,33,27,.2); background: transparent; color: #443c31; }
.ts-button.small { min-height: 34px; padding: 0 11px; font-size: .63rem; }
.ts-actions a.ts-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ts-status { min-height: 22px; margin: 11px 0 0; color: #756c60; font-size: .77rem; line-height: 1.5; }
.ts-status.ok { color: #33714d; }
.ts-status.error { color: #9b3e34; }
.ts-status.busy:before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border: 2px solid rgba(147,109,44,.25); border-top-color: #936d2c; border-radius: 50%; vertical-align: -1px; animation: ts-spin .8s linear infinite; }
@keyframes ts-spin { to { transform: rotate(360deg); } }

.ts-template-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; margin-bottom: 22px; }
.ts-template-card { position: relative; min-height: 130px; padding: 13px; border: 1px solid rgba(38,33,27,.14); background: #fffdf8; text-align: left; cursor: pointer; }
.ts-template-card:hover { border-color: rgba(151,111,44,.55); }
.ts-template-card.on { border-color: #9a7331; box-shadow: inset 0 0 0 1px #9a7331; background: #fbf2df; }
.ts-template-card:disabled { cursor: not-allowed; opacity: .62; }
.ts-template-mark { display: grid; width: 31px; height: 31px; place-items: center; margin-bottom: 12px; border: 1px solid rgba(151,111,44,.38); border-radius: 50%; color: #94702f; font-family: var(--serif,Georgia,serif); }
.ts-template-card strong { display: block; font-family: var(--serif,Georgia,serif); font-size: .94rem; font-weight: 500; }
.ts-template-card span { display: block; margin-top: 6px; color: #786f63; font-size: .67rem; line-height: 1.4; }
.ts-template-card b { position: absolute; top: 10px; right: 10px; color: #8b692f; font-size: .55rem; letter-spacing: .1em; text-transform: uppercase; }

.ts-direct-prompt { margin: 0 0 18px; padding: 15px; border: 1px solid rgba(151,111,44,.26); background: linear-gradient(135deg,#fffdf8,#f3ead9); }
.ts-direct-prompt label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: #705426; font-size: .68rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.ts-direct-prompt label span { color: #8a8072; font-weight: 500; letter-spacing: .04em; }
.ts-direct-prompt textarea { display: block; width: 100%; min-height: 82px; border: 1px solid rgba(38,33,27,.18); background: #fff; padding: 11px; color: #2a251e; font: inherit; font-size: .8rem; line-height: 1.5; resize: vertical; }
.ts-direct-prompt small { display: block; margin-top: 7px; color: #756c60; font-size: .68rem; line-height: 1.45; }

.ts-concept-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.ts-concept { overflow: hidden; border: 1px solid rgba(38,33,27,.14); background: #fffdf8; }
.ts-concept-media { position: relative; aspect-ratio: 5/4; overflow: hidden; background: #17130f; }
.ts-concept-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ts-concept-placeholder { position: absolute; inset: 0; display: grid; place-content: center; gap: 9px; padding: 25px; color: #b8aa91; text-align: center; background: radial-gradient(circle at 50% 45%,#2b241a,#15110d 68%); }
.ts-concept-placeholder i { width: 40px; height: 40px; margin: auto; border: 1px solid rgba(218,184,116,.45); border-radius: 50%; }
.ts-concept-placeholder span { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }
.ts-concept-placeholder.busy i { border-width: 2px; border-right-color: transparent; animation: ts-spin 1s linear infinite; }
.ts-concept-tag { position: absolute; left: 11px; top: 11px; padding: 7px 9px; border: 1px solid rgba(224,190,121,.42); background: rgba(20,16,12,.88); color: #e4c985; font-size: .59rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.ts-concept-body { padding: 15px; }
.ts-concept-body h5 { margin: 0; font-family: var(--serif,Georgia,serif); font-size: 1rem; font-weight: 500; }
.ts-concept-body p { min-height: 38px; margin: 6px 0 12px; color: #756c60; font-size: .72rem; line-height: 1.48; }
.ts-concept-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ts-concept-meta span { padding: 4px 6px; background: #f1eadc; color: #786744; font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; }
.ts-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.ts-empty-note { padding: 16px; border-left: 3px solid #bf9450; background: #f2e8d4; color: #665c50; font-size: .76rem; line-height: 1.55; }

.ts-refine-layout { display: grid; grid-template-columns: minmax(0,1.18fr) minmax(270px,.82fr); gap: 16px; }
.ts-mask-card,.ts-control-card { border: 1px solid rgba(38,33,27,.14); background: #fffdf8; }
.ts-mask-stage { position: relative; min-height: 360px; display: grid; place-items: center; overflow: hidden; background: #17130f; touch-action: none; }
.ts-mask-stage img { display: block; width: 100%; height: auto; max-height: 600px; object-fit: contain; user-select: none; pointer-events: none; }
.ts-mask-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.ts-mask-empty { padding: 40px; color: #b7aa94; text-align: center; line-height: 1.6; }
.ts-mask-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px; border-top: 1px solid rgba(38,33,27,.12); }
.ts-mask-toolbar span { color: #786e61; font-size: .69rem; }
.ts-control-card { padding: 17px; }
.ts-field { margin-bottom: 14px; }
.ts-field label { display: block; margin-bottom: 7px; color: #6f6558; font-size: .65rem; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.ts-field input,.ts-field select,.ts-field textarea { width: 100%; border: 1px solid rgba(38,33,27,.2); background: #fff; color: #28231d; padding: 10px 11px; font: inherit; font-size: .8rem; }
.ts-field textarea { min-height: 92px; resize: vertical; }
.ts-version-strip { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 13px; border-top: 1px solid rgba(38,33,27,.11); }
.ts-version { padding: 6px 8px; border: 1px solid rgba(38,33,27,.16); background: transparent; color: #665d51; font: inherit; font-size: .63rem; cursor: pointer; }
.ts-version.on { border-color: #9e7938; background: #f5ead4; color: #775821; }

.ts-model-layout { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(310px,.65fr); border: 1px solid rgba(38,33,27,.14); background: #fffdf8; }
.ts-model-stage { position: sticky; top: 80px; min-height: 560px; background: radial-gradient(circle at 50% 42%,#3a3024,#15110d 70%); }
.ts-model-stage model-viewer { width: 100%; height: 560px; --poster-color: transparent; }
.ts-model-overlay { position: absolute; left: 13px; right: 13px; bottom: 13px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.ts-model-overlay > * { pointer-events: auto; }
.ts-model-tools { display: flex; gap: 5px; }
.ts-model-tools button { min-height: 33px; padding: 0 9px; border: 1px solid rgba(225,195,133,.35); background: rgba(19,15,11,.78); color: #e3cb98; font: inherit; font-size: .6rem; cursor: pointer; }
.ts-model-controls { padding: 18px; border-left: 1px solid rgba(38,33,27,.12); }
.ts-template-summary { padding: 13px; margin-bottom: 15px; border: 1px solid rgba(151,111,44,.25); background: #f5ecd9; }
.ts-template-summary strong { display: block; font-family: var(--serif,Georgia,serif); font-size: 1rem; }
.ts-template-summary span { display: block; margin-top: 5px; color: #786d5e; font-size: .7rem; line-height: 1.45; }
.ts-part-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.ts-part { padding: 9px; border: 1px solid rgba(38,33,27,.15); background: #fff; color: #5f564a; font: inherit; font-size: .66rem; text-align: left; cursor: pointer; }
.ts-part.on { border-color: #9b7433; background: #f7ecd7; color: #6d4f1f; box-shadow: inset 3px 0 #9b7433; }
.ts-part:disabled { cursor: not-allowed; opacity: .5; }
.ts-param-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ts-param { min-width: 0; }
.ts-param label { display: block; margin-bottom: 5px; color: #73695d; font-size: .59rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ts-param input,.ts-param select { width: 100%; min-height: 37px; border: 1px solid rgba(38,33,27,.18); background: #fff; padding: 6px 8px; font: inherit; font-size: .72rem; }
.ts-edit-prompt { margin: 12px 0; }
.ts-edit-prompt label { display: block; margin-bottom: 5px; color: #73695d; font-size: .59rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ts-edit-prompt input { width: 100%; border: 1px solid rgba(38,33,27,.18); padding: 10px; font: inherit; font-size: .75rem; }
.ts-revision-list { max-height: 150px; overflow: auto; margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(38,33,27,.12); }
.ts-revision { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 7px 0; color: #71675b; font-size: .67rem; line-height: 1.4; }
.ts-revision b { color: #987331; }
.ts-limit { margin-top: 15px; padding: 12px; border-left: 3px solid #9b7433; background: #f3ead9; color: #675e52; font-size: .69rem; line-height: 1.55; }

.ts-handoff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.ts-handoff-card { padding: 17px; border: 1px solid rgba(38,33,27,.14); background: #fffdf8; }
.ts-handoff-card h5 { margin: 0 0 10px; color: #8a672c; font-size: .68rem; letter-spacing: .13em; text-transform: uppercase; }
.ts-handoff-card dl { margin: 0; }
.ts-handoff-card dl > div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(38,33,27,.08); }
.ts-handoff-card dt { color: #81776b; font-size: .68rem; }
.ts-handoff-card dd { margin: 0; color: #302a23; font-size: .72rem; word-break: break-word; }

@media (max-width: 1180px) {
  .ts-template-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .ts-model-layout,.ts-refine-layout { grid-template-columns: 1fr; }
  .ts-model-stage { position: relative; top: auto; }
  .ts-model-controls { border-left: 0; border-top: 1px solid rgba(38,33,27,.12); }
}
@media (max-width: 760px) {
  .ts-command { align-items: flex-start; flex-direction: column; padding: 18px; }
  .ts-provider-stack { width: 100%; }
  .ts-provider { white-space: normal; }
  .ts-tabs { grid-template-columns: 1fr 1fr; }
  .ts-pane { padding: 16px; }
  .ts-section-head { align-items: stretch; flex-direction: column; }
  .ts-template-grid,.ts-concept-grid,.ts-handoff-grid { grid-template-columns: 1fr; }
  .ts-template-card { min-height: 105px; }
  .ts-mask-stage { min-height: 280px; }
  .ts-model-stage,.ts-model-stage model-viewer { min-height: 380px; height: 380px; }
  .ts-param-grid,.ts-part-list { grid-template-columns: 1fr; }
  .ts-model-overlay { align-items: flex-end; flex-direction: column; }
  .ts-model-tools { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .ts-field input,.ts-field select,.ts-field textarea,
  .ts-param input,.ts-param select,.ts-edit-prompt input,.ts-direct-prompt textarea { font-size: 16px; }
  .ts-button.small,.ts-model-tools button,.ts-part { min-height: 44px; }
  .ts-direct-prompt label { align-items: flex-start; flex-direction: column; }
  .ts-model-controls { padding: 14px; }
  .ts-handoff-card dl > div { grid-template-columns: 92px minmax(0,1fr); }
}

/* Capability 3 — template-constrained regeneration panel (3D tab) */
.ts-render-card { margin-top: 16px; padding: 14px; border: 1px solid rgba(38,33,27,.14); background: #fffdf8; }
.ts-render-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ts-render-head strong { color: #26211b; font-size: .78rem; }
.ts-render-pill { padding: 3px 8px; border: 1px solid rgba(38,33,27,.2); border-radius: 999px; color: #7d7466; font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; }
.ts-render-pill.on { border-color: #9a7331; background: #fbf2df; color: #7b5c1f; }
.ts-render-card p { margin: 9px 0 12px; color: #756c60; font-size: .72rem; line-height: 1.55; }
.ts-render-preview { margin-top: 12px; }
.ts-render-preview img { display: block; width: 100%; height: auto; border: 1px solid rgba(38,33,27,.14); }
.ts-render-preview span { display: block; margin-top: 6px; color: #857c6f; font-size: .64rem; }

/* Addendum Section 6 — "3D editing not yet available for this style" */
.ts-empty-note.warn { border-left-color: #9b3e34; background: #f6e4e0; color: #6b4a44; }

/* Generation mode switch (template-locked vs free description) */
.ts-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 16px; }
.ts-mode { padding: 13px; border: 1px solid rgba(38,33,27,.14); background: #fffdf8; text-align: left; cursor: pointer; }
.ts-mode:hover { border-color: rgba(151,111,44,.55); }
.ts-mode.on { border-color: #9a7331; box-shadow: inset 0 0 0 1px #9a7331; background: #fbf2df; }
.ts-mode[disabled] { opacity: .55; cursor: not-allowed; }
.ts-mode strong { display: block; margin-bottom: 5px; color: #26211b; font-size: .78rem; }
.ts-mode span { display: block; color: #756c60; font-size: .69rem; line-height: 1.5; }
@media (max-width: 720px) { .ts-mode-switch { grid-template-columns: 1fr; } }
