@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,600&display=swap");

:root {
  --bg: #edf1eb;
  --paper: #ffffff;
  --paper-soft: #f6f8f4;
  --ink: #18251f;
  --ink-soft: #65736c;
  --ink-faint: #8d9892;
  --line: #dce4dd;
  --line-strong: #c8d3ca;
  --green: #246b50;
  --green-dark: #174c3c;
  --green-soft: #e6f0e9;
  --green-bright: #d8edbd;
  --wood: #a06b3b;
  --wood-dark: #78502f;
  --accent: #e9a451;
  --danger: #b8443d;
  --shadow: 0 12px 36px rgba(31, 54, 42, 0.1);
  --shadow-soft: 0 4px 16px rgba(31, 54, 42, 0.08);
  --radius: 16px;
  font-family: "Manrope", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(216, 237, 189, 0.42), transparent 28rem),
    var(--bg);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
summary {
  font: inherit;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(36, 107, 80, 0.2);
  outline-offset: 2px;
}

.app-header {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 10px 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(200, 211, 202, 0.85);
  box-shadow: 0 2px 14px rgba(31, 54, 42, 0.04);
  backdrop-filter: blur(18px);
}

.brand-mark,
.login-logo,
.empty-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 13px;
  background: var(--green-dark);
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.08);
}

.brand-mark::before,
.login-logo::before,
.empty-icon::before {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 9px;
  width: 2px;
  height: 18px;
  border-radius: 4px;
  background: #eef8e7;
}

.brand-mark::after,
.login-logo::after,
.empty-icon::after,
.brand-mark span,
.login-logo span,
.empty-icon span {
  content: "";
  position: absolute;
  width: 13px;
  height: 8px;
  border-radius: 12px 2px 12px 2px;
  background: var(--green-bright);
  transform: rotate(22deg);
}

.brand-mark::after,
.login-logo::after,
.empty-icon::after {
  left: 9px;
  top: 12px;
}

.brand-mark span,
.login-logo span,
.empty-icon span {
  right: 7px;
  top: 9px;
  transform: rotate(70deg) scaleX(-1);
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.5px;
}

.brand-copy p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.location-pill {
  margin-left: 8px;
  padding: 6px 10px;
  color: var(--green-dark);
  border: 1px solid #cfe0d3;
  border-radius: 999px;
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.25px;
}

.app-header .spacer {
  flex: 1;
}

.header-action,
.app-header #user-menu button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: 160ms ease;
}

.header-action:hover,
.app-header #user-menu button:hover {
  border-color: var(--line-strong);
  background: var(--paper-soft);
  transform: translateY(-1px);
}

