:root {
    color-scheme: light;
    --ink: #15283a;
    --muted: #637488;
    --soft-muted: #8290a0;
    --line: #dce5ec;
    --canvas: #f5f8fa;
    --paper: #ffffff;
    --teal: #0d6871;
    --teal-dark: #09545d;
    --teal-soft: #e6f3f2;
    --focus: #247c83;
    --danger: #b64242;
    --shadow: 0 14px 40px rgba(20, 46, 63, 0.12);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }

:focus-visible {
    outline: 3px solid rgba(36, 124, 131, 0.42);
    outline-offset: 3px;
}

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 clamp(18px, 3vw, 44px);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.brand-mark, .wordmark-mark {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: var(--teal);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -1px;
    box-shadow: 0 5px 12px rgba(13, 104, 113, 0.2);
}
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-name { color: var(--ink); font-size: 13px; font-weight: 800; letter-spacing: 0.07em; }
.brand-name > span { color: var(--teal); }
.brand-sub { color: var(--muted); font-size: 11px; }
.crumb { margin: 0 4px; color: #b4c0cb; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #49675f;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.privacy-badge > span, .preview-live-dot, .eyebrow-dot {
    width: 7px;
    height: 7px;
    display: inline-block;
    border-radius: 50%;
    background: #4da78c;
}
.btn-primary {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 17px;
    border: 0;
    border-radius: 10px;
    background: var(--teal);
    color: #fff;
    box-shadow: 0 5px 12px rgba(13, 104, 113, 0.14);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.btn-primary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); transform: translateY(-1px); box-shadow: 0 7px 16px rgba(13, 104, 113, 0.22); }
.btn-primary:disabled { background: #aab9bc; box-shadow: none; cursor: not-allowed; }

.layout {
    display: grid;
    grid-template-columns: minmax(420px, 0.96fr) minmax(0, 1.04fr);
    align-items: start;
}
.form-panel {
    min-width: 0;
    height: calc(100dvh - 72px);
    overflow-y: auto;
    padding: 35px clamp(22px, 3.4vw, 54px) 44px;
    background: var(--paper);
    scrollbar-color: #c4d0d9 transparent;
    scrollbar-width: thin;
}
.editor-intro { margin: 0 0 29px; }
.eyebrow {
    margin: 0 0 9px;
    color: var(--teal);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
}
.eyebrow > span:not(.eyebrow-dot) { margin: 0 4px; color: #a5b4be; }
.editor-intro h1 {
    max-width: 540px;
    margin: 0;
    font-size: clamp(25px, 2.35vw, 32px);
    line-height: 1.16;
    letter-spacing: -0.04em;
}
.editor-intro > p:last-child {
    max-width: 520px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}
.form-block {
    margin: 0 0 27px;
    padding: 0 0 25px;
    border-bottom: 1px solid var(--line);
}
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 15px;
}
.section-heading > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.section-index {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #eef4f5;
    color: var(--teal);
    font-size: 10px;
    font-weight: 800;
}
.section-heading h2 { margin: 0; font-size: 15px; letter-spacing: -0.01em; }
.section-note { color: var(--soft-muted); font-size: 11px; white-space: nowrap; }

.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 11px; background: #f0f4f6; }
.tab {
    flex: 1;
    min-height: 37px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--paper); color: var(--teal-dark); box-shadow: 0 1px 4px rgba(27, 53, 69, 0.12); }
