/* First Frost - a gardener's almanac at night: pale frosted paper, slate ink, a night-sky strip, glass cloches and a
 * terracotta warning colour for the nights that need action. */
:root {
  --bg: #eef3f6; --paper: #fbfdfe; --card: #e3ebf0; --ink: #152230; --muted: #4b5c6b; --line: #c6d4de;
  --slate: #1f3a56; --slate-ink: #ffffff; --ice: #2a6c96; --ice-soft: #d9ecf7; --frost: #e9f6ff;
  --warm: #9a3b17; --warm-ink: #ffffff; --warm-soft: #f8e1d5; --moss: #2c6a3c; --moss-soft: #ddefe0;
  --sky1: #0c1a2e; --sky2: #1b3352; --sky-ink: #e8f2fb; --sky-muted: #b9cbdc;
  --tube: #f4f8fb; --tube-edge: #8fa6ba; --merc-none: #d9534f; --merc-possible: #f0b44c; --merc-frost: #7fc8f0; --merc-hard: #b9e4ff;
  --k-tender: #a03a2a; --k-half: #8a5a00; --k-hardy: #2c6a3c; --k-water: #1f5f8b; --k-pot: #7b4a2a; --k-car: #4a4f63; --k-unsure: #5a5f6b;
  --ok: #24613a; --ok-bg: #e2f0e4; --warn: #8a2c16; --warn-bg: #fbe3dc; --note: #6b4e0f; --note-bg: #fbf0d2;
  --v-tonight: #9a3b17; --v-week: #7a4b00; --v-clear: #24613a;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 6px 20px rgba(20, 50, 80, 0.08);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b131c; --paper: #121d29; --card: #1b2836; --ink: #e8eff5; --muted: #a9b9c7; --line: #2c3d4f;
  --slate: #a9cdee; --slate-ink: #0b1622; --ice: #8cc8ef; --ice-soft: #1d3346; --frost: #16283a;
  --warm: #f2a07c; --warm-ink: #24100a; --warm-soft: #3d2219; --moss: #93d3a3; --moss-soft: #1c3324;
  --sky1: #050c16; --sky2: #12243b;
  --tube: #22344a; --tube-edge: #6f8aa3;
  --k-tender: #f2a28f; --k-half: #f0c76a; --k-hardy: #93d3a3; --k-water: #8cc8ef; --k-pot: #e2b08d; --k-car: #c3c8da; --k-unsure: #c0c4cc;
  --ok: #8fd6a4; --ok-bg: #1d3326; --warn: #ffb4a0; --warn-bg: #3d1f18; --note: #f0d38a; --note-bg: #3a2f14;
  --v-tonight: #f2a07c; --v-week: #f0c76a; --v-clear: #93d3a3;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3 { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; line-height: 1.2; overflow-wrap: anywhere; }
a { color: var(--ice); }
.hidden { display: none !important; }
.small { font-size: 0.88rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* header with a rime of frost along its lower edge */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px 12px; background: var(--paper); position: relative; flex-wrap: nowrap;
  border-bottom: 1px solid var(--line); }
.bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 7px; pointer-events: none;
  background: radial-gradient(circle at 6px 0, var(--ice-soft) 5px, transparent 5.5px) 0 0 / 12px 7px repeat-x; }
