* { box-sizing: border-box; }
:root { font-family: Arial, Helvetica, sans-serif; color: #0f172a; background: #f0f2f5; font-synthesis: none; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button { border: 0; background: transparent; }
button, input, textarea, select { transition: background-color .15s, border-color .15s; }
button:focus-visible, select:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
[hidden] { display: none !important; }
.header { background: white; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.header-inner { max-width: 1280px; min-height: 64px; padding: 10px 16px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #155dfb; color: white;  box-shadow: 0 2px 4px #bedbff; }
h1 { font-size: 18px; margin: 0; letter-spacing: -.4px; color: #1e293b; }
.copy-actions { display: flex; align-items: center; gap: 12px; }
#copy-error { max-width: 270px; margin: 0; font-size: 12px; color: #dc2626; }
.primary { display: flex; gap: 8px; align-items: center; padding: 11px 24px; border-radius: 30px; background: #0f172a; color: white; font-size: 14px; font-weight: 700; white-space: nowrap; box-shadow: 0 6px 15px #e2e8f0; }
.primary:hover { background: #1e293b; }
.copied, .macro-copy.copied { background: #10b981; color: white; }
main { width: 100%; max-width: 1280px; margin: auto; padding: 32px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 32px; flex: 1; min-height: 0; }
.form-column { overflow: auto; padding-right: 8px; min-height: 0; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.card { background: white; border: 1px solid #e2e8f0; border-radius: 16px; padding: 20px; margin-bottom: 24px; box-shadow: 0 1px 2px #00000012; }
h2, label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .1px; color: #64748b; margin: 0 0 16px; }
.icon { width: 17px; height: 17px; flex-shrink: 0; vertical-align: middle; }
.brand-icon .icon { width: 23px; height: 23px; }
h2 .icon, label .icon { color: #64748b; }
.check-icon { display: none; }
.copied .copy-icon { display: none; }
.copied .check-icon { display: block; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px; background: #f1f5f9; border-radius: 12px; }
.segmented button { padding: 10px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; color: #64748b; }
.segmented [aria-pressed="true"] { background: #155dfb; color: white; box-shadow: 0 1px 3px #00000012; }
input, textarea { display: block; width: 100%; padding: 12px 16px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; color: #0f172a; outline: none; }
input:focus, textarea:focus { background: white; border-color: #3b82f6; box-shadow: 0 0 0 2px #3b82f64d; }
input::placeholder, textarea::placeholder { color: #a3afc0; }
#title { font-size: 18px; font-weight: 600; }
textarea { font: 14px/1.6 Consolas, monospace; resize: vertical; min-height: 100px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.card-heading h2 { margin: 0; }
.add { display: inline-flex; align-items: center; gap: 4px; padding: 6px 9px; font-size: 12px; font-weight: 600; border-radius: 6px; color: #2563eb; background: #eff6ff; white-space: nowrap; }
.add .icon { width: 14px; height: 14px; }
.add:hover { background: #dbeafe; }
.empty { margin: 0; padding: 4px 0; font-size: 12px; line-height: 1.5; color: #7b8798; }
.subtitle-row { display: flex; gap: 8px; margin-top: 12px; }
.subtitle-row input { min-width: 0; padding: 9px 12px; border-radius: 8px; font-size: 14px; }
.remove-subtitle { padding: 8px 12px; border-radius: 8px; color: #ef4444; background: #fef2f2; font-size: 20px; }
.remove-subtitle:hover { background: #fee2e2; }
.notice { display: flex; gap: 12px; padding: 16px; margin-bottom: 32px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f1f5f9; color: #64748b; }
.notice > .icon { margin-top: 2px; }
.notice strong { font-size: 12px; } .notice p { font-size: 11px; margin: 6px 0 0; line-height: 1.5; }
.output-column { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 16px; background: white; box-shadow: 0 15px 25px #cbd5e14d; }
.output-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 16px; border-bottom: 1px solid #f1f5f9; background: #fafbfc; }
.output-heading h2 { margin: 0; color: #475569; }
.view-controls { margin-left: auto; display: flex; align-items: center; gap: 8px; }
select { border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px; background: white; font-size: 12px; }
.view-toggle { display: flex; padding: 4px; border-radius: 8px; background: #f1f5f9; }
.view-toggle button { padding: 5px 8px; border-radius: 5px; color: #64748b; font-size: 12px; }
.view-toggle [aria-pressed="true"] { background: white; color: #2563eb; box-shadow: 0 1px 3px #00000012; }
#preview-scroll { flex: 1; min-height: 0; overflow: auto; padding: 32px; background: #f8fafc; }
.preview-paper { background: white; border: 1px solid #d5dce5; border-radius: 8px; padding: 24px; max-width: 750px; margin: auto; overflow-x: auto; }
.preview-wrapper { zoom: .6; }
.preview-wrapper ul:not([style*="list-style: none"]):not([style*="list-style-type: none"]) { list-style-type: disc !important; padding-left: 20px !important; }
.preview-wrapper ul { margin-top: 0; margin-bottom: 1em !important; }
.preview-wrapper li { margin-bottom: .25em !important; }
#html-output { flex: 1; min-height: 0; width: 100%; resize: none; border: 0; border-radius: 0; padding: 20px; background: #0f172a; color: #f1f5f9; font: 12px/1.6 Consolas, monospace; }
footer { flex-shrink: 0; padding: 14px 16px; border-top: 1px solid #e2e8f0; background: white; box-shadow: 0 -3px 10px #00000005; }
.footer-inner { max-width: 1280px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
footer h2 { margin: 0; flex-shrink: 0; }
#macros { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.macro { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fafbfc; }
.macro-copy { padding: 7px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: white; font-size: 12px; font-weight: 700; color: #334155; white-space: nowrap; box-shadow: 0 1px 2px #00000008; }
.macro-copy:hover { background: #f1f5f9; }
.macro.highlighted .macro-copy { background: #f97316; color: white; border-color: #ea580c; }
.macro-highlight { width: 13px; height: 13px; border-radius: 50%; border: 1px solid #94a3b8; background: #cbd5e1; padding: 0; }
.macro-highlight[aria-pressed="true"] { background: #f97316; border-color: #ea580c; }
@media (max-width: 1100px) { .footer-inner { flex-direction: column; } #macros { justify-content: center; } }
@media (max-width: 900px) {
 body { height: auto; min-height: 100dvh; overflow: auto; }
 main { grid-template-columns: minmax(0,1fr); padding: 20px; gap: 24px; flex: none; }
 .form-column { overflow: visible; padding: 0; }
 .card { margin-bottom: 24px; }
 .notice { margin-bottom: 0; }
 .output-column { height: 650px; }
}
@media (max-width: 520px) { .header-inner { align-items: flex-start; flex-wrap: wrap; } .copy-actions { margin-left: auto; } main { padding: 16px; } .card { padding: 16px; } #preview-scroll { padding: 16px; } .preview-paper { padding: 16px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
