:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color-scheme: light;
  color: var(--text);
  background: var(--page);
  --page: #f7f7f8;
  --surface: #ffffff;
  --soft: #f0f0f3;
  --text: #242428;
  --muted: #686872;
  --line: #e2e2e7;
  --input-line: #c9c9d2;
  --input-bg: #ffffff;
  --accent: #5b4de3;
  --accent-soft: #f0edff;
  --primary: #5b4de3;
  --primary-text: #ffffff;
  --primary-hover: #4b3cc9;
  --link: #5946c5;
  --error: #a7303b;
  --error-bg: #fff1f1;
  --info-bg: #f0edff;
  --info-ink: #51458a;
  --shadow: 0 3px 12px #18181b04;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #1c1c1f;
  --surface: #242427;
  --soft: #2c2c31;
  --text: #f4f4f5;
  --muted: #afafb9;
  --line: #39393f;
  --input-line: #55555f;
  --input-bg: #202023;
  --accent: #a6a0ff;
  --accent-soft: #302d46;
  --primary: #6255e8;
  --primary-text: #ffffff;
  --primary-hover: #5748db;
  --link: #b3adff;
  --error: #ffb1b9;
  --error-bg: #3b2228;
  --info-bg: #302d46;
  --info-ink: #d1caff;
  --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; line-height: 1.5; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; outline-offset: 4px; }
