
:root {
  --red:        var(--red-500);
  --red-dark:   var(--red-600);
  --red-press:  var(--red-700);
  --red-pale:   var(--red-50);
  --red-glow:   rgba(225,58,68,0.18);
  --green:      var(--color-success);
  --green-pale: #eef6f1;
  --white:      var(--neutral-0);
  --bg:         var(--color-bg-warm);
  --surface:    var(--surface-card);
  --surface2:   var(--surface-sunken);
  --border:     var(--border-subtle);
  --border-lt:  var(--neutral-100);
  --app-ink:        var(--neutral-800);
  --text-tertiary:  var(--neutral-600);
  --text-disabled:  var(--neutral-400);
  --chrome-dark:  var(--neutral-800);
  --chrome-mid:   var(--neutral-600);
  --chrome-light: var(--neutral-300);
  --glass-card:      rgba(255,255,255,0.64);
  --glass-card-hi:   rgba(255,255,255,0.82);
  --glass-sunken:    rgba(255,255,255,0.34);
  --glass-tint-red:  rgba(252,235,236,0.66);
  --transition: 0.18s cubic-bezier(0.2,0,0,1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.app-body { position: relative; }
.is-initially-hidden { display: none; }
.atp-page-hero {
  background: linear-gradient(120deg, #c92d37 0%, #a8232c 30%, #7d1a21 55%, #c92d37 80%, #c92d37 100%);
  border-bottom: none;
  padding: 64px 40px 52px;
  position: relative; overflow: hidden;
}
.atp-page-hero__title {
  font-family: 'Poppins', sans-serif;
  font-weight: 300; font-style: normal;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 0.96; letter-spacing: -0.035em;
  color: #fff; margin: 0 0 12px;
}
.atp-page-hero__desc {
  font-size: var(--text-base); font-weight: 400;
  color: rgba(255,255,255,0.96); margin: 0;
  max-width: 62ch;
}
.atp-page-hero__deco {
  position: absolute; right: -60px; top: -60px;
  width: 300px; height: 300px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.22); pointer-events: none;
}
.atp-page-hero__deco::after {
  content: ''; position: absolute; inset: 18%;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.16);
}
.lang-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 28px; }
.lang-bar-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-tertiary); margin-right: 4px;
}
.lang-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 4px 11px; border: 1px solid var(--border);
  background: var(--white); color: var(--text-tertiary);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition); min-height: 26px;
}
.lang-btn:hover { border-color: var(--chrome-mid); color: var(--app-ink); }
.lang-btn.active { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.page-layout {
  display: grid;
  align-items: stretch;
}
.right-col-wrap {
  position: static; height: auto;
  background: var(--surface2);
}
.right-col {
  padding: 32px 28px 80px;
}
@media (min-width: 981px) {
  .right-col-wrap {
    border-left: 1px solid rgba(255,255,255,0.72);
    box-shadow: inset 1px 0 0 rgba(44,42,37,0.05),
               -18px 0 40px -24px rgba(44,42,37,0.16);
  }
}
@media (max-width: 980px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); }
  .right-col-wrap {
    position: static; height: auto;
    border-top: 1px solid rgba(255,255,255,0.72);
    box-shadow: inset 0 1px 0 rgba(44,42,37,0.05),
                0 -18px 40px -24px rgba(44,42,37,0.16);
  }
}
.progress-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.progress-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-tertiary);
}
.progress-count { font-size: var(--text-xs); font-weight: 500; color: var(--text-tertiary); }
.progress-bar-wrap {
  margin-bottom: var(--space-6); background: var(--border);
  border-radius: var(--radius-pill); height: 2px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; width: 100%; background: var(--red); border-radius: var(--radius-pill);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.panel-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl)); font-weight: 300;
  font-style: normal; letter-spacing: -0.03em; line-height: 1.12;
  color: var(--app-ink); margin-bottom: 6px;
}
.panel-desc {
  font-size: var(--text-sm); font-weight: 300;
  color: var(--app-ink); margin-bottom: var(--space-6);
}
.templates-section { margin-bottom: var(--space-6); }
.templates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-sm); font-weight: 400;
  color: var(--text-primary); background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 14px; cursor: pointer; text-align: left;
  transition: all var(--transition); line-height: 1.4;
  box-shadow: var(--shadow-xs);
}
@media (hover: hover) {
  .tpl-btn:hover {
    border-color: var(--red-dark); box-shadow: var(--shadow-sm), 0 0 0 3px var(--red-glow);
    transform: translateY(-1px);
  }
}
.tpl-btn-title {
  font-weight: 600; font-size: var(--text-sm);
  display: block; margin-bottom: 2px; color: var(--text-primary);
}
.tpl-btn-desc { font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 400; }
.controls-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  align-items: start;
}
.control-group {
  display: flex; flex-direction: column; gap: var(--space-2);
}
.control-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-tertiary); white-space: nowrap;
}
.mode-btns {
  display: flex;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface2);
  height: 36px; width: fit-content;
}
.mode-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 16px; border: none; background: transparent;
  color: var(--text-tertiary); cursor: pointer;
  transition: all var(--transition); height: 100%;
  white-space: nowrap;
}
.mode-btn + .mode-btn { border-left: 1px solid var(--border); }
.mode-btn:focus-visible { outline-offset: -4px; }
.mode-btn.active:focus-visible { outline-color: #fff; }
.mode-btn.active {
  background: var(--red-dark); color: #fff;
  box-shadow: var(--shadow-brand);
}
body.basic-mode .advanced-only { display: none !important; }
select {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-sm); font-weight: 400;
  color: var(--text-primary); background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 30px 0 11px; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color var(--transition), box-shadow var(--transition);
  height: 36px; display: block;
}
select:focus { outline: none; border-color: var(--red-dark); box-shadow: 0 0 0 3px var(--red-glow); }
.section-heading { display: flex; align-items: center; gap: 12px; margin: 32px 0 4px; }
.section-heading--flush { margin-top: 0; }
.section-heading-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-tertiary); white-space: nowrap;
}
.section-heading-line { flex: 1; height: 1px; background: var(--border); }
.field-table { width: 100%; border-collapse: collapse; }
.field-table tr { border-bottom: 1px solid var(--border-lt); }
.field-table tr:last-child { border-bottom: none; }
.col-attr { width: 36%; vertical-align: top; padding: 16px 20px 16px 0; }
.attr-label {
  font-weight: 600; font-size: var(--text-sm);
  color: var(--text-primary); margin-bottom: 4px;
  display: flex; align-items: center; gap: 0;
}
.attr-hint {
  font-size: var(--text-xs); font-weight: 400;
  color: var(--text-tertiary); line-height: 1.5;
  cursor: pointer; user-select: none;
}
.attr-hint-full { display: none; margin-top: 4px; }
.attr-hint.expanded .attr-hint-full { display: block; }
.attr-hint-toggle {
  font-size: var(--text-xs); color: var(--red-dark); font-weight: 600;
  cursor: pointer; text-decoration: none;
  display: inline-block; margin-top: 3px;
}
.col-input {
  width: 64%; vertical-align: top;
  padding: 16px 0 16px 20px;
  border-left: 2px solid var(--border-lt); position: relative;
  transition: border-color var(--transition);
}
.col-input.filled { border-left-color: var(--green); }
.col-input.filled::after {
  content: '✓'; position: absolute; top: 19px; right: 6px;
  font-size: var(--text-xs); color: var(--green); font-weight: 600;
}
textarea {
  width: 100%; font-family: 'Poppins', sans-serif; font-weight: 400;
  font-size: 16px; color: var(--text-primary); background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; resize: none; min-height: 60px; overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.6;
}
@media (hover: hover) and (pointer: fine) {
  textarea { font-size: var(--text-sm); }
}
textarea:focus {
  outline: none; border-color: var(--red-dark);
  box-shadow: 0 0 0 3px var(--red-glow);
}
textarea::placeholder { color: var(--text-disabled); font-weight: 300; }
textarea.invalid { border-color: var(--red) !important; animation: shake 0.3s ease; }
textarea.required-empty { border-color: var(--red-400) !important; }
textarea.required-empty:focus { border-color: var(--red) !important; box-shadow: 0 0 0 3px var(--red-glow) !important; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.field-required-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--red-dark); margin-left: 8px;
}
.optional-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border); display: inline-block;
  margin-left: 8px; vertical-align: middle; transition: background 0.2s;
}
.col-input.filled .optional-dot { background: var(--green); }
.field-reset {
  position: absolute; top: 18px; right: 4px;
  width: 20px; height: 20px; border: none; background: none;
  color: var(--text-tertiary); font-size: 14px; line-height: 1;
  cursor: pointer; padding: 0; border-radius: var(--radius-sm);
  opacity: 0; transition: opacity var(--transition), color var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.col-input:hover .field-reset, .col-input.filled .field-reset { opacity: 1; }
.field-reset:hover { color: var(--red-dark); }
.copy-btn:disabled, .dl-btn:disabled, .pdf-btn:disabled {
  opacity: 0.3; cursor: not-allowed; pointer-events: none;
}
.validation-msg {
  font-size: var(--text-xs); font-weight: 500; color: var(--red-dark);
  margin-bottom: 10px; min-height: 16px; transition: opacity 0.2s;
}
.validation-msg:empty { opacity: 0; }
.preview-draft-notice {
  font-size: var(--text-xs); font-weight: 500; color: var(--red-dark);
  padding: 8px 14px; margin-bottom: 10px;
  border-radius: var(--radius-pill);
  background-color: var(--glass-tint-red);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(225, 58, 68, 0.24);
}
.preview-draft-notice.hidden { display: none; }
.bayes-toggle-wrap { padding: 12px 0 8px; }
.toggle-label {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  user-select: none; font-size: var(--text-sm); font-weight: 400;
  color: var(--app-ink);
}
.toggle-label { position: relative; }
.toggle-label input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.toggle-label input:focus-visible + .toggle-switch { outline: 2px solid var(--red); outline-offset: 2px; }
.toggle-switch {
  width: 36px; height: 20px; background: var(--border);
  border-radius: 10px; position: relative;
  transition: background var(--transition); flex-shrink: 0;
}
.toggle-switch::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  background: #fff; border-radius: 50%; top: 3px; left: 3px;
  transition: left var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .toggle-switch { background: var(--red); }
input:checked + .toggle-switch::after { left: 19px; }
.bayes-block {
  display: none; background: var(--red-pale);
  border: 1px solid rgba(225,58,68,0.15);
  border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 4px;
}
.bayes-block.visible { display: block; }
.bayes-tag {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--red-dark); margin-bottom: 10px;
}
.bayes-block .field-table tr { border-bottom: 1px solid rgba(225,58,68,0.10); }
.bayes-block .col-input { border-left: 1px solid rgba(225,58,68,0.15); }
.prompt-section { margin-top: 32px; }
.prompt-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 10px; gap: 12px; flex-wrap: wrap;
}
.prompt-header-left { display: flex; flex-direction: column; gap: 3px; }
.prompt-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; color: var(--text-primary);
}
.token-counter { font-size: var(--text-xs); font-weight: 400; color: var(--text-tertiary); }
.token-counter span { font-weight: 600; color: var(--app-ink); }
.word-counter { font-size: var(--text-xs); font-weight: 400; color: var(--text-tertiary); }
.word-counter span { font-weight: 600; color: var(--app-ink); }
.token-limit-bar {
  height: 2px; border-radius: var(--radius-pill); margin-top: 4px;
  background: var(--border); overflow: hidden;
}
.token-limit-fill { height: 100%; width: 100%; border-radius: var(--radius-pill); background: var(--green); transform: scaleX(0); transform-origin: left; transition: transform 0.3s, background 0.3s; }
.token-limit-fill.warn { background: var(--caution-400); }
.token-limit-fill.over { background: var(--red); }
.token-limit-label {
  font-size: var(--text-xs); font-weight: 500; color: var(--text-tertiary);
  margin-top: 2px; min-height: 14px; transition: color 0.3s;
}
.token-limit-label.warn { color: var(--caution-700); }
.token-limit-label.over { color: var(--red-dark); }
.prompt-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.copy-options {
  margin-top: 14px; padding: 12px 16px;
  background: var(--surface2); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.copy-options-header { display: flex; align-items: center; margin-bottom: 4px; }
.copy-options-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-tertiary);
}
.copy-options-desc {
  font-size: var(--text-xs); font-weight: 400; color: var(--text-tertiary);
  line-height: 1.5; margin-bottom: 8px;
}
.copy-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; padding: 0 20px;
  background: var(--red-dark); color: #fff; border: none;
  border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  height: 36px; white-space: nowrap; box-shadow: var(--shadow-brand);
}
.copy-btn:hover { background: var(--red-dark); box-shadow: 0 4px 14px rgba(225,58,68,0.38); transform: translateY(-1px); }
.copy-btn:active { opacity: 0.9; transform: none; }
.copy-btn.copied { background: var(--green); box-shadow: none; }
.dl-btn, .pdf-btn, .clear-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; padding: 0 14px;
  background: var(--white); color: var(--app-ink);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  cursor: pointer; transition: all var(--transition);
  height: 36px; white-space: nowrap; box-shadow: var(--shadow-xs);
}
.dl-btn:hover, .pdf-btn:hover { border-color: var(--chrome-dark); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.clear-btn:hover { border-color: var(--red-dark); color: var(--red-dark); }
.prompt-box {
  background: var(--glass-bg-strong); color: var(--text-primary);
  font-family: 'Poppins', sans-serif; font-weight: 300;
  font-size: var(--text-sm); line-height: 1.75;
  padding: 20px 22px; border-radius: var(--radius-lg);
  white-space: pre-wrap; word-break: break-word; min-height: 90px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}
.prompt-box.empty {
  color: var(--text-tertiary); font-style: italic;
  font-size: var(--text-sm); font-weight: 300;
}
.prompt-box.hidden { display: none; }
.preview-box {
  display: none; background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px 20px; min-height: 90px;
}
.preview-box.visible { display: block; }
.preview-box.empty {
  color: var(--text-tertiary); font-style: normal;
  font-size: var(--text-sm); font-weight: 300;
}
.preview-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-lt); }
.preview-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.preview-section-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--red-dark); margin-bottom: 4px;
}
.preview-section-text {
  font-size: var(--text-sm); font-weight: 300;
  color: var(--text-primary); line-height: 1.7; white-space: pre-wrap;
}
.prompt-view-note {
  font-size: var(--text-xs); font-weight: 400; color: var(--text-tertiary);
  line-height: 1.5; margin-top: 8px;
}
.autosave-bar {
  position: fixed; bottom: 20px; right: 24px; z-index: 200;
  background: var(--red-dark); color: #fff;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 8px 16px; border-radius: var(--radius-sm);
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s; pointer-events: none;
  box-shadow: var(--shadow-md);
}
.autosave-bar.show { opacity: 1; transform: translateY(0); }
.history-section {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}
.history-section--flush { margin-top: 0; padding-top: 0; border-top: none; }
.history-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.history-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; color: var(--text-tertiary);
}
.history-clear {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-tertiary);
  background: none; border: none; cursor: pointer; padding: 0;
  transition: color var(--transition);
}
.history-clear:hover { color: var(--red-dark); }
.history-list { display: flex; flex-direction: column; gap: var(--space-2); }
.history-item {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  box-shadow: var(--shadow-xs);
}
.history-item:hover { border-color: var(--red-dark); box-shadow: var(--shadow-sm), 0 0 0 3px var(--red-glow); }
.history-item { width: 100%; text-align: left; font: inherit; color: inherit; }
.history-item-text {
  font-size: var(--text-xs); font-weight: 300; color: var(--app-ink);
  line-height: 1.5; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.history-item-meta { font-size: var(--text-xs); color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.history-empty {
  font-size: var(--text-xs); font-weight: 400; color: var(--text-tertiary); font-style: italic;
}
@media (min-width: 641px) and (max-width: 1099px) {
  .right-col { padding: 24px 32px 60px; }
}
@media (max-width: 640px) {
  .lang-bar { padding: 5px 16px; }
  .atp-page-hero__desc { font-size: var(--text-sm); }
  .right-col { padding: 20px 16px 48px; }
  .panel-title { font-size: var(--text-xl); }
  .field-table, .field-table tbody, .field-table tr, .field-table td { display: block; width: 100%; }
  .col-attr { padding: 14px 0 4px; }
  .col-input { padding: 4px 0 14px; border-left: none; border-top: 2px solid var(--border-lt); }
  .col-input.filled { border-top-color: var(--green); }
  .col-input.filled::after { top: 6px; right: 4px; }
  .templates-grid { grid-template-columns: minmax(0, 1fr); }
  .controls-row, .img-mode-row { gap: var(--space-5); }
  select { font-size: 16px; height: 40px; }
  .mode-btn { padding: 0 12px; font-size: var(--text-xs); }
  .mode-btns { height: 40px; }
  .prompt-actions { gap: 6px; }
  .copy-btn { height: 40px; }
  .dl-btn, .pdf-btn, .clear-btn { height: 40px; }
  .history-item { flex-direction: column; gap: 4px; }
  body { overflow-x: hidden; }
}
.stepper {
  display: flex; align-items: flex-start; gap: 0;
  margin-bottom: var(--space-6); position: relative;
}
.stepper::before {
  content: ''; position: absolute;
  top: 14px; left: 14px; right: 14px; height: 1px;
  background: var(--border); z-index: 0;
}
.step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; position: relative; z-index: 1; cursor: pointer;
}
.step-dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-2xs); font-weight: 600; color: var(--text-tertiary);
  transition: all 0.2s; margin-bottom: 6px; flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.step.active .step-dot {
  border-color: var(--red-dark); background: var(--red-dark); color: #fff;
  box-shadow: var(--shadow-brand);
}
.step.done .step-dot {
  border-color: var(--green); background: var(--green); color: #fff;
}
.step-dot::after { content: attr(data-n); }
.step.done .step-dot::after { content: '✓'; }
.step-label {
  font-size: var(--text-2xs); font-weight: 600; letter-spacing: var(--tracking-wider);
  text-transform: uppercase; color: var(--text-tertiary);
  text-align: center; line-height: 1.3;
  transition: color 0.2s;
}
.step.active .step-label { color: var(--red-dark); }
.step.done .step-label { color: var(--green); }
.field-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 18px;
  margin-bottom: var(--space-3); transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-xs);
}
.field-card--tight { margin-bottom: 6px; }
.field-card textarea.textarea--tall { min-height: 80px; }
.field-card textarea.textarea--taller { min-height: 100px; }
.field-card:focus-within {
  border-color: var(--red-dark); box-shadow: var(--shadow-sm), 0 0 0 3px var(--red-glow);
}
.field-card.is-filled { border-color: var(--green); box-shadow: var(--shadow-xs); }
.field-card.is-required-empty { border-color: var(--red-100); }
.field-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.field-card-label {
  font-size: var(--text-sm); font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 6px;
}
.field-card-actions {
  display: flex; align-items: center; gap: var(--space-2);
}
.field-char-count {
  font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 400;
}
.field-card textarea {
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
  background: var(--white) !important;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm) !important;
  min-height: 56px !important;
  width: 100% !important;
  display: block !important;
  transition: border-color var(--transition), box-shadow var(--transition) !important;
}
.field-card textarea:focus {
  outline: none !important;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px var(--red-glow) !important;
}
@media (hover: hover) and (pointer: fine) {
  .field-card textarea { font-size: var(--text-sm); }
}
.field-card .field-reset { position: static; opacity: 1; }
.field-card .field-reset.hidden { display: none; }
.field-hint {
  font-size: var(--text-xs); font-weight: 400;
  color: var(--text-tertiary); line-height: 1.5;
  margin-top: 6px;
}
.field-hint-expanded {
  display: none;
  font-size: var(--text-xs); font-weight: 400;
  color: var(--app-ink); line-height: 1.55;
  margin-top: 4px; padding: 8px 10px;
  background: var(--surface2); border-radius: var(--radius-sm);
  border-left: 2px solid var(--border);
}
.field-hint-expanded.visible { display: block; }
.tip-btn {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--border); background: none;
  color: var(--text-tertiary); font-size: 10px; font-weight: 600;
  cursor: pointer; line-height: 1; padding: 0; flex-shrink: 0;
  transition: all var(--transition);
  font-family: 'Poppins', sans-serif;
}
.tip-btn::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 36px; height: 36px; transform: translate(-50%, -50%);
}
.tip-btn:hover { border-color: var(--red-dark); color: var(--red-dark); }
.tip-btn.active { border-color: var(--red-dark); color: var(--red-dark); background: var(--red-pale); }
.tooltip-wrap { display: inline-flex; }
.tooltip-popup { display: none; }
.field-card.field-primary { background: var(--red-pale); border-color: var(--red-glow); }
.field-card.field-primary .field-card-label { color: var(--text-primary); }
.progress-segments {
  display: flex; gap: var(--space-1); margin-bottom: var(--space-6);
}
.progress-seg {
  flex: 1; height: 3px; border-radius: var(--radius-pill);
  background: var(--border); transition: background 0.3s;
}
.progress-seg.filled { background: var(--green); }
.progress-seg.required-empty { background: var(--red-200); }
.mode-badge {
  display: inline-block; font-size: var(--text-2xs); font-weight: 600;
  background: rgba(255,255,255,0.3); color: inherit;
  padding: 1px 5px; border-radius: var(--radius-pill); margin-left: 4px;
  vertical-align: middle;
}
.mode-btn.active .mode-badge { background: rgba(255,255,255,0.25); }
.model-info {
  font-size: var(--text-xs); color: var(--text-tertiary);
  margin-top: 3px; height: 14px; transition: all 0.2s;
}
.prompt-edit-wrap { position: relative; }
.prompt-box-editable {
  width: 100%; font-family: 'Poppins', sans-serif; font-weight: 300;
  font-size: var(--text-sm); color: var(--text-primary);
  background: var(--white); border: 1px solid var(--red);
  border-radius: var(--radius-md); padding: 18px 20px;
  min-height: 90px; line-height: 1.75; resize: vertical;
  box-shadow: 0 0 0 3px var(--red-glow);
  display: none;
}
.prompt-box-editable.visible { display: block; }
.edit-mode-bar {
  display: none; align-items: center; gap: 8px;
  margin-bottom: 8px; padding: 6px 10px;
  background: var(--red-pale); border-radius: var(--radius-sm);
  border: 1px solid rgba(225,58,68,0.2);
}
.edit-mode-bar.visible { display: flex; }
.edit-mode-label {
  font-size: var(--text-xs); font-weight: 600; color: var(--red-dark);
  letter-spacing: 1px; text-transform: uppercase; flex: 1;
}
.edit-done-btn {
  font-family: 'Poppins', sans-serif; font-size: var(--text-xs);
  font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 0 12px; height: 26px; background: var(--red-dark); color: #fff;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
}
.edit-reset-btn {
  font-family: 'Poppins', sans-serif; font-size: var(--text-xs);
  font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 0 12px; height: 26px; background: transparent;
  color: var(--app-ink); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.edit-toggle-btn {
  font-family: 'Poppins', sans-serif; font-size: var(--text-xs);
  font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 0 14px; background: var(--white); color: var(--app-ink);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition); height: 36px;
}
.edit-toggle-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.edit-toggle-btn.active { border-color: var(--red-dark); color: var(--red-dark); background: var(--red-pale); }
.autosave-status {
  font-size: var(--text-sm); font-weight: 500; color: var(--text-tertiary);
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
  transition: opacity 0.3s;
}
.autosave-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px; text-align: center;
}
.empty-state-icon {
  font-size: var(--text-2xl); margin-bottom: 8px; opacity: 0.4;
}
.empty-state-title {
  font-size: var(--text-sm); font-weight: 600;
  color: var(--app-ink); margin-bottom: 4px;
}
.empty-state-desc {
  font-size: var(--text-xs); font-weight: 400;
  color: var(--text-tertiary); line-height: 1.5;
}
@keyframes promptReveal {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.prompt-box.revealed, .preview-box.revealed { animation: promptReveal 0.25s ease; }
.right-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  margin-bottom: 20px; gap: 0;
}
.right-tab {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 10px 8px; border: none; background: none;
  color: var(--text-tertiary); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all var(--transition);
}
.right-tab:hover { color: var(--app-ink); }
.right-tab.active { color: var(--red-dark); border-bottom-color: var(--red-dark); font-weight: 600; }
.right-panel { display: none; }
.right-panel.active { display: block; }
:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}
button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}
.onboard-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 400;
  background: rgba(125,26,33,0.35); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.onboard-overlay.hidden { display: none; }
