:root {
  --navy: #0f172a;
  --navy-2: #172554;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --teal: #0f766e;
  --teal-light: #ccfbf1;
  --ink: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --soft: #f8fafc;
  --blue-soft: #eff6ff;
  --amber-soft: #fef3c7;
  --amber: #92400e;
  --radius: 16px;
  --shadow: 0 10px 35px rgba(15, 23, 42, .08);
  --container: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.65; }
img { max-width: 100%; height: auto; }
a { color: var(--blue-dark); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--teal); }
button, input, select, textarea { font: inherit; }
button, .button-primary, .button-secondary { min-height: 44px; }
h1, h2, h3 { margin: 0 0 .65rem; color: var(--navy); line-height: 1.18; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2.15rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
.container { width: min(calc(100% - 2rem), var(--container)); margin-inline: auto; }
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-tint { background: var(--soft); border-block: 1px solid var(--line); }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 100; transform: translateY(-150%); padding: .75rem 1rem; border-radius: 8px; background: var(--navy); color: white; }
.skip-link:focus { transform: 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; }

.site-header { position: relative; z-index: 10; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--navy); font-size: 1.15rem; text-decoration: none; white-space: nowrap; }
.brand-mark { position: relative; width: 36px; height: 36px; flex: 0 0 36px; border: 3px solid var(--blue); border-radius: 50%; background: linear-gradient(135deg, var(--blue-soft), white); }
.brand-mark::after { content: ""; position: absolute; width: 13px; height: 3px; right: -9px; bottom: 0; transform: rotate(45deg); border-radius: 3px; background: var(--teal); }
.primary-nav { display: flex; align-items: center; gap: clamp(.8rem, 2vw, 1.5rem); }
.primary-nav a { color: var(--ink); font-size: .92rem; font-weight: 650; text-decoration: none; }
.primary-nav .nav-cta { padding: .62rem 1rem; border-radius: 999px; background: var(--blue); color: white; }
.primary-nav .nav-cta:hover { background: var(--blue-dark); color: white; }

