*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  color-scheme: light;
  --bg: #f2f1ed;
  --bg-elev: #f8f7f4;
  --surface: #fdfcf9;
  --surface2: #f7f6f2;
  --border: #d9d5cd;
  --border2: #c3bcb1;
  --text: #121211;
  --text2: #5f5b54;
  --text3: #8a857d;
  --accent: #171717;
  --accent-light: #ebe8e2;
  --accent-dark: #0f0f0f;
  --accent-contrast: #f4f2ed;
  --success: #2f7d4f;
  --success-light: #e8f5ee;
  --danger: #b64848;
  --danger-light: #f9ecec;
  --danger-border: #e3a5a5;
  --radius: 12px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 15, 15, 0.04);
  --overlay: rgba(20, 20, 20, 0.42);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418;
  --bg-elev: #15191e;
  --surface: #181d23;
  --surface2: #1d232b;
  --border: #2c333d;
  --border2: #424b58;
  --text: #f2f0ec;
  --text2: #beb9af;
  --text3: #938e85;
  --accent: #ebe8e2;
  --accent-light: #222832;
  --accent-dark: #ffffff;
  --accent-contrast: #13161b;
  --success: #86d4a3;
  --success-light: rgba(134, 212, 163, 0.18);
  --danger: #ff9f9f;
  --danger-light: rgba(220, 120, 120, 0.16);
  --danger-border: #9e5454;
  --shadow-sm: none;
  --overlay: rgba(7, 8, 10, 0.55);
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Geist', 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1.6rem 1rem 4rem;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.page { max-width: 760px; margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  gap: 0.75rem;
}
.brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
}
.theme-switcher {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  padding: 3px;
  gap: 4px;
}
.theme-btn {
  border: 0;
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.theme-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.25;
  opacity: 0.88;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-btn:hover { color: var(--text); background: var(--accent-light); }
.theme-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.header {
  margin-bottom: 1.7rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
}
.header-eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 0.75rem; }
.badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--text2);
  border: 1px solid var(--border);
}
.header-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.4rem;
}
.header-sub { font-size: 14px; color: var(--text2); }
.progress-wrap { margin-top: 1.25rem; display: flex; align-items: center; gap: 12px; }
.progress-bar-outer { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; width: 0%; }
.progress-label { font-size: 12px; color: var(--text3); white-space: nowrap; min-width: 80px; text-align: right; }

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.45rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.3s ease both;
}
.section:nth-child(3){animation-delay:.03s}
.section:nth-child(4){animation-delay:.06s}
.section:nth-child(5){animation-delay:.09s}
.section:nth-child(6){animation-delay:.12s}
@keyframes fadeUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .section { animation: none; }
  .section:nth-child(3),
  .section:nth-child(4),
  .section:nth-child(5),
  .section:nth-child(6) { animation-delay: 0s; }
  .progress-bar-inner { transition: none; }
}

.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 1.2rem; padding-bottom: 0.85rem; border-bottom: 1px solid var(--border); }
.section-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-light); color: var(--text);
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.section-title { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text2); }

.field { margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.req { color: var(--text2); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text3); margin-top: 5px; line-height: 1.5; }
.err-msg { font-size: 12px; color: var(--danger); margin-top: 5px; display: none; }

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
  -webkit-appearance: none;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
  border-color: var(--border2);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(122, 122, 122, 0.15);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2388847d' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field.has-error input, .field.has-error textarea, .field.has-error select {
  border-color: var(--danger-border) !important;
  background: var(--danger-light) !important;
  box-shadow: 0 0 0 3px rgba(182, 72, 72, 0.12) !important;
}
.field.has-error .pill-group,
.field.has-error .tile-grid { outline: 2px solid var(--danger-border); border-radius: var(--radius-sm); }
.field.has-error label { color: var(--danger); }
.field.has-error .err-msg { display: block; }

.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text2);
  background: var(--surface2);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.pill:hover { border-color: var(--border2); color: var(--text); }
.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 500;
}
.pill-group--readonly .pill {
  cursor: default;
  opacity: 0.95;
}
.pill-group--readonly .pill:hover {
  border-color: var(--border);
  color: var(--text2);
  background: var(--surface2);
}
.pill:focus-visible, .platform-checkbox:focus-visible + .tile {
  outline: 2px solid var(--border2);
  outline-offset: 2px;
}

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.platform-option { display: block; cursor: pointer; margin: 0; }
.platform-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tile {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: all .15s;
  user-select: none;
}
.platform-option:hover .tile { border-color: var(--border2); color: var(--text); }
.platform-checkbox:checked + .tile {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text);
  font-weight: 500;
}
.tile-check {
  width: 18px; height: 18px; border: 1.5px solid var(--border2); border-radius: 4px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: transparent; transition: all .15s;
}
.platform-checkbox:checked + .tile .tile-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.submit-area { display: flex; align-items: center; justify-content: space-between; margin-top: 1.5rem; gap: 1rem; }
.status-msg { font-size: 13px; color: var(--text3); flex: 1; }
.status-msg.status-msg--complete { color: var(--success); }
.r-dim-note { font-size: 12px; color: var(--text3); }
.btn-group { display: flex; gap: 8px; }
.btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-dl {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-dl:hover { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.btn-claude {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.btn-claude:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--accent-contrast); }
.btn-claude:active { transform: scale(0.98); }
.btn[disabled], .btn.is-loading { opacity: 0.7; pointer-events: none; }

.btn-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite; flex-shrink: 0;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: all .25s ease;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }

