:root {
  --bg: #f3f5f0;
  --card: #ffffff;
  --ink: #1f2419;
  --soft: #5f6657;
  --line: #dde3d6;
  --accent: #497a3a;
  --accent-ink: #3a6230;
  --good: #2f7d4e;
  --good-bg: #e6f1e8;
  --warn: #9a5a1e;
  --warn-bg: #f6ece0;
  --pick-bg: #eef3e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28,36,20,.06), 0 8px 24px rgba(28,36,20,.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }

.top { padding: 34px 0 10px; }
.top h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.logo {
  display: inline-block; width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); position: relative;
}
.logo::before { content: ""; position: absolute; left: 7px; right: 7px; top: 10px; height: 8px; border: 2px solid #fff; border-bottom: 0; border-radius: 8px 8px 0 0; }
.logo::after { content: ""; position: absolute; left: 9px; bottom: 6px; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.tag { margin: 0; color: var(--soft); max-width: 60ch; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px 18px; box-shadow: var(--shadow); margin-top: 20px; }

.group { border: 0; padding: 12px 0; margin: 0; border-top: 1px solid var(--line); }
.group:first-of-type { border-top: 0; }
.group legend { font-size: 13px; font-weight: 700; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .05em; padding: 0; }
.opt-tag { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--soft); font-size: 12px; }

.field-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 120px; }
.field.narrow { flex: 0 1 130px; }
.field span { font-size: 13px; color: var(--soft); font-weight: 600; }
.field input, .field select {
  font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  min-width: 0; width: 100%;
}
.field input:focus, .field select:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--soft); }

.more { margin-top: 12px; }
.more summary { font-size: 13px; color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.more summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.out { margin-top: 16px; }
.result { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.result h3 { margin: 0 0 12px; font-size: 14px; color: var(--soft); font-weight: 700; letter-spacing: .01em; }

.opt { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.opt.pick { border-color: var(--accent); background: var(--pick-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.opt-h { font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tagpill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eceee7; color: var(--soft); }
.tagpill.good { color: var(--good); background: var(--good-bg); }
.tagpill.warn { color: var(--warn); background: var(--warn-bg); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; margin-top: 12px; }
.cell { text-align: center; background: #eef1e8; border: 1px solid var(--line); border-radius: 10px; padding: 11px 6px; }
.cell.big { background: var(--accent); border-color: var(--accent); }
.cell.big .k, .cell.big .v { color: #fff; }
.cell .k { display: block; font-size: 11px; color: var(--soft); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.cell .v { display: block; font-size: 22px; font-weight: 800; margin-top: 3px; }
.cell .u { font-size: 13px; font-weight: 700; }
.opt-sub { margin: 10px 0 0; font-size: 13px; color: var(--soft); }

.advice { margin: 0; padding-left: 18px; }
.advice li { font-size: 14px; color: var(--soft); margin-bottom: 7px; }
.advice li:last-child { margin-bottom: 0; }

.bad { border-color: #d8ddce; }
.bad h3 { color: var(--warn); }
.msg { margin: 0; font-size: 14px; color: var(--soft); }

.actions { display: flex; align-items: center; gap: 12px; margin: 6px 0 8px; }
.ghost {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.ghost:hover { border-color: var(--accent); }
.ghost:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.share-done { color: var(--good); font-size: 14px; font-weight: 600; }

.note { margin: 20px 0 10px; padding: 16px 18px; background: #e9eee1; border: 1px solid var(--line); border-radius: var(--radius); }
.note h2 { margin: 0 0 6px; font-size: 15px; }
.note p { margin: 0; color: var(--soft); font-size: 14px; }

.foot { padding: 20px 16px 120px; color: var(--soft); font-size: 13px; }
.foot a { color: var(--accent-ink); }

/* ---- Tip the wheelbarrow ---- */
.tip-dock { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tip-dock.tucked .tip-bubble, .tip-dock.tucked .tip { display: none; }
.tip-hide {
  align-self: flex-end; appearance: none; border: 1px solid var(--line); background: #fff; color: var(--soft);
  font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
}
.tip-dock.tucked .tip-hide::after { content: "Tip"; }
.tip-dock.tucked .tip-hide { font-size: 13px; }
.tip-bubble:empty { display: none; }
.tip-bubble {
  max-width: 244px; background: var(--ink); color: #fff; padding: 10px 13px; border-radius: 13px 13px 3px 13px;
  font-size: 13.5px; line-height: 1.4; box-shadow: var(--shadow);
}
.tip-bubble.pop { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.tip { appearance: none; border: 0; background: transparent; cursor: pointer; padding: 4px; }
.tip-svg { display: block; width: 72px; height: 64px; }
.tip-tray { fill: #d7a85a; stroke: var(--accent-ink); stroke-width: 2.4; stroke-linejoin: round; }
.tip-load { fill: #6a4b2f; }
.tip-wheel circle { fill: #3c4636; }
.tip-hub { fill: #cdd3c6 !important; }
.tip-leg, .tip-handle { fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; }
.tip-face { transition: transform .1s ease; }
.tip-eye { fill: #26301d; }
.tip-mouth { fill: none; stroke: #26301d; stroke-width: 2; stroke-linecap: round; }

.tip[data-mood="happy"] { animation: hop .5s ease; }
.tip[data-mood="happy"] .tip-mouth { d: path("M26 36 Q32 42 38 36"); }
.tip[data-mood="think"] .tip-mouth { d: path("M28 38 H36"); }
.tip[data-mood="strain"] .tip-load { fill: #5a3f28; }
.tip[data-mood="strain"] .tip-mouth { d: path("M27 39 Q32 35 37 39"); }
.tip[data-mood="strain"] { animation: shake .5s ease; }
.tip[data-mood="calm"] .tip-eye { transform: scaleY(.8); transform-origin: center; }
@keyframes hop { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-9px); } 55% { transform: translateY(0); } 70% { transform: translateY(-4px); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

.crumb { position: fixed; pointer-events: none; width: 8px; height: 8px; border-radius: 2px; background: #6a4b2f; z-index: 49; animation: fly 1s ease-out forwards; }
@keyframes fly { from { opacity: 1; transform: translate(0,0) rotate(0); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--dr)); } }

@media (prefers-reduced-motion: reduce) {
  .tip[data-mood="happy"], .tip[data-mood="strain"], .tip-bubble.pop { animation: none; }
  .crumb { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12150f; --card: #1b1f16; --ink: #e8ece0; --soft: #a3ab98; --line: #2b3123;
    --warn-bg: #2d2114; --good-bg: #16261b; --accent-ink: #8bbd6e; --pick-bg: #1c2416;
  }
  .cell { background: #242a1d; }
  .cell.big { background: var(--accent); }
  .note { background: #1b1f16; }
  .opt { border-color: #2b3123; }
  .tagpill { background: #242a1d; }
}
