:root { color-scheme: light dark; --bg: #f6f5f1; --card: #ffffff; --text: #1f1e1b; --muted: #6b6a64;
        --line: #d9d7cf; --accent: #2f6fb0; --coffee: #b5651d; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1c1b; --card: #262624; --text: #ecebe6; --muted: #a3a29b; --line: #3a3a37; --accent: #6aa5e0; --coffee: #e0a060; }
}
* { box-sizing: border-box; }
body { margin: 0 auto; max-width: 980px; padding: 20px 24px 40px; background: var(--bg); color: var(--text);
       font: 14px/1.5 system-ui, "Segoe UI", Arial, sans-serif; }
header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
h1 { font-size: 21px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.sub, .muted, .hint { color: var(--muted); }
.hint { font-size: 13px; margin: 8px 0 12px; }
.note { background: #fff4d6; color: #5c4400; border: 1px solid #f0d88a; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
@media (prefers-color-scheme: dark) { .note { background: #3d3315; color: #f3dc9a; border-color: #6b5a22; } }
section { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
section.top { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.preview { background: #111; border-radius: 8px; padding: 8px; }
.preview canvas { width: 100%; height: 300px; display: block; }
.actions button { display: block; width: 100%; margin-bottom: 8px; }
button { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--card);
         color: var(--text); cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 9px 12px; }
.row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.row label, .row .label { width: 120px; color: var(--muted); }
select, input[type=number], input[type=text] { font: inherit; padding: 4px 6px; border-radius: 6px;
       border: 1px solid var(--line); background: var(--card); color: var(--text); }
select { min-width: 260px; }
#settings { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }
#settings .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#settings fieldset { border: none; margin: 0; padding: 0; }
#settings legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
#settings .field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 5px 0; }
#settings .field > span.lab { color: var(--muted); }
#settings input[type=number] { width: 90px; }
#settings select { min-width: 0; max-width: 220px; }
#settings .tick { display: flex; gap: 8px; align-items: center; margin: 5px 0; }
#settings .tick .ticklab { color: var(--text); }
@media (max-width: 760px) { #settings { grid-template-columns: 1fr; } #settings .col { gap: 16px; } #settings .col + .col { margin-top: 16px; } }
.info { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 6px;
        border: 1px solid var(--muted); border-radius: 50%; color: var(--muted); font: italic 10px/1 "Segoe UI", serif;
        cursor: help; position: relative; vertical-align: middle; }
.info .balloon { display: none; position: absolute; left: 50%; top: 21px; transform: translateX(-50%); z-index: 30;
        width: 250px; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
        padding: 9px 11px; font: 12.5px/1.45 system-ui, "Segoe UI", Arial, sans-serif; font-style: normal;
        box-shadow: 0 6px 20px rgba(0,0,0,.22); text-align: left; }
.info:hover .balloon, .info:focus .balloon, .info.open .balloon { display: block; }
.info .balloon a { color: var(--accent); text-decoration: none; white-space: nowrap; }
.notehint { font-size: 12.5px; line-height: 1.4; color: var(--muted); margin: 6px 0; }
.notehint.warn { color: #c23a1f; font-weight: 600; }
.notehint.caution { color: #9a6a12; }
@media (prefers-color-scheme: dark) { .notehint.warn { color: #ff8a6a; } .notehint.caution { color: #e0b25a; } }
.intro { font-size: 14.5px; max-width: 680px; margin: 2px 0 14px; }
.credit { color: var(--muted); font-size: 13px; font-style: italic; margin-top: 12px; }
.sub-h { font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
.range { margin: 6px 0 10px; padding-left: 18px; }
.range li { margin: 5px 0; }
.coffee, .coffee-btn { display: inline-block; background: var(--coffee); color: #fff; border: none; border-radius: 8px;
        padding: 8px 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.coffee-cta { display: inline-block; margin-top: 2px; color: var(--coffee); border: 1px solid var(--coffee);
        border-radius: 6px; padding: 6px 12px; font-weight: 600; text-decoration: none; }
footer { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
