@layer reset, base, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, figure, dl, dd { margin: 0; }
  button, input, select { font: inherit; }
  button, a, input, summary { -webkit-tap-highlight-color: transparent; }
  button, summary { cursor: pointer; }
  img, svg { max-width: 100%; display: block; }
  a { color: inherit; text-decoration: none; }
  [hidden] { display: none !important; }
}

@layer base {
  :root { color-scheme: dark; --paper: #242424; --ink: #f5f5f5; --muted: #c3c3c3; --line: #484848; --accent: #fff; --accent-hover: #dedede; --wash: #303030; --chrome: #111; }
  html { scroll-behavior: smooth; scroll-padding-top: 90px; }
  body { background: var(--paper); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
  :lang(ja) { font-family: system-ui, -apple-system, 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans CJK JP', sans-serif; }
  :lang(ko) { font-family: system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans CJK KR', sans-serif; word-break: keep-all; overflow-wrap: anywhere; }
  :lang(zh-CN) { font-family: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif; }
  :lang(zh-TW) { font-family: system-ui, -apple-system, 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans CJK TC', sans-serif; }
  ::selection { background: #e0e0e0; color: #171717; }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
  h1, h2, h3 { line-height: 1.15; font-weight: 650; text-wrap: balance; }
  h2 { font-size: clamp(1.65rem, 2.6vw, 2.25rem); letter-spacing: -.04em; }
  p { color: var(--muted); }
  .wrap { width: min(1280px, calc(100% - 80px)); margin-inline: auto; }
  .section { padding-block: 76px; }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 24px; padding: 12px 20px; background: var(--accent); border: 1px solid var(--accent); color: #171717; border-radius: 4px; font-size: .9375rem; font-weight: 600; text-align: center; transition: background .15s, border-color .15s; }
  .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .button > span { font-size: 1.3rem; line-height: 1; }
  .button-small { min-height: 44px; padding: 9px 15px; gap: 16px; font-size: .875rem; }
  .button-large { min-height: 60px; padding: 16px 28px; font-size: 1.0625rem; }
  .button-outline { background: transparent; color: var(--ink); border-color: #858585; }
  .button-outline:hover { background: var(--wash); border-color: #aaa; }
  .text-link { display: inline-flex; align-items: center; gap: 12px; font-size: .875rem; }
  .text-link:hover, .footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
  .skip-link { position: fixed; z-index: 100; top: 12px; left: 16px; background: var(--paper); padding: 12px 20px; opacity: 0; pointer-events: none; }
  .skip-link:focus { opacity: 1; pointer-events: auto; }
}

@layer components {
  .section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
  .section-heading h2 { max-width: 800px; }
  .section-heading > a { flex-shrink: 0; }
  .home-guides { border-top: 1px solid var(--line); }
  .guide-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; list-style: none; padding: 0; margin: 0; }
  .guide-list li { border-top: 1px solid var(--line); }
  .guide-list a { display: block; padding-block: 26px; }
  .guide-list h3 { font-size: 1.2rem; line-height: 1.45; letter-spacing: -.02em; color: var(--accent); }
  .guide-list a:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
  .guide-list p { margin-top: 12px; }
  .guide-hub, .guide-main { padding-bottom: 64px; }
  .breadcrumbs { padding-block: 24px; font-size: .8125rem; color: var(--muted); }
  .breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 8px 12px; list-style: none; padding: 0; margin: 0; }
  .breadcrumbs li + li::before { content: '/'; margin-right: 12px; color: var(--muted); }
  .breadcrumbs a, .guide-body a, .guide-toc a { text-decoration: underline; text-underline-offset: 3px; }
  .guide-heading { max-width: 960px; padding-block: 32px 48px; }
  .guide-heading h1 { font-size: clamp(2.1rem, 4vw, 3.5rem); letter-spacing: -.045em; }
  .guide-heading > p:not(.section-label) { margin-top: 22px; max-width: 800px; }
  .guide-heading > p:not(.section-label):not(.guide-meta) { font-size: 1.125rem; }
  .guide-heading > .guide-meta { font-size: .8125rem; }
  .guide-heading .button { margin-top: 26px; }
  .guide-layout { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 760px); gap: 64px; border-top: 1px solid var(--line); padding-top: 36px; }
  .guide-toc { align-self: start; position: sticky; top: 28px; font-size: .875rem; }
  .guide-toc h2 { font-size: 1rem; letter-spacing: 0; }
  .guide-toc ul { padding: 0; list-style: none; }
  .guide-toc li { margin-block: 12px; }
  .guide-body { min-width: 0; }
  .updates-body { max-width: 800px; }
  .updates-body h3 { margin-top: 26px; font-size: 1.125rem; }
  .updates-body li { margin-top: 12px; }
  .guide-body section { margin-top: 40px; }
  .guide-body h2 { font-size: 1.6rem; line-height: 1.35; letter-spacing: -.025em; }
  .guide-body p { margin-top: 18px; line-height: 1.8; color: var(--ink); }
  .download-options { padding-left: 24px; line-height: 1.8; }
  .download-options li { margin-top: 18px; }
  .checksum-commands { margin-top: 22px; }
  .checksum-commands dt { margin-top: 14px; font-weight: 600; }
  .checksum-commands dd { margin: 8px 0 0; overflow-wrap: anywhere; font-size: .875rem; }
  .comparison-scroll { max-width: 100%; overflow-x: auto; margin-top: 24px; }
  .comparison-table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: .875rem; line-height: 1.6; }
  .comparison-table caption { text-align: left; font-weight: 600; padding-bottom: 12px; }
  .comparison-table th, .comparison-table td { padding: 16px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
  .comparison-table thead { background: var(--wash); }
  .comparison-table th[scope="row"] { width: 24%; }
  .guide-note { padding: 18px 22px; background: var(--wash); border-left: 3px solid var(--accent); font-size: .875rem; }
  .guide-body > .guide-note { margin-top: 0; }
  .practice-file { margin-top: 28px; padding: 24px; border: 1px solid #ead8aa; border-radius: 4px; background: #fff5d9; }
  .practice-file h2 { font-size: 1.25rem; }
  .practice-file > a { margin-top: 18px; color: var(--accent); font-weight: 600; }
  .practice-file .small { font-size: .8125rem; color: var(--muted); }
  .guide-figure { margin-top: 28px; }
  .guide-figure img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
  .guide-figure figcaption { margin-top: 10px; font-size: .8125rem; color: var(--muted); }
  .guide-sources { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 28px; font-size: .875rem; }
  .guide-sources h2 { font-size: 1.125rem; }
  .guide-sources ul { padding-left: 20px; }
  .guide-sources li { margin-top: 8px; }
  .guide-related { margin-top: 64px; }
  .guide-related > h2 { margin-bottom: 28px; }
  .page-home { color-scheme: light; --paper: #fcfbf8; --ink: #1d2738; --muted: #536174; --line: #d8dee7; --accent: #244fc5; --accent-hover: #193c9e; --wash: #eff3fb; --chrome: #eaf0f8; }
  .page-home ::selection { background: #ffe08a; color: #1d2738; }
  .page-home .button { color: #fff; }
  .page-home .site-header { --ink: #fff; --muted: #e0e9ff; --accent: #ffe08a; --chrome: #244fc5; color: var(--ink); border-bottom-color: #193c9e; }
  .page-home .brand-mark { background: #244fc5; border-color: #244fc5; color: #fff; }
  .page-home .site-header .brand-mark { background: #fff; border-color: #fff; color: #244fc5; }
  .page-home .button-outline { border-color: #a4baff; color: #fff; }
  .page-home .button-outline:hover { background: #fff; border-color: #fff; color: #244fc5; }
  .page-home .language-panel { --ink: #1d2738; --muted: #536174; --accent: #244fc5; background: #fff; color: var(--ink); border-color: #c6d2e6; box-shadow: 0 12px 36px #203b6a26; }
  .page-home .language-panel nav a:hover { background: #eff3fb; }
  .page-home .language-panel nav a[aria-current] { background: #e5edff; color: #244fc5; }
  .page-home .language-note { border-top-color: #d8dee7; }
  .site-header { border-bottom: 1px solid #383838; background: var(--chrome); }
  .header-inner { width: min(1400px, calc(100% - 64px)); min-height: 72px; margin-inline: auto; display: flex; align-items: center; gap: 28px; justify-content: space-between; }
  .brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1rem; letter-spacing: -.035em; white-space: nowrap; }
  .brand-mark { display: grid; place-items: center; width: 32px; height: 32px; background: #242424; color: #fff; border: 1px solid #888; border-radius: 5px; font: 600 17px/1 system-ui, sans-serif; letter-spacing: -.06em; }
  .primary-nav { display: flex; gap: 28px; font-size: .875rem; color: var(--muted); }
  .primary-nav a:hover { color: var(--ink); }
  .header-actions { display: flex; align-items: center; gap: 22px; }
  .language-menu { position: relative; font-size: .875rem; }
  .language-menu summary { display: flex; gap: 8px; align-items: center; list-style: none; min-height: 44px; border-radius: 4px; }
  .language-menu summary::-webkit-details-marker { display: none; }
  .globe { width: 18px; height: 18px; flex: none; }
  .language-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 360px; max-height: min(560px, 75dvh); overflow-y: auto; z-index: 30; padding: 18px; background: var(--wash); border: 1px solid #777; border-radius: 6px; box-shadow: 0 12px 36px #0006; }
  .language-title { color: var(--ink); font-weight: 600; margin-bottom: 12px; }
  .language-panel nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .language-panel nav a { display: flex; justify-content: space-between; gap: 8px; min-height: 44px; align-items: center; padding: 9px 10px; border-radius: 3px; }
  .language-panel nav a:hover { background: #414141; }
  .language-panel nav a[aria-current] { background: #505050; color: #fff; }
  .language-note { font-size: .8125rem; line-height: 1.6; padding-top: 12px; margin-top: 12px; border-top: 1px solid #666; }
  .hero-band { border-bottom: 1px solid var(--line); }
  .home-intro { max-width: 900px; }
  .home-intro p { margin-top: 20px; }
  .intro-links { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 24px; }
  .hero { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: center; text-align: center; padding-block: 64px 42px; }
  .hero h1 { max-width: 1040px; margin-inline: auto; font-size: clamp(2.6rem, 4.65vw, 4.2rem); letter-spacing: -.055em; line-height: 1.08; }
  .hero-description { max-width: 780px; margin-inline: auto; font-size: 1.125rem; line-height: 1.7; margin-top: 24px; color: var(--muted); }
  .hero-start { justify-self: center; }
  .hero-start .button { min-width: 270px; box-shadow: 0 3px 0 #153384; }
  .benefits { padding: 0; list-style: none; font-size: .875rem; color: var(--muted); margin: 18px 0 16px; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 24px; }
  .benefits li::before { content: '✓'; color: var(--accent); margin-right: 9px; }
  .hero-start .text-link { color: var(--muted); font-size: .875rem; }
  .editor-preview { overflow: hidden; border: 1px solid #b7c6e6; border-top: 6px solid var(--accent); border-radius: 6px; background: #262626; box-shadow: 0 18px 48px #203b6a1a; }
  .editor-preview > a { display: block; }
  .editor-preview img { width: 100%; height: auto; }
  .editor-preview figcaption { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 15px 20px; background: #edf2ff; color: var(--muted); font-size: .875rem; border-top: 1px solid #b7c6e6; }
  .editor-preview figcaption a { flex: none; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
  .formats { display: flex; align-items: center; gap: 40px; padding-block: 32px; }
  .formats h2 { font-size: .875rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
  .formats ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; font: 600 .9375rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
  .formats li { padding: 5px 12px; border-radius: 3px; background: #e5edff; color: #244fc5; }
  .formats li:nth-child(3), .formats li:nth-child(4) { background: #fbe7df; color: #a13c2a; }
  .formats li:nth-child(5), .formats li:nth-child(6) { background: #faefcd; color: #755414; }
  .toolkit { display: grid; grid-template-columns: .85fr 1.15fr; gap: 100px; }
  .section-label { margin-bottom: 18px; font-size: .875rem; color: var(--accent); }
  .feature-list > div { padding-block: 24px; border-bottom: 1px solid var(--line); }
  .feature-list > div:first-child { padding-top: 0; }
  .feature-list > div:last-child { padding-bottom: 0; border-bottom: 0; }
  .feature-list dt { font-size: 1.125rem; font-weight: 600; margin-bottom: 10px; }
  .feature-list > div:nth-child(1) dt { color: #244fc5; }
  .feature-list > div:nth-child(2) dt { color: #a13c2a; }
  .feature-list > div:nth-child(3) dt { color: #755414; }
  .feature-list dd { font-size: 1rem; line-height: 1.75; color: var(--muted); }
  .privacy-band { background: #fff0c9; border-block: 1px solid #ead8aa; }
  .privacy { display: grid; grid-template-columns: .85fr 1.15fr; gap: 100px; padding-block: 36px; align-items: start; }
  .privacy h2 { font-size: 1.375rem; letter-spacing: -.025em; }
  .privacy p { font-size: 1rem; line-height: 1.75; }
  .faq-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 100px; }
  .questions { border-top: 1px solid var(--line); }
  .questions details { border-bottom: 1px solid var(--line); }
  .questions summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; list-style: none; min-height: 68px; padding-block: 20px; font-size: 1rem; }
  .questions summary::-webkit-details-marker { display: none; }
  .questions summary span { flex: none; font-size: 1.25rem; color: var(--accent); }
  .questions details[open] summary span { transform: rotate(45deg); }
  .questions details p { font-size: 1rem; line-height: 1.75; padding-bottom: 24px; }
  .footer-band { background: var(--chrome); border-top: 1px solid var(--line); }
  .footer { padding-top: 36px; }
  .footer-top { display: flex; justify-content: space-between; align-items: center; gap: 25px; }
  .footer-top nav { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: .875rem; }
  .footer-languages { display: flex; flex-wrap: wrap; gap: 0 24px; padding-block: 20px; font-size: .875rem; color: var(--muted); }
  .footer-languages a { padding-block: 11px; }
  .footer-languages [aria-current] { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
  .page-home .footer a:hover, .page-home .footer-languages [aria-current] { color: var(--accent); }
  .footer-bottom { display: flex; justify-content: space-between; gap: 20px; padding-block: 22px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
  .page-editor { height: 100dvh; min-height: 440px; display: flex; flex-direction: column; background: var(--wash); }
  .editor-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .workspace-bar { display: grid; flex-shrink: 0; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 44px; padding: 4px 12px; border-bottom: 1px solid var(--line); background: var(--chrome); font-size: .75rem; }
  .workspace-home { display: grid; place-items: center; min-height: 36px; color: var(--muted); font-size: 1.125rem; }
  .workspace-title { font-size: .875rem; line-height: 1.4; text-wrap: initial; }
  .workspace-actions { display: flex; align-items: center; gap: 16px; }
  .workspace-actions .language-menu { font-size: .75rem; }
  .workspace-actions .language-menu summary { min-height: 36px; }
  .workspace-actions .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 32px; min-height: 36px; }
  .workspace-action-icon { width: 18px; height: 18px; }
  .workspace-help-icon { display: none; width: 18px; height: 18px; border: 1px solid currentColor; border-radius: 50%; font-size: .75rem; line-height: 16px; text-align: center; }
  .workspace-help { position: relative; }
  .workspace-help > summary { list-style: none; }
  .workspace-help > summary::-webkit-details-marker { display: none; }
  .editor-help-panel { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; width: min(520px, calc(100vw - 24px)); max-height: min(640px, calc(100dvh - 96px)); overflow: auto; padding: 20px; border: 1px solid #777; border-radius: 6px; background: var(--wash); box-shadow: 0 12px 36px #0006; font-size: .8125rem; }
  .editor-help-panel h2 { font-size: 1rem; line-height: 1.4; letter-spacing: 0; }
  .editor-help-panel p { margin-top: 12px; }
  .editor-help-panel ul { margin-block: 12px; padding-left: 20px; }
  .editor-help-panel li + li { margin-top: 6px; }
  .editor-help-panel a { text-decoration: underline; text-underline-offset: 3px; }
  .editor-help-panel .button { margin-top: 12px; }
  .text-button { border: 0; background: transparent; padding: 3px 0; font-size: .75rem; color: var(--ink); }
  .text-button:hover { text-decoration: underline; }
  .editor-stage { position: relative; flex: 1; min-height: 240px; background: #262626; }
  .editor-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #262626; }
  .editor-stage:fullscreen { width: 100vw; height: 100dvh; }
  .editor-status { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; overflow: auto; text-align: center; padding: 30px 24px; gap: 16px; background: var(--wash); }
  .status-symbol { color: var(--accent); font-size: 2.5rem; }
  .editor-status h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.03em; }
  .editor-status p { max-width: 510px; font-size: .875rem; }
  .status-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 10px; }
  .editor-announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  dialog { padding: 28px; border: 1px solid #777; border-radius: 6px; background: var(--paper); color: var(--ink); width: min(600px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: 0 20px 80px #0006; }
  dialog::backdrop { background: #0009; }
  .dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
  .dialog-heading h2 { font-size: 1.5rem; }
  .dialog-heading button { padding: 0 4px; border: 0; background: transparent; font-size: 1.6rem; color: var(--muted); line-height: 1; }
  dialog p { font-size: .875rem; margin-bottom: 16px; }
  dialog > a { display: inline-block; font-size: .875rem; text-decoration: underline; margin: 12px 0 0 16px; }
  .noscript-message { padding: 14px 20px; text-align: center; }
  .route-page { min-height: 100dvh; display: grid; place-items: center; padding: 30px; }
  .route-page main { max-width: 760px; }
  .route-page h1 { margin-bottom: 18px; font-size: 2rem; }
  .route-page nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
}

@layer responsive {
  @media (max-width: 900px) {
    .guide-layout { grid-template-columns: 1fr; gap: 12px; }
    .guide-toc { position: static; }
    .section-heading { flex-direction: column; gap: 16px; }
  }
  @media (max-width: 600px) {
    .guide-list { grid-template-columns: 1fr; }
    .guide-heading { padding-block: 16px 32px; }
    .guide-heading h1 { overflow-wrap: anywhere; }
    .practice-file { padding: 20px; }
  }
  @media (min-width: 1500px) { .hero h1 { font-size: 4.25rem; } }
  @media (max-width: 1100px) {
    .primary-nav { display: none; }
    .hero { gap: 28px; }
    .toolkit, .privacy, .faq-grid { gap: 50px; }
  }
  @media (max-width: 760px) {
    .wrap { width: calc(100% - 40px); }
    .header-inner { width: calc(100% - 32px); min-height: 64px; gap: 16px; }
    .header-actions { gap: 12px; }
    .header-actions > .button { display: none; }
    .hero { grid-template-columns: 1fr; gap: 28px; padding-block: 40px 32px; }
    .hero h1 { font-size: clamp(2.35rem, 8vw, 3.4rem); max-width: 620px; }
    .hero-description { font-size: 1rem; margin-top: 20px; }
    .hero-start { max-width: 460px; }
    .hero-start .button { min-width: 240px; }
    .benefits { display: flex; flex-wrap: wrap; gap: 5px 16px; margin-block: 14px 12px; }
    .editor-preview figcaption { padding: 11px 12px; }
    .editor-preview figcaption a { display: none; }
    .formats { display: block; padding-block: 22px; }
    .formats h2 { margin-bottom: 12px; }
    .formats ul { gap: 8px; }
    .section { padding-block: 46px; }
    .toolkit, .privacy, .faq-grid { grid-template-columns: 1fr; gap: 26px; }
    .toolkit h2 { max-width: 520px; }
    .privacy { padding-block: 28px; gap: 16px; }
    .footer-top { align-items: flex-start; flex-direction: column; gap: 20px; }
    .footer-bottom { flex-direction: column; gap: 8px; }
    .language-panel { position: fixed; top: 68px; left: 16px; right: 16px; width: auto; max-width: 420px; margin-left: auto; }
    .page-editor .language-panel { position: absolute; top: calc(100% + 4px); left: auto; right: 0; width: min(360px, calc(100vw - 24px)); }
    .workspace-title { font-size: .75rem; }
    .workspace-bar { gap: 6px; padding-inline: 8px; }
    .workspace-actions { position: relative; gap: 4px; }
    .workspace-actions .language-menu, .workspace-help { position: static; }
    .workspace-actions .language-menu summary { min-width: 32px; gap: 3px; }
    .workspace-actions .language-menu summary > span:not([aria-hidden]), .workspace-action-label { display: none; }
    .workspace-help-icon { display: inline-block; }
  }
  @media (max-width: 360px) { .brand { font-size: .85rem; gap: 7px; }.language-menu { font-size: .75rem; }.language-menu summary { gap: 5px; } }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; }*, *::before, *::after { transition: none !important; animation: none !important; } }
}
