:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --hover: #fbfbfd;
    --text: #1d1d1f;
    --text-body: #424245;
    --text-2: #6e6e73;
    --text-3: #86868b;
    --text-4: #aeaeb2;
    --hairline: rgba(0, 0, 0, 0.07);
    --accent: #0071e3;
    --accent-link: #0066cc;
    --danger: #d70015;
    --warning: #b25000;
    --success: #007a35;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --r-pill: 999px;
    --r-input: 12px;
    --r-card: 18px;
    --r-panel: 22px;
    --max-grid: 1080px;
    --pad-x: 22px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
    --shadow-panel: 0 1px 3px rgba(0, 0, 0, 0.05), 0 14px 40px rgba(0, 0, 0, 0.05);
    --ease: cubic-bezier(0.25, 1, 0.5, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    min-width: 320px;
    min-height: 100dvh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-optical-sizing: auto;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; }
a { color: var(--accent-link); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid rgba(0, 113, 227, 0.35);
    outline-offset: 3px;
}

.site-shell { width: min(var(--max-grid), calc(100% - (var(--pad-x) * 2))); margin: 0 auto; }
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid transparent;
    background: rgba(245, 245, 247, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--hairline); box-shadow: 0 1px 12px rgba(0, 0, 0, 0.04); }
.header-content { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 6px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 0.62rem; font-weight: 700; letter-spacing: -0.08em; }
.brand strong { display: block; font-size: 0.94rem; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
.brand-caption { display: none; }
nav { display: flex; align-items: center; gap: 18px; }
nav a { display: inline-flex; min-height: 44px; align-items: center; color: var(--text-2); font-size: 0.81rem; font-weight: 500; text-decoration: none; transition: color 160ms var(--ease); }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }

