@layer reset, base, layout, table, dialog, states, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p { margin: 0; }
  button, input, select { font: inherit; }
  button, select, summary { cursor: pointer; }
  button { color: inherit; }
  [hidden] { display: none !important; }
}

@layer base {
  :root {
    color-scheme: light;
    --ink: #171b25;
    --muted: #586174;
    --line: #dbe0e8;
    --line-strong: #c6ceda;
    --blue: #174fcf;
    --blue-soft: #edf3ff;
    --surface: #fff;
    --tint: #f6f8fb;
    --action-width: 20rem;
    --browser-width: 11.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    color: var(--ink);
    background: #f5f6f9;
    font-synthesis: none;
  }
  body { min-width: 320px; }
  a { color: var(--blue); text-underline-offset: .18em; }
  a:hover { text-decoration-thickness: 2px; }
  button:disabled, input:disabled, select:disabled { cursor: default; opacity: .5; }
  :focus-visible { outline: 3px solid #4c7ee8; outline-offset: 3px; }
  button { border: 0; background: none; }
  .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; z-index: 100; top: .7rem; left: 1rem; transform: translateY(-180%); padding: .75rem 1rem; background: white; border-radius: .4rem; }
  .skip-link:focus { transform: none; }
  .eyebrow { color: var(--muted); font-size: .75rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
  .text-button { padding: .3rem .2rem; font-size: .875rem; font-weight: 550; color: var(--blue); }
  .text-button:hover { text-decoration: underline; text-underline-offset: .2em; }
  .platform { display: inline-flex; padding: .25rem .55rem; background: #e8ecf3; border: 1px solid #d6dce7; border-radius: .35rem; font-size: .8125rem; line-height: 1.25; font-weight: 600; color: #4b5567; }
  kbd { font-family: inherit; }
}

@layer layout {
  main { margin: 0 auto; padding: 1.5rem 1.75rem 1rem; max-width: 2200px; }
  .page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding-bottom: 1.3rem; }
  .title-line { display: flex; align-items: center; gap: .8rem; margin-top: .35rem; }
  h1 { font-size: clamp(1.75rem, 2.4vw, 2.15rem); letter-spacing: -.045em; font-weight: 670; line-height: 1.15; }
  .catalog-summary { color: var(--muted); font-size: .875rem; line-height: 1.5; margin-top: .55rem; }
  .method-button { white-space: nowrap; margin-bottom: .08rem; }
  .method-button span { margin-left: .35rem; }
  .controls { border: 1px solid var(--line-strong); border-radius: .7rem; background: var(--surface); box-shadow: 0 1px 2px #17233806; }
  .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }
  .search-field { flex: 1 1 20rem; display: flex; align-items: center; gap: .65rem; border: 1px solid #bfc9d8; border-radius: .4rem; background: white; min-width: 14rem; max-width: 38rem; padding-left: .8rem; }
  .search-field:focus-within { outline: 3px solid #4c7ee844; border-color: var(--blue); }
  .search-field svg { width: 1.15rem; height: 1.15rem; stroke: #667289; fill: none; stroke-width: 1.6; flex: 0 0 auto; }
  .search-field input { border: 0; background: transparent; width: 100%; min-width: 0; padding: .6rem .7rem .6rem 0; font-size: 1rem; outline: none; color: var(--ink); }
  input::placeholder { color: #677286; opacity: 1; }
  .category-field { display: flex; align-items: center; gap: .65rem; font-size: .875rem; color: var(--muted); }
  .category-field select { padding: .62rem 2rem .62rem .7rem; border: 1px solid #c8d0dc; border-radius: .4rem; background: #fff; color: var(--ink); max-width: 17rem; }
  .emphasis-control { display: flex; align-items: center; gap: .5rem; margin-left: auto; font-size: .875rem; white-space: nowrap; cursor: pointer; }
  input[type="checkbox"] { accent-color: var(--blue); width: 1rem; height: 1rem; margin: 0; flex-shrink: 0; }
  .browser-row { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.1rem; }
  fieldset { border: 0; padding: 0; margin: 0; display: flex; flex: 1; align-items: center; gap: 1rem; min-width: 0; }
  fieldset legend { float: left; font-size: .875rem; color: var(--muted); margin-right: 1rem; line-height: 2.25rem; white-space: nowrap; }
  .browser-options { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
  .browser-choice { display: flex; align-items: center; gap: .4rem; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: .35rem; line-height: 1.3; font-size: .875rem; color: var(--muted); cursor: pointer; }
  .browser-choice:has(input:checked) { background: var(--blue-soft); color: #153d8f; border-color: #cfdbf6; }
  .browser-choice:hover { border-color: #819ed8; }
  .browser-choice input { width: .875rem; height: .875rem; }
  .column-actions { display: flex; gap: .6rem; align-items: center; white-space: nowrap; color: #a5aebd; }
  .comparison-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .95rem .1rem .65rem; }
  #results-summary { font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
  .legend { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; font-size: .75rem; line-height: 1.5; color: var(--muted); }
  .legend-mark { height: .45rem; width: .45rem; background: var(--blue); border-radius: 50%; margin-right: .1rem; }
  .unknown-label { margin-left: .35rem; color: #646b7a; }
  .table-footnote { display: flex; flex-wrap: wrap; gap: .3rem 1rem; color: var(--muted); font-size: .75rem; line-height: 1.5; margin: .7rem .2rem 0; }
  .footnote-context { margin-left: auto; }
}

@layer table {
  .table-container { border: 1px solid var(--line-strong); border-radius: .55rem; background: var(--surface); overflow: auto; max-height: max(24rem, calc(100dvh - 19rem)); min-height: 19rem; scrollbar-color: #aab6c7 #eef1f6; scrollbar-width: auto; overscroll-behavior-inline: contain; }
  .table-container:focus-visible { outline-offset: 2px; }
  table { width: max(100%, calc(var(--action-width) + var(--browser-width) * var(--browser-count, 8))); border-spacing: 0; table-layout: fixed; font-size: .875rem; }
  .action-col { width: var(--action-width); }
  .browser-col { min-width: var(--browser-width); }
  thead th { position: sticky; top: 0; z-index: 3; text-align: left; background: #f0f3f8; border-bottom: 1px solid #c5cede; padding: .75rem 1rem; height: 4.35rem; }
  thead .action-head { left: 0; z-index: 5; box-shadow: 1px 0 0 #cad2df; }
  .action-head-main { display: block; font-size: .8125rem; font-weight: 650; }
  .action-head-sub { display: block; color: var(--muted); font-weight: 400; font-size: .75rem; margin-top: .25rem; }
  .browser-name { font-weight: 650; letter-spacing: -.01em; }
  .browser-meta { display: flex; align-items: baseline; gap: .4rem; font-weight: 400; font-size: .75rem; margin-top: .3rem; color: #5c677b; }
  .browser-source { color: #4d638d; padding: 0; font-size: .75rem; text-decoration: underline; text-underline-offset: .2em; }
  tbody th, tbody td { padding: 1rem; border-bottom: 1px solid #e2e6ed; vertical-align: top; text-align: left; }
  .action-cell { position: sticky; left: 0; z-index: 2; background: white; box-shadow: 1px 0 0 #d8dee8; font-weight: 400; }
  .action-row:hover > * { background-color: #fafbfd; }
  .action-title { font-size: .9375rem; line-height: 1.35; font-weight: 600; letter-spacing: -.008em; }
  .action-description { color: var(--muted); font-size: .875rem; line-height: 1.5; margin-top: .25rem; }
  .category-row th { position: sticky; left: 0; background: #eaf0f9; z-index: 2; padding: .52rem 1rem; color: #40516e; font-size: .75rem; letter-spacing: .045em; font-weight: 650; border-bottom-color: #d3ddec; box-shadow: 1px 0 0 #d3ddec; }
  .category-row td { background: #eaf0f9; padding: .52rem 1rem; border-bottom-color: #d3ddec; color: #697993; font-size: .75rem; }
  .shortcut-variants { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
  .shortcut-variant { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .2rem; max-width: 100%; color: #202938; }
  .shortcut-variant kbd { background: #f6f8fb; border: 1px solid #cdd5e2; border-bottom-width: 2px; border-radius: .3rem; min-width: 1.7rem; min-height: 1.8rem; padding: .25rem .38rem .22rem; display: inline-flex; justify-content: center; align-items: center; font-size: .875rem; font-weight: 500; line-height: 1.1; white-space: normal; overflow-wrap: anywhere; }
  .shortcut-variant .modifier-key { font-size: 1rem; padding-block: .18rem; }
  .key-plus { color: #748198; font-size: .7rem; }
  .shortcut-variant.is-majority kbd { color: #1749b0; border-color: #b6c9ee; background: #f0f5ff; }
  .shortcut-variant.is-different kbd { color: #647082; background: #f8f9fb; border-color: #e0e5ed; font-weight: 400; }
  .shortcut-variant.is-different .key-plus { color: #8490a1; }
  .cell-context { color: #586174; font-size: .75rem; line-height: 1.45; margin-top: .5rem; overflow-wrap: anywhere; }
  .cell-actions { display: flex; flex-wrap: wrap; gap: .2rem .6rem; margin-top: .55rem; align-items: center; font-size: .75rem; }
  .cell-details { color: #51647d; padding: 0; font-size: .75rem; text-decoration: underline; text-underline-offset: .2em; }
  .cell-source { color: #536b95; text-decoration: none; }
  .cell-source:hover { text-decoration: underline; }
  .missing { color: #697384; font-size: .8125rem; line-height: 1.5; padding-top: .3rem; }
  .common-list { display: flex; flex-direction: column; gap: .25rem; margin-top: .65rem; }
  .common-choice { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .4rem; color: #2558b8; font-size: .75rem; line-height: 1.5; }
  .common-label { font-weight: 600; }
  .common-key { font-weight: 500; }
  .common-count { font-variant-numeric: tabular-nums; color: #5474ab; }
  .empty-state { min-height: 22rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .65rem; padding: 2rem; text-align: center; }
  .empty-state h2 { font-size: 1.2rem; font-weight: 600; letter-spacing: -.02em; }
  .empty-state p { color: var(--muted); font-size: .9375rem; line-height: 1.6; max-width: 30rem; }
  .empty-state button { margin-top: .35rem; border: 1px solid #c6d3e8; border-radius: .4rem; padding: .55rem .9rem; color: var(--blue); background: var(--blue-soft); }
  .loading-dot { width: .6rem; height: .6rem; background: #b4c3db; border-radius: 50%; margin-bottom: .5rem; }
}

@layer dialog {
  dialog { width: min(46rem, calc(100vw - 2rem)); max-height: min(88dvh, 58rem); padding: 1.4rem 1.7rem 1.8rem; border: 1px solid #bec9da; border-radius: .8rem; color: var(--ink); box-shadow: 0 20px 80px #182a4733; overflow: auto; }
  dialog::backdrop { background: #1c294663; backdrop-filter: blur(2px); }
  .dialog-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; }
  .close-button { display: grid; place-items: center; width: 2rem; height: 2rem; font-size: 1.65rem; color: #4d5a70; border-radius: .3rem; line-height: 1; }
  .close-button:hover { background: #eaf0f8; }
  dialog h2 { font-size: 1.5rem; font-weight: 620; letter-spacing: -.025em; line-height: 1.25; }
  dialog h3 { font-size: 1rem; font-weight: 650; margin-top: 1.5rem; margin-bottom: .55rem; }
  dialog p, dialog li { font-size: 1rem; line-height: 1.65; color: #4e5b70; }
  dialog p { margin-top: .65rem; }
  dialog ul { margin: .55rem 0 0; padding-left: 1.2rem; }
  dialog li + li { margin-top: .4rem; }
  .dialog-entry { margin-top: 1.25rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
  .dialog-entry .shortcut-variants { flex-direction: row; flex-wrap: wrap; gap: .6rem; margin-bottom: .65rem; }
  .evidence-label { display: inline-flex; padding: .15rem .45rem; border: 1px solid #d6deeb; border-radius: .3rem; background: #f1f5fb; color: #526785; font-size: .75rem; line-height: 1.5; margin-top: .6rem; }
  .source-list { list-style: none; padding: 0; margin: .8rem 0 0; }
  .source-list li { padding: .7rem 0; border-bottom: 1px solid #e5e9ef; }
  .source-list a { overflow-wrap: anywhere; font-size: .875rem; }
  .source-title { display: block; font-size: .875rem; font-weight: 600; color: var(--ink); margin-bottom: .3rem; }
  .source-meta { display: block; font-size: .75rem; line-height: 1.6; color: #6b778b; margin-top: .2rem; }
  .evidence-fields { margin: .7rem 0 0; font-size: .8125rem; line-height: 1.55; }
  .evidence-fields > div { display: grid; grid-template-columns: minmax(6rem, 1fr) minmax(0, 3fr); gap: .5rem; margin: .3rem 0; }
  .evidence-fields dt { color: #63718a; }
  .evidence-fields dd { margin: 0; color: #364660; overflow-wrap: anywhere; white-space: pre-wrap; }
  .evidence-fields code { font-size: .75rem; }
  .evidence-fields .evidence-fields { margin-top: 0; }
  .evidence-fields ul { margin-top: 0; }
  .evidence-fields li { font-size: .8125rem; }
  .entry-evidence { margin-top: .85rem; padding: .65rem .8rem; background: #f6f8fc; border: 1px solid #dbe3ef; border-radius: .4rem; }
  .entry-evidence summary { font-size: .875rem; color: #365e9d; }
  .coverage-block { margin-top: 1.25rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .5rem; background: #f8faff; }
  .coverage-block h3 { margin-top: 0; }
  .coverage-block p { font-size: .875rem; }
  .coverage-block button { padding: 0; margin-top: .6rem; }
  .method-note { padding-left: .8rem; border-left: 3px solid #8aa9e5; }
}

@layer states {
  .no-script { position: fixed; inset: 1rem; display: grid; place-content: center; gap: 1rem; padding: 2rem; background: white; z-index: 50; text-align: center; }
  @media (prefers-reduced-motion: no-preference) { dialog[open] { animation: appear 120ms ease-out; } @keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } } }
}

@layer responsive {
  @media (min-width: 1800px) { :root { --browser-width: 12rem; --action-width: 21rem; } }
  @media (max-width: 1180px) {
    .filter-row { gap: .7rem; }
    .search-field { flex-basis: 16rem; }
    .category-field span { display: none; }
    .browser-row { align-items: flex-end; }
    fieldset { display: block; }
    fieldset legend { float: none; line-height: 1.5; margin-bottom: .5rem; }
    .comparison-meta { align-items: flex-start; }
    .legend { max-width: 33rem; justify-content: flex-end; }
    .table-container { max-height: max(24rem, calc(100dvh - 21rem)); }
  }
  @media (max-width: 760px) {
    :root { --action-width: 15rem; --browser-width: 11rem; }
    main { padding: 1.1rem .8rem; }
    .page-header { align-items: flex-start; padding-bottom: 1rem; }
    .title-line { flex-wrap: wrap; gap: .5rem; }
    h1 { font-size: 1.65rem; }
    .method-button { font-size: .75rem; white-space: normal; max-width: 5.4rem; line-height: 1.5; margin-top: 1.6rem; }
    .filter-row { padding: .8rem; }
    .search-field { flex-basis: 100%; max-width: none; }
    .category-field { flex: 1; }
    .category-field select { max-width: 12rem; width: 100%; font-size: .8125rem; }
    .emphasis-control { font-size: .8125rem; }
    .browser-row { padding: .7rem .8rem; gap: .65rem; }
    .browser-choice { padding: .4rem .45rem; font-size: .8125rem; }
    .column-actions { flex-direction: column; gap: .1rem; align-items: flex-end; }
    .column-actions > span { display: none; }
    .text-button { font-size: .8125rem; }
    .comparison-meta { flex-direction: column; gap: .35rem; margin-top: .8rem; }
    .legend { justify-content: flex-start; font-size: .75rem; max-width: none; }
    .footnote-context { margin-left: 0; width: 100%; }
    .table-container { max-height: 68dvh; min-height: 22rem; }
    tbody th, tbody td, thead th { padding: .8rem; }
    .action-description { font-size: .875rem; }
    .category-row th, .category-row td { padding-inline: .8rem; }
    dialog { padding: 1rem 1.1rem 1.4rem; }
  }
  @media (max-width: 460px) { :root { --action-width: 11.2rem; --browser-width: 10.6rem; } .action-title { font-size: .875rem; } .action-description { font-size: .875rem; } .common-choice { gap: .1rem .35rem; } }
  @media print {
    main { padding: 0; }
    .controls, .method-button, .comparison-meta, .cell-actions, dialog, .table-footnote { display: none; }
    .table-container { overflow: visible; max-height: none; border: 0; }
    table { width: 100%; font-size: 8pt; }
    thead { display: table-header-group; }
    thead th, .action-cell, .category-row th { position: static; }
    .action-col { width: 18%; }
    tbody th, tbody td, thead th { padding: .4rem; }
    tr { break-inside: avoid; }
    .action-title, .action-description, .shortcut-variant kbd { font-size: 8pt; }
  }
}
