:root {
    color-scheme: light;
    --bg: #f3f4f6;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-strong: #ffffff;
    --surface-muted: #f8fafc;
    --border: rgba(148, 163, 184, 0.22);
    --border-strong: rgba(100, 116, 139, 0.32);
    --text: #0f172a;
    --text-muted: #475569;
    --primary: #1d4ed8;
    --primary-strong: #1e293b;
    --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.06);
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --font-sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
    overflow-x: hidden;
}

.shell,
.site-footer {
    position: relative;
    z-index: 1;
}

.shell {
    width: min(100% - 2rem, 68rem);
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.hero {
    padding: 1rem 0 1.25rem;
    text-align: left;
}

.eyebrow {
    margin: 0 0 1rem;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #334155;
}

.hero h1,
.features h2,
.tool-panel h2,
.site-footer h2 {
    margin: 0;
    line-height: 1.08;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    letter-spacing: -0.05em;
    text-wrap: balance;
}

.lead {
    width: min(100%, 42rem);
    margin: 0.95rem 0 0;
    font-size: clamp(1rem, 2vw, 1.08rem);
    line-height: 1.75;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.tool-panel {
    margin-top: 1.5rem;
    padding: 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-panel h2 {
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.panel-copy {
    margin: 0.7rem 0 0;
    max-width: 42rem;
    color: var(--text-muted);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.field-group {
    margin: 0;
}

.field-label {
    display: inline-flex;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
}

.editor {
    width: 100%;
    min-height: 16rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.04);
    color: var(--text);
    font: inherit;
    line-height: 1.7;
    overflow-wrap: anywhere;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

textarea.editor {
    resize: vertical;
}

.editor:focus {
    outline: none;
    border-color: rgba(29, 78, 216, 0.4);
    box-shadow:
        0 0 0 3px rgba(29, 78, 216, 0.12),
        inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.field-help {
    margin: 0.7rem 0 0;
    color: var(--text-muted);
    font-size: 0.94rem;
    line-height: 1.6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    padding: 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    text-align: left;
}

.stat-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.stat-value {
    display: block;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.button {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.95rem 1.2rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(15, 23, 42, 0.08);
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:focus-visible {
    outline: 3px solid rgba(29, 78, 216, 0.16);
    outline-offset: 2px;
}

.button-primary {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.button-primary:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
}

.button-secondary {
    background: #ffffff;
    border-color: var(--border-strong);
    color: var(--text);
}

.button-secondary:hover {
    background: #f8fafc;
}

.button-danger {
    background: #ffffff;
    border-color: rgba(239, 68, 68, 0.28);
    color: #b91c1c;
}

.button-danger:hover {
    background: #fef2f2;
    border-color: rgba(239, 68, 68, 0.4);
}

.converter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.converter-textarea,
.rich-editor {
    min-height: 18rem;
}

.rich-editor {
    overflow: auto;
    white-space: pre-wrap;
}

.rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
}

.rich-editor p,
.rich-editor blockquote,
.rich-editor pre,
.rich-editor ul,
.rich-editor ol,
.rich-editor h1,
.rich-editor h2,
.rich-editor h3,
.rich-editor h4,
.rich-editor h5,
.rich-editor h6 {
    margin: 0 0 0.85rem;
}

.rich-editor h1,
.rich-editor h2,
.rich-editor h3,
.rich-editor h4,
.rich-editor h5,
.rich-editor h6 {
    line-height: 1.3;
}

.rich-editor h1 {
    font-size: 1.65rem;
}

.rich-editor h2 {
    font-size: 1.4rem;
}

.rich-editor h3 {
    font-size: 1.2rem;
}

.rich-editor ul,
.rich-editor ol {
    padding-left: 1.4rem;
}

.rich-editor blockquote {
    margin-left: 0;
    padding-left: 1rem;
    border-left: 3px solid #cbd5e1;
    color: #334155;
}

.rich-editor pre,
.rich-editor code {
    font-family: "SFMono-Regular", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.rich-editor pre {
    overflow: auto;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
}

.rich-editor :not(pre) > code {
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    background: #e2e8f0;
    color: #0f172a;
}

.rich-editor a {
    color: var(--primary);
}

.converter-actions {
    margin-top: 1.2rem;
}

.features {
    margin-top: 1.5rem;
    padding: 1.4rem;
    border-radius: var(--radius-xl);
    background: transparent;
    border: 1px solid var(--border);
}

.features h2 {
    margin-bottom: 1.2rem;
    text-align: left;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    text-wrap: balance;
}

.feature-grid,
.footer-grid {
    display: grid;
    gap: 1rem;
}

.feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-item {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.feature-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.feature-title h3 {
    margin: 0;
    font-size: 1rem;
}

.feature-item p,
.site-footer p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.site-footer {
    width: min(100% - 2rem, 68rem);
    margin: 0 auto 2rem;
    padding: 1.5rem 0 0;
    border-top: 1px solid var(--border);
}

.footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1.2rem;
}

.site-footer h2 {
    margin-bottom: 0.7rem;
    font-size: 1rem;
}

.footer-links {
    text-align: right;
}

.footer-links a,
.footer-meta a {
    color: var(--primary);
    text-decoration: none;
}

.footer-links a:hover,
.footer-meta a:hover {
    text-decoration: underline;
}

.footer-meta {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.separator {
    margin: 0 0.6rem;
}

.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;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: 0.75rem;
    z-index: 10;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: #0f172a;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-150%);
    transition: transform 160ms ease;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 1rem, 68rem);
        padding-top: 1rem;
    }

    .tool-panel,
    .features {
        padding: 1.15rem;
    }

    .stats-grid,
    .actions,
    .feature-grid,
    .footer-grid,
    .converter-grid {
        grid-template-columns: 1fr;
    }

    .footer-links {
        text-align: left;
    }

    .separator {
        display: none;
    }

    .footer-meta {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }
}