.tool-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 0.42fr); align-items: end; gap: clamp(24px, 6vw, 72px); padding: clamp(38px, 6vw, 64px) 0 clamp(26px, 4vw, 38px); }
.eyebrow, .panel-kicker { margin: 0 0 9px; color: var(--text-3); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--text); }
h1 { max-width: 690px; margin-bottom: 14px; font-size: clamp(2rem, 5vw, 2.9rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.12; }
h2 { margin-bottom: 8px; font-size: clamp(1.28rem, 3.4vw, 1.62rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.25; }
h3 { margin-bottom: 0; font-size: 0.98rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.45; }
.intro-copy { max-width: 560px; margin-bottom: 0; color: var(--text-2); font-size: clamp(0.98rem, 2.5vw, 1.12rem); line-height: 1.65; }
.privacy-note { display: grid; gap: 3px; padding-left: 18px; border-left: 1px solid var(--hairline); color: var(--text-2); font-size: 0.86rem; line-height: 1.6; }
.privacy-note strong { color: var(--text); font-size: 0.87rem; font-weight: 600; }

.workspace { display: grid; grid-template-columns: minmax(310px, 0.88fr) minmax(0, 1.12fr); overflow: hidden; border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-panel); }
.panel { min-width: 0; padding: clamp(22px, 3.4vw, 34px); }
.input-panel { border-right: 1px solid var(--hairline); }
.panel-heading { margin-bottom: 24px; }
.panel-heading p:not(.panel-kicker) { margin-bottom: 0; color: var(--text-2); font-size: 0.9rem; line-height: 1.65; }
.result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
label { display: block; margin-bottom: 8px; color: var(--text-body); font-size: 0.86rem; font-weight: 600; }
.field { margin-top: 16px; }
.field:first-of-type { margin-top: 0; }
input, select, textarea {
    display: block;
    width: 100%;
    border: 1px solid transparent;
    border-radius: var(--r-input);
    background: var(--hover);
    color: var(--text);
    transition: border-color 160ms var(--ease), background-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input, select { min-height: 44px; padding: 0 13px; }
textarea { min-height: 166px; padding: 14px; resize: vertical; font-family: var(--mono); font-size: 0.8rem; line-height: 1.6; }
textarea.short-code { min-height: 112px; }
input::placeholder, textarea::placeholder { color: var(--text-4); }
input:hover, select:hover, textarea:hover { border-color: var(--hairline); background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); outline: 0; }
.field-help, .input-error { margin: 7px 0 0; font-size: 0.78rem; line-height: 1.6; }
.field-help { color: var(--text-3); }
.input-error { color: var(--danger); font-weight: 550; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.button-row { display: flex; gap: 10px; margin-top: 20px; }
.button { min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--r-pill); cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: transform 180ms var(--ease), background-color 180ms var(--ease), box-shadow 180ms var(--ease); }
.button:active, .sample-button:active, .copy-button:active { transform: scale(0.97); }
.button-primary { flex: 1; background: var(--accent); box-shadow: 0 8px 20px rgba(0, 113, 227, 0.18); color: #fff; }
.button-primary:hover { background: var(--accent-link); box-shadow: 0 12px 26px rgba(0, 113, 227, 0.24); transform: translateY(-2px); }
.button-secondary { background: rgba(0, 0, 0, 0.05); color: var(--text); }
.button-secondary:hover { background: #e8e8ed; transform: translateY(-2px); }
.button:disabled { cursor: wait; opacity: 0.65; }
.sample-button { min-height: 44px; margin-top: 8px; padding: 0; border: 0; background: transparent; color: var(--accent-link); cursor: pointer; font-size: 0.82rem; font-weight: 550; text-align: left; }
.sample-button:hover { color: var(--accent); }

.result-status { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; border-radius: var(--r-pill); background: rgba(0, 0, 0, 0.05); color: var(--text-2); font-size: 0.74rem; font-weight: 550; white-space: nowrap; }
.result-status.is-valid { color: var(--success); }
.result-status.is-warning { color: var(--warning); }
.result-status.is-invalid { color: var(--danger); }
.result-content { min-height: 400px; overflow: hidden; border-radius: var(--r-card); background: var(--hover); }
.empty-state { display: grid; min-height: 400px; place-content: center; padding: 28px; color: var(--text-2); text-align: center; }
.empty-state p { max-width: 330px; margin-bottom: 0; font-size: 0.88rem; line-height: 1.7; }
.empty-title { margin-bottom: 6px !important; color: var(--text); font-size: 0.98rem !important; font-weight: 600; }
.result-note { padding: 14px 16px; color: var(--warning); font-size: 0.79rem; line-height: 1.65; }
.result-note + .result-card, .result-note + .check-list { border-top: 1px solid var(--hairline); }
.result-card { background: var(--surface); }
.result-card + .result-card { border-top: 1px solid var(--hairline); }
.result-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px 9px; }
.result-card-header h3 { font-family: var(--mono); font-size: 0.81rem; font-weight: 600; letter-spacing: 0; }
.copy-button { min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-pill); background: rgba(0, 0, 0, 0.05); color: var(--text-2); cursor: pointer; font-size: 0.73rem; font-weight: 550; transition: background-color 160ms var(--ease), color 160ms var(--ease); }
.copy-button:hover { background: #e8e8ed; color: var(--text); }
.code-output { max-height: 260px; margin: 0; padding: 0 16px 16px; overflow: auto; color: var(--text-body); font-family: var(--mono); font-size: 0.77rem; font-variant-numeric: tabular-nums; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.check-list { background: var(--surface); }
.check-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 13px 16px; }
.check-row + .check-row { border-top: 1px solid var(--hairline); }
.check-icon { display: grid; width: 18px; height: 18px; place-items: center; margin-top: 2px; border-radius: 50%; background: rgba(0, 0, 0, 0.06); color: var(--text-2); font-size: 0.68rem; font-weight: 700; }
.check-row.is-pass .check-icon { background: rgba(0, 122, 53, 0.11); color: var(--success); }
.check-row.is-fail .check-icon { background: rgba(215, 0, 21, 0.1); color: var(--danger); }
.check-row.is-warn .check-icon { background: rgba(178, 80, 0, 0.12); color: var(--warning); }
.check-row strong { display: block; color: var(--text); font-size: 0.83rem; font-weight: 600; line-height: 1.45; }
.check-row p { margin: 2px 0 0; color: var(--text-2); font-size: 0.79rem; line-height: 1.65; word-break: break-word; }
.token-output { padding: 16px; background: var(--surface); }
.token-output p { margin: 0 0 8px; color: var(--text-3); font-size: 0.73rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.token-output code { display: block; max-height: 130px; overflow: auto; color: var(--text-body); font-family: var(--mono); font-size: 0.76rem; line-height: 1.65; overflow-wrap: anywhere; }

.content-section, .faq { padding-top: clamp(38px, 6vw, 58px); }
.content-lead { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(240px, 0.55fr); align-items: end; gap: clamp(24px, 6vw, 64px); margin-bottom: 22px; }
.content-lead p:last-child { max-width: 430px; margin-bottom: 0; color: var(--text-body); font-size: 0.95rem; line-height: 1.85; }
.content-grid { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-card); }
.content-block { padding: clamp(22px, 3vw, 30px); }
.content-block + .content-block { border-left: 1px solid var(--hairline); }
.content-block h3 { margin-bottom: 15px; }
.text-list { display: grid; gap: 10px; padding: 0; margin: 0; color: var(--text-body); font-size: 0.86rem; line-height: 1.7; list-style: none; }
.text-list li { position: relative; padding-left: 16px; }
.text-list li::before { position: absolute; top: 0.68em; left: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); content: ""; }
.content-block p { margin-bottom: 0; color: var(--text-body); font-size: 0.88rem; line-height: 1.85; }
.content-block p + p { margin-top: 12px; }
.tool-links { display: grid; gap: 0; overflow: hidden; margin-top: 22px; border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-card); }
.tool-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; padding: 16px clamp(18px, 3vw, 26px); color: var(--text); text-decoration: none; transition: background-color 160ms var(--ease); }
.tool-link + .tool-link { border-top: 1px solid var(--hairline); }
.tool-link:hover { background: var(--hover); }
.tool-link span { color: var(--text-3); font-size: 0.82rem; }
.tool-link strong { font-size: 0.92rem; font-weight: 600; }
.tool-link::after { color: var(--accent-link); content: "›"; font-size: 1.4rem; }