.hero { overflow: hidden; position: relative; padding: clamp(4.25rem, 9vw, 7.5rem) 0; background: radial-gradient(circle at 82% 15%, rgba(45,212,191,.2), transparent 28%), radial-gradient(circle at 15% 85%, rgba(96,165,250,.18), transparent 32%), linear-gradient(135deg, #0f172a, #172554 62%, #123c5a); color: white; }
.hero::after { content: ""; position: absolute; inset: 0; opacity: .12; background-image: linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; max-width: 820px; text-align: center; }
.hero h1 { color: white; }
.hero-copy { max-width: 690px; margin: 0 auto 2rem; color: #dbeafe; font-size: clamp(1.05rem, 2vw, 1.25rem); }
.eyebrow { margin-bottom: .55rem; color: var(--teal); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero .eyebrow { color: #5eead4; }
.search-form { display: flex; gap: .65rem; }
.search-form input, .search-form select { min-width: 0; padding: .78rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--navy); }
.search-form input { flex: 1; }
.search-form button, .button-primary { display: inline-flex; align-items: center; justify-content: center; padding: .75rem 1.15rem; border: 0; border-radius: 10px; background: var(--blue); color: white; font-weight: 750; text-decoration: none; cursor: pointer; }
.search-form button:hover, .button-primary:hover { background: var(--blue-dark); color: white; }
.search-form-large { max-width: 720px; margin: 0 auto; padding: .45rem; border-radius: 14px; background: white; box-shadow: 0 18px 50px rgba(0,0,0,.2); }
.search-form-large input { border: 0; }
.hero-actions { display: flex; justify-content: center; gap: 1.25rem; margin-top: 1.2rem; }
.hero-actions a { color: #dbeafe; font-size: .9rem; }
.utility-search { padding: .8rem 0; background: var(--soft); border-bottom: 1px solid var(--line); }
.utility-search .search-form { max-width: 720px; }

.stats-strip { border-bottom: 1px solid var(--line); background: white; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats-grid > div { padding: 1.4rem clamp(1rem, 3vw, 2.5rem); text-align: center; }
.stats-grid > div + div { border-left: 1px solid var(--line); }
.stats-grid strong, .stats-grid span { display: block; }
.stats-grid strong { color: var(--navy); font-size: 1.12rem; }
.stats-grid span { color: var(--muted); font-size: .85rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; }
.section-heading.compact { margin-bottom: 1rem; }
.text-link { font-weight: 750; }
.panel, .about-card, .sidebar-card, .detail-card { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.panel { padding: clamp(1rem, 3vw, 2rem); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 2rem; align-items: start; }
.about-card { padding: clamp(1.35rem, 3vw, 2rem); }
.button-secondary { display: inline-flex; align-items: center; justify-content: center; padding: .7rem 1rem; border: 1px solid #bfdbfe; border-radius: 10px; background: var(--blue-soft); color: var(--blue-dark); font-weight: 750; text-decoration: none; }
.button-secondary:hover { border-color: var(--blue); background: white; }
.button-small { min-height: 38px; padding: .45rem .75rem; font-size: .85rem; }

/* Compatibility styling for category HTML generated by the legacy Perl routine. */
.category-output table { width: 100% !important; border: 0 !important; border-collapse: separate; border-spacing: 0; }
.category-output > table > tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.category-output > table > tbody > tr > td { display: block; width: auto !important; min-width: 0; padding: 0 !important; color: var(--muted); font: inherit !important; line-height: 2; }
.category-output font, .category-output .headline { color: inherit !important; font: inherit !important; }
.category-output strong > a { color: var(--navy); font-size: 1.05rem; text-decoration: none; }
.category-output strong > a:hover { color: var(--blue); }
.category-output img { display: none; }
.category-output a { margin-right: .35rem; }

.breadcrumbs { margin-bottom: 1.5rem; color: var(--muted); font-size: .88rem; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span { margin-inline: .45rem; }
.page-header { max-width: 760px; margin-bottom: 2rem; }
.page-header h1 { font-size: clamp(2rem, 4vw, 3rem); }
.page-header > p:last-child { color: var(--muted); font-size: 1.08rem; }
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2rem; align-items: start; }
.content-section + .content-section { margin-top: 2rem; }
.sidebar { display: grid; gap: 1rem; position: sticky; top: 1rem; }
.sidebar-card { padding: 1.25rem; box-shadow: none; }
.sidebar-card h2 { font-size: 1.05rem; }
.sidebar-card nav { display: grid; gap: .7rem; }
.sidebar-cta { background: linear-gradient(145deg, var(--blue-soft), white); }
.results-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-block: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.results-toolbar strong { color: var(--navy); }
.results-toolbar span { margin-left: .6rem; }
.results-toolbar-bottom { margin-top: 1rem; }
.pagination a, .pagination strong { display: inline-flex; min-width: 34px; min-height: 34px; align-items: center; justify-content: center; margin: .1rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.related-panel h2 { font-size: 1.2rem; }
.related-list { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin: 0; padding-left: 1.2rem; }

.listing-stack, .latest-listing { display: grid; gap: 1rem; }
.listing-stack { margin-top: 1rem; }
.listing-card { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; background: white; }
.listing-card:hover { border-color: #bfdbfe; box-shadow: 0 8px 25px rgba(37,99,235,.08); }
.listing-main { min-width: 0; }
.listing-main p { margin-bottom: .45rem; color: var(--ink); }
.listing-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.listing-title-row h3 { margin: 0; }
.listing-title-row h3 a { text-decoration: none; }
.badges { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.badge { display: inline-flex; align-items: center; padding: .15rem .48rem; border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.badge-new { background: var(--teal-light); color: #115e59; }
.badge-popular { background: #ede9fe; color: #6d28d9; }
.badge-pick { background: var(--amber-soft); color: var(--amber); }
.display-url { display: block; overflow: hidden; color: var(--teal); font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.listing-meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .65rem; color: var(--muted); font-size: .78rem; }
.rating-image img { vertical-align: middle; }
.listing-actions { display: grid; gap: .55rem; flex: 0 0 auto; text-align: center; }
.listing-card-featured { box-shadow: var(--shadow); }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2rem; align-items: start; }
.detail-card { overflow: hidden; }
.detail-header, .detail-section, .detail-actions { padding: clamp(1.25rem, 3vw, 2rem); }
.detail-header { display: flex; justify-content: space-between; gap: 1.5rem; border-bottom: 1px solid var(--line); }
.detail-header h1 { overflow-wrap: anywhere; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.detail-summary { max-width: 700px; margin: 0; color: var(--muted); font-size: 1.08rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .75rem; background: var(--soft); border-bottom: 1px solid var(--line); }
.detail-section + .detail-section { border-top: 1px solid var(--line); }
.detail-section h2 { font-size: 1.25rem; }
.prose { overflow-wrap: anywhere; }
.details-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.details-list > div { padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.details-list > div:nth-child(odd) { border-right: 1px solid var(--line); }
.details-list dt, .quick-facts dt { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.details-list dd, .quick-facts dd { margin: .15rem 0 0; color: var(--navy); font-weight: 650; overflow-wrap: anywhere; }
.rating-panel { display: flex; justify-content: space-between; gap: 1.5rem; background: var(--soft); }
.rating-form { display: flex; align-items: end; gap: .6rem; }
.rating-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.rating-form select { min-height: 44px; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 9px; background: white; }
.rating-form button { padding: .65rem .9rem; border: 0; border-radius: 9px; background: var(--blue); color: white; font-weight: 750; }
.rating-page-card { overflow: hidden; }
.rating-listing-summary { padding-bottom: 1.5rem; }
.rating-listing-summary h2 { margin-bottom: .6rem; }
.rating-listing-summary h2 a { color: var(--navy); text-decoration: none; }
.rating-listing-summary h2 a:hover { color: var(--blue); }
.rating-description { max-width: 760px; color: var(--ink); font-size: 1.02rem; }
.rating-current-meta { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-top: 1rem; color: var(--muted); font-size: .88rem; }
.rating-current-meta strong { color: var(--navy); }
.rating-submit-section { margin: 0 clamp(-2rem, -3vw, -1rem) clamp(-2rem, -3vw, -1rem); padding: 1.5rem clamp(1rem, 3vw, 2rem) 2rem; border-top: 1px solid var(--line); background: var(--soft); }
.rating-submit-section h2 { font-size: 1.3rem; }
.quick-facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; text-align: center; }
.quick-facts > div + div { border-left: 1px solid var(--line); }
.visually-muted { padding: 0 2rem 1rem; color: var(--muted); font-size: .8rem; }

/* Shared forms, messages and result pages. */
.form-panel > h2, .result-panel > h2 { font-size: 1.35rem; }
.form-note { color: var(--muted); }
.modern-form { display: grid; gap: 1.5rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: .4rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field legend { color: var(--navy); font-size: .86rem; font-weight: 750; }
.field input:not([type="radio"]):not([type="checkbox"]), .field select, .field textarea,
.legacy-control select, .legacy-control input, .legacy-control textarea { width: 100%; max-width: 100%; min-height: 46px; padding: .7rem .8rem; border: 1px solid #cbd5e1; border-radius: 9px; background: white; color: var(--navy); }
.field textarea, .legacy-control textarea { min-height: 110px; resize: vertical; }
.field small { color: var(--muted); }
.choice-row { display: flex; flex-wrap: wrap; gap: .6rem 1.1rem; }
.choice-row label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
.choice-row input { width: 1rem; height: 1rem; accent-color: var(--blue); }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; padding-top: .25rem; }
.inline-form { grid-template-columns: minmax(180px, 300px) auto; align-items: end; }
.search-options > .field { max-width: 720px; }
.alert { margin-bottom: 1.25rem; padding: 1rem 1.15rem; border: 1px solid; border-radius: 12px; overflow-wrap: anywhere; }
.alert h2 { font-size: 1.08rem; }
.alert-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.alert-success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.record-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 1rem 0 1.5rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.record-summary > div { min-width: 0; padding: .85rem 1rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.record-summary > div:nth-child(odd) { border-right: 1px solid var(--line); }
.record-summary dt { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.record-summary dd { margin: .15rem 0 0; color: var(--navy); }
.language-images img { display: inline-block; margin-right: .35rem; }
.rankings-grid, .rankings-stack { display: grid; grid-template-columns: 1fr; gap: 2rem; width: 100%; }
.legacy-results { min-width: 0; overflow-wrap: anywhere; }
.legacy-results table, .category-search-results table { width: 100% !important; }
.ranking-table-wrap { width: 100%; overflow-x: auto; }
.ranking-table { width: 100%; table-layout: auto; border-collapse: collapse; font-size: .92rem; }
.ranking-table th, .ranking-table td { padding: .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ranking-table th { background: var(--soft); color: var(--navy); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.ranking-table th:first-child, .ranking-table th:nth-child(2), .ranking-table td:first-child, .ranking-table td:nth-child(2) { width: 85px; text-align: center; white-space: nowrap; }
.ranking-table th:last-child, .ranking-table td:last-child { width: auto; overflow-wrap: anywhere; }
.ranking-table tbody tr:hover { background: var(--blue-soft); }
.ranking-table a { color: var(--blue-dark); font-weight: 650; text-decoration: none; }
.ranking-table a:hover { color: var(--teal); text-decoration: underline; }
.category-search-results { margin-top: 1.25rem; }
.pagination-standalone { margin-top: 1.25rem; }

.site-footer { padding: 3rem 0 1.25rem; background: var(--navy); color: #cbd5e1; }
.brand-footer { color: white; }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 2rem; }
.footer-grid p { max-width: 450px; margin-top: .8rem; }
.footer-grid nav { display: flex; flex-wrap: wrap; align-content: start; justify-content: end; gap: .75rem 1.25rem; }
.footer-grid nav a { color: #e2e8f0; }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #334155; color: #94a3b8; font-size: .78rem; }
.footer-bottom table, .footer-bottom tbody, .footer-bottom tr, .footer-bottom td { display: block; width: 100% !important; background: transparent !important; color: inherit !important; }
.footer-bottom img { display: none; }

:focus-visible { outline: 3px solid #38bdf8; outline-offset: 3px; }

@media (max-width: 900px) {
  .header-inner { align-items: flex-start; flex-direction: column; padding-block: 1rem; }
  .primary-nav { width: 100%; overflow-x: auto; padding-bottom: .25rem; }
  .page-layout, .detail-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .section { padding: 3rem 0; }
  .primary-nav .nav-cta { padding: .48rem .75rem; }
  .search-form, .search-form-large { flex-direction: column; }
  .search-form select, .search-form button { width: 100%; }
  .hero-actions, .section-heading, .results-toolbar, .rating-panel { align-items: flex-start; flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .content-grid { grid-template-columns: 1fr; }
  .category-output > table > tbody > tr { grid-template-columns: 1fr; gap: 1.25rem; }
  .listing-card { align-items: flex-start; flex-direction: column; }
  .listing-actions { display: flex; align-items: center; }
  .details-list { grid-template-columns: 1fr; }
  .details-list > div:nth-child(odd) { border-right: 0; }
  .sidebar { grid-template-columns: 1fr; }
  .rating-form { width: 100%; align-items: stretch; flex-direction: column; }
  .rating-submit-section { margin: 0 -1rem -1rem; padding: 1.25rem 1rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid nav { justify-content: start; }
  .footer-bottom { flex-direction: column; }
  .form-grid, .form-grid-compact, .record-summary, .rankings-grid, .rankings-stack, .inline-form { grid-template-columns: 1fr; }
  .record-summary > div:nth-child(odd) { border-right: 0; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

@media print { .site-header, .utility-search, .site-footer, .sidebar, .detail-actions, .rating-form { display: none !important; } .section { padding: 0; } .detail-layout { display: block; } .detail-card { border: 0; box-shadow: none; } }
