body { padding-bottom: 64px; font-size: 16px; line-height: 1.55; }
.skip-link { padding: 7px 11px; }
.skip-link:focus { top: 12px; }

.page-shell { width: min(1560px, calc(100% - 44px)); margin-inline: auto; padding-top: 26px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 22px; padding: 10px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; }
.toolbar label { display: flex; align-items: center; gap: 7px; color: var(--muted-strong); }
.search-control { flex: 1 1 360px; }
.search-control input { width: min(100%, 560px); }
input[type="search"], select { height: 32px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 0; outline: none; background: var(--paper); font-size: 13px; }
input[type="search"]:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
kbd { padding: 1px 5px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 11px/1.5 var(--mono); }
.toolbar-separator { width: 1px; height: 25px; background: var(--line); }
button { padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper); font-size: 13px; font-variant: small-caps; letter-spacing: .35px; }
button:hover { background: var(--surface); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.text-button { padding-inline: 3px; border-color: transparent; background: none; color: var(--blue); }
.toolbar-reset { margin-left: auto; }
.filter-toggle { display: none; }
.filter-toggle span { color: var(--blue); font-family: var(--mono); font-size: 11px; }

.archive { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.filters { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow-y: auto; padding: 0 16px 12px 0; border-right: 1px solid var(--line); scrollbar-width: thin; }
.filter-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 0 8px; border-bottom: 1px solid var(--line); }
.filter-heading h2 { margin: 0; font-size: 15px; font-variant: small-caps; font-weight: 600; letter-spacing: .4px; }
.drawer-close { display: none; }
#filter-groups { padding-top: 7px; }
.filter-option { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: start; gap: 6px; margin: 6px 0; color: var(--muted-strong); cursor: pointer; font-size: 12.5px; line-height: 1.3; user-select: none; }
.filter-option input { position: absolute; opacity: 0; pointer-events: none; }
.fake-check { position: relative; width: 15px; height: 15px; border: 1px solid var(--line-strong); background: var(--paper); }
.filter-option:hover .fake-check { border-color: var(--blue); }
.filter-option input:checked + .fake-check { border-color: var(--blue); background: var(--blue); }
.filter-option input:checked + .fake-check::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.filter-option input:focus-visible + .fake-check { outline: 2px solid var(--blue); outline-offset: 1px; }
.option-count { color: var(--faint); font: 10px/1.5 var(--mono); }
.results { min-width: 0; }
.active-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; margin-bottom: 10px; }
.active-chips:empty { display: none; }
.chip { padding: 3px 7px; border-color: var(--line-strong); color: var(--blue); font-family: var(--serif); font-size: 11px; font-variant: normal; letter-spacing: 0; }

.puzzle-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.puzzle-table th { padding: 8px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); background: var(--surface); color: var(--muted-strong); font-size: 12px; font-variant: small-caps; font-weight: 600; letter-spacing: .35px; text-align: left; }
.puzzle-table th:first-child { width: 39%; }
.puzzle-table th:nth-child(2) { width: 43%; }
.puzzle-table th:nth-child(3) { width: 145px; }
.puzzle-table th:last-child { width: 44px; }
.puzzle-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.puzzle-table tbody tr:hover { background: var(--surface); }
.puzzle-name { color: var(--ink); font-size: 16px; font-weight: 600; text-decoration: none; }
.puzzle-name:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.row-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.type-tag { display: inline-block; padding: 2px 6px; border: 1px solid var(--line-strong); background: var(--surface-blue); color: var(--blue-dark); font-family: var(--serif); font-size: 10.5px; font-variant: normal; letter-spacing: 0; line-height: 1.45; text-decoration: none; }
button.type-tag:hover, a.type-tag:hover { border-color: var(--blue); background: var(--surface-blue); }
.puzzle-table time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.row-arrow { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; color: var(--blue); font-family: var(--mono); text-decoration: none; }
.row-arrow:hover { background: var(--surface-blue); }
.puzzle-cards { display: none; }
.empty-state { padding: 70px 20px; border-top: 1px solid var(--line); text-align: center; }
.empty-state p { color: var(--muted); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .2); }

.detail-shell { width: min(1060px, calc(100% - 44px)); margin-inline: auto; padding-top: 28px; }
.detail-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-nav a { color: var(--muted); text-decoration: none; }
.detail-nav a:hover { color: var(--blue); }
.puzzle-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 34px 0 12px; }
.puzzle-header h1 { margin: 0 0 4px; font-size: clamp(28px, 4vw, 46px); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.puzzle-header time { color: var(--muted); font-size: 13px; }
.source-link { flex: none; padding: 8px 11px; border: 1px solid var(--line-strong); color: var(--blue); font-size: 12px; text-decoration: none; }
.source-link:hover { border-color: var(--blue); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 26px; border-bottom: 1px solid var(--line); }
.puzzle-content { max-width: 900px; padding: 38px 0 20px; font-size: 18px; line-height: 1.72; }
.puzzle-content a { color: var(--blue); text-underline-offset: 3px; }
.puzzle-content img { display: block; width: auto; max-width: 100%; height: auto; margin: 30px auto; border: 1px solid var(--line); background: #fff; padding: 12px; }
.puzzle-content table { max-width: 100%; border-collapse: collapse; }
.puzzle-content td, .puzzle-content th { padding: 6px 9px; border: 1px solid var(--line); }
.puzzle-content hr { margin: 34px 0; border: 0; border-top: 1px solid var(--line); }
.puzzle-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 50px; padding-top: 20px; border-top: 1px solid var(--line); }
.puzzle-pagination a { display: grid; gap: 4px; color: var(--ink); font-size: 17px; text-decoration: none; }
.puzzle-pagination a:last-child { justify-self: end; text-align: right; }
.puzzle-pagination a span { color: var(--faint); font-size: 10px; font-variant: small-caps; letter-spacing: .5px; }
.puzzle-pagination a:hover { color: var(--blue); }
.not-found { padding-top: 80px; }

@media (max-width: 780px) {
  .page-shell, .detail-shell { width: min(100% - 28px, 1060px); }
  .page-shell { padding-top: 14px; }
  .toolbar { gap: 9px; margin-bottom: 14px; }
  .search-control { order: -2; flex-basis: 100%; }
  .search-control input { flex: 1; width: 0; }
  .toolbar-separator, kbd { display: none; }
  .filter-toggle { display: inline-block; }
  .toolbar-reset { margin-left: 0; }
  .archive { display: block; }
  .filters { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(320px, 88vw); max-height: none; padding: 18px 20px 30px; border: 0; background: var(--paper); box-shadow: 4px 0 18px rgb(0 0 0 / .14); transform: translateX(-105%); transition: transform .18s ease; }
  .filters.is-open { transform: translateX(0); }
  .drawer-close { display: inline-block; padding: 0 6px; border: 0; font-size: 22px; }
  .puzzle-table-wrap { display: none; }
  .puzzle-cards { display: grid; }
  .puzzle-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
  .puzzle-card .row-tags { grid-column: 1 / -1; }
  .puzzle-card time { color: var(--muted); font-size: 12px; }
  .puzzle-header { align-items: start; padding-top: 26px; }
  .puzzle-header h1 { font-size: 30px; }
  .puzzle-content { padding-top: 28px; font-size: 17px; }
  .puzzle-content img { padding: 6px; }
  .puzzle-pagination { grid-template-columns: 1fr; }
  .puzzle-pagination a:last-child { justify-self: start; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .filters { transition: none; }
}