:focus-visible { outline: 3px solid var(--accent); }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.5rem, 2.5vw, 2rem); letter-spacing: -.035em; line-height: 1.2; margin-bottom: 0; font-weight: 650; }
h2 { font-size: 1rem; line-height: 1.4; margin: 0; font-weight: 650; letter-spacing: -.025em; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1520px; margin: auto; min-height: 80px; padding: 16px 36px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: 1.5rem; font-weight: 750; letter-spacing: -.04em; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { flex-shrink: 0; border-radius: 10px; }
.brand-context { font-size: .75rem; letter-spacing: 0; font-weight: 450; color: var(--muted); border-left: 1px solid var(--line); padding-left: 16px; margin-left: 5px; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.refresh-meta { text-align: right; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.refresh-meta time { display: block; font-variant-numeric: tabular-nums; color: var(--text); }
.button { min-height: 42px; padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: .875rem; line-height: 1.3; font-weight: 600; transition: background-color .15s, border-color .15s; }
.primary { background: var(--primary); color: var(--primary-text); }
.primary:hover:enabled { background: var(--primary-hover); }
.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.secondary:hover:enabled { background: var(--soft); border-color: var(--input-line); }
.full { width: 100%; }
main { max-width: 1520px; margin: auto; padding: 30px 36px 0; }
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.display-settings { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 18px; }
.visibility-toggle { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-weight: 450; font-size: .875rem; cursor: pointer; }
.visibility-toggle input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.theme-setting select { width: 112px; min-height: 38px; padding: 7px 10px; font-size: .875rem; background: var(--surface); }
.setting-error { width: 100%; text-align: right; color: var(--error); font-size: .75rem; }
.app-layout { display: grid; grid-template-columns: 296px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.handles-panel, .random-panel { padding: 22px; }
.panel-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.section-icon { flex: 0 0 20px; color: var(--muted); }
fieldset { margin: 0; border: 0; padding: 0; min-width: 0; }
label, legend { display: block; font-size: .875rem; font-weight: 550; margin-bottom: 7px; }
input:not([type=radio]):not([type=checkbox]), select { width: 100%; min-height: 42px; min-width: 0; background: var(--input-bg); border: 1px solid var(--input-line); border-radius: 7px; padding: 9px 11px; color: var(--text); font-size: 1rem; }
select { text-overflow: ellipsis; padding-right: 24px; }
input::placeholder { color: var(--muted); opacity: .85; }
input[aria-invalid=true] { border-color: var(--error); }
.field { margin-bottom: 22px; }
.label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.label-row label { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; border-radius: 5px; background: var(--soft); border: 1px solid var(--line); font-size: .875rem; padding: 4px 5px 4px 10px; }
.chip span { overflow-wrap: anywhere; }
.chip button { flex-shrink: 0; color: var(--muted); background: transparent; border: none; padding: 3px 6px; font-size: 1.125rem; line-height: 1; border-radius: 3px; }
.chip button:hover { background: var(--line); }
.add-handle { display: flex; gap: 8px; }
.add-handle .button { padding-inline: 12px; }
.field-error { font-size: .8125rem; color: var(--error); margin: 8px 0 0; }
.mode-options { margin-bottom: 22px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; gap: 3px; }
.mode-switch label { position: relative; margin: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mode-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-switch span { width: 100%; text-align: center; font-size: .8125rem; font-weight: 550; padding: 9px 4px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); }
.mode-switch input:checked + span { background: var(--surface); border-color: var(--line); color: var(--text); box-shadow: var(--shadow); }
.mode-switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }
.random-panel { border-top: 3px solid var(--accent); padding-top: 20px; }
.random-panel .section-icon { color: var(--accent); }
.random-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.random-range > div { min-width: 0; }
.random-panel #pick { margin-top: 16px; }
#random-count { margin: 10px 0 0; }
.recommendation { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 17px; overflow-wrap: anywhere; }
.recommendation > a:first-child { color: var(--text); font-size: 1rem; font-weight: 600; }
.recommendation p { margin: 8px 0; color: var(--muted); font-size: .75rem; }
.recommendation .solution-link { display: inline-block; }
.how-it-works { padding: 0 5px; color: var(--muted); font-size: .8125rem; }
.how-it-works summary { cursor: pointer; padding-block: 4px; font-size: .875rem; }
.how-it-works p { margin: 14px 0 0; line-height: 1.7; }
.how-it-works strong { color: var(--text); font-weight: 600; }
.results-column { min-width: 0; }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 18px; min-height: 28px; }
.results-heading h2 { font-size: 1.125rem; overflow-wrap: anywhere; }
.mode-badge { flex-shrink: 0; font-size: .75rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stat { padding: 18px 22px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat strong { display: block; font-size: 1.875rem; font-weight: 650; letter-spacing: -.055em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: .75rem; color: var(--muted); margin-top: 6px; }
.stat.featured { background: var(--accent-soft); }
.stat.featured strong { color: var(--accent); }
.source-stats { display: flex; flex-wrap: wrap; gap: 5px 16px; margin: 12px 2px 22px; }
.source-stat { font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.source-stat a { font-weight: 600; }
.problem-panel { overflow: hidden; }
.tabs { display: flex; padding: 0 22px; gap: 26px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 18px 0 16px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: .875rem; font-weight: 600; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.tabs span { display: inline-block; font-size: .75rem; background: var(--soft); border-radius: 4px; padding: 1px 6px; margin-left: 5px; font-variant-numeric: tabular-nums; }
.filters { padding: 20px 22px 12px; display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(160px, 1fr) minmax(120px, .8fr) minmax(155px, 1fr); gap: 12px; align-items: end; }
.filters > div { min-width: 0; }
.filters label { color: var(--muted); font-size: .75rem; font-weight: 500; }
.filters input, .filters select { font-size: .875rem; min-height: 40px; }
.filter-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-pair > div { min-width: 0; }
.list-caption { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px 16px; }
.list-caption p { color: var(--muted); font-size: .75rem; margin: 0; }
.text-button { border: none; background: transparent; color: var(--link); font-size: .8125rem; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 18px; color: var(--muted); font-size: .75rem; font-weight: 500; border-block: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
td { padding: 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--soft); }
.number-cell { width: 42px; padding-left: 22px; padding-right: 0; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
td.number-cell { padding-top: 22px; }
.problem-title { color: var(--text); font-size: .9375rem; font-weight: 550; line-height: 1.5; overflow-wrap: anywhere; }
.problem-id { display: inline-block; margin-right: 8px; color: var(--muted); font-size: .8125rem; font-weight: 450; font-variant-numeric: tabular-nums; }
.problem-links { display: flex; flex-wrap: wrap; gap: 4px 13px; margin-top: 5px; }
.solution-link { font-size: .75rem; color: var(--link); }
.problem-tags { margin-top: 6px; font-size: .75rem; color: var(--muted); }
.rating { display: inline-block; font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; border-radius: 5px; padding: 3px 7px; background: var(--soft); border: 1px solid var(--line); }
.rating.unrated { color: var(--muted); font-weight: 400; }
.date-cell { font-size: .75rem; color: var(--text); white-space: nowrap; padding-top: 21px; }
.date-cell small { display: block; color: var(--muted); font-size: .75rem; margin-top: 5px; max-width: 160px; white-space: normal; overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 15px 22px; }
.pagination > span { color: var(--muted); font-size: .75rem; }
.pagination > div { display: flex; gap: 8px; }
.pagination .button { font-size: .8125rem; min-height: 38px; padding: 8px 13px; }
.notice, .progress-panel { padding: 16px 18px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 20px; font-size: .875rem; }
.notice strong { display: block; margin-bottom: 4px; }
.notice .text-button { margin-left: 12px; }
.error { color: var(--error); background: var(--error-bg); }
.info { color: var(--info-ink); background: var(--info-bg); }
.cache-note { font-size: .8125rem; color: var(--muted); margin: -12px 0 18px; }
.progress-panel { background: var(--surface); }
.progress-panel > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
progress { width: 100%; height: 6px; accent-color: var(--accent); margin-top: 10px; display: block; }
.welcome { min-height: 440px; padding: 48px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.welcome img { margin-bottom: 22px; }
.welcome h2 { font-size: 1.5rem; letter-spacing: -.04em; }
.welcome p { max-width: 410px; color: var(--muted); margin: 12px 0 0; font-size: .9375rem; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state strong { font-size: 1.125rem; }
.empty-state p { font-size: .875rem; color: var(--muted); margin: 10px auto 0; max-width: 430px; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 0; margin-top: 30px; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); }
footer > span { font-weight: 600; }
footer a { color: var(--muted); }
.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; top: -80px; left: 16px; z-index: 10; background: var(--primary); color: var(--primary-text); padding: 10px 16px; border-radius: 6px; }
.skip-link:focus { top: 12px; }
@media (max-width: 1250px) {
  .header-inner { padding-inline: 28px; }
  main { padding-inline: 28px; }
  .app-layout { grid-template-columns: 276px minmax(0, 1fr); gap: 22px; }
  .handles-panel, .random-panel { padding-inline: 20px; }
  .filters { grid-template-columns: minmax(140px, 1fr) minmax(160px, 1fr); }
  .stat { padding: 17px 16px; }
}
@media (max-width: 980px) {
  .brand-context { display: none; }
  .app-layout { grid-template-columns: 1fr; gap: 26px; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 18px; }
  .how-it-works { grid-column: 1 / -1; }
  .page-toolbar { flex-wrap: wrap; }
  .display-settings { justify-content: flex-start; }
  .random-panel { align-self: stretch; }
}
@media (max-width: 600px) {
  .header-inner { min-height: 72px; padding: 14px 18px; flex-wrap: wrap; gap: 8px 14px; }
  .header-actions { display: contents; }
  .refresh-meta { order: 3; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 2px 6px; text-align: left; }
  .refresh-meta time { min-width: 0; overflow-wrap: anywhere; }
  .brand { font-size: 1.375rem; margin-right: auto; }
  main { padding: 24px 18px 0; }
  .page-toolbar { gap: 18px; margin-bottom: 24px; }
  .display-settings { width: 100%; gap: 12px; justify-content: space-between; }
  .visibility-toggle { font-size: .8125rem; }
  .theme-setting { margin-left: auto; }
  .theme-setting select { width: 100px; }
  .sidebar { grid-template-columns: 1fr; gap: 16px; }
  .handles-panel, .random-panel { padding: 20px; }
  .panel-heading { margin-bottom: 18px; }
  .field, .mode-options { margin-bottom: 18px; }
  .random-panel { padding-top: 18px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 16px 18px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .results-heading h2 { font-size: 1rem; }
  .results-heading { gap: 10px; }
  .filters { padding: 18px 16px 10px; gap: 14px 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .search-field { grid-column: 1 / -1; }
  .filter-pair { grid-column: 1 / -1; }
  .filters input, .filters select { font-size: 1rem; }
  .tabs { padding-inline: 16px; gap: 22px; }
  .tabs button { font-size: .8125rem; }
  .tabs span { margin-left: 3px; }
  .list-caption { padding-inline: 16px; gap: 10px; }
  table { min-width: 520px; }
  th, td { padding-inline: 14px; }
  .number-cell { padding-left: 16px; }
  .problem-title { font-size: .875rem; }
  .pagination { padding: 14px 16px; gap: 8px; flex-wrap: wrap; }
  .pagination .button { padding-inline: 10px; }
  .welcome { min-height: 310px; padding: 32px 22px; }
  .welcome h2 { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