.header-action.sync-action {
  color: #fff;
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.cloud {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

#user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}

#user-avatar {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

#user-name {
  display: block;
  max-width: 130px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 12px;
  gap: 12px;
}

aside {
  position: relative;
  z-index: 20;
  display: flex;
  width: 370px;
  min-width: 330px;
  max-width: 38vw;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  transition: width 220ms ease, min-width 220ms ease, opacity 180ms ease, transform 220ms ease;
}

.panel-head {
  padding: 20px 18px 10px;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.step-label {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.panel-head h2,
.workspace-title h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.35px;
  text-transform: none;
}

.panel-head p,
.workspace-title p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.panel-collapse {
  display: inline-flex;
  min-height: 34px;
  padding: 0 10px;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.panel-collapse span {
  color: var(--green-dark);
  font-size: 17px;
  line-height: 1;
}

.catalog-reveal {
  position: absolute;
  top: 50%;
  left: 15px;
  z-index: 25;
  display: none;
  min-height: 42px;
  padding: 0 12px;
  align-items: center;
  gap: 6px;
  color: var(--green-dark);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  transform: translateY(-50%);
}

body.cat-collapsed .catalog-reveal {
  display: inline-flex;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  padding: 3px;
  gap: 3px;
  border-radius: 11px;
  background: #edf1ed;
}

.tabs button {
  min-height: 32px;
  padding: 4px 5px;
  color: var(--ink-soft);
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  transition: 150ms ease;
}

.tabs button.active {
  color: var(--green-dark);
  background: #fff;
  box-shadow: 0 1px 5px rgba(31, 54, 42, 0.1);
}

.search {
  position: relative;
  margin: 4px 18px 12px;
}

.search > span {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  color: var(--ink-soft);
  font-size: 20px;
  transform: translateY(-54%) rotate(-15deg);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 13px 0 39px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
  font-size: 11px;
  transition: 160ms ease;
}

.search input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(36, 107, 80, 0.09);
}

.filter-title,
.season-lbl {
  display: block;
  padding: 0 18px 6px;
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.filterbar,
.season-row .filterbar {
  display: flex;
  padding: 0 18px 10px;
  gap: 6px;
  flex-wrap: wrap;
}

.horizontal-scroll {
  overflow: visible;
}

.benefit-filters {
  padding-bottom: 14px;
  row-gap: 7px;
}

.season-row {
  display: block;
  padding: 2px 0 0;
  border: 0;
}

.chip {
  display: inline-flex;
  min-height: 28px;
  padding: 5px 9px;
  flex: 0 0 auto;
  align-items: center;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  transition: 140ms ease;
}

.chip:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.chip.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 3px 8px rgba(36, 107, 80, 0.2);
}

.catalog {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 22px;
  scrollbar-color: #c5d0c7 transparent;
  scrollbar-width: thin;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.group-label {
  margin: 16px 2px 8px;
  padding: 0 2px 7px;
  color: var(--green-dark);
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.plant {
  position: relative;
  min-width: 0;
  min-height: 174px;
  padding: 12px 10px 44px;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: grab;
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.plant:hover {
  z-index: 1;
  border-color: #abc4b3;
  box-shadow: 0 10px 24px rgba(31, 54, 42, 0.11);
  transform: translateY(-2px);
}

.plant:active {
  cursor: grabbing;
}

.plant .art {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 0 auto 7px;
}

.plant .art .ring {
  position: absolute;
  inset: 2px;
  border: 1px dashed rgba(36, 107, 80, 0.35);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 237, 189, 0.2), transparent 65%);
}

.plant .art .art-img {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 54px;
  height: 54px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.plant .nm {
  margin-top: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plant .sci {
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 8px;
  font-style: italic;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plant .dist {
  position: absolute;
  top: 9px;
  left: 9px;
  margin: 0;
  padding: 3px 6px;
  color: var(--green-dark);
  border-radius: 99px;
  background: var(--green-soft);
  font-size: 8px;
  font-weight: 800;
}

.plant .fx {
  position: absolute;
  top: 9px;
  right: 8px;
  display: flex;
  margin: 0;
  gap: 1px;
  font-size: 10px;
}

.plant .met {
  display: none;
}

.plant .card-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 6px;
}

.info-btn,
.add-btn {
  min-height: 31px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  transition: 140ms ease;
}

.info-btn {
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--paper-soft);
  text-transform: capitalize;
}

.add-btn {
  color: #fff;
  border: 1px solid var(--green);
  background: var(--green);
  font-size: 17px;
  line-height: 1;
}

.info-btn:hover,
.add-btn:hover {
  filter: brightness(0.96);
}

.legend {
  display: none;
}

.loading {
  padding: 28px 14px;
  color: var(--ink-soft);
  text-align: center;
}

.planner {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.workspace-head {
  display: flex;
  min-height: 70px;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.workspace-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.tools-toggle {
  display: inline-flex;
  min-height: 40px;
  padding: 0 12px;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--green-dark);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper-soft);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.tools-toggle-icon {
  font-size: 15px;
  line-height: 1;
  transition: transform 180ms ease;
}

body.tools-collapsed .tools-toggle-icon {
  transform: rotate(180deg);
}

.group.proj-group {
  display: flex;
  max-width: 520px;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
}

.proj-group > label {
  margin-right: 2px;
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.proj-select {
  width: 160px;
  height: 36px;
  padding: 0 30px 0 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  font-size: 10px;
  font-weight: 600;
}

.iconbtn {
  width: auto;
  min-height: 36px;
  padding: 0 11px;
  flex: 0 0 auto;
  color: #fff;
  border: 1px solid var(--green);
  border-radius: 10px;
  background: var(--green);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.iconbtn.subtle {
  color: var(--ink-soft);
  border-color: var(--line);
  background: #fff;
}

.toolbar {
  display: grid;
  min-height: 0;
  padding: 9px 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  border-bottom: 1px solid var(--line);
  background: #f8faf7;
}

body.tools-collapsed .toolbar {
  display: none;
}

.toolbar-mobile-head,
.mobile-dock {
  display: none;
}

.tool-section {
  display: flex;
  min-width: 0;
  padding: 7px 9px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.bed-tool,
.terrain-tool {
  align-items: flex-end;
}

.bed-tool .tool-copy,
.terrain-tool .tool-copy {
  align-self: center;
}

.bed-tool > .btn,
.terrain-tool > .btn {
  height: 36px;
  align-self: flex-end;
}

.tool-copy {
  display: flex;
  min-width: 92px;
  flex-direction: column;
  padding-right: 4px;
}

.tool-kicker {
  color: var(--green);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.tool-copy strong {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.25;
}

.measure-fields {
  display: flex;
  align-items: center;
  gap: 6px;
}

.measure-field {
  display: grid;
  width: 76px;
  gap: 4px;
}

.measure-field > span:first-child {
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.measure-input {
  display: flex;
  width: 100%;
  height: 36px;
  padding: 0 9px;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.measure-input:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 107, 80, 0.09);
}

.measure-input input {
  min-width: 0;
  width: 100%;
  padding: 0;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
  -moz-appearance: textfield;
}

.toolbar .measure-input input[type="number"] {
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
}

.measure-input input::-webkit-outer-spin-button,
.measure-input input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.measure-input small {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
}

.dimension-x {
  margin-top: 18px;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 700;
}

.btn {
  min-height: 36px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--paper-soft);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition: 140ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.btn.primary {
  color: #fff;
  border-color: var(--green-dark);
  background: var(--green-dark);
  box-shadow: 0 4px 10px rgba(23, 76, 60, 0.18);
}

.btn.secondary {
  color: var(--green-dark);
  border-color: #cbdcd0;
  background: var(--green-soft);
}

.btn.ghost {
  color: var(--ink-soft);
  border-color: var(--line);
  background: #fff;
}

.view-tool {
  gap: 10px;
}

.zoom-control {
  display: flex;
  height: 36px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.zoom-control .btn {
  min-width: 31px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 16px;
}

#scaleLbl {
  min-width: 62px;
  padding: 0 5px;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 700;
  text-align: center;
}

.snap-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.snap-lbl input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--green);
}

.action-tool {
  margin-left: 0;
  justify-content: flex-end;
}

.btn.icon-only {
  width: 36px;
  padding: 0;
  font-size: 16px;
}

.more-menu {
  position: relative;
}

.more-menu summary {
  display: grid;
  min-width: 54px;
  place-items: center;
  list-style: none;
}

.more-menu summary::-webkit-details-marker {
  display: none;
}

.more-popover {
  position: fixed;
  top: 148px;
  right: 22px;
  z-index: 100;
  display: flex;
  width: 220px;
  padding: 9px;
  flex-direction: column;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow);
}

.more-popover > span {
  padding: 6px 7px 4px;
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.menu-btn {
  min-height: 35px;
  padding: 0 8px;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  text-align: left;
}

.menu-btn:hover {
  background: var(--paper-soft);
}

.more-popover hr {
  width: 100%;
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.danger-text {
  color: var(--danger);
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 237, 189, 0.28), transparent 36rem),
    #eef2ec;
  scrollbar-color: #bdc9bf transparent;
  scrollbar-width: thin;
}

.canvas-badge {
  position: sticky;
  top: 10px;
  left: 12px;
  z-index: 16;
  display: inline-flex;
  min-height: 30px;
  margin: 10px 0 -40px 12px;
  padding: 0 10px;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  border: 1px solid rgba(200, 211, 202, 0.9);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 3px 10px rgba(31, 54, 42, 0.06);
  backdrop-filter: blur(8px);
  font-size: 8px;
  font-weight: 700;
}

.canvas-badge span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

#stage {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  margin: 0;
  transform-origin: top left;
}

#grid {
  position: absolute;
  inset: 0;
}

.empty-hint {
  position: sticky;
  top: 50%;
  left: 50%;
  z-index: 10;
  width: min(370px, calc(100vw - 64px));
  margin: 0;
  padding: 28px;
  color: var(--ink);
  border: 1px solid rgba(200, 211, 202, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.empty-hint .empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 13px;
  border-radius: 15px;
}

.empty-hint h3 {
  margin: 2px 0 6px;
  font-family: "Newsreader", Georgia, serif;
  font-size: 23px;
  letter-spacing: -0.4px;
}

.empty-hint p {
  max-width: 290px;
  margin: 0 auto 16px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.empty-hint small {
  display: block;
  max-width: 285px;
  margin: 12px auto 0;
  color: var(--ink-faint);
  font-size: 8px;
  line-height: 1.45;
}

.del-sel {
  position: sticky;
  top: 10px;
  left: calc(100% - 148px);
  z-index: 18;
  min-height: 32px;
  padding: 0 11px;
  color: #fff;
  border: 0;
  border-radius: 9px;
  background: var(--danger);
  box-shadow: 0 4px 12px rgba(184, 68, 61, 0.2);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.stats {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  width: 220px;
  overflow: hidden;
  border: 1px solid rgba(200, 211, 202, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.stats h4 {
  display: flex;
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  border: 0;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.stats-body {
  display: grid;
  padding: 4px 12px 11px;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.stats .row {
  display: flex;
  min-width: 0;
  padding: 7px 8px;
  flex-direction: column;
  gap: 3px;
  border: 1px solid #e5ebe5;
  border-radius: 9px;
  background: var(--paper-soft);
}

.stats .row span {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 7px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats .row b {
  color: var(--green-dark);
  font-size: 12px;
}

.stats .row.conflict {
  grid-column: 1 / -1;
  color: var(--danger);
  border-color: #efc9c5;
  background: #fff3f1;
}

.stats .mini {
  display: none;
  grid-column: 1 / -1;
  max-height: 100px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.stats:not(.collapsed) .mini:not(:empty) {
  display: block;
}

.stats .mini div {
  display: flex;
  padding: 5px 2px;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 8px;
}

.stats.collapsed .stats-body {
  display: none;
}

.stats.collapsed {
  width: 160px;
}

body.cat-collapsed aside {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-16px);
}

/* Canvas objects */
.node {
  position: absolute;
  user-select: none;
}

.plant-node {
  z-index: 7;
  cursor: grab;
  transform: translate(-50%, -50%);
}

.plant-node:active,
.board-rect:active {
  cursor: grabbing;
}

.plant-node .pring {
  position: absolute;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  border: 1.5px dashed rgba(36, 107, 80, 0.55);
  border-radius: 50%;
  background: rgba(216, 237, 189, 0.13);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.plant-node.overlap .pring {
  border-color: rgba(184, 68, 61, 0.8);
  background: rgba(184, 68, 61, 0.08);
}

.plant-node .psvg {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  box-sizing: border-box;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 9px rgba(31, 54, 42, 0.2);
  transform: translate(-50%, -50%);
}

.plant-node .psvg .art-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.plant-node .tag {
  position: absolute;
  top: calc(50% + var(--icon-size) / 2 + 2px);
  left: 50%;
  z-index: 3;
  padding: 2px 5px;
  color: var(--ink);
  border: 1px solid rgba(200, 211, 202, 0.9);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 1px 4px rgba(31, 54, 42, 0.1);
  font-size: 7px;
  font-weight: 800;
  white-space: nowrap;
  transform: translateX(-50%);
}

.plant-node .nbadge {
  top: calc(50% - var(--icon-size) / 2 - 6px);
  right: calc(50% - var(--icon-size) / 2 - 6px);
  bottom: auto;
  left: auto;
}

.node.sel .psvg,
.node.sel .board-rect {
  outline: 3px solid rgba(36, 107, 80, 0.42);
  outline-offset: 3px;
}

.board {
  z-index: 3;
}

.board-rect {
  position: relative;
  cursor: move;
  filter: drop-shadow(0 8px 12px rgba(58, 41, 25, 0.14));
}

.board-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid #76543b;
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 12%, transparent 88%, rgba(55, 31, 16, 0.12)),
    #9a6b47;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 0 rgba(55, 31, 16, 0.14);
}

.board-soil {
  position: absolute;
  inset: var(--frame);
  border: 1px solid rgba(103, 77, 52, 0.34);
  border-radius: 6px;
  background-color: #e7deca;
  background-image: radial-gradient(circle, rgba(104, 82, 58, 0.18) 0 1px, transparent 1.2px);
  background-size: 13px 13px;
  box-shadow:
    inset 0 8px 18px rgba(103, 77, 52, 0.09),
    inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

.board button {
  position: absolute;
  z-index: 5;
  display: grid;
  min-width: 26px;
  min-height: 26px;
  padding: 0 6px;
  place-items: center;
  color: var(--ink);
  border: 1px solid rgba(200, 211, 202, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 8px rgba(31, 54, 42, 0.12);
  cursor: pointer;
  font-size: 10px;
}

.board-actions {
  position: absolute;
  top: -44px;
  left: 0;
  z-index: 8;
  display: flex;
  max-width: calc(100% - 16px);
  padding: 3px;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  border: 1px solid rgba(200, 211, 202, 0.92);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 12px rgba(31, 54, 42, 0.12);
  backdrop-filter: blur(8px);
}

.board .board-actions button {
  position: static;
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 30px;
  padding: 0 9px;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.board .board-actions button:hover {
  color: var(--ink);
  background: var(--paper-soft);
}

.board .board-actions .lock.on {
  color: var(--green-dark);
  background: var(--green-soft);
}

.board .board-actions .del {
  color: var(--danger);
}

.board-footer {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 9;
  display: flex;
  width: 100%;
  min-width: max-content;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.board-size {
  display: inline-flex;
  min-height: 36px;
  padding: 0 11px;
  align-items: center;
  gap: 4px;
  color: #63472f;
  border: 1px solid rgba(140, 105, 73, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 5px 14px rgba(58, 41, 25, 0.12);
  font-size: 9px;
  font-weight: 800;
  pointer-events: auto;
  white-space: nowrap;
}

.board-size::before {
  content: "Medidas";
  margin-right: 4px;
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 700;
}

.board-size small {
  color: var(--ink-faint);
  font-size: 8px;
}

.board .board-footer .dim {
  position: static;
  padding: 0;
  color: inherit;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: inherit;
  transform: none;
}

.board .board-footer .ana {
  position: static;
  display: inline-flex;
  min-height: 36px;
  padding: 0 14px;
  align-items: center;
  gap: 6px;
  color: #fff;
  border-color: var(--green-dark);
  background: var(--green-dark);
  box-shadow: 0 5px 14px rgba(23, 76, 60, 0.22);
  font-size: 9px;
  font-weight: 800;
  transform: none;
  pointer-events: auto;
  white-space: nowrap;
}

.board .board-footer .ana::before {
  content: "+";
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
}

.board .handle {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 6;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid rgba(200, 211, 202, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 44%, var(--green-dark) 45% 51%, transparent 52% 61%, var(--green-dark) 62% 68%, transparent 69%),
    rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 8px rgba(31, 54, 42, 0.14);
  cursor: nwse-resize;
}

.nbadge {
  position: absolute;
  right: -8px;
  bottom: -8px;
  z-index: 5;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 9px;
}

.nbadge.good {
  background: #9edb9d;
}

.nbadge.bad {
  background: #efaaa4;
}

.marquee {
  position: absolute;
  z-index: 30;
  border: 1px solid var(--green);
  background: rgba(36, 107, 80, 0.1);
  pointer-events: none;
}

#ghost {
  position: fixed;
  z-index: 999;
  display: none;
  width: 58px;
  height: 58px;
  padding: 5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#ghost .art-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1000;
  max-width: min(440px, calc(100vw - 32px));
  padding: 11px 15px;
  color: #fff;
  border-radius: 11px;
  background: #18251f;
  box-shadow: var(--shadow);
  font-size: 10px;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Modals */
.modal-back,
#tutorial,
#login-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(17, 31, 24, 0.56);
  backdrop-filter: blur(8px);
}

.modal {
  position: relative;
  width: min(820px, 100%);
  max-height: min(86vh, 900px);
  padding: 28px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(17, 31, 24, 0.24);
}

.modal-close,
.tut-x,
.login-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  cursor: pointer;
}

.m-head {
  display: flex;
  padding-right: 40px;
  align-items: center;
  gap: 18px;
}

.m-art {
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-soft);
}

.m-art .art-img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.m-head h3 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 30px;
  letter-spacing: -0.6px;
}

.m-sci {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.m-tags {
  display: flex;
  margin-top: 9px;
  gap: 5px;
  flex-wrap: wrap;
}

.m-tags span,
.pill {
  display: inline-flex;
  min-height: 27px;
  padding: 4px 9px;
  align-items: center;
  color: var(--green-dark);
  border: 1px solid #d3e2d6;
  border-radius: 99px;
  background: var(--green-soft);
  font-size: 8px;
  font-weight: 700;
}

button.pill {
  cursor: pointer;
}

.m-grid {
  display: grid;
  margin-top: 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.m-cell {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
}

.m-cell.full {
  grid-column: 1 / -1;
}

.m-cell h5 {
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.m-cell .v,
.m-cell > div {
  color: var(--ink);
  font-size: 10px;
  line-height: 1.55;
}

.m-cell.pos {
  border-color: #cce0d0;
  background: #f2f8f3;
}

.m-cell.neg {
  border-color: #efcfcb;
  background: #fff6f5;
}

.m-foot {
  margin-top: 16px;
  color: var(--ink-faint);
  font-size: 8px;
  line-height: 1.5;
}

.tut-card,
.login-card {
  position: relative;
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(17, 31, 24, 0.26);
  text-align: center;
}

.tut-art {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 15px;
  place-items: center;
  border-radius: 18px;
  background: var(--green-soft);
  font-size: 28px;
}

.tut-card h3,
.login-card h2 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 28px;
  letter-spacing: -0.5px;
}

.tut-card > p,
.login-txt {
  margin: 10px auto 20px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.tut-dots {
  display: flex;
  margin: 17px 0;
  justify-content: center;
  gap: 5px;
}

.tut-dots span {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: #dbe2dc;
  transition: 160ms ease;
}

.tut-dots span.on {
  width: 20px;
  background: var(--green);
}

.tut-foot {
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 18px;
}

.login-kicker {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--green);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#g-signin {
  display: flex;
  min-height: 40px;
  justify-content: center;
}

.guest-btn {
  width: 100%;
  margin-top: 9px;
}

.login-note {
  margin: 13px 0 0;
  color: var(--ink-faint);
  font-size: 8px;
}

#login-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 9px;
}

#rotate-hint {
  display: none !important;
}

@media (max-width: 1180px) {
  .location-pill,
  .tool-copy {
    display: none;
  }

  aside {
    width: 340px;
    min-width: 310px;
  }

  .toolbar {
    padding-right: 8px;
  }

  .action-tool {
    margin-left: 0;
  }

  .proj-group > label,
  .iconbtn.subtle {
    display: none;
  }
}

@media (max-width: 880px) {
  .app-header {
    min-height: 62px;
    padding: 8px 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-copy h1 {
    font-size: 20px;
  }

  .brand-copy p,
  .cloud,
  #user-menu .u-info,
  #btnTutorial {
    display: none;
  }

  .header-action,
  .app-header #user-menu button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 9px;
  }

  main {
    padding: 0;
    gap: 0;
  }

  .planner {
    border: 0;
    border-radius: 0;
  }

  aside {
    position: fixed;
    top: 70px;
    bottom: 8px;
    left: 8px;
    z-index: 200;
    width: min(370px, calc(100vw - 16px));
    min-width: 0;
    max-width: none;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(17, 31, 24, 0.25);
  }

  body.cat-collapsed aside {
    width: min(370px, calc(100vw - 16px));
    min-width: 0;
    opacity: 0;
    transform: translateX(calc(-100% - 16px));
  }

  #catClose {
    display: grid;
    place-items: center;
  }

  #catBackdrop {
    position: fixed;
    inset: 62px 0 0;
    z-index: 190;
    display: block;
    background: rgba(17, 31, 24, 0.34);
    opacity: 1;
    transition: 180ms ease;
  }

  body.cat-collapsed #catBackdrop {
    opacity: 0;
    pointer-events: none;
  }

  .workspace-head {
    min-height: 64px;
    padding: 9px 10px;
  }

  .workspace-title h2 {
    font-size: 15px;
  }

  .workspace-title p,
  .proj-group .proj-select,
  #projSave {
    display: none;
  }

  .proj-group {
    gap: 4px;
  }

  .iconbtn.subtle {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
  }

  .toolbar {
    display: flex;
    min-height: 68px;
    padding: 7px 8px;
    align-items: stretch;
    overflow-x: auto;
  }

  .tool-section {
    min-width: max-content;
    padding: 5px 6px;
  }

  .view-tool .snap-lbl,
  .action-tool #calBtn {
    display: none;
  }

  .canvas-badge {
    margin-left: 8px;
  }

  .stats {
    right: 10px;
    bottom: 10px;
  }

  .modal-back,
  #tutorial,
  #login-gate {
    padding: 12px;
  }

  .modal {
    max-height: 92vh;
    padding: 22px 16px;
    border-radius: 17px;
  }
}

@media (max-width: 560px) {
  .brand-copy p,
  .workspace-title .step-label,
  .proj-group,
  .terrain-tool,
  .action-tool #undoBtn {
    display: none;
  }

  .brand-copy h1 {
    font-size: 18px;
  }

  .sync-action {
    margin-left: auto;
  }

  .workspace-head {
    min-height: 58px;
  }

  .toolbar {
    min-height: 64px;
  }

  .measure-field {
    width: 68px;
  }

  .stats {
    width: 190px;
  }

  .stats.collapsed {
    width: 146px;
  }

  .empty-hint {
    width: calc(100vw - 32px);
    padding: 22px 18px;
  }

  .empty-hint h3 {
    font-size: 21px;
  }

  .m-head {
    align-items: flex-start;
  }

  .m-art {
    width: 68px;
    height: 68px;
  }

  .m-art .art-img {
    width: 58px;
    height: 58px;
  }

  .m-head h3 {
    font-size: 24px;
  }

  .m-grid {
    grid-template-columns: 1fr;
  }

  .m-cell.full {
    grid-column: auto;
  }

  .tut-card,
  .login-card {
    padding: 28px 20px 22px;
  }
}

/* Mobile app shell: the catalog and tools behave as independent bottom sheets. */
@media (max-width: 880px) {
  html,
  body {
    overscroll-behavior: none;
  }

  main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .workspace-head {
    min-height: 62px;
    padding: 8px 12px;
  }

  .workspace-title {
    gap: 0;
  }

  .workspace-title h2 {
    font-size: 17px;
  }

  .tools-toggle,
  .catalog-reveal {
    display: none !important;
  }

  aside {
    top: 70px;
    right: 8px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-width: none;
    border-radius: 20px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 240ms cubic-bezier(.2, .8, .2, 1);
  }

  body.cat-collapsed aside {
    width: auto;
    opacity: 0;
    transform: translateY(calc(100% + 90px));
    pointer-events: none;
  }

  .panel-head {
    padding: 16px 14px 10px;
  }

  .panel-collapse {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 11px;
    font-size: 10px;
  }

  .catalog {
    padding-bottom: 12px;
    overscroll-behavior: contain;
  }

  #catBackdrop {
    position: fixed;
    inset: 62px 0 calc(64px + env(safe-area-inset-bottom));
    z-index: 190;
    display: block;
    background: rgba(17, 31, 24, 0.4);
    opacity: 1;
    pointer-events: auto;
    transition: opacity 180ms ease;
    backdrop-filter: blur(2px);
  }

  body.cat-collapsed:not(.mobile-tools-open) #catBackdrop {
    opacity: 0;
    pointer-events: none;
  }

  .toolbar,
  body.tools-collapsed .toolbar {
    position: fixed;
    right: 8px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    left: 8px;
    z-index: 260;
    display: none;
    width: auto;
    max-height: min(72dvh, 620px);
    min-height: 0;
    padding: 10px;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 20px;
    background: rgba(248, 250, 247, 0.98);
    box-shadow: 0 24px 70px rgba(17, 31, 24, 0.28);
    overscroll-behavior: contain;
  }

  body.mobile-tools-open .toolbar,
  body.mobile-tools-open.tools-collapsed .toolbar {
    display: grid;
    animation: mobileSheetIn 220ms cubic-bezier(.2, .8, .2, 1);
  }

  @keyframes mobileSheetIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .toolbar-mobile-head {
    position: sticky;
    top: -10px;
    z-index: 3;
    display: flex;
    min-height: 48px;
    margin: -10px -10px 2px;
    padding: 10px 12px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 250, 247, 0.98);
  }

  .toolbar-mobile-head strong {
    font-family: "Newsreader", Georgia, serif;
    font-size: 18px;
  }

  .toolbar-mobile-head button {
    min-height: 36px;
    padding: 0 13px;
    color: var(--green-dark);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    font-size: 10px;
    font-weight: 800;
  }

  .tool-section {
    width: 100%;
    min-width: 0;
    padding: 11px;
    border-radius: 14px;
  }

  .bed-tool,
  .terrain-tool {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 9px;
  }

  .bed-tool .tool-copy,
  .terrain-tool .tool-copy {
    display: flex;
    grid-column: 1 / -1;
    padding: 0;
  }

  .tool-copy strong {
    font-size: 11px;
  }

  .measure-fields {
    width: 100%;
  }

  .measure-field {
    width: auto;
    min-width: 0;
    flex: 1;
  }

  .measure-input,
  .bed-tool > .btn,
  .terrain-tool > .btn {
    height: 44px;
  }

  .bed-tool > .btn,
  .terrain-tool > .btn {
    min-width: 100px;
    padding: 0 14px;
  }

  .view-tool,
  .action-tool {
    display: flex;
    min-height: 58px;
    justify-content: space-between;
  }

  .view-tool .snap-lbl,
  .action-tool #calBtn,
  .action-tool #undoBtn {
    display: inline-flex;
  }

  .action-tool .btn,
  .view-tool .btn,
  .more-menu > summary {
    min-height: 42px;
  }

  .mobile-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 300;
    display: grid;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-top: 1px solid rgba(200, 211, 202, 0.86);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -8px 30px rgba(31, 54, 42, 0.12);
    backdrop-filter: blur(14px);
  }

  .mobile-dock button {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ink-soft);
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-dock button span {
    color: var(--green);
    font-size: 15px;
  }

  .mobile-dock button[aria-pressed="true"] {
    color: var(--green-dark);
    border-color: #cfe0d3;
    background: var(--green-soft);
  }

  .stage-wrap {
    padding-bottom: 76px;
    touch-action: pan-x pan-y;
  }

  .stats,
  .stats.collapsed {
    right: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 20px);
  }

  #toast {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  #tutorial {
    padding: 16px 10px calc(10px + env(safe-area-inset-bottom));
    align-items: end;
  }

  .tut-card {
    width: 100%;
    max-height: 84dvh;
    padding: 26px 20px 18px;
    overflow-y: auto;
    border-radius: 24px 24px 18px 18px;
    text-align: left;
  }

  .tut-art {
    width: 54px;
    height: 54px;
    margin: 0 0 14px;
    border-radius: 15px;
    font-size: 24px;
  }

  .tut-card h3 {
    padding-right: 34px;
    font-size: 26px;
  }

  .tut-card > p {
    margin: 10px 0 16px;
    font-size: 12px;
    line-height: 1.65;
  }

  .tut-dots {
    justify-content: flex-start;
  }

  .tut-foot .btn {
    min-height: 44px;
  }

  .board-footer {
    top: calc(100% + 8px);
    gap: 6px;
  }

  .board-size {
    min-height: 34px;
  }

  .board .board-footer .ana {
    min-height: 34px;
  }
}

@media (max-width: 560px) {
  .app-header {
    min-height: 60px;
  }

  .brand-copy h1 {
    max-width: 170px;
    font-size: 16px;
    line-height: 1.05;
  }

  #btnTutorial {
    display: grid;
    width: 38px;
    min-width: 38px;
    padding: 0;
    place-items: center;
    font-size: 0;
  }

  #btnTutorial::before {
    content: "?";
    font-size: 14px;
    font-weight: 900;
  }

  .header-action {
    padding: 0 9px;
  }

  .workspace-head {
    min-height: 58px;
  }

  .group.proj-group {
    display: none;
  }

  .terrain-tool {
    display: grid;
  }

  .action-tool #undoBtn {
    display: inline-flex;
  }

  .bed-tool,
  .terrain-tool {
    grid-template-columns: 1fr;
  }

  .bed-tool > .btn,
  .terrain-tool > .btn {
    width: 100%;
  }

  .view-tool,
  .action-tool {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .action-tool #analysisBtn {
    flex: 1;
  }

  .board-footer {
    width: max-content;
  }

  .board-size::before {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