@keyframes modalIn {
  from { opacity:0; transform: scale(0.97) translateY(6px); }
  to   { opacity:1; transform: none; }
}
.onboard-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 32px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
.onboard-badge {
  display: inline-block; font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; color: var(--red-dark);
  margin-bottom: 12px;
}
.onboard-title {
  font-size: var(--text-xl); font-weight: 600; color: var(--text-primary);
  margin: 0 0 8px; line-height: 1.2;
}
.onboard-desc {
  font-size: var(--text-sm); font-weight: 300; color: var(--app-ink);
  line-height: 1.65; margin-bottom: 20px;
}
.onboard-steps {
  display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-6);
}
.onboard-step {
  display: flex; align-items: flex-start; gap: 12px;
}
.onboard-step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--red-dark); color: #fff;
  font-size: var(--text-2xs); font-weight: 600; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.onboard-step-text {
  font-size: var(--text-sm); font-weight: 300; color: var(--app-ink);
  padding-top: 2px;
}
.onboard-btn {
  width: 100%; font-family: 'Poppins', sans-serif;
  font-size: var(--text-sm); font-weight: 600; padding: 12px;
  background: var(--red-dark); color: #fff; border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition);
}
.onboard-btn:hover { background: var(--red-dark); }
.attr-hint { display: none; }
.history-section { display: none; }
.intro-block {
  background: var(--red-pale); border: 1px solid var(--red-glow); border-radius: var(--radius-md);
  padding: 20px 22px; margin-bottom: var(--space-6);
}
.intro-title {
  font-size: var(--text-base); font-weight: 600;
  color: var(--text-primary); margin-bottom: 8px;
}
.intro-body {
  font-size: var(--text-sm); font-weight: 400;
  color: var(--app-ink); line-height: 1.65; margin-bottom: 16px;
}
.intro-steps { display: flex; flex-direction: column; gap: var(--space-3); }
.intro-step { display: flex; align-items: flex-start; gap: 12px; }
.intro-step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--red-dark); color: #fff;
  font-size: var(--text-2xs); font-weight: 600; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.intro-step-content { flex: 1; }
