:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1d2928;
  background: #f7f5f0;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #d57746; outline-offset: 3px; }
textarea { resize: vertical; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.clipboard-buffer { position: fixed; left: -9999px; top: 0; opacity: 0; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 10; padding: .75rem 1rem; background: #18332f; color: #fff; }
.skip-link:focus { top: .75rem; }

.page-shell { max-width: 1440px; margin: auto; padding: 0 clamp(20px, 4.5vw, 72px); }
.site-header { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e3e2dc; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #1d2928; text-decoration: none; font-size: 24px; font-weight: 750; letter-spacing: -.075em; white-space: nowrap; }
.brand img { flex: none; }
.brand-accent { color: #ba683d; }
.brand-period { color: #ba683d; }
.header-actions { display: flex; align-items: center; gap: clamp(14px, 2.3vw, 34px); }
.tab-list { display: flex; gap: 4px; padding: 4px; border: 1px solid #deded7; border-radius: 999px; background: #efeee8; }
.tab { min-width: 102px; padding: 10px 18px; border: 0; border-radius: 999px; background: transparent; color: #65716c; font-size: 13px; font-weight: 700; }
.tab[aria-selected="true"] { background: #fff; color: #20352f; box-shadow: 0 1px 4px #1d292812; }
.ai-button { display: inline-flex; align-items: center; gap: 8px; padding: 11px 17px; border: 1px solid #25483c; border-radius: 8px; background: #25483c; color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; transition: background .2s ease, transform .2s ease; }
.ai-button:hover, .primary-button:hover { background: #17382e; transform: translateY(-1px); }
.sparkle { color: #d7c794; font-size: 17px; line-height: 1; }

.intro { max-width: 690px; padding: clamp(56px, 6.4vw, 90px) 0 42px; }
.eyebrow, .step, .key-card-header, .site-footer { font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #a26340; }
.eyebrow-line { width: 25px; height: 1px; background: currentColor; }
h1, h2, p { margin-top: 0; }
h1 { margin: 20px 0 19px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(43px, 5.4vw, 74px); line-height: 1.04; letter-spacing: -.06em; font-weight: 400; }
h1 em { color: #b76841; font-weight: 400; }
.intro > p { max-width: 570px; margin-bottom: 0; color: #68716d; font-size: 16px; line-height: 1.65; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr); gap: 18px; align-items: stretch; }
.panel { min-width: 0; border: 1px solid #e6e4de; border-radius: 13px; background: #fff; box-shadow: 0 9px 36px #25352b08; }
.composer { padding: clamp(24px, 3.3vw, 42px); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 27px; }
.step { color: #b26846; }
.panel-mark { color: #bba979; font-size: 21px; line-height: 1; }
.panel h2 { margin-bottom: 9px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(26px, 2.6vw, 33px); font-weight: 400; letter-spacing: -.04em; }
.section-intro { color: #52635a; font-size: 13px; line-height: 1.6; }
.composer .section-intro { margin-bottom: 27px; }
.field { margin-bottom: 20px; }
.field label, .label-row label { display: block; margin-bottom: 9px; color: #303d39; font-size: 12px; font-weight: 750; }
.label-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.field-hint, .optional { color: #52635a; font-size: 11px; font-weight: 500; }
.field textarea, .field input, .field select, #result-output, #result-key { display: block; width: 100%; border: 1px solid #e2e5df; border-radius: 7px; background: #fbfcfa; color: #26352f; font-size: 13px; line-height: 1.55; }
.field textarea { min-height: 119px; padding: 15px 16px; }
.field input, .field select { height: 46px; padding: 0 13px; }
.field textarea::placeholder, .field input::placeholder, #result-output::placeholder, #result-key::placeholder { color: #a5aea6; }
.field textarea:focus, .field input:focus, .field select:focus { border-color: #9baf9e; background: #fff; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.carrier-choice { display: none; align-items: center; gap: 18px; margin: 0 0 19px; padding: 0; border: 0; }
.js .carrier-choice { display: flex; }
.carrier-choice legend { float: left; margin-right: 18px; color: #303d39; font-size: 12px; font-weight: 750; }
.carrier-choice label { display: inline-flex; align-items: center; gap: 7px; color: #34473c; font-size: 12px; font-weight: 700; cursor: pointer; }
.carrier-choice input { accent-color: #25483c; }
.regenerate-key { margin: 8px 14px 0 0; padding: 0; border: 0; background: none; color: #315c48; font-size: 11px; font-weight: 750; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
#image-note { margin-top: 0; }
.image-file-field input[type="file"] { height: auto; padding: 11px 12px; }
.image-file-field .field-note { margin: 7px 0 0; }
.select-wrap { position: relative; }
.select-wrap:after { content: "⌄"; position: absolute; right: 14px; top: 8px; pointer-events: none; color: #506157; font-size: 20px; }
.field select { appearance: none; padding-right: 36px; }
.password-wrap { position: relative; }
.transient-secret.is-masked { -webkit-text-security: disc; }
.password-wrap input { padding-right: 56px; }
.icon-button { border: 0; background: transparent; color: #728078; font-size: 11px; font-weight: 700; }
.password-wrap .icon-button { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); padding: 5px; }
.field-note { margin: -10px 0 20px; color: #52635a; font-size: 11px; line-height: 1.5; }
#artwork-field .field-note, #text-source-field .field-note, #upload-field .field-note, #writing-style-field .field-note, #image-style-field .field-note { margin: 7px 0 0; }
#writing-style-field[hidden] + #image-style-field[hidden] + .field { grid-column: 1 / -1; }
.advanced { margin: 2px 0 23px; border-top: 1px solid #eaede7; border-bottom: 1px solid #eaede7; }
.advanced summary { list-style: none; padding: 16px 0; color: #34473c; font-size: 12px; font-weight: 750; cursor: pointer; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary:before { content: "+"; display: inline-block; width: 21px; color: #b26946; font-size: 18px; font-weight: 400; vertical-align: -1px; }
.advanced[open] summary:before { content: "−"; }
.advanced summary span { margin-left: 6px; color: #52635a; font-size: 11px; font-weight: 500; }
.advanced .field { margin-top: 5px; margin-bottom: 14px; }
.advanced .field-note { margin: 7px 0 0; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 47px; padding: 11px 20px; border: 1px solid #25483c; border-radius: 7px; background: #25483c; color: #fff; font-size: 13px; font-weight: 750; transition: background .2s ease, transform .2s ease; }
.composer .primary-button { width: 100%; justify-content: space-between; }
.primary-button span:last-child { font-size: 18px; font-weight: 400; }
.form-status { min-height: 0; margin: 14px 0 0; color: #365d48; font-size: 12px; line-height: 1.5; }
.form-status:empty { display: none; }
.form-status.is-error { color: #a24738; }
.js [data-panel][hidden] { display: none; }

.output { display: flex; flex-direction: column; padding: clamp(24px, 3.3vw, 42px); background: #f9faf7; }
.result-state { display: flex; align-items: center; gap: 8px; color: #8a978c; font-size: 10px; font-weight: 650; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b6c2b6; }
.output.has-result .status-dot { background: #5f9473; }
.output-main { flex: 1; }
.output-main .section-intro { margin-bottom: 21px; }
#result-output { min-height: 278px; padding: 17px; border-color: #e6e9e2; background: #fff; resize: vertical; }
.image-placeholder { display: grid; place-items: center; min-height: 278px; padding: 20px; border: 1px dashed #d2dbd0; border-radius: 7px; background: #f4f6f1; color: #8a978c; font-size: 12px; text-align: center; }
.image-result img { display: block; width: 100%; height: auto; border: 1px solid #e6e9e2; border-radius: 7px; background: #edf0e9; }
.image-download { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; margin-top: 14px; padding: 9px 15px; border-radius: 7px; background: #25483c; color: #fff; font-size: 12px; font-weight: 750; text-decoration: none; }
.image-download:hover { background: #17382e; }
.image-result p { margin: 11px 0 15px; color: #52635a; font-size: 11px; line-height: 1.5; }
.source-credit { margin: 13px 0 17px; color: #52635a; font-size: 11px; line-height: 1.5; }
.source-credit a { color: #25483c; text-decoration: underline; text-underline-offset: 2px; }
.output-actions { min-height: 55px; display: flex; align-items: center; gap: 14px; }
.copy-button { display: inline-flex; align-items: center; gap: 8px; padding: 7px 0; border: 0; background: transparent; color: #315c48; font-size: 12px; font-weight: 750; }
#copy-status { color: #5f8066; font-size: 11px; }
.token-card { margin-top: 14px; padding: 18px 20px; border: 1px solid #dfe8dd; border-radius: 9px; background: #fff; }
.token-card label { display: block; margin-bottom: 7px; color: #315c48; font-size: 12px; font-weight: 750; }
.token-card p { margin: 0 0 10px; color: #52635a; font-size: 11px; line-height: 1.5; }
#result-token { min-height: 75px; resize: vertical; overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.key-card { margin-top: 14px; padding: 20px 22px; border: 1px solid #dfe8dd; border-radius: 9px; background: #eef3ec; }
.key-card-header { display: flex; justify-content: space-between; color: #506e55; }
.key-symbol { font-size: 16px; line-height: .7; }
.key-card-body { display: flex; align-items: center; gap: 11px; margin: 13px 0; }
.key-value { position: relative; flex: 1; min-width: 0; }
#result-key { height: 42px; padding: 0 56px 0 12px; border-color: #d6dfd4; background: #fff; }
.key-value .icon-button { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); padding: 5px; }
.key-copy { min-height: 42px; padding: 0 12px; border: 1px solid #b6c6b7; border-radius: 6px; background: transparent; color: #365740; font-size: 11px; font-weight: 750; white-space: nowrap; }
.key-card p { margin-bottom: 0; color: #465c4c; font-size: 11px; line-height: 1.5; }
.security-note { display: flex; align-items: flex-start; gap: 13px; max-width: 790px; margin: 30px 0 68px; color: #465c4c; }
.security-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: none; margin-top: 1px; border: 1px solid #aaafa6; border-radius: 50%; font-size: 11px; font-weight: 700; }
.security-note p { margin: 0; font-size: 11px; line-height: 1.6; }
.security-note strong { color: #465849; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 0 31px; border-top: 1px solid #e3e2dc; color: #a4aaa1; font-size: 9px; }

dialog { width: min(440px, calc(100vw - 32px)); padding: 27px; border: 1px solid #dfe5dc; border-radius: 13px; background: #fff; box-shadow: 0 30px 100px #10231d33; color: #23372c; }
dialog::backdrop { background: #14241dd1; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; }
.dialog-symbol { color: #b66b44; font-size: 26px; }
.dialog-close { border: 0; background: transparent; color: #59665c; font-size: 25px; line-height: 1; }
dialog h2 { margin: 14px 0 8px; font-family: Georgia, serif; font-size: 31px; font-weight: 400; }
dialog > p { color: #77827a; font-size: 13px; line-height: 1.6; }
dialog .field { margin: 24px 0 12px; }
dialog .field-note { margin: 0; }
#ai-status { min-height: 18px; margin: 13px 0 0; color: #315e45; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 12px; }
.secondary-button { min-height: 45px; padding: 0 13px; border: 1px solid #dce3da; border-radius: 7px; background: #fff; color: #405a49; font-size: 12px; font-weight: 700; }

@media (max-width: 850px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .output { min-height: 490px; }
  .intro { padding-top: 62px; }
}

@media (max-width: 620px) {
  .site-header { min-height: 86px; flex-wrap: wrap; gap: 12px; padding: 17px 0; }
  .brand { font-size: 22px; }
  .brand img { width: 38px; height: 38px; }
  .header-actions { width: 100%; justify-content: space-between; }
  .tab { min-width: 84px; padding: 9px 12px; }
  .ai-button { padding: 10px 12px; }
  .intro { padding: 53px 0 34px; }
  .intro > p { font-size: 14px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .composer, .output { padding: 23px; }
  .security-note { margin-bottom: 50px; }
  .site-footer { flex-direction: column; gap: 8px; }
}

@media (max-width: 380px) {
  .tab { min-width: 72px; }
  .ai-button { gap: 4px; font-size: 11px; }
  .key-card-body { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
