:root {
  --green: #2f6b4f;
  --green-dark: #1e4634;
  --leaf: #e5f2e8;
  --soil: #6b4a32;
  --soil-soft: #c4a484;
  --cream: #f6f1e7;
  --card: #fffdf8;
  --ink: #2a241c;
  --muted: #5e564c;
  --line: #e4d8c8;
  --warn: #8a4b12;
  --shadow: 0 8px 24px rgba(60, 40, 20, 0.08);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { min-height: 100vh; }
a { color: var(--green-dark); }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.site-header, .site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--green-dark); color: #f4f7f2; }
.site-header a, .site-footer a { color: #f4f7f2; text-decoration: none; }
.logo { font-weight: 700; letter-spacing: 0.02em; font-size: 1.15rem; display: inline-flex; align-items: center; }
.logo img { height: 32px; width: auto; display: block; }
body.home { background: #c9d7c4 url("../images/home-garden-sm.webp") center top / cover no-repeat; }
.home .hero { background: rgba(255, 253, 248, 0.92); }
.home .guide-list a { background: rgba(255, 253, 248, 0.94); }
@media (min-width: 800px) {
  body.home { background-image: url("../images/home-garden.webp"); }
}
.nav { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer { background: #24362c; font-size: 0.92rem; }
.wrap { max-width: 980px; margin: 0 auto; padding: 28px 18px 64px; }
.hero { background: var(--card); border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow); }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 1.35rem; margin: 0 0 8px; }
.lede { font-size: 1.15rem; margin: 0 0 18px; }
.sell { background: var(--leaf); border-radius: 14px; padding: 12px 14px; margin: 0 0 18px; }
.btn { display: inline-block; background: var(--green); color: white; text-decoration: none; border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 650; }
.btn.secondary, button.secondary { background: white; color: var(--green-dark); border: 1px solid var(--soil-soft); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.card { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; }
.card p, .prose p { line-height: 1.5; }
.prose { max-width: 720px; }
.prose h1 { margin-bottom: 12px; }
.muted { color: var(--muted); }
.guide-list { display: grid; gap: 12px; margin-top: 18px; }
.guide-list a { display: block; background: var(--card); border-radius: 16px; padding: 14px 16px; text-decoration: none; box-shadow: var(--shadow); }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="search"] {
  width: 100%; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px 10px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; }
.plan-page { background: #efe8dc; }
.how { margin: 10px 10px 0; background: var(--card); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
.how-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.how-bar strong { font-size: 1rem; }
.how-bar button { border-radius: 10px; border: 1px solid var(--line); background: white; padding: 8px 10px; }
.how video { width: 100%; max-height: 320px; background: #243028; border-radius: 12px; display: block; }
.how.collapsed video { display: none; }
.how.collapsed .how-bar { margin-bottom: 0; }
.plan-app { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; grid-template-rows: auto minmax(420px, calc(100vh - 150px)); gap: 10px; padding: 10px; }
.library, .side, .board-wrap { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; }
.library { grid-row: 1 / span 2; padding: 12px; overflow: auto; }
.board-wrap { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; padding: 10px; }
.side { grid-column: 3; grid-row: 1 / span 2; padding: 12px; overflow: auto; }
.toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.toolbar .row button, .side button, .library button.block { border-radius: 10px; border: 1px solid var(--line); background: white; padding: 8px 10px; }
button.primary, .toolbar button.primary { background: var(--green); color: white; border-color: var(--green); }
button.on { outline: 2px solid var(--green); }
.library h2, .side h2 { font-size: 1rem; margin: 0 0 8px; }
.plant-btn { display: flex; gap: 8px; width: 100%; text-align: left; border: 1px solid transparent; background: var(--leaf); border-radius: 12px; padding: 8px; margin: 0 0 6px; }
.plant-btn strong { display: block; }
.plant-btn span { color: var(--muted); font-size: 0.8rem; }
.plant-btn.armed { outline: 2px solid var(--green); }
.emoji { font-size: 1.3rem; width: 1.6rem; text-align: center; }
#viewport { position: relative; flex: 1; min-height: 320px; overflow: hidden; border-radius: 14px; background: #e7f0df; touch-action: none; border: 1px solid var(--line); }
#viewport.grid-on {
  background-image:
    linear-gradient(to right, rgba(90, 60, 30, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(90, 60, 30, 0.28) 1px, transparent 1px);
  background-color: #e7f0df;
}
.photo-layer, .bed { position: absolute; }
.photo-layer { user-select: none; pointer-events: none; }
.photo-layer img { width: 100%; height: 100%; object-fit: fill; display: block; }
.bed { background: rgba(255, 253, 248, 0.45); border: 2px solid var(--soil); border-radius: 8px; overflow: hidden; }
.bed.selected { border-color: var(--green); }
.bed-bar { display: flex; justify-content: space-between; gap: 6px; align-items: center; background: var(--soil); color: white; font-size: 0.78rem; padding: 3px 6px; cursor: grab; }
.bed-grid { position: absolute; inset: 22px 0 0 0; }
.cell { position: absolute; border: 1px dashed rgba(107, 74, 50, 0.35); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.72rem; line-height: 1.1; text-align: center; overflow: hidden; }
.cell.filled { background: rgba(229, 242, 232, 0.78); border-style: solid; }
.cell.selected { outline: 2px solid var(--green); z-index: 2; }
.hint { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.account-box { margin-top: 12px; }
.account-box summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.price { font-size: 1.4rem; margin: 0 0 8px; }
.note { background: #fff6e8; border-radius: 12px; padding: 8px 10px; margin: 8px 0; font-size: 0.88rem; }
.note.caution { background: #fde8d8; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; }
.panel { display: none; }
.panel.on { display: block; }
label.file { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: white; cursor: pointer; }
.file input { display: none; }
.scale-box { background: var(--leaf); border-radius: 12px; padding: 8px; margin-top: 6px; }
#printSheet { display: none; }
#placeBar[hidden], #stampTray[hidden] { display: none !important; }
.place-bar .muted { margin: 4px 0 0; }
#photoLibrary[hidden] { display: none !important; }
.lib-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.lib-filters button { border-radius: 999px; border: 1px solid var(--line); background: white; padding: 6px 10px; }
.lib-filters button.on { background: var(--green); color: white; border-color: var(--green); }
.lib-card { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; background: white; border: 1px solid var(--line); border-radius: 12px; padding: 6px; margin: 0 0 6px; }
.lib-card img { width: 54px; height: 54px; object-fit: contain; background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 12px 12px; border-radius: 8px; }
.lib-card span span { display: block; color: var(--muted); font-size: 0.8rem; }
.stamp-btn { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; background: var(--leaf); border: 0; border-radius: 12px; padding: 6px; margin: 0 0 6px; }
.stamp-btn img { width: 42px; height: 42px; object-fit: contain; background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 12px 12px; border-radius: 8px; }
.piece { position: absolute; transform-origin: center center; touch-action: none; }
.piece img, .piece .icon-face { width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.piece .icon-face { display: flex; align-items: center; justify-content: center; line-height: 1; }
.piece.selected { outline: 2px solid var(--green); outline-offset: 2px; }
.piece-handle { position: absolute; width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 2px solid var(--green); background: white; }
.piece-handle.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
.piece-handle.rot { left: 50%; top: -28px; margin-left: -8px; cursor: grab; }
.placing #bedRow, .placing #removePlant, .placing #clearBed { display: none; }
.print-piece { position: absolute; }
.print-piece img { width: 100%; height: 100%; object-fit: contain; }
.narrow, .plants-close, .plants-toggle, .photo-toggle { display: none; }
.photo-body { display: flex; flex-direction: column; gap: 8px; }
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.library-head h2 { margin: 0 0 8px; }
.prose a, .guide-list a, .wrap { overflow-wrap: anywhere; }
.chart-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.chart-nav a { background: var(--card); border-radius: 999px; padding: 6px 10px; text-decoration: none; border: 1px solid var(--line); }
.mgrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; min-width: 520px; font-size: 0.72rem; color: var(--muted); }
.bloom-grid { min-width: 0; margin: 8px 0; }
.bloom-grid span { text-align: center; border-radius: 6px; padding: 4px 0; background: #efe8dc; }
.bloom-grid span.on { background: var(--green); color: white; }
.track-scroll { overflow-x: auto; }
.track { position: relative; height: 22px; min-width: 520px; background: #efe8dc; border-radius: 8px; }
.bar { position: absolute; top: 4px; height: 14px; border-radius: 4px; }
.frost-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); }
.legend { font-size: 0.85rem; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin: 0 4px 0 10px; }
.legend i.line { width: 2px; height: 12px; background: var(--warn); }
.chart-row { margin: 0 0 12px; }
.chart-name { font-weight: 650; }
@media print {
  .site-header, .site-footer, .no-print, .chart-nav { display: none !important; }
  body { background: white; }
  .wrap { max-width: none; padding: 0; }
}
@media (max-width: 700px) {
  .wide { display: none; }
  .narrow { display: inline; }
  h1 { font-size: 1.55rem; }
  .site-header, .site-footer { padding: 10px 12px; }
  .nav { width: 100%; gap: 10px; font-size: 0.9rem; }
  .hero { padding: 18px 14px; }
}
@media (max-width: 980px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .plan-page { padding-bottom: 72px; }
  .plan-app { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; width: 100%; padding: 8px; }
  .library, .board-wrap, .side { grid-column: 1; grid-row: auto; width: 100%; max-width: 100%; }
  .board-wrap { order: -1; }
  #viewport { width: 100%; min-height: 52vh; }
  .toolbar .row, .side .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }
  .toolbar .row > *, .side .row > * { min-width: 0; max-width: 100%; }
  #addBed { grid-column: 1 / -1; }
  .toolbar button, .toolbar label.file, .side button, .side label.file, .tabs button,
  .photo-toggle, .plants-toggle, .plants-close, .plant-btn {
    min-height: 44px;
    max-width: 100%;
    text-align: center;
  }
  .plant-btn { text-align: left; }
  input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="email"], input[type="range"], select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  input[type="text"], input[type="number"], input[type="date"], input[type="search"], select { min-height: 44px; }
  .photo-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: white;
    padding: 8px 12px;
  }
  .photo-toggle::after { content: "Show"; color: var(--muted); font-size: 0.85rem; }
  .photo-panel.open .photo-toggle::after { content: "Hide"; }
  .photo-body { display: none; }
  .photo-panel.open .photo-body { display: flex; }
  .plants-toggle {
    display: block;
    position: fixed;
    z-index: 20;
    left: 8px;
    right: 8px;
    bottom: 8px;
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    background: var(--green);
    color: white;
    font-weight: 650;
    box-shadow: var(--shadow);
  }
  .library {
    display: none;
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 72vh;
    overflow: auto;
    border-radius: 16px 16px 0 0;
  }
  .library.open { display: block; }
  .plants-close { display: inline-flex; align-items: center; margin-bottom: 8px; }
  .nav a { display: inline-flex; align-items: center; min-height: 44px; }
  button, label.file, .btn { min-height: 44px; }
  input[type="range"] { min-height: 44px; }
  .grid-toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; }
  .grid-toggle input[type="checkbox"] { width: 22px; height: 22px; }
  .piece-handle { display: none; }
}
@media print {
  .site-header, .site-footer, .plan-app, .how, .plants-toggle { display: none !important; }
  #printSheet { display: block; padding: 12px; color: black; background: white; }
  #printSheet .print-photo { position: relative; width: 100%; margin: 8px 0 16px; }
  #printSheet .print-photo img { width: 100%; display: block; }
  #printSheet .print-bed {
    position: absolute; border: 2px solid #333; background: rgba(255,255,255,0.72); font-size: 11px;
  }
  #printSheet table { page-break-inside: avoid; margin-bottom: 12px; }
}