.faq { padding-bottom: clamp(48px, 7vw, 74px); }
.faq > h2 { margin-bottom: 20px; }
.faq-list { overflow: hidden; border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-card); }
details { padding: 0; }
details + details { border-top: 1px solid var(--hairline); }
summary { display: flex; min-height: 58px; align-items: center; padding: 16px clamp(18px, 3vw, 26px); cursor: pointer; color: var(--text); font-size: 0.92rem; font-weight: 600; line-height: 1.45; list-style: none; transition: background-color 160ms var(--ease); }
summary::-webkit-details-marker { display: none; }
summary::after { margin-left: auto; padding-left: 16px; color: var(--text-3); content: "+"; font-size: 1.25rem; font-weight: 400; }
details[open] summary { background: var(--hover); }
details[open] summary::after { content: "−"; }
details p { max-width: 720px; margin: 0; padding: 0 clamp(18px, 3vw, 26px) 19px; color: var(--text-body); font-size: 0.9rem; line-height: 1.85; }

.site-footer { background: var(--surface); }
.footer-content { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 20px; color: var(--text-3); font-size: 0.78rem; }
.footer-content p { margin: 0; }
.footer-content a { font-weight: 550; text-decoration: none; }
.footer-content a:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 680px) {
    .tool-intro, .workspace, .content-lead, .content-grid { grid-template-columns: 1fr; }
    .tool-intro { gap: 18px; }
    .privacy-note { max-width: 420px; }
    .input-panel { border-right: 0; border-bottom: 1px solid var(--hairline); }
    .result-content, .empty-state { min-height: 320px; }
    .content-lead { gap: 10px; }
    .content-block + .content-block { border-top: 1px solid var(--hairline); border-left: 0; }
}

@media (max-width: 480px) {
    .site-shell { width: min(var(--max-grid), calc(100% - 32px)); }
    nav { display: none; }
    h1 { font-size: 2rem; }
    .panel { padding: 22px; }
    .two-fields { grid-template-columns: 1fr; gap: 0; }
    .button-row { display: grid; grid-template-columns: 1fr 0.62fr; }
    .footer-content { min-height: 86px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
    .site-header { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-contrast: more) {
    input, select, textarea, .workspace, .content-grid, .faq-list, .tool-links { outline: 1px solid var(--text); }
}
