:root {
    --page-bg: #f5f7fb;
    --ink: #172033;
    --muted: #667085;
    --line: rgba(23, 32, 51, 0.12);
    --surface: #ffffff;
    --soft: #eef3f8;
    --accent: #2563eb;
    --accent-2: #0f9f6e;
    --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
textarea,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.wechat-app {
    min-height: 100vh;
}

.product-topbar {
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.product-topbar-inner {
    width: min(1180px, calc(100% - 36px));
    min-height: 66px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.product-name {
    font-weight: 800;
    font-size: 16px;
}

.product-tagline {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.product-nav a,
.toolbar-actions button,
.segmented button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.product-nav a:hover,
.toolbar-actions button:hover,
.segmented button:hover {
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--accent);
}

.product-hero {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 54px 0 34px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 34px;
    align-items: end;
}

.product-kicker {
    margin: 0 0 12px;
    color: #047857;
    font-weight: 800;
    font-size: 14px;
}

.product-hero h1 {
    margin: 0;
    max-width: 760px;
    font-size: 42px;
    line-height: 1.12;
    letter-spacing: 0;
}

.product-hero p {
    max-width: 760px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.85;
}

.product-stats {
    display: grid;
    gap: 10px;
}

.product-stats div {
    min-height: 78px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.product-stats span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.product-stats strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
}

.workspace {
    width: min(1360px, calc(100% - 36px));
    margin: 0 auto;
    padding: 20px 0 72px;
    display: grid;
    grid-template-columns: minmax(420px, 0.96fr) minmax(460px, 1.04fr);
    gap: 18px;
}

.editor-panel,
.preview-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    min-height: 82px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
}

.panel-header h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
}

.panel-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.counter,
.status-line {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.toolbar {
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
}

.segmented,
.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.segmented button.active {
    border-color: rgba(37, 99, 235, 0.32);
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
}

.toolbar-actions .primary-button,
.primary-button {
    border-color: #172033;
    background: #172033;
    color: #fff;
}

#markdownInput {
    width: 100%;
    min-height: 680px;
    display: block;
    padding: 22px;
    border: 0;
    resize: vertical;
    outline: none;
    color: #1f2937;
    background:
        linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px) 0 0 / 100% 32px,
        #fff;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.9;
}

.status-line {
    min-height: 36px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
}

.wechat-preview {
    min-height: 620px;
    max-height: 780px;
    overflow: auto;
    padding: 32px 20px;
    background:
        linear-gradient(90deg, rgba(23, 32, 51, 0.04) 1px, transparent 1px) center / 36px 36px,
        #eef2f7;
}

.wechat-preview > section {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.html-drawer {
    border-top: 1px solid var(--line);
    background: #fbfcfe;
}

.html-drawer summary {
    padding: 14px 20px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

#htmlOutput {
    width: 100%;
    min-height: 220px;
    display: block;
    padding: 16px 20px;
    border: 0;
    border-top: 1px solid var(--line);
    resize: vertical;
    outline: none;
    background: #0f172a;
    color: #dbeafe;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.7;
}

@media (max-width: 980px) {
    .product-hero,
    .workspace {
        grid-template-columns: 1fr;
    }

    .workspace {
        width: min(760px, calc(100% - 28px));
    }

    .product-hero h1 {
        font-size: 34px;
    }

    #markdownInput {
        min-height: 520px;
    }
}

@media (max-width: 640px) {
    .product-topbar-inner,
    .product-hero {
        width: calc(100% - 24px);
    }

    .product-hero {
        padding-top: 36px;
    }

    .product-hero h1 {
        font-size: 29px;
    }

    .panel-header,
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-actions button,
    .segmented button {
        flex: 1 1 auto;
    }

    .wechat-preview {
        padding: 20px 12px;
    }
}
