:root {
  --ink: #2E2B27; --paper: #FFFFFF; --cream: #F4EFE4; --soft: #F5EDD8;
  --green: #4C6B3C; --green-dark: #35502A; --brown: #7C5A44;
  --rust: #B7410E; --gold: #C9A44B; --red: #C0392B; --magenta: #D6336C;
  --safe: var(--green); --unnecessary: var(--brown); --ineffective: var(--gold); --danger: var(--red);
  --base-size: 18px; --heading: Georgia, 'Times New Roman', serif;
  --body: Arial, Helvetica, sans-serif; --radius: 14px; --pale-green: #EAF0E3;
  --shadow: 0 3px 12px rgb(46 43 39 / 5%); --header-height: 84px;
}
* { box-sizing: border-box; min-width: 0; }
html { font-size: var(--base-size); scroll-padding-block: 100px 100px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); line-height: 1.45; padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
body::before { content: ''; position: absolute; inset: 0 0 auto; height: 168px; background: var(--green); opacity: .075; pointer-events: none; }
a { color: var(--green-dark); text-underline-offset: 4px; }
a, button, summary, label { -webkit-tap-highlight-color: transparent; }
button, a, summary, input, select, textarea { touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; max-width: 100%; padding: 12px 16px; border: 1px solid #B9C6AE; border-radius: 11px; background: var(--paper); color: var(--green-dark); font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none; cursor: pointer; overflow-wrap: anywhere; white-space: normal; }
button.primary, .button.primary, .actions > :first-child, form > button { color: var(--paper); background: var(--green-dark); border-color: var(--green-dark); }
button[aria-pressed=true], .tab[aria-selected=true] { color: var(--paper); background: var(--green-dark); border-color: var(--green-dark); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--rust); outline-offset: 4px; }
button:active, .button:active, .tile:active { transform: translateY(1px); }
.icon { width: 28px; height: 28px; display: block; flex: 0 0 auto; }
.app-header { max-width: 560px; margin-inline: auto; min-height: var(--header-height); padding: 12px 16px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--green-dark); color: var(--cream); box-shadow: 0 3px 10px rgb(46 43 39 / 8%); }
.brand { display: flex; align-items: center; gap: 7px; flex: 1; min-height: 48px; color: var(--cream); text-decoration: none; font: 700 18px/1.14 var(--heading); }
.brand-mark { flex: 0 0 30px; width: 30px; height: 42px; }
.brand > span { max-width: 200px; }
.reading-tools { display: flex; flex: 0 0 150px; padding: 2px; border: 1px solid rgb(244 239 228 / 35%); border-radius: 11px; margin-left: auto; }
.reading-tools button { min-width: 48px; flex: 0 0 48px; width: 48px; min-height: 48px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--paper); font: 700 16px var(--body); }
.reading-tools button[aria-pressed=true] { background: var(--cream); color: var(--green-dark); box-shadow: 0 1px 5px rgb(0 0 0 / 12%); }
.reading-tools :focus-visible { outline-color: var(--gold); outline-offset: 2px; }
main, .notice, #status, .app-footer { position: relative; max-width: 560px; margin-inline: auto; }
main { padding: 22px 18px 0; min-height: 65vh; }
h1, h2, h3 { font-family: var(--heading); line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: lining-nums; }
.lining-number { font-family: var(--body); font-size: 1em; font-style: inherit; font-weight: inherit; font-variant-numeric: normal; }
h1 { margin: 0; font-size: 1.8rem; font-weight: 400; letter-spacing: -.025em; }
h2 { font-size: 1.3rem; margin: 1.6rem 0 .7rem; font-weight: 400; }
h3 { font-size: 1.08rem; }
p { margin: .5rem 0 1rem; overflow-wrap: anywhere; }
.screen-title { padding: 22px; border-radius: var(--radius); background: var(--green-dark); color: var(--paper); border-bottom: 3px solid var(--gold); margin-bottom: 20px; }
.screen-body { min-width: 0; }
.screen-body > p:first-child { margin-top: 0; }
.screen-body > p { margin-inline: 4px; }
.screen-body .screen-photo { height: 150px; aspect-ratio: auto; margin: 18px 0; }
.screen-photo { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius); margin: 24px 0 6px; background: var(--soft); }
[data-route=home] > .screen-photo { margin: 0 0 22px; box-shadow: var(--shadow); }
[data-route=home] .screen-title { padding: 0 2px; border: 0; background: transparent; color: var(--ink); margin-bottom: 22px; }
[data-route=home] h1 { font-size: 1.95rem; max-width: 430px; }
[data-route=home] .screen-body > p:first-child { padding: 13px 16px; background: var(--pale-green); border-left: 3px solid var(--green); border-radius: 0 10px 10px 0; font-size: .9rem; margin: 0 0 18px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 17px 14px 18px; border: 1px solid #EAE3D6; border-radius: var(--radius); background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.tile-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: var(--paper); }
.tile-icon .icon { width: 27px; height: 27px; }
.tile strong { display: block; font: 400 1.08rem/1.22 var(--heading); font-variant-numeric: lining-nums; }
.tile small { display: block; font: 400 max(15px, .84rem)/1.4 var(--body); margin-top: 8px; }
.card, .result, details, fieldset, form, .table-wrap, .screen-body > ol { border: 1px solid var(--cream); background: var(--paper); border-radius: var(--radius); padding: 18px; margin: 16px 0; min-width: 0; max-width: 100%; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.calculator { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: end; gap: 16px 12px; }
.calculator > label { margin: 0; }
.calculator > .result { grid-column: 1 / -1; margin: 0; }
.card h2:first-child { margin-top: 0; }
.card > :last-child, .result > :last-child, details > :last-child { margin-bottom: 0; }
.rule-callout { background: var(--soft); border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; padding: 16px 18px; margin: 16px 0; }
.rule-callout p { margin: 0; }
.result { background: var(--pale-green); border: 1px solid #D5DFC8; padding: 22px 20px; box-shadow: none; font-variant-numeric: lining-nums; }
.result > p:first-child, p.result { font: 400 max(30px, 1.7rem)/1.22 var(--heading); letter-spacing: -.02em; margin-top: 0; font-variant-numeric: lining-nums; }
.result > p:not(:first-child) { margin-top: 16px; }
.result:empty { display: none; }
#change-output .result > p:last-child { padding-top: 14px; border-top: 1px solid #B8C6AA; }
label { display: block; margin: 14px 0; }
input:not([type=checkbox]):not([type=radio]), select, textarea { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 54px; padding: 12px; margin-top: 8px; border: 1px solid #9EAA93; border-radius: 9px; background: var(--paper); font-size: max(18px, 1rem); }
input[type=date], input[type=datetime-local] { appearance: none; -webkit-appearance: none; min-width: 0; }
input[type=number] { font-variant-numeric: tabular-nums; }
textarea { min-height: 108px; resize: vertical; }
fieldset { padding: 16px 14px 10px; }
legend { max-width: 100%; padding: 0 7px; font-family: var(--heading); font-weight: 700; font-variant-numeric: lining-nums; }
.choice { position: relative; display: flex; align-items: flex-start; gap: 11px; width: 100%; min-height: 56px; margin: 9px 0; padding: 14px 12px; border: 1px solid #D4DCCB; border-radius: 10px; background: var(--paper); cursor: pointer; }
.choice input { appearance: none; -webkit-appearance: none; position: absolute; width: 100%; height: 100%; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.choice > span { pointer-events: none; }
.choice .choice-check { display: flex; align-items: center; justify-content: center; width: 25px; height: 25px; flex: 0 0 25px; border: 1.5px solid #849777; border-radius: 6px; background: var(--paper); margin-top: 1px; }
.choice-check .icon { width: 19px; height: 19px; opacity: 0; stroke-width: 3; }
.choice:has(input[type=radio]) .choice-check { border-radius: 50%; }
.choice:has(input:checked) { border-color: var(--green); background: var(--pale-green); box-shadow: inset 0 0 0 1px var(--green); }
.choice input:checked + .choice-check { background: var(--green-dark); border-color: var(--green-dark); color: var(--paper); }
.choice input:checked + .choice-check .icon { opacity: 1; }
.choice:has(input:focus-visible) { outline: 3px solid var(--rust); outline-offset: 3px; }
.choice small { display: block; margin-top: 7px; font-size: .9rem; }
.actions, .tabs, .presets { display: flex; flex-wrap: wrap; gap: 9px; margin-block: 16px; }
.actions > *, .presets > * { flex: 1 1 160px; }
.journal-backup-actions > * { flex-basis: 100%; }
.presets { display: grid; grid-template-columns: 1fr; }
.presets button { justify-content: flex-start; text-align: left; font-weight: 400; }
.tabs { padding: 5px; border: 1px solid #D9DDCF; border-radius: 12px; background: #E8EBDD; gap: 3px; }
.tabs button { flex: 1 1 auto; padding: 10px 8px; min-height: 48px; border-color: transparent; background: transparent; font-size: .9rem; }
.tabs .tab[aria-selected=true] { background: var(--green-dark); box-shadow: 0 2px 5px rgb(46 43 39 / 12%); }
summary { cursor: pointer; min-height: 48px; padding-block: 10px; font-weight: 700; }
details { padding-block: 8px; }
details > p { margin-top: 10px; }
details[open] { border-color: #C4CEB9; }
.step-number { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; background: var(--green-dark); color: var(--paper); align-items: center; justify-content: center; font: 700 18px var(--body); margin-right: 5px; font-variant-numeric: lining-nums; }
.screen-body > ol { padding: 8px 20px 8px 56px; counter-reset: step; list-style: none; }
.screen-body > ol > li { position: relative; counter-increment: step; padding-block: 7px; margin-block: 12px; }
.screen-body > ol > li::before { content: counter(step); position: absolute; left: -40px; top: 6px; display: grid; place-items: center; width: 29px; height: 29px; background: var(--green-dark); color: var(--paper); border-radius: 50%; font: 700 16px var(--body); font-variant-numeric: lining-nums; }
ol, ul { padding-left: 1.4rem; } li { margin-block: .8rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border-radius: 7px; padding: 6px 9px; font: 700 13px/1.3 var(--body); letter-spacing: .02em; }
.chip .icon { width: 19px; height: 19px; stroke-width: 2.5; }
.chip.safe { background: var(--safe); color: var(--paper); }
.chip.unnecessary { background: var(--unnecessary); color: var(--paper); }
.chip.ineffective { background: var(--ineffective); color: var(--ink); }
.chip.danger { background: var(--danger); color: var(--paper); }
.rating { padding: 7px 16px; }
.rating summary { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; position: relative; padding-right: 20px; list-style: none; }
.rating summary::-webkit-details-marker { display: none; }
.rating summary::after { content: '+'; position: absolute; right: 0; top: 9px; color: var(--green-dark); font: 24px var(--body); }
.rating[open] summary::after { content: '−'; }
.rating-practice { display: block; font-weight: 700; }
.rating-why { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 400; }
.rating[open] .rating-why { display: block; }
.safe-search { position: sticky; top: var(--header-height); z-index: 10; background: var(--cream); padding: 12px 0; margin: 0; font-weight: 700; }
.safe-search input { box-shadow: var(--shadow); background: var(--paper); }
.filter-rail { display: flex; overflow-x: auto; max-width: 100%; gap: 10px; padding: 4px 0 12px; margin-bottom: 8px; scrollbar-width: thin; scrollbar-color: #9EAA93 transparent; overscroll-behavior-inline: contain; }
.filters { display: flex; flex: 0 0 auto; gap: 7px; }
.filters + .filters { padding-left: 10px; border-left: 1px solid var(--gold); }
.filters button { flex: 0 0 auto; white-space: nowrap; border-radius: 25px; padding: 10px 15px; font-size: 16px; }
.wizard-progress { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; padding: 4px 10px; margin: 2px 0 24px; }
.wizard-progress::before { content: ''; position: absolute; left: 12px; right: 12px; height: 2px; background: #C9D3BE; }
.wizard-progress > span { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #AAB69E; border-radius: 50%; background: var(--cream); font-weight: 700; }
.wizard-progress .current { background: var(--green-dark); color: var(--paper); outline: 3px solid var(--gold); outline-offset: 3px; }
.wizard-progress .done { background: var(--green-dark); color: var(--paper); border-color: var(--green-dark); }
.wizard-progress .icon { width: 23px; height: 23px; }
.table-wrap { padding: 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 620px; table-layout: fixed; font-size: max(15px, .86rem); }
th, td { padding: 13px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--cream); overflow-wrap: normal; word-break: normal; hyphens: none; }
th { background: var(--soft); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
caption { padding: 12px; }
dd { margin-left: 16px; }
.note, footer p { font-size: max(15px, .86rem); }
.screen-body > footer { margin-top: 28px; border-top: 1px solid var(--gold); padding-top: 16px; }
.app-footer { display: flex; justify-content: center; padding: 14px 18px 4px; }
.app-footer a { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; font-size: 16px; }
.notice, #status { padding: 12px 18px; }
#status:empty { display: none; }
.bottom-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0 5px max(8px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid #E6E2D6; background: var(--paper); box-shadow: 0 -4px 18px rgb(46 43 39 / 5%); z-index: 30; }
.bottom-bar a { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; min-height: 70px; padding: 9px 2px 5px; color: var(--ink); text-decoration: none; border-top: 2px solid transparent; font: 400 13px/1.2 var(--body); }
.bottom-bar .icon { width: 25px; height: 25px; }
.bottom-bar a[aria-current=page] { color: var(--green-dark); background: #F1F4EC; border-top-color: var(--gold); font-weight: 700; }
[hidden] { display: none !important; }
@media (hover: hover) { .tile:hover { border-color: #9DAD8D; box-shadow: 0 5px 18px rgb(46 43 39 / 9%); } button:hover:not(:disabled), .button:hover { filter: brightness(.96); } }
@media (min-width: 600px) { main { padding: 26px 24px 0; } .app-header { border-radius: 0 0 16px 16px; padding-inline: 22px; } .tile { padding: 20px; } .bottom-bar { border-radius: 16px 16px 0 0; } }
@media (max-width: 350px) { .app-header { padding-inline: 10px; gap: 6px; } .brand { font-size: 16px; gap: 4px; } .brand-mark { width: 22px; flex-basis: 22px; } main { padding-inline: 12px; } .tile { padding: 13px 11px; } }
@media (prefers-reduced-motion: no-preference) { .tile, button, .button { transition: box-shadow .15s, border-color .15s, transform .15s; } }
@media print {
  :root { --base-size: 12pt !important; }
  body { background: white; color: black; padding: 0; }
  body::before, .app-header, .reading-tools, .bottom-bar, .app-footer, .actions, .tabs, .presets, .filter-rail, .safe-search, #status, .notice, button, input[type=file], .wizard-progress { display: none !important; }
  main { max-width: none; padding: 0; min-height: 0; }
  h1 { font-size: 24pt; }
  .screen-title { color: black; background: white; padding: 0 0 12pt; border-radius: 0; border-color: #777; }
  .screen-body .screen-photo { height: auto; max-height: 150pt; }
  .screen-photo { max-height: 150pt; width: auto; max-width: 100%; margin: 12pt auto; }
  .tiles, .calculator { display: block; }
  .card, details, fieldset, form, .result, .tile, .table-wrap, .screen-body > ol { box-shadow: none; border-color: #BBB; break-inside: avoid; background: white; }
  .rating-why { display: block; }
  details > :not(summary) { display: block !important; }
  .result > p:first-child { font-size: 20pt; }
  .chip, .step-number, .choice-check, .tile-icon { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .table-wrap { overflow: visible; } th, td { padding: 6pt; }
  a { color: black; }
}