.hint, .helper-note { margin: 9px 0 14px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.helper-note { margin: 10px 0 0; font-size: 11px; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0 0 16px; }
.template-card {
    min-height: 76px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    text-align: left;
    cursor: pointer;
    transition: border 120ms ease, background 120ms ease, transform 120ms ease;
}
.template-card:hover { border-color: #9cbec0; transform: translateY(-1px); }
.template-card.selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
.template-card .t-name { display: block; color: var(--ink); font-size: 12px; font-weight: 750; }
.template-card .t-desc { display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px; line-height: 1.4; }

.style-row { display: flex; align-items: flex-end; gap: 14px; }
.style-field { min-width: 0; flex: 1; }
.style-field label, .field > span {
    display: block;
    margin: 0 0 6px;
    color: #405366;
    font-size: 11px;
    font-weight: 650;
}
.style-field input[type="color"] {
    width: 100%;
    height: 39px;
    display: block;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    cursor: pointer;
}
.style-field select, .field input, .field textarea {
    width: 100%;
    min-height: 40px;
    display: block;
    padding: 9px 11px;
    border: 1px solid #d6e0e7;
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    font-size: 12px;
    line-height: 1.4;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field { display: block; min-width: 0; margin: 0 0 12px; }
.field > span { margin-bottom: 6px; }
.field > span i { color: var(--danger); font-style: normal; }
.field input::placeholder, .field textarea::placeholder { color: #9aa8b5; opacity: 1; }
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field textarea:focus, .style-field select:focus, .style-field input[type="color"]:focus {
    border-color: var(--focus);
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 124, 131, 0.14);
}
.field input:invalid:not(:placeholder-shown) { border-color: #d89494; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.grid-2 > .field { margin-bottom: 12px; }

.entry-card {
    position: relative;
    margin: 0 0 12px;
    padding: 15px 15px 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfcfd;
}
.entry-card .grid-2 { padding-right: 22px; }
.btn-remove {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7d8c99;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}
.btn-remove:hover { background: #fff0f0; color: var(--danger); }
.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 33px;
    padding: 0 10px;
    border: 1px solid #bad4d3;
    border-radius: 8px;
    background: #f7fbfb;
    color: var(--teal-dark);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}
.btn-add:hover { border-color: var(--teal); background: var(--teal-soft); }
.btn-add > span { font-size: 16px; font-weight: 500; line-height: 0; }

.editor-footer { padding-bottom: 12px; }
.form-message { min-height: 20px; margin: 0 0 9px; color: var(--teal-dark); font-size: 12px; font-weight: 650; line-height: 1.5; }
.form-message.error { color: var(--danger); }
.privacy-note { max-width: 560px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.draft-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 12px 0; color: var(--muted); font-size: 11px; }
.draft-controls .btn-add { min-height: 32px; }
.back-link { display: inline-block; margin-top: 15px; color: var(--teal-dark); font-size: 11px; font-weight: 700; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.preview-panel {
    position: sticky;
    top: 72px;
    height: calc(100dvh - 72px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 19px clamp(17px, 2.6vw, 38px) 13px;
    overflow: hidden;
    background: #eaf0f3;
}
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.preview-title { display: flex; align-items: center; gap: 10px; }
.preview-live-dot { position: relative; flex: 0 0 auto; }
.preview-live-dot::after { position: absolute; inset: -4px; border: 1px solid rgba(77, 167, 140, 0.35); border-radius: 50%; content: ""; }
.preview-title > div { display: flex; flex-direction: column; gap: 2px; }
.preview-title strong { color: #2c4152; font-size: 12px; }
.preview-title small { color: var(--muted); font-size: 10px; }
.preview-status { color: var(--muted); font-size: 10.5px; text-align: right; }
.preview-frame-wrap {
    width: 100%;
    max-width: 750px;
    min-height: 0;
    flex: 1;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid #dbe3e8;
    border-radius: 5px;
    background: #fff;
    box-shadow: var(--shadow);
}
#previewFrame { width: 100%; height: 100%; min-height: 540px; display: block; border: 0; background: #fff; }
.preview-footnote { margin: 9px auto 0; color: #738293; font-size: 10px; text-align: center; }

@media (max-width: 1024px) {
    .layout { display: flex; flex-direction: column; }
    .preview-panel { position: relative; order: -1; top: auto; width: 100%; height: 55vh; min-height: 390px; padding: 14px 20px 12px; }
    #previewFrame { min-height: 350px; }
    .form-panel { width: 100%; height: auto; overflow: visible; padding: 30px clamp(20px, 6vw, 64px) 40px; }
    .editor-intro { max-width: 760px; margin-right: auto; margin-left: auto; }
    .form-block, .editor-footer { max-width: 760px; margin-right: auto; margin-left: auto; }
}
@media (max-width: 600px) {
    .topbar { height: 64px; padding: 0 13px; gap: 8px; }
    .brand { gap: 8px; }
    .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }
    .brand-name { font-size: 11px; }
    .brand-sub { font-size: 9px; }
    .topbar-actions { gap: 8px; }
    .privacy-badge { display: none; }
    .btn-primary { min-height: 39px; gap: 6px; padding: 0 11px; border-radius: 9px; font-size: 11px; }
    .btn-primary svg { width: 16px; height: 16px; }
    .preview-panel { height: 47vh; min-height: 330px; padding: 11px 12px 10px; }
    .preview-toolbar { margin-bottom: 9px; }
    .preview-status { max-width: 120px; font-size: 9px; }
    #previewFrame { min-height: 275px; }
    .form-panel { padding: 26px 17px 34px; }
    .editor-intro { margin-bottom: 24px; }
    .editor-intro h1 { font-size: 27px; }
    .editor-intro > p:last-child { font-size: 12px; }
    .form-block { margin-bottom: 23px; padding-bottom: 21px; }
    .section-heading h2 { font-size: 14px; }
    .section-note { font-size: 10px; }
    .grid-2 { grid-template-columns: 1fr; gap: 0; }
    .template-grid { gap: 7px; }
    .template-card { min-height: 75px; padding: 9px; }
    .template-card .t-name { font-size: 11px; }
    .template-card .t-desc { font-size: 9.5px; }
    .btn-add { min-height: 31px; padding: 0 7px; font-size: 10px; }
    .entry-card { padding: 13px 12px 2px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

.seo-faq {
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: 64px 24px 76px;
}
.seo-faq-inner { max-width: 980px; margin: 0 auto; }
.seo-faq h2 { max-width: 700px; margin: 8px 0 14px; color: var(--ink); font-size: clamp(24px, 3vw, 36px); line-height: 1.14; letter-spacing: -0.03em; }
.seo-faq-intro { max-width: 760px; margin: 0 0 28px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.faq-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.faq-list details { border: 1px solid var(--line); border-radius: 12px; background: #fbfdfe; padding: 0 18px; }
.faq-list summary { cursor: pointer; list-style: none; padding: 17px 28px 17px 0; color: var(--ink); font-size: 14px; font-weight: 700; position: relative; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 0; top: 14px; color: var(--teal); font-size: 21px; font-weight: 400; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list details p { margin: -2px 0 17px; color: var(--muted); font-size: 13px; line-height: 1.6; }
@media (max-width: 700px) {
    .seo-faq { padding: 44px 17px 54px; }
    .faq-list { grid-template-columns: 1fr; }
}
