* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { position: fixed; top: 72px; left: 12px; z-index: 1001; padding: 10px; background: var(--surface); }
.diet-shell { width: min(100% - 40px, 1560px); margin: auto; padding: 91px 0 24px; }
.diet-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.diet-header h1 { margin: 0; font-size: 29px; line-height: 1.2; letter-spacing: -0.04em; }
.diet-header p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.diet-header time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.diet-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 20px; margin-bottom: 18px; font-size: 11px; color: var(--muted); }
.diet-legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.diet-legend > a { margin-left: auto; font-weight: 600; text-decoration: none; }
.badge { display: inline-flex; justify-content: center; align-items: center; min-width: 35px; min-height: 27px; padding: 2px 7px; border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.diet-legend .badge { min-width: 23px; min-height: 22px; padding: 1px 5px; font-size: 11px; }
.grade-1 { background: var(--accent-soft); color: var(--accent); }
.grade-2 { background: #e9eff0; color: #45616b; }
.grade-3 { background: var(--warning-soft); color: #87631c; }
.grade-4 { background: #f5e7dd; color: #92592d; }
.grade-5 { background: #f4e5e3; color: var(--danger); }
.grade-0 { background: var(--surface-muted); color: var(--muted); }
.table-wrap, .compare-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); scrollbar-color: #beb7a9 var(--surface-muted); }
.table-wrap:focus-visible, .compare-wrap:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.master { width: 100%; min-width: 980px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.master caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.master col:nth-child(1) { width: 8%; }
.master col:nth-child(2) { width: 22%; }
.master col:nth-child(3) { width: 6%; }
.master col:nth-child(4) { width: 20%; }
.master col:nth-child(5) { width: 44%; }
.master thead th { position: sticky; top: 0; z-index: 2; padding: 12px 15px; border-bottom: 1px solid var(--border); background: var(--surface-muted); color: var(--muted); text-align: left; font-size: 11px; font-weight: 700; }
.master thead th:nth-child(3) { text-align: center; }
.master tbody td, .master tbody th { padding: 13px 15px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; text-align: left; font-size: 12px; font-weight: 400; line-height: 1.7; overflow-wrap: anywhere; }
.master tbody tr:nth-child(even) { background: #fcfbf8; }
.master tbody tr:hover { background: var(--accent-soft); }
.master tbody tr:last-child > * { border-bottom: 0; }
.master .category { color: var(--muted); font-size: 11px; }
.master .grade-cell { text-align: center; }
.master .reason { line-height: 1.85; }
.food { display: block; font-size: 13px; font-weight: 650; }
.condition { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.fat-section { margin-top: 26px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 14px; margin-bottom: 11px; }
.section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -0.025em; }
.section-heading > span { color: var(--muted); font-size: 11px; }
.compare { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 12px; }
.compare th, .compare td { padding: 12px 15px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.compare th { background: var(--surface-muted); color: var(--muted); font-size: 11px; }
.compare th:first-child, .compare td:first-child { text-align: left; }
.compare tbody tr:last-child td { border-bottom: 0; }
.diet-details { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.fat-section + .diet-details { margin-top: 24px; }
.diet-details summary { padding: 13px 16px; cursor: pointer; font-size: 12px; font-weight: 600; }
.diet-details summary span { margin-left: 6px; color: var(--muted); font-size: 10px; font-weight: 400; }
.detail-content { padding: 3px 18px 18px; }
.detail-content > p { margin: 8px 0 14px; color: var(--muted); font-size: 12px; }
.notes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 30px; }
.note { padding-top: 12px; border-top: 1px solid var(--border); }
.note strong { font-size: 12px; }
.note p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.sources { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 35px; margin: 8px 0 0; padding-left: 22px; }
.sources li { padding-left: 2px; font-size: 12px; scroll-margin-top: 90px; }
.sources li:target { background: var(--accent-soft); outline: 5px solid var(--accent-soft); }
.sources a { font-weight: 600; }
.sources span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.sources .print-url { display: none; }
.diet-footer { padding: 24px 0 0; color: var(--muted); font-size: 10px; }
@media (max-width: 1000px) {
    .diet-legend { gap: 8px 12px; }
}
@media (max-width: 620px) {
    .diet-shell { width: calc(100% - 24px); padding-top: 85px; }
    .diet-header { align-items: start; margin-bottom: 16px; }
    .diet-header h1 { font-size: 25px; }
    .diet-header time { padding-top: 5px; font-size: 10px; }
    .diet-legend { font-size: 10px; gap: 8px 11px; }
    .diet-legend > a { margin-left: 0; }
    .master tbody td, .master tbody th { padding: 11px 13px; }
    .section-heading { display: block; }
    .section-heading > span { display: block; margin-top: 4px; }
    .notes, .sources { grid-template-columns: 1fr; }
}
@media print {
    @page { size: A4 landscape; margin: 12mm; }
    html { scroll-behavior: auto; }
    body { color: #000; background: #fff; font-size: 9pt; }
    .top-nav, .skip, .diet-legend > a { display: none !important; }
    .diet-shell { width: 100%; padding: 0; }
    .diet-header { margin-bottom: 12px; }
    .diet-header h1 { font-size: 21pt; }
    .diet-legend { margin-bottom: 12px; }
    .table-wrap, .compare-wrap { max-height: none; overflow: visible; border: 0; border-radius: 0; }
    .master { min-width: 0; border-collapse: collapse; }
    .master thead { display: table-header-group; }
    .master thead th { position: static; font-size: 8pt; }
    .master tbody tr { display: table-row !important; break-inside: avoid; }
    .master thead th, .master tbody th, .master tbody td { padding: 6px 8px; border: 1px solid #ccc; font-size: 8pt; line-height: 1.5; }
    .master .food { font-size: 8.5pt; }
    .master .category, .condition { font-size: 7pt; }
    .badge { min-width: 27px; min-height: 21px; font-size: 8pt; }
    .compare { min-width: 0; }
    .compare th, .compare td { padding: 7px 10px; font-size: 8pt; border: 1px solid #ccc; }
    .fat-section { break-inside: avoid; }
    .diet-details { border: 0; border-radius: 0; }
    .diet-details summary { padding: 12px 0; font-size: 11pt; }
    .detail-content { padding: 0; }
    .notes, .sources { display: block; columns: 2; column-gap: 24px; }
    .note, .sources li { margin-bottom: 12px; break-inside: avoid; }
    .note p, .note strong, .detail-content > p, .sources li { font-size: 8pt; }
    .sources span { font-size: 7pt; }
    .sources .print-url { display: block; font-size: 6.5pt; }
    a { color: #000; text-decoration: none; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