.intro-step-title {
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-primary); margin-bottom: 1px;
}
.intro-step-desc {
  font-size: var(--text-xs); font-weight: 400;
  color: var(--app-ink); line-height: 1.5;
}
.section-desc {
  font-size: var(--text-sm); font-weight: 400;
  color: var(--app-ink); line-height: 1.6;
  margin-top: 2px; margin-bottom: 12px;
}
.model-explain-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 10px; height: 22px; margin-top: 4px;
  background: none; border: 1px solid var(--border);
  color: var(--text-tertiary); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition); display: block;
}
.model-explain-btn:hover { border-color: var(--red-dark); color: var(--red-dark); }
.model-explain-btn.active { border-color: var(--red-dark); color: var(--red-dark); background: var(--red-pale); }
.model-explain-panel {
  display: none; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 18px; margin-bottom: 16px;
}
.model-explain-panel.visible { display: block; }
.model-explain-title {
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-primary); margin-bottom: 5px;
}
.model-explain-body {
  font-size: var(--text-sm); font-weight: 400;
  color: var(--app-ink); line-height: 1.65;
}
.field-hint {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--app-ink);
  line-height: 1.6;
  margin-top: 6px;
}
.field-hint-expanded {
  font-size: var(--text-sm);
}
.controls-explain {
  display: flex; flex-direction: column; gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.controls-explain-block {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
}
.controls-explain-title {
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-primary); margin-bottom: 4px;
}
.controls-explain-body {
  font-size: var(--text-sm); font-weight: 400;
  color: var(--app-ink); line-height: 1.6;
}
.controls-explain-body strong {
  font-weight: 600; color: var(--text-primary);
}
.control-explain {
  font-size: var(--text-xs); font-weight: 400;
  color: var(--text-tertiary); line-height: 1.55;
  margin-top: 6px;
}
.clear-row {
  display: flex; justify-content: flex-end;
  margin-bottom: 20px;
}
.section-tabs {
  display: flex; gap: 0; margin-bottom: 28px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  overflow: hidden; background: var(--surface2); width: fit-content;
  box-shadow: var(--shadow-xs);
}
.section-tab {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 22px; height: 38px; border: none;
  background: transparent; color: var(--text-tertiary);
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.section-tab + .section-tab { border-left: 1px solid var(--border); }
.section-tab.active {
  background: var(--red-dark); color: #fff;
  box-shadow: var(--shadow-brand);
}
@media (max-width: 640px) {
  .section-tabs { width: 100%; }
  .section-tab { flex: 1; min-width: 0; padding: 0 6px; font-size: var(--text-2xs); letter-spacing: 0.3px; white-space: normal; line-height: 1.2; }
}
.img-section { display: none; }
.img-section.active { display: block; }
.txt-section { display: block; }
.txt-section.hidden { display: none; }
.img-subtype-tabs {
  display: flex; gap: 8px; margin-bottom: 24px;
}
.img-subtype-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 20px; height: 36px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--white);
  color: var(--text-tertiary); cursor: pointer;
  transition: all var(--transition);
}
.img-subtype-btn.active {
  border-color: var(--red-dark); color: var(--red-dark);
  background: var(--red-pale);
}
.img-subpanel { display: none; }
.img-subpanel.active { display: block; }
.example-btns-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px;
}
.example-btn {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 14px; height: 28px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--white);
  color: var(--app-ink); cursor: pointer;
  transition: all var(--transition);
}
.example-btn.active {
  border-color: var(--text-primary); color: var(--text-primary);
  background: var(--surface2);
}
.example-panel {
  display: none; margin-top: 6px; margin-bottom: 8px;
  padding: 10px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 400;
  color: var(--app-ink); line-height: 1.65;
  font-style: italic;
}
.example-panel.visible { display: block; }
.img-mode-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  align-items: start;
}
.img-prompt-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-primary); margin-bottom: 8px;
}
.img-prompt-box {
  background: var(--surface2); color: var(--text-primary);
  font-family: 'Poppins', sans-serif; font-weight: 300;
  font-size: var(--text-sm); line-height: 1.75;
  padding: 18px 20px; border-radius: var(--radius-md);
  white-space: pre-wrap; word-break: break-word; min-height: 90px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.img-prompt-box.empty {
  color: var(--text-tertiary); font-style: italic; font-size: var(--text-sm);
}
.img-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.img-copy-btn {
  font-family: 'Poppins', sans-serif; font-size: var(--text-xs);
  font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 0 18px; height: 36px; background: var(--red-dark); color: #fff;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition); white-space: nowrap;
}
.img-copy-btn:hover { background: var(--red-dark); }
.img-copy-btn.copied { background: var(--green); }
.img-copy-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.img-dl-btn {
  font-family: 'Poppins', sans-serif; font-size: var(--text-xs);
  font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 0 14px; height: 36px; background: var(--white);
  color: var(--app-ink); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
}
.img-dl-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.img-dl-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.img-right { display: none; }
.img-right.active { display: block; }
.txt-right { display: block; }
.txt-right.hidden { display: none; }
@keyframes imgReveal { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
.img-prompt-box.img-revealed { animation: imgReveal 0.22s ease; }
.img-section { display: none; }
.img-section.active { display: block; }
.txt-section { display: block; }
.txt-section.hidden { display: none; }
.img-right { display: none; }
.img-right.active { display: block; }
.txt-right { display: block; }
.txt-right.hidden { display: none; }
body { background-color: var(--bg); background-image: var(--ambient-warm); background-repeat: no-repeat; }
.main-wrap { background: transparent; }
.right-col-wrap { background-color: var(--surface2); background-image: var(--ambient-warm); background-repeat: no-repeat; }
.atp-page-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 12% -10%, rgba(255,255,255,0.20), transparent 58%);
}
.field-card {
  background-color: var(--glass-card);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(255,255,255,0.70);
  box-shadow: var(--glass-rim);
}
.field-card:focus-within {
  background-color: var(--glass-card-hi);
  border-color: var(--red-dark);
  box-shadow: var(--glass-rim-raised), 0 0 0 3px var(--red-glow);
}
.field-card.is-filled { border-color: rgba(47,125,84,0.55); box-shadow: var(--glass-rim); }
.field-card.is-required-empty { border-color: var(--red-100); }
.field-card.field-primary {
  background-color: var(--glass-tint-red);
  border-color: rgba(225,58,68,0.26);
}
.field-card textarea {
  background: rgba(255,255,255,0.80) !important;
  border: 1px solid var(--neutral-500) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), inset 0 0 0 1px rgba(44,42,37,0.06) !important;
}
.field-card textarea:focus {
  background: rgba(255,255,255,0.96) !important;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px var(--red-glow) !important;
}
textarea {
  background: rgba(255,255,255,0.80);
  border-color: rgba(255,255,255,0.86);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), inset 0 0 0 1px rgba(44,42,37,0.06);
}
textarea:focus { background: rgba(255,255,255,0.96); }
.field-card textarea.required-empty, textarea.required-empty { border-color: var(--red-400) !important; }
.field-card textarea.invalid, textarea.invalid { border-color: var(--red) !important; }
.field-card textarea.required-empty:focus, .field-card textarea.invalid:focus,
textarea.required-empty:focus, textarea.invalid:focus {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px var(--red-glow) !important;
}
.field-card textarea.required-empty:focus-visible, textarea.required-empty:focus-visible { outline: 2px solid var(--red) !important; outline-offset: 2px !important; }
.col-input { border-left-width: 1px; border-left-color: rgba(44,42,37,0.10); }
.col-input.filled { border-left-color: rgba(47,125,84,0.35); }
@media (max-width: 640px) {
  .col-input { border-top-width: 1px; border-top-color: rgba(44,42,37,0.10); }
  .col-input.filled { border-top-color: rgba(47,125,84,0.35); }
}
.field-hint-expanded {
  background-color: var(--glass-sunken);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(255,255,255,0.70);
  border-left: 1px solid rgba(255,255,255,0.70);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
  padding: 10px 12px;
}
.intro-block, .bayes-block {
  background-color: var(--glass-tint-red);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(225,58,68,0.22);
  box-shadow: var(--glass-rim);
}
.model-explain-panel, .controls-explain-block, .example-panel, .copy-options, .edit-mode-bar {
  background-color: var(--glass-card);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(255,255,255,0.70);
  box-shadow: var(--glass-rim);
}
.edit-mode-bar { background-color: var(--glass-tint-red); border-color: rgba(225,58,68,0.24); }
.tpl-btn, .dl-btn, .pdf-btn, .clear-btn,
.example-btn, .img-subtype-btn, .edit-toggle-btn,
.edit-reset-btn, .model-explain-btn, .lang-btn, .img-dl-btn {
  background-color: var(--glass-card-hi);
  background-image: var(--glass-sheen);
  border-color: rgba(255,255,255,0.78);
  box-shadow: var(--glass-rim);
}
select {
  background-color: var(--glass-card-hi);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666158'/%3E%3C/svg%3E"),
    var(--glass-sheen);
  background-repeat: no-repeat, no-repeat;
  background-position: right 10px center, 0 0;
  background-size: auto, auto;
  border-color: var(--neutral-500);
  box-shadow: var(--glass-rim);
}
select:hover { background-color: rgba(255,255,255,0.94); box-shadow: var(--glass-rim-raised); }
select:focus { background-color: rgba(255,255,255,0.96); border-color: var(--red-dark); box-shadow: 0 0 0 3px var(--red-glow); }
@media (hover: hover) {
  .tpl-btn:hover { border-color: var(--red-dark); box-shadow: var(--glass-rim-raised), 0 0 0 3px var(--red-glow); }
}
.dl-btn:hover, .pdf-btn:hover, .example-btn:hover,
.img-subtype-btn:hover, .edit-toggle-btn:hover,
.model-explain-btn:hover, .lang-btn:hover, .img-dl-btn:hover {
  background-color: rgba(255,255,255,0.94); box-shadow: var(--glass-rim-raised);
}
.example-btn.active { background-color: rgba(255,255,255,0.96); }
.img-subtype-btn.active, .edit-toggle-btn.active, .model-explain-btn.active {
  background-color: var(--glass-tint-red); border-color: var(--red-dark);
}
.mode-btns, .section-tabs {
  background-color: var(--glass-sunken);
  background-image: var(--glass-sheen);
  border-color: rgba(255,255,255,0.70);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.62), inset 0 -1px 0 rgba(44,42,37,0.05);
}
.mode-btn + .mode-btn, .section-tab + .section-tab { border-left-color: rgba(44,42,37,0.10); }
.mode-btn.active, .section-tab.active, .copy-btn,
.img-copy-btn, .onboard-btn, .edit-done-btn,
.step.active .step-dot, .intro-step-num, .onboard-step-num {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.26), 0 8px 20px -10px rgba(168,35,44,0.55);
}
.copy-btn:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,0.30), 0 12px 26px -10px rgba(225,58,68,0.55); }
.copy-btn.copied, .img-copy-btn.copied { box-shadow: inset 0 1px 0 rgba(255,255,255,0.26), 0 8px 20px -10px rgba(47,125,84,0.45); }
.lang-btn.active { box-shadow: inset 0 1px 0 rgba(255,255,255,0.26), 0 6px 16px -8px rgba(168,35,44,0.5); }
.step-dot {
  background-color: var(--glass-card-hi);
  background-image: var(--glass-sheen);
  border-color: rgba(255,255,255,0.80);
  box-shadow: var(--glass-rim);
}
.step.done .step-dot { border-color: rgba(47,125,84,0.55); }
.stepper::before { background: rgba(44,42,37,0.12); }
.progress-bar-wrap, .token-limit-bar, .progress-seg, .toggle-switch {
  background: rgba(44,42,37,0.12);
  box-shadow: inset 0 1px 2px rgba(44,42,37,0.10);
}
.progress-seg.filled { background: var(--green); }
.progress-seg.required-empty { background: var(--red-200); }
input:checked + .toggle-switch { background: var(--red); box-shadow: inset 0 1px 2px rgba(85,17,21,0.28); }
.toggle-switch { background: var(--neutral-600); }
.toggle-switch::after { box-shadow: 0 1px 3px rgba(44,42,37,0.22), inset 0 1px 0 rgba(255,255,255,0.9); }
.section-heading-line { background: rgba(44,42,37,0.10); }
.prompt-box {
  background-color: var(--glass-bg-strong);
  background-image: var(--glass-sheen);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-rim-raised);
}
.preview-box, .img-prompt-box {
  background-color: var(--glass-card-hi);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: var(--glass-rim);
  border-radius: var(--radius-lg);
}
.prompt-box-editable {
  background-color: rgba(255,255,255,0.94);
  box-shadow: 0 0 0 3px var(--red-glow), inset 0 1px 0 rgba(255,255,255,0.85);
}
.history-item {
  background-color: var(--glass-card);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(255,255,255,0.70);
  box-shadow: var(--glass-rim);
}
.history-item:hover { border-color: var(--red-dark); box-shadow: var(--glass-rim-raised), 0 0 0 3px var(--red-glow); }
.right-tabs { border-bottom-color: rgba(44,42,37,0.12); }
.onboard-overlay {
  background: rgba(125,26,33,0.30);
  -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%);
}
.onboard-card {
  background-color: rgba(255,255,255,0.90);
  background-image: var(--glass-sheen);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-rim-raised);
}
.prompt-box.empty, .img-prompt-box.empty,
.history-empty, .example-panel {
  font-style: normal; letter-spacing: 0.01em;
}
@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  header, .prompt-box, .onboard-card { background-color: rgba(255,255,255,0.98); }
  .onboard-overlay { background: rgba(125,26,33,0.55); }
}
@media print {
  *, *::before, *::after {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    box-shadow: none !important; animation: none !important;
  }
  header, .autosave-bar, .onboard-overlay, .right-tabs, .lang-bar { display: none !important; }
  body, .main-wrap, .right-col-wrap { background-image: none !important; background-color: #fff !important; }
  .field-card, .prompt-box, .preview-box, .img-prompt-box, .history-item, textarea {
    background: #fff !important; background-image: none !important;
    border: 1px solid var(--border) !important;
  }
}
:root {
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;
  --container-sm: 640px;
  --container-md: 880px;
  --container-lg: 1120px;
  --container-xl: 1280px;
  --rail-app: 820px;
  --gutter: var(--space-6);
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --text-2xs: 0.6875rem;
  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-base:1rem;
  --text-lg:  1.125rem;
  --text-xl:  1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;
  --text-5xl: 4rem;
  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;
  --tracking-tight: -0.02em;
  --tracking-wide: 0.08em;
  --tracking-wider: 0.16em;
  --font-sans: "Poppins", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-heading: var(--font-sans);
  --font-body: var(--font-sans);
  --font-body-lg: var(--weight-light) var(--text-lg)/var(--leading-relaxed) var(--font-body);
  --font-body-base: var(--weight-light) var(--text-base)/var(--leading-normal) var(--font-body);
  --font-ui: var(--weight-regular) var(--text-sm)/var(--leading-normal) var(--font-body);
  --font-eyebrow: var(--weight-semibold) var(--text-xs)/var(--leading-normal) var(--font-heading);
  --radius-2xl: 28px;
  --radius-3xl: 40px;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;
}
@media (max-width: 768px) { :root { --gutter: var(--space-5); } }
@media (max-width: 560px) { :root { --gutter: var(--space-4); } }
.field-card .col-input {
  width: 100%;
  padding: var(--space-3) 0 0;
  border-left: 0;
  border-top: 0;
}
.field-card .col-input.filled::after { content: none; }
.field-card.is-filled .field-card-actions::before {
  content: '✓';
  color: var(--green);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  line-height: 1;
  margin-right: 2px;
}
@media (max-width: 640px) {
  .field-card .col-input { padding: 0; border-top: 0; }
}
.atp-page-hero { padding-block: var(--space-7); padding-inline: 0; }
.atp-page-hero__inner {
  position: relative; z-index: 1;
  max-width: var(--rail-app);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.right-col { padding: var(--space-5) var(--gutter) var(--space-8); }
@media (max-width: 640px) {
  .atp-page-hero { padding-block: var(--space-6); }
  .right-col { padding: var(--space-5) var(--gutter) var(--space-7); }
}
html, body { overflow-x: clip; }
.page-layout {
  grid-template-columns: minmax(0, 1fr) clamp(380px, 30vw, 560px);
  overflow-x: clip;
}
.left-col-wrap, .right-col-wrap { min-width: 0; }
.section-tabs-wrap {
  max-width: var(--rail-app);
  margin-inline: auto;
  padding: var(--space-5) var(--gutter) 0;
}
.main-wrap {
  max-width: var(--rail-app);
  margin-inline: auto;
  padding: var(--space-6) var(--gutter) var(--space-8);
}
.templates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 640px) { .templates-grid { grid-template-columns: minmax(0, 1fr); } }
.progress-segments, .stepper, .controls-row, .img-mode-row,
.prompt-actions, .example-btns-row, .img-subtype-tabs { min-width: 0; }
.control-group { min-width: 0; }
.control-explain { max-width: min(100%, 62ch); }
select { max-width: 100%; }
.controls-row .control-group > select { width: 100%; }
.field-hint, .field-hint-expanded, .section-desc, .control-explain,
.example-panel, .model-explain-body, .controls-explain-body, .intro-body,
.panel-desc, .attr-hint, .copy-options-desc { overflow-wrap: break-word; }
@media (max-width: 980px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); }
  .main-wrap, .atp-page-hero__inner, .section-tabs-wrap { max-width: none; }
}
.right-tabs { flex-wrap: nowrap; gap: 2px; }
.right-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 5px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
@media (max-width: 400px) {
  .right-tab { font-size: var(--text-2xs); letter-spacing: 0; padding: 10px 4px; }
}
.field-card-header { flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); }
.field-card-label { flex-wrap: wrap; min-width: 0; row-gap: 4px; overflow-wrap: break-word; }
.field-card-actions { flex-shrink: 0; }
.img-subtype-tabs { flex-wrap: wrap; }
@media (max-width: 400px) {
  .section-heading { flex-wrap: wrap; }
  .section-heading-label { white-space: normal; }
}
.col-input.filled::after, .prompt-label, .copy-options-label,
.preview-section-label, .history-label,
.step-dot, .tip-btn, .mode-badge, .right-tab.active,
.onboard-badge, .onboard-step-num, .intro-step-num, .img-prompt-label {
  font-weight: var(--weight-semibold);
}
.atp-page-hero__title { font-weight: var(--weight-light); letter-spacing: -0.035em; }
.panel-title { font-weight: var(--weight-light); letter-spacing: -0.028em; }
@media (max-width: 700px) {
  .panel-title { font-weight: var(--weight-regular); }
}
@media (max-width: 560px) {
  .atp-page-hero__title { font-size: clamp(2.1rem, 10vw, 2.7rem); }
}
.intro-title, .intro-step-title, .onboard-title,
.empty-state-title, .model-explain-title, .controls-explain-title,
.tpl-btn-title {
  font-weight: var(--weight-medium);
}
.field-card-label { font-weight: var(--weight-semibold); }
.dl-btn, .pdf-btn, .clear-btn, .example-btn,
.edit-toggle-btn, .edit-reset-btn, .model-explain-btn,
.lang-btn, .img-dl-btn, .img-subtype-btn, .history-clear {
  font-weight: var(--weight-medium);
}
.copy-btn, .img-copy-btn,
.onboard-btn, .edit-done-btn {
  font-weight: var(--weight-semibold);
}
.mode-btn, .section-tab, .right-tab, .step-label { font-weight: var(--weight-medium); }
.mode-btn.active, .section-tab.active, .right-tab.active,
.step.active .step-label, .step.done .step-label,
.example-btn.active, .img-subtype-btn.active { font-weight: var(--weight-semibold); }
.prompt-box, .prompt-box-editable, .preview-section-text, .panel-desc,
.history-item-text,
.onboard-desc, .onboard-step-text { font-weight: var(--weight-regular); }
.token-counter span, .word-counter span, .field-char-count,
.progress-count, .token-limit-label {
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
}
.copy-btn, .dl-btn, .pdf-btn, .clear-btn,
.example-btn, .img-subtype-btn, .edit-toggle-btn,
.edit-reset-btn, .edit-done-btn, .model-explain-btn, .lang-btn,
.img-copy-btn, .img-dl-btn,
.onboard-btn {
  border-radius: var(--radius-pill);
}
.tpl-btn, .field-card, .history-item,
.field-hint-expanded, .example-panel, .copy-options,
.controls-explain-block, .model-explain-panel, .edit-mode-bar {
  border-radius: var(--radius-lg);
}
.intro-block, .bayes-block, .prompt-box, .prompt-box-editable,
.preview-box, .img-prompt-box, .onboard-card {
  border-radius: var(--radius-2xl);
}
.field-card textarea, textarea {
  border-radius: var(--radius-md) !important;
  padding: 11px 14px !important;
  line-height: var(--leading-relaxed);
}
.prompt-box-editable {
  padding: var(--space-5) !important;
  border-radius: var(--radius-2xl) !important;
}
.tip-btn {
  background-color: var(--glass-card-hi);
  background-image: var(--glass-sheen);
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: var(--glass-rim);
}
.tip-btn:hover, .tip-btn.active {
  background-color: var(--glass-tint-red);
  border-color: var(--red-dark);
  box-shadow: var(--glass-rim-raised);
}
.validation-msg:not(:empty) {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background-color: var(--glass-tint-red);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(225, 58, 68, 0.24);
  box-shadow: var(--glass-rim);
  font-weight: var(--weight-medium);
}
.history-empty, .empty-state {
  display: block;
  padding: var(--space-5);
  text-align: center;
  border-radius: var(--radius-lg);
  background-color: var(--glass-sunken);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62), inset 0 -1px 0 rgba(44, 42, 37, 0.04);
}
.empty-state { display: flex; }
.right-tab { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.right-tab.active {
  background-color: var(--glass-tint-red);
  background-image: var(--glass-sheen);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.70);
}
.mode-badge { background: rgba(44, 42, 37, 0.10); color: var(--app-ink); }
.mode-btn.active .mode-badge { background: rgba(0, 0, 0, 0.18); color: inherit; }
.autosave-status {
  align-self: flex-start;
  padding: 4px 12px 4px 10px;
  border-radius: var(--radius-pill);
  background-color: var(--glass-card-hi);
  background-image: var(--glass-sheen);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--glass-rim);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
@media print {
  header { display: none !important; }
  .atp-page-hero, .right-col { padding-top: var(--space-6) !important; }
  .validation-msg:not(:empty), .history-empty,
  .empty-state, .tip-btn, .autosave-status, .right-tab.active,
  .preview-draft-notice {
    background: #fff !important; background-image: none !important;
    border-color: var(--border) !important;
  }
}
@media (max-width: 480px) {
  .m-appshell-header__crumb > a:first-child,
  .m-appshell-header__crumb > a:first-child + .m-crumb-sep {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  textarea.invalid,
  .autosave-status-dot,
  .prompt-box.revealed,
  .preview-box.revealed,
  .onboard-card,
  .img-prompt-box.img-revealed {
    animation: none !important;
  }
}