.result-card {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.result-card.show { display: block; animation: fadeUp 0.3s ease; }
.result-header {
  background: var(--accent);
  padding: 1.5rem;
  color: var(--accent-contrast);
}
.result-eyebrow { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.72; margin-bottom: 5px; }
.result-title { font-size: 1.45rem; font-weight: 600; margin-bottom: 4px; }
.result-meta { font-size: 12px; opacity: 0.8; }
.result-body { padding: 1.5rem; }
.r-section { margin-bottom: 1.25rem; }
.r-section:last-child { margin-bottom: 0; }
.r-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 0.6rem;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.r-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 0.5rem; }
.r-field-label { font-size: 11px; color: var(--text3); margin-bottom: 2px; }
.r-field-value { font-size: 13px; color: var(--text); font-weight: 500; line-height: 1.5; }
.r-text { font-size: 13px; color: var(--text2); line-height: 1.6; white-space: pre-wrap; }
.r-tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin: 2px 2px 2px 0;
  border: 1px solid var(--border);
}
.result-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.result-footer-note { font-size: 12px; color: var(--text3); flex: 1; min-width: 120px; }

.copy-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: .5rem; animation: fadeUp 0.3s ease both; }
.copy-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.copy-card-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.copy-card-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.copy-card-angulo { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.copy-card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.copy-card-row { display: flex; flex-direction: column; gap: 3px; }
.copy-card-lbl { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); }
.copy-card-headline { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
.copy-card-txt { font-size: 13px; color: var(--text2); line-height: 1.55; }
.copy-card-cta { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: var(--radius-pill); margin-top: 2px; width: fit-content; border: 1px solid transparent; }
.copy-placeholder-stack { display: flex; flex-direction: column; gap: 10px; }

/* Meta DCO: five variation blocks from IA */
.copy-variations { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 0.5rem; }
.copy-var-block { padding-bottom: 1.15rem; border-bottom: 1px solid var(--border); }
.copy-var-block:last-child { border-bottom: 0; padding-bottom: 0; }
.copy-var-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.65rem; }
.copy-var-row { margin-bottom: 0.55rem; }
.copy-var-row:last-child { margin-bottom: 0; }
.copy-var-lbl { font-size: 11px; color: var(--text3); margin-bottom: 2px; }
.copy-var-val { font-size: 13px; color: var(--text); line-height: 1.5; white-space: pre-wrap; }
.copy-var-val strong { font-weight: 600; }
.copy-hint { font-size: 13px; color: var(--text3); line-height: 1.55; }
.field-input-conditional { margin-top: 8px; }
.dimensoes-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#pg-dimensoes { flex-shrink: 0; }
#f-dimensoes-outro { flex: 1; min-width: 7rem; }
.field--tight { margin-bottom: 0; }
.textarea--short { min-height: 70px; }
.r-id-line { margin-bottom: 0.5rem; }
.r-id-line--tight { margin-bottom: 0.25rem; }
.r-brief-line { margin-bottom: 0.75rem; }
.r-value-spaced { margin-top: 4px; }
.access-modal-actions .btn-primary { padding: 8px 16px; border: 1px solid var(--border); border-color: var(--border); }
.copy-card-headline, .copy-card-txt { word-break: break-word; }

.copy-loading {
  min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; border: 1px dashed var(--border2); border-radius: var(--radius); background: var(--surface2);
}
.copy-loading-spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(122, 122, 122, 0.25); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.copy-loading-text { font-size: 13px; color: var(--text3); }

.access-modal-overlay {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: 1rem; background: var(--overlay); backdrop-filter: blur(4px); z-index: 1000;
}
.access-modal-overlay.show { display: flex; animation: fadeUp 0.25s ease both; }
.access-modal-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-sm);
}
.access-modal-title { font-size: 1.45rem; font-weight: 600; line-height: 1.2; margin-bottom: 0.5rem; }
.access-modal-sub { font-size: 14px; color: var(--text2); margin-bottom: 1rem; }
.access-modal-error { color: var(--danger); font-size: 13px; margin-top: 0.65rem; min-height: 18px; }
.access-modal-actions { margin-top: 1rem; display: flex; justify-content: flex-end; }
.u-hidden { display: none !important; }

@media (max-width: 680px) {
  .copy-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { padding-top: 1rem; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .field-row, .tile-grid, .r-row { grid-template-columns: 1fr; }
  .submit-area { flex-direction: column; align-items: stretch; }
  .btn-group { flex-direction: column; }
  .result-footer {
    flex-direction: row;
    align-items: stretch;
  }
  .result-footer-note {
    flex: 1 1 100%;
    min-width: 100%;
  }
  .result-footer .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }
  .result-footer #btnNew { flex-basis: 100%; }
  .header { padding: 1.2rem; }
  .header-title { font-size: 1.65rem; }
}