.back { text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 1.15rem; }
.brand strong { white-space: nowrap; }
.logo { width: 30px; height: 30px; flex: none; }
.lg-ring { fill: var(--slate); stroke: none; }
:root[data-theme="dark"] .lg-ring { fill: #1b3352; }
.lg-cloche { fill: none; stroke: #e9f6ff; stroke-width: 1.8; stroke-linecap: round; }
.lg-frost { fill: none; stroke: #9fd6f7; stroke-width: 1.6; stroke-linecap: round; }
.session { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; border: 1.5px solid var(--slate); background: transparent; color: var(--slate);
  padding: 6px 14px; font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.pill:hover:not(:disabled) { background: var(--card); }
.pill.solid { background: var(--slate); color: var(--slate-ink); }
.pill.solid:hover:not(:disabled) { background: var(--slate); filter: brightness(1.12); }
.pill.ghost { border-color: var(--line); color: var(--ink); cursor: default; }
.pill.tiny { padding: 3px 10px; font-size: 0.8rem; }
.pill.big { padding: 10px 22px; font-size: 1rem; }
.pill:disabled { opacity: 0.5; cursor: not-allowed; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 24px 0 6px; }
.kicker { display: inline-block; margin: 0 0 10px; padding: 6px 12px; border-radius: 8px; background: var(--ice-soft); color: var(--ink); font-size: 0.86rem; border-left: 4px solid var(--ice); }
.hero h1 { font-size: clamp(1.7rem, 4.6vw, 2.7rem); margin: 4px 0 8px; }
.lede { max-width: 780px; margin: 0 0 12px; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { border-radius: 8px; border: 1.5px dashed var(--ice); background: var(--paper); color: var(--ink); padding: 5px 12px; font: inherit; font-size: 0.86rem; cursor: pointer; }
.chip.on { border-style: solid; background: var(--slate); border-color: var(--slate); color: var(--slate-ink); }

.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-top: 16px; box-shadow: var(--shadow); min-width: 0; }
.layout .panel { margin-top: 0; }
.ph { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin: 0 0 10px; }
.step-no { display: inline-flex; width: 30px; height: 30px; flex: none; border-radius: 50%; align-items: center; justify-content: center; background: var(--slate); color: var(--slate-ink); font-family: Georgia, serif; font-size: 1rem; }
.sub { font-size: 1.05rem; margin: 18px 0 4px; }
.lbl { display: block; font-size: 0.86rem; font-weight: 600; margin: 10px 0 4px; color: var(--ink); }
input[type="text"], input[type="date"], textarea, select { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.92rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ice); outline-offset: 1px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.note { background: var(--note-bg); color: var(--note); border-radius: 8px; padding: 8px 10px; }

/* the verdict plate */
.plate { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--frost); border: 1.5px solid var(--line); }
.plate-verdict { margin: 0; }
.plate-verdict b { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 1.2rem; display: block; }
.v-act_tonight { color: var(--v-tonight); } .v-act_this_week { color: var(--v-week); } .v-all_clear { color: var(--v-clear); } .v-none { color: var(--muted); }

/* the night strip: always a night sky, in both themes */
.sky-host { margin: 8px 0 4px; }
.sky-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.sky-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; border-radius: 12px; min-width: 0; text-align: center;
  background: linear-gradient(180deg, var(--sky1), var(--sky2)); color: var(--sky-ink); border: 2px solid transparent; }
.sky-tile.first { border-color: var(--ice); }
.sky-name { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; font-size: 0.95rem; max-width: 100%; overflow-wrap: anywhere; line-height: 1.15; }
.thermo { width: 100%; max-width: 74px; height: auto; display: block; }
.star { fill: #dbe9f6; }
.crystal { fill: none; stroke: #bfe6ff; stroke-width: 1.3; stroke-linecap: round; }
.tube { fill: #22344a; stroke: #8fa6ba; stroke-width: 1.2; }
.bulb, .mercury { stroke: none; }
.rk-none.bulb, .rk-none.mercury { fill: var(--merc-none); } .rk-possible.bulb, .rk-possible.mercury { fill: var(--merc-possible); }
.rk-frost.bulb, .rk-frost.mercury { fill: var(--merc-frost); } .rk-hard.bulb, .rk-hard.mercury { fill: var(--merc-hard); }
.freeze { stroke: #e8f2fb; stroke-width: 1.2; stroke-dasharray: 2 2; }
.air-mark { fill: #e8f2fb; }
.sky-low { font-size: 0.78rem; color: var(--sky-muted); line-height: 1.25; }
.sky-ground { font-size: 0.82rem; color: var(--sky-ink); line-height: 1.25; }
.sky-ground b { font-size: 0.95rem; white-space: nowrap; }
.sky-k { color: var(--sky-muted); }
.sky-risk { margin-top: 3px; font-size: 0.72rem; font-weight: 700; border-radius: 8px; padding: 1px 7px; max-width: 100%; overflow-wrap: anywhere; line-height: 1.3; }
.sky-risk.rk-none { background: #2b3f57; color: #e8f2fb; }
.sky-risk.rk-possible { background: #f0b44c; color: #231600; }
.sky-risk.rk-frost { background: #bfe6ff; color: #0c1a2e; }
.sky-risk.rk-hard { background: #ffffff; color: #0c1a2e; }
.empty-sky, .empty-bed { margin: 8px 0; padding: 14px; border-radius: 12px; background: var(--card); color: var(--muted); font-size: 0.9rem; }

/* the cloche bed: a raised bed of soil rows */
.bed-host { margin: 6px 0 6px; }
.bed { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(var(--n, 7), minmax(0, 1fr)); gap: 4px; padding: 10px; border-radius: 12px; background: #5b3d26; border: 3px solid #3f2a1a; }
:root[data-theme="dark"] .bed { background: #2c1e13; border-color: #4a3322; }
.bed-corner, .bed-night { font-size: 0.78rem; font-weight: 700; color: #f6ead9; text-align: center; padding: 2px 2px 4px; min-width: 0; overflow-wrap: anywhere; line-height: 1.15; }
.bed-corner { text-align: left; }
.bed-night.first { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.bed-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 8px; background: var(--paper); min-width: 0; }
.bed-item b { font-size: 0.86rem; line-height: 1.2; overflow-wrap: anywhere; }
.kind-tag { align-self: flex-start; font-size: 0.72rem; font-weight: 700; border-radius: 6px; padding: 0 6px; border: 1.5px solid currentColor; max-width: 100%; overflow-wrap: anywhere; }
.k-tender { color: var(--k-tender); } .k-half { color: var(--k-half); } .k-hardy { color: var(--k-hardy); } .k-water { color: var(--k-water); }
.k-pot { color: var(--k-pot); } .k-car { color: var(--k-car); } .k-unsure { color: var(--k-unsure); }
.bed-cell { display: flex; align-items: center; justify-content: center; border-radius: 8px; background: #7a5638; min-width: 0; min-height: 44px; }
:root[data-theme="dark"] .bed-cell { background: #3d2a1b; }
.bed-cell.hit { background: #c9e6f6; }
:root[data-theme="dark"] .bed-cell.hit { background: #24445e; }
.cell-svg { width: 100%; max-width: 46px; height: auto; display: block; }
.g-plant .stem { stroke: #8fd19e; stroke-width: 2; fill: none; } .g-plant .leaf { fill: #8fd19e; }
.bed-cell.hit .g-plant .stem { stroke: #2c6a3c; } .bed-cell.hit .g-plant .leaf { fill: #2c6a3c; }
.g-water { fill: #8cc8ef; } .bed-cell.hit .g-water { fill: #1f5f8b; }
.g-pot { fill: #e0a07a; } .bed-cell.hit .g-pot { fill: #9a3b17; }
.g-car { fill: #c3c8da; } .bed-cell.hit .g-car { fill: #4a4f63; }
:root[data-theme="dark"] .bed-cell.hit .g-plant .stem { stroke: #93d3a3; } :root[data-theme="dark"] .bed-cell.hit .g-plant .leaf { fill: #93d3a3; }
:root[data-theme="dark"] .bed-cell.hit .g-water { fill: #8cc8ef; } :root[data-theme="dark"] .bed-cell.hit .g-pot { fill: #f2a07c; } :root[data-theme="dark"] .bed-cell.hit .g-car { fill: #c3c8da; }
.cloche { fill: rgba(255, 255, 255, 0.28); stroke: #0e3a5a; stroke-width: 1.6; stroke-linejoin: round; }
:root[data-theme="dark"] .cloche { fill: rgba(200, 235, 255, 0.16); stroke: #cfeaff; }
.cloche-knob { stroke: #0e3a5a; stroke-width: 2.4; stroke-linecap: round; } :root[data-theme="dark"] .cloche-knob { stroke: #cfeaff; }
.cloche-shine { fill: none; stroke: #ffffff; stroke-width: 1.4; stroke-linecap: round; opacity: 0.8; }

/* run area */
.runrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.gate { background: var(--note-bg); color: var(--note); border-radius: 8px; padding: 8px 10px; margin: 10px 0 6px; }
.progress h3 { margin: 0 0 6px; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { padding: 3px 0; color: var(--muted); } .step.active { color: var(--ink); font-weight: 600; } .step.done { color: var(--ok); }
.step-ic { display: inline-block; width: 16px; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--card); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; }

/* the result */
.res-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.res-head h2 { margin: 0; font-size: 1.45rem; min-width: 0; }
.stamp { display: inline-block; padding: 4px 12px; border-radius: 8px; border: 2px solid currentColor; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; background: var(--frost); white-space: nowrap; }
.summary { font-size: 1.02rem; }
.result h3 { font-size: 1.1rem; margin: 18px 0 8px; }
/* tonight: a note held to the fridge by a magnet */
.fridge { position: relative; background: #fff7cf; color: #2a2410; border-radius: 4px; padding: 16px 18px 12px; margin: 16px 0 8px; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12); transform: rotate(-0.6deg); max-width: 720px; }
:root[data-theme="dark"] .fridge { background: #3a3418; color: #fbf3cf; }
.fridge::before { content: ""; position: absolute; top: -9px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--warm); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25); }
.fridge h3 { margin: 0 0 4px; color: inherit; }
.fridge p { margin: 0 0 6px; font-size: 1.04rem; }
/* rules: plant labels pushed into the soil */
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.rule-card { position: relative; background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px 10px 4px 4px; padding: 10px 12px 12px; min-width: 0; border-top: 6px solid var(--line); }
.rule-card.hit { border-top-color: var(--warm); } .rule-card.quiet { border-top-color: var(--moss); }
.rule-card p { margin: 4px 0; overflow-wrap: anywhere; font-size: 0.94rem; }
.rule-card .k { font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-right: 4px; }
.rule-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rule-head b { overflow-wrap: anywhere; }
.when-nights { font-size: 0.82rem; color: var(--muted); }
/* nights: little almanac cards */
.night-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.night-card { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; border-left: 6px solid var(--line); }
.night-card.rk-possible { border-left-color: #f0b44c; } .night-card.rk-frost { border-left-color: #7fc8f0; } .night-card.rk-hard { border-left-color: #2a6c96; }
.night-card p { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 0.94rem; }
.night-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 0.78rem; font-weight: 700; max-width: 100%; overflow-wrap: anywhere; }
.t-night { background: var(--slate); color: var(--slate-ink); }
.t-risk { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.t-act { background: var(--warm-soft); color: var(--warm); border: 1px solid var(--warm); }
.kit { margin: 0; padding-left: 20px; }
.kit li { margin: 2px 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cardrow, .exports { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.exports { margin-top: 14px; }
.recon { list-style: none; padding: 0; margin: 0; }
.recon li { padding: 6px 10px; border-radius: 8px; margin: 4px 0; background: var(--ok-bg); color: var(--ok); }
.recon li.warn { background: var(--warn-bg); color: var(--warn); }
.recon li.note { background: var(--note-bg); color: var(--note); }
.recon li.none { background: var(--ok-bg); color: var(--ok); }
li.none { color: var(--muted); }

/* kept weeks */
.weeklist { list-style: none; padding: 0; margin: 10px 0 0; }
.hrow { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.hinfo { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.hinfo b { overflow-wrap: anywhere; }
.hbtns { display: flex; gap: 6px; flex: none; }
.mini { width: 44px; height: auto; flex: none; background: #5b3d26; border-radius: 8px; padding: 3px; border: 2px solid var(--line); }
.mini .g-plant .stem { stroke: #8fd19e; } .mini .g-plant .leaf { fill: #8fd19e; }
.mini.v-act_tonight { border-color: var(--v-tonight); } .mini.v-act_this_week { border-color: var(--v-week); } .mini.v-all_clear { border-color: var(--v-clear); }
.mini .cloche { stroke: #cfeaff; fill: rgba(200, 235, 255, 0.2); } .mini .cloche-knob { stroke: #cfeaff; }

.foot { max-width: 1120px; margin: 0 auto; padding: 10px 16px 40px; color: var(--muted); font-size: 0.86rem; }
.foot a { color: var(--ice); }
.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; width: min(92vw, 520px); }
.toast { padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); transition: opacity 0.5s; font-size: 0.92rem; }
.toast.err { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sky-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .bar { gap: 8px; padding: 8px 12px 10px; }
  .back { display: none; }
  .brand { font-size: 1rem; }
  .pill { padding: 5px 10px; font-size: 0.84rem; }
  .three { grid-template-columns: 1fr 1fr; }
  .three > div:last-child { grid-column: 1 / -1; }
  .sky-row { gap: 6px; }
  .bed { grid-template-columns: minmax(0, 2.6fr) repeat(var(--n, 7), minmax(0, 1fr)); padding: 6px; gap: 3px; }
  .bed-item { padding: 4px 5px; }
  .bed-item b { font-size: 0.78rem; }
  .bed-cell { min-height: 36px; border-radius: 6px; }
  .bed-night, .bed-corner { font-size: 0.7rem; }
  .bed-night { display: flex; align-items: flex-end; justify-content: center; }
  .bed-night.long span { writing-mode: vertical-rl; transform: rotate(180deg); overflow-wrap: normal; }
  .kind-tag { font-size: 0.66rem; padding: 0 4px; }
  .kind-tag .kn { display: block; }
  .kind-tag .kd { display: none; }
  .sky-ground b { display: block; }
  .sky-k { display: block; font-size: 0.7rem; }
  .cols { grid-template-columns: 1fr; }
  .panel { padding: 14px 14px; }
  .hrow { flex-wrap: wrap; }
}
