@layer reset, app;

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

@layer app {
  :root {
    color-scheme: light;
    --background: #f4f6f8;
    --paper: #fff;
    --ink: #172338;
    --subtle: #53627a;
    --accent: #284f85;
    --tint: #edf2f8;
    --line: #d8e0e9;
    --input-line: #8b99ad;
    --focus: #205faa;
    --error: #9b231d;
    --radius: 10px;
    font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  }

  body { background: var(--background); color: var(--ink); line-height: 1.55; min-width: 0; }
  .shell { width: min(1110px, calc(100% - 64px)); margin-inline: auto; }
  .site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
  .header-inner { display: flex; justify-content: space-between; gap: 14px; align-items: stretch; min-height: 66px; }
  .wordmark { display: flex; gap: 10px; align-items: center; width: max-content; font-size: 1rem; font-weight: 740; white-space: nowrap; text-decoration: none; }
  .mark { display: flex; width: 27px; height: 27px; align-items: flex-end; justify-content: center; gap: 2px; padding: 7px 5px; border-radius: 6px; background: var(--accent); }
  .mark i { display: block; width: 3px; height: 5px; border-radius: 1px; background: #fff; }
  .mark i:nth-child(2) { height: 9px; }
  .mark i:nth-child(3) { height: 13px; }
  .version { color: var(--subtle); font-size: .76rem; font-weight: 600; margin-inline-start: 2px; }
  nav { display: flex; align-items: stretch; gap: 24px; overflow-x: auto; }
  nav a { display: flex; align-items: center; border-bottom: 2px solid transparent; padding-block: 9px 7px; color: var(--subtle); font-size: .9rem; white-space: nowrap; font-weight: 610; text-decoration: none; }
  nav a:hover, nav a[aria-current="page"] { color: var(--accent); }
  nav a[aria-current="page"] { border-color: var(--accent); }
  main { padding-block: 46px 40px; min-height: min(700px, 78vh); }
  .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
  h1 { font-size: clamp(1.85rem, 4vw, 2.75rem); font-weight: 740; line-height: 1.13; letter-spacing: -.04em; text-wrap: balance; }
  .page-heading p, .section-heading p { color: var(--subtle); margin-top: 8px; }
  h2 { font-size: 1.42rem; line-height: 1.26; letter-spacing: -.025em; }
  h3 { font-size: 1.05rem; line-height: 1.3; }
  .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
  .task-panel { padding: 24px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 19px 36px; }
  .field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  label, legend { font-size: .91rem; font-weight: 650; }
  fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
  legend { padding: 0; margin-bottom: 6px; }
  input:not([type="checkbox"], [type="radio"]), textarea, select { width: 100%; min-width: 0; border: 1px solid var(--input-line); border-radius: 6px; background: var(--paper); color: var(--ink); padding: 8px 10px; }
  input:not([type="checkbox"], [type="radio"]), select { min-height: 42px; }
  textarea { resize: vertical; }
  input::placeholder, textarea::placeholder { color: var(--subtle); opacity: 1; }
  input[type="checkbox"] { accent-color: var(--accent); margin: 0; width: 17px; height: 17px; }
  .compare-settings { display: grid; gap: 12px; align-content: start; }
  .segments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--input-line); border-radius: 6px; }
  .segments label { display: grid; position: relative; min-width: 0; }
  .segments label + label { border-left: 1px solid var(--input-line); }
  .segments input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
  .segments span { display: grid; place-items: center; min-height: 40px; border-radius: 5px; color: var(--subtle); }
  .segments input:checked + span { color: var(--accent); background: var(--tint); }
  :focus-visible, .segments input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; }
  .segments input:focus-visible + span { outline-offset: -3px; }
  .token-fields, .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .task-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
  .filters { display: flex; gap: 18px; flex-wrap: wrap; }
  .filters label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 30px; }
  #flexible-help { grid-column: 1 / -1; margin-top: -9px; }
  .button, .text-button { cursor: pointer; font-weight: 660; font-size: .89rem; }
  .button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid transparent; padding: 8px 13px; min-height: 42px; border-radius: 6px; text-decoration: none; text-align: center; }
  .primary { color: #fff; background: var(--accent); }
  .primary:hover { background: #1c3e6e; }
  .secondary { color: var(--accent); background: var(--paper); border-color: var(--input-line); }
  .secondary:hover { background: var(--tint); }
  button:disabled { opacity: .65; cursor: wait; }
  .text-button { border: 0; padding: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; min-height: 30px; text-align: left; }
  .example-button { justify-self: start; }
  .status { color: var(--subtle); font-size: .86rem; }
  .status[data-error="true"] { color: var(--error); }
  .catalog-status { margin: -8px 0 15px; }
  .content-section { margin-top: 29px; }
  .section-heading { margin-bottom: 13px; }
  .section-heading p { font-size: .9rem; margin-top: 5px; }
  .comparison { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; }
  .comparison-card { min-width: 0; padding: 19px; display: grid; grid-template-rows: subgrid; grid-row: span 5; gap: 0; }
  .comparison-card + .comparison-card { border-left: 1px solid var(--line); }
  .comparison-card.highlight { background: #f2f5f9; }
  .model-heading { min-width: 0; padding-bottom: 14px; }
  .model-heading h3 { font-size: 1.25rem; overflow-wrap: anywhere; font-weight: 745; letter-spacing: -.02em; }
  .model-heading p { margin-top: 5px; overflow-wrap: anywhere; }
  .tag { font-size: .77rem; font-weight: 650; color: var(--accent); padding-bottom: 8px; }
  .metric { padding-block: 9px; border-top: 1px solid var(--line); min-width: 0; }
  .metric strong { display: block; font-size: 1.14rem; font-variant-numeric: tabular-nums; }
  .metric small { display: block; color: var(--subtle); }
  .comparison-actions { display: flex; gap: 7px 14px; flex-wrap: wrap; padding-top: 9px; border-top: 1px solid var(--line); }
  #estimate-note { margin-top: 9px; }
  .small, .small a { font-size: .83rem; }
  .subtle { color: var(--subtle); }
  .catalog-panel { margin-top: 25px; }
  summary { cursor: pointer; padding: 13px 16px; font-weight: 670; }
  summary span { color: var(--subtle); font-size: .83rem; font-weight: 500; margin-left: 5px; }
  .catalog-content, .search-panel, .notebook-panel { padding: 18px; display: grid; gap: 10px; justify-items: start; }
  .catalog-content > *, .search-panel > *, .notebook-panel > * { width: 100%; }
  .catalog-content .button, .notebook-panel .button { width: auto; }
  .inline-form { display: flex; gap: 10px; }
  .inline-form .button { flex: none; }
  .model-list { padding: 0; list-style: none; }
  .model-list:empty { display: none; }
  .model-list li, .saved-note { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .model-list li:last-child, .saved-note:last-child { border-bottom: none; }
  .row-actions { display: flex; flex: none; align-items: center; flex-wrap: wrap; gap: 7px 14px; }
  .source-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .list-panel, .empty { padding: 16px 18px; }
  .saved-note p { white-space: pre-wrap; }
  #notebook-content, #saved-tests + div { margin-top: 12px; }
  .site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; padding-block: 17px 25px; border-top: 1px solid var(--line); color: var(--subtle); font-size: .82rem; }
  .site-footer a { text-underline-offset: 3px; }
  .sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .skip-link:focus { display: block; position: absolute; z-index: 2; background: var(--paper); padding: 10px; left: 10px; top: 10px; }

  @media (max-width: 750px) {
    .shell { width: calc(100% - 36px); }
    .header-inner { flex-direction: column; gap: 4px; padding-top: 11px; }
    nav { gap: 19px; }
    nav a { min-height: 41px; }
    main { padding-top: 29px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
    .task-panel { grid-template-columns: minmax(0, 1fr); padding: 17px; gap: 13px; }
  }
  @media (max-width: 610px) {
    .comparison { grid-template-columns: minmax(0, 1fr); }
    .comparison-card { grid-row: auto; grid-template-rows: none; }
    .comparison-card + .comparison-card { border-left: 0; border-top: 1px solid var(--line); }
    .model-list li, .saved-note { align-items: flex-start; flex-direction: column; gap: 2px; }
  }
  @media (max-width: 370px) {
    .shell { width: calc(100% - 28px); }
    nav { gap: 14px; }
    .inline-form { flex-wrap: wrap; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
  }
}
