:root {
  --paper: #edf0f5;
  --card: #fbfcff;
  --ink: #172231;
  --muted: #687486;
  --line: #cbd2df;
  --blue: #3157ff;
  --blue-soft: #e2e7ff;
  --lime: #d9f36c;
  --coral: #ff7a4b;
  --shadow: 0 18px 50px rgba(23, 34, 49, .09);
  --radius: 20px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-display: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  background-image: linear-gradient(90deg, rgba(49, 87, 255, .035) 1px, transparent 1px), linear-gradient(rgba(49, 87, 255, .035) 1px, transparent 1px);
  background-size: 36px 36px; font-family: var(--font-sans); line-height: 1.65; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
canvas, svg { display: block; }
.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: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 16px; color: white; background: var(--ink); border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.site-header { padding: 22px 0; border-bottom: 1px solid rgba(23, 34, 49, .12); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; color: var(--card); background: var(--blue); border-radius: 5px 15px 5px 15px; font-family: var(--font-display); font-size: 20px; font-weight: 700; transform: rotate(-3deg); }
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-size: 19px; letter-spacing: .07em; }
.brand-copy small { margin-top: 3px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .13em; }
.top-nav { display: flex; gap: 26px; font-size: 13px; }
.top-nav a { text-decoration: none; position: relative; }
.top-nav a::after { content: ""; position: absolute; height: 3px; left: 0; right: 100%; bottom: -5px; background: var(--lime); transition: right .18s; }
.top-nav a:hover::after { right: 0; }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); align-items: center; gap: clamp(42px, 8vw, 105px); padding-block: clamp(54px, 8vw, 100px) 72px; }
.eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 22px; color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.eyebrow span { padding: 4px 8px; color: var(--card); background: var(--blue); border-radius: 3px; font-family: var(--font-mono); font-size: 9px; }
.hero h1 { margin: 0; font-family: var(--font-display); font-size: clamp(64px, 9vw, 112px); line-height: .94; letter-spacing: -.075em; }
.hero h1 em { position: relative; color: var(--blue); font-style: normal; z-index: 0; }
.hero h1 em::after { content: ""; position: absolute; z-index: -1; left: -.02em; right: -.02em; bottom: .07em; height: .24em; background: var(--lime); transform: skewX(-11deg); }
.hero-copy > p:not(.eyebrow) { max-width: 620px; margin: 27px 0 1px; color: #536073; font-size: clamp(15px, 1.7vw, 18px); line-height: 1.9; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.hero-tags span { padding: 5px 10px; border: 1px solid #aab4c6; border-radius: 4px; background: rgba(251, 252, 255, .65); font-family: var(--font-mono); font-size: 9px; }
.type-board { position: relative; padding: 25px; overflow: hidden; color: var(--card); background: var(--ink); border-radius: 7px 37px 7px 37px; box-shadow: 11px 12px 0 var(--blue); }
.type-board::before { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; top: -80px; border: 37px solid var(--lime); border-radius: 50%; opacity: .18; }
.board-label { display: flex; align-items: center; gap: 8px; color: #8c9bb3; font-family: var(--font-mono); font-size: 8px; letter-spacing: .12em; }
.board-label i { flex: 1; height: 1px; background: #34445b; }
.board-glyph { display: flex; align-items: flex-end; justify-content: space-between; margin: 18px 0 25px; font-family: var(--font-display); font-size: clamp(92px, 12vw, 140px); line-height: .9; letter-spacing: -.08em; }
.board-glyph span { color: var(--lime); font-family: var(--font-mono); font-size: 24px; letter-spacing: -.08em; }
.board-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #3b4a5e; border: 1px solid #3b4a5e; }
.board-numbers div { padding: 11px; background: #1b2a3d; }
.board-numbers strong { display: block; font-family: var(--font-mono); font-size: 19px; line-height: 1.2; }
.board-numbers span { color: #8d9cb0; font-size: 8px; }

.workbench { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 24px; align-items: start; }
.editor-card, .stats-card, .advanced-card { background: var(--card); border: 1px solid #d5dbe6; border-radius: var(--radius); box-shadow: var(--shadow); }
.editor-card { min-width: 0; padding: clamp(22px, 3.2vw, 34px); }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-index { margin: 0 0 2px; color: var(--blue); font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; }
.limit-state { display: flex; align-items: center; gap: 7px; padding: 6px 9px; color: var(--muted); background: #f1f3f8; border: 1px solid #d9dfe8; border-radius: 100px; font-family: var(--font-mono); font-size: 8.5px; }
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.limit-state.is-over { color: #a22e17; background: #ffe7df; border-color: #f1b5a5; }
.limit-state.is-over .state-dot { background: var(--coral); }
.tool-groups { display: grid; gap: 10px; padding: 13px; background: #f2f4f9; border: 1px solid #dce1ea; border-radius: 12px; }
.tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tool-label { width: 37px; color: #8590a2; font-family: var(--font-mono); font-size: 8px; }
.tool-button { padding: 5px 9px; color: #3d4b5f; background: var(--card); border: 1px solid #cbd2df; border-radius: 6px; font-size: 10px; cursor: pointer; }
.tool-button:hover:not(:disabled) { color: var(--card); background: var(--ink); border-color: var(--ink); }
.tool-button:disabled { color: #a3acba; background: #eaedf3; cursor: not-allowed; }
.undo-button { margin-left: auto; border-style: dashed; }
.editor-frame { position: relative; margin-top: 16px; border: 1px solid #c8d0dd; border-radius: 12px; background: #fff; overflow: hidden; }
.editor-ruler { position: absolute; top: 0; bottom: 0; left: 0; z-index: 1; width: 43px; padding: 16px 8px; display: flex; flex-direction: column; gap: 27px; color: #aab3c1; background: #f5f7fb; border-right: 1px solid #e1e5ec; font-family: var(--font-mono); font-size: 7.5px; text-align: right; pointer-events: none; }
#editor { display: block; width: 100%; min-height: 466px; padding: 15px 18px 15px 57px; resize: vertical; color: #223044; background: transparent; border: 0; outline: 0; font-size: 15px; line-height: 1.8; }
#editor::placeholder { color: #9da7b5; }
.editor-frame:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49, 87, 255, .11); }
.editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 13px; }
.usage-meter { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 360px; }
.usage-track { flex: 1; height: 5px; overflow: hidden; background: #dee3ec; border-radius: 8px; }
.usage-track i { display: block; width: 0; height: 100%; background: var(--blue); border-radius: inherit; transition: width .2s; }
.usage-track i.is-over { background: var(--coral); }
.usage-meter > span { color: var(--muted); font-family: var(--font-mono); font-size: 8.5px; white-space: nowrap; }
.local-badge { color: #778395; font-size: 9px; }
.local-badge span { color: #37a06d; font-size: 7px; }
.limit-warning { margin-top: 13px; padding: 9px 11px; color: #8a2c18; background: #ffe7df; border-left: 3px solid var(--coral); font-size: 10.5px; }
.action-notice { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 10px; }
.action-notice.is-success { color: #247450; }
.action-notice.is-error { color: #a2321a; }

.side-stack { display: grid; gap: 20px; }
.stats-card { padding: 24px; }
.stats-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.stats-heading h2, .advanced-heading h2 { margin: 0; font-family: var(--font-display); font-size: 25px; letter-spacing: -.04em; }
.stats-live { display: flex; align-items: center; gap: 6px; color: #8090a1; font-family: var(--font-mono); font-size: 8px; }
.stats-live i { width: 6px; height: 6px; border-radius: 50%; background: #36a473; box-shadow: 0 0 0 4px rgba(54, 164, 115, .1); }
.stats-primary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 17px; overflow: hidden; background: #d6dce7; border: 1px solid #d6dce7; border-radius: 11px; }
.stat-block { padding: 15px; background: #f5f7fb; }
.stat-block strong { display: block; font-family: var(--font-mono); font-size: 23px; line-height: 1.2; letter-spacing: -.04em; }
.stat-block span { color: var(--muted); font-size: 8.5px; }
.stat-hero { grid-column: 1 / -1; background: var(--blue); color: white; }
.stat-hero strong { font-size: 40px; }
.stat-hero span { color: #cdd6ff; }
.stats-secondary { display: grid; gap: 0; margin: 14px 0 0; padding: 0; }
.stats-secondary div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #e3e7ee; }
.stats-secondary dt { color: var(--muted); font-size: 9.5px; }
.stats-secondary dd { margin: 0; font-family: var(--font-mono); font-size: 10px; }
.stats-note { margin: 12px 0 0; color: #8893a2; font-size: 8.5px; line-height: 1.55; }

.advanced-card { padding: 24px; }
.advanced-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.premium-tag { display: inline-flex; padding: 2px 6px; color: var(--ink); background: var(--lime); border-radius: 3px; font-family: var(--font-mono); font-size: 8px; font-style: normal; font-weight: 500; }
.replace-panel { margin-top: 17px; border: 1px solid #d7dde7; border-radius: 9px; background: #f7f8fb; overflow: hidden; }
.replace-panel summary { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; font-size: 11px; font-weight: 650; cursor: pointer; list-style: none; }
.replace-panel summary::-webkit-details-marker { display: none; }
.replace-panel summary::after { content: "+"; color: var(--blue); font-size: 17px; line-height: 1; }
.replace-panel[open] summary::after { content: "−"; }
.replace-panel summary span { margin-left: auto; color: var(--muted); font-family: var(--font-mono); font-size: 8px; font-weight: 400; }
.replace-body { display: grid; gap: 10px; padding: 0 12px 13px; }
.replace-body label:not(.check-label) { display: grid; gap: 4px; color: var(--muted); font-size: 9px; }
.replace-body input[type="text"] { width: 100%; padding: 8px 9px; color: var(--ink); background: white; border: 1px solid #cdd4e0; border-radius: 6px; font-size: 11px; outline: 0; }
.replace-body input[type="text"]:focus { border-color: var(--blue); }
.replace-body input:disabled { background: #ebedf2; cursor: not-allowed; }
.replace-options { display: grid; gap: 5px; }
.check-label { display: flex; align-items: center; gap: 6px; color: #5f6c7e; font-size: 9.5px; }
.check-label input { width: 14px; height: 14px; accent-color: var(--blue); }
.solid-button, .outline-button, .download-button { border: 1px solid var(--ink); border-radius: 7px; cursor: pointer; font-size: 10px; font-weight: 650; }
.solid-button { min-height: 34px; color: var(--card); background: var(--ink); }
.solid-button:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
.solid-button:disabled, .outline-button:disabled, .download-button:disabled { opacity: .42; cursor: not-allowed; }
.tool-error { margin: 0; color: #a1321b; font-size: 9px; }
.sort-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 14px 0; border-bottom: 1px solid #e3e7ee; }
.sort-row > span { width: 100%; color: var(--muted); font-size: 9px; }
.outline-button { padding: 6px 9px; color: #405066; background: var(--card); }
.outline-button:hover:not(:disabled) { color: var(--blue); border-color: var(--blue); }
.download-button { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 39px; margin-top: 14px; color: var(--card); background: var(--blue); border-color: var(--blue); }
.download-button:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
.download-button span { font-size: 15px; }
.advanced-note { margin: 9px 0 0; color: #8490a0; font-size: 8.5px; }

.unlock-section { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 24px; align-items: start; margin-top: 32px; scroll-margin-top: 30px; }
.premium-card { padding: 29px; background: var(--lime); border-radius: 7px 28px 7px 28px; box-shadow: 7px 7px 0 var(--ink); }
.premium-card h2 { margin: 10px 0 16px; font-family: var(--font-display); font-size: 28px; line-height: 1.25; letter-spacing: -.04em; }
.premium-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.premium-card li { padding-bottom: 7px; border-bottom: 1px solid rgba(23, 34, 49, .18); font-size: 10.5px; }
.premium-card li::before { content: "+"; margin-right: 7px; color: var(--blue); font-family: var(--font-mono); font-weight: 800; }

.site-footer { margin-top: 76px; padding: 33px 0 20px; color: #e8ecf5; background: var(--ink); }
.footer-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; }
.footer-brand { display: flex; align-items: center; gap: 11px; }
.footer-mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--ink); background: var(--lime); border-radius: 4px 11px 4px 11px; font-family: var(--font-display); font-weight: 700; }
.footer-brand strong { letter-spacing: .07em; }
.footer-brand p { margin: 1px 0 0; color: #8593a7; font-size: 9px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 9px 20px; justify-content: flex-end; font-size: 10.5px; }
.footer-links a { color: #bdc7d5; text-decoration: none; }
.footer-links a:hover { color: var(--lime); }
.footer-base { display: flex; justify-content: space-between; gap: 20px; margin-top: 27px; padding-top: 14px; border-top: 1px solid #344157; color: #758396; font-family: var(--font-mono); font-size: 8px; }

/* Shared referral card. */
.referral-card { position: relative; overflow: hidden; padding: clamp(24px, 4vw, 36px); color: #f8faff; background: #172231; border: 1px solid var(--ink); border-radius: 7px 28px 7px 28px; box-shadow: 7px 7px 0 var(--blue); }
.referral-card::after { content: ""; position: absolute; width: 205px; height: 205px; right: -77px; top: -100px; border: 31px solid var(--lime); border-radius: 50%; opacity: .17; pointer-events: none; }
.referral-kicker { display: flex; align-items: center; gap: 8px; color: #8797ad; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .12em; }
.referral-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(217, 243, 108, .13); }
.referral-heading { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-top: 16px; }
.referral-heading h2 { margin: 0; font-family: var(--font-display); font-size: clamp(25px, 3vw, 35px); line-height: 1.22; letter-spacing: -.035em; }
.referral-heading p { max-width: 560px; margin: 9px 0 0; color: #aebacb; font-size: 11.5px; }
.referral-badge { flex: 0 0 auto; padding: 5px 9px; border: 1px solid #526177; border-radius: 100px; color: #b6c1d1; font-family: var(--font-mono); font-size: 8.5px; }
.referral-badge.is-unlocked, .referral-badge.is-trial { color: var(--ink); background: var(--lime); border-color: var(--lime); }
.referral-badge.is-trial { background: #ffd9c9; border-color: #ffd9c9; }
.referral-progress { display: flex; align-items: center; gap: 12px; margin-top: 21px; color: #d1d9e4; font-size: 10.5px; }
.referral-steps { display: flex; gap: 5px; }
.referral-steps i { width: 31px; height: 5px; border-radius: 10px; background: #3c4b5f; }
.referral-steps i.is-filled { background: var(--lime); }
.referral-label { display: block; margin: 24px 0 7px; color: #7f90a6; font-size: 8.5px; }
.referral-copy-row { display: flex; gap: 8px; }
.referral-link { min-width: 0; flex: 1; color: #eef2fa !important; background: #223248 !important; border-color: #495b74 !important; font-family: var(--font-mono); font-size: 10px; }
.referral-copy { flex: 0 0 auto; padding: 9px 14px; color: var(--ink); background: var(--lime); border: 1px solid var(--lime); border-radius: 7px; font-weight: 700; font-size: 10.5px; cursor: pointer; }
.referral-copy.is-copied { background: #b9f0cb; border-color: #b9f0cb; }
.referral-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-top: 12px; color: #78899f; font-size: 9px; }
.referral-refresh { flex: 0 0 auto; padding: 0; color: #a5b3c5; background: transparent; border: 0; border-bottom: 1px solid #52647b; font-size: 8.5px; cursor: pointer; }
.referral-trial { margin-top: 15px; padding: 9px 11px; color: #ffe3d6; background: rgba(255, 122, 75, .13); border: 1px solid rgba(255, 122, 75, .3); border-radius: 7px; font-size: 9.5px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .type-board { width: min(100%, 440px); justify-self: start; }
  .workbench { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; align-items: start; }
  .unlock-section { grid-template-columns: 1fr; }
}

@media (max-width: 660px) {
  .shell { width: min(100% - 24px, 1180px); }
  .site-header { padding: 15px 0; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 16px; }
  .top-nav { gap: 14px; font-size: 11px; }
  .hero { gap: 34px; padding-top: 48px; }
  .hero h1 { font-size: clamp(56px, 19vw, 82px); }
  .hero-copy > p:not(.eyebrow) { font-size: 14px; }
  .type-board { padding: 20px; }
  .board-glyph { font-size: 96px; }
  .editor-card, .stats-card, .advanced-card { padding: 19px; }
  .editor-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .tool-label { width: 100%; }
  .undo-button { margin-left: 0; }
  #editor { min-height: 380px; padding-left: 15px; font-size: 14px; }
  .editor-ruler { display: none; }
  .editor-footer { align-items: flex-start; flex-direction: column; }
  .usage-meter { width: 100%; max-width: none; }
  .side-stack { grid-template-columns: 1fr; }
  .stats-primary { grid-template-columns: 1fr 1fr; }
  .footer-main, .footer-base { flex-direction: column; }
  .footer-links { justify-content: flex-start; }
  .referral-heading { flex-direction: column; }
  .referral-copy-row { flex-direction: column; }
  .referral-foot { flex-direction: column; gap: 8px; }
}

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