:root {
  color-scheme: light;
  --g-ink: #163923;
  --g-muted: #526251;
  --g-line: #c8cbb7;
  --g-divider: #d9dbc9;
  --g-panel: #fffaef;
  --g-surface: #f7f4e7;
  --g-leaf: #1a432d;
  --g-tint: #e8eedc;
  --g-pad: clamp(13px, 1.45vw, 24px);
}
*, *::before, *::after { box-sizing: border-box; }
body { line-height: 1.45; }
main { padding-bottom: 35px; }
main :is(h2, p) { margin: 0; }
main h2 { font-size: clamp(1.06rem, 1.35vw, 1.35rem); line-height: 1.18; letter-spacing: -.035em; }
main :is(button, input, select) { color: inherit; font: inherit; }
main :is(button, summary, select) { cursor: pointer; }
main button { appearance: none; }
main :is(button, input, a, summary) { -webkit-tap-highlight-color: transparent; }
main button:disabled { opacity: .44; cursor: default; }
:focus-visible { outline: 3px solid #92631c; outline-offset: 3px; }
[hidden] { display: none !important; }
.icon-bank { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.icon { display: inline-block; width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: fixed; z-index: 9; top: 4px; left: 8px; padding: .6rem .8rem; background: var(--g-leaf); color: #fff; transform: translateY(-150%); }
.skip:focus { transform: none; }
.intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 13px 24px; }
.intro p { margin-top: .48rem; font-size: clamp(1rem, 1.22vw, 1.13rem); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .62rem 1rem; border: 1px solid var(--g-line); border-radius: 8px; background: var(--g-panel); font-size: .94rem; font-weight: 700; line-height: 1.15; }
.btn.primary { color: #fffaf0; background: var(--g-leaf); border-color: var(--g-leaf); }
.btn.primary:hover { background: #295b3e; }
.btn.outline:not(:disabled):hover, .icon-btn:not(:disabled):hover { background: var(--g-tint); border-color: #96a58c; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(295px, 29.5%); gap: clamp(14px, 1.65vw, 25px); align-items: start; }
.studio:focus:not(:focus-visible) { outline: 0; }
.panel { min-width: 0; border: 1px solid var(--g-line); border-radius: 14px; background: var(--g-panel); box-shadow: 0 2px 6px #3d482e0a; }
.plan-panel { overflow: hidden; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .56rem var(--g-pad); }
.plan-tools, .history { display: flex; align-items: center; gap: 6px; }
.plan-tools { gap: 12px; }
.history { padding-left: 11px; border-left: 1px solid var(--g-divider); }
.icon-btn { display: inline-grid; place-items: center; width: 39px; height: 38px; padding: 0; border: 1px solid var(--g-line); border-radius: 7px; background: var(--g-panel); }
.icon-btn .icon { width: 17px; height: 17px; }
.grid-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 10px; border: 1px solid var(--g-line); border-radius: 7px; background: var(--g-panel); font-size: .89rem; font-weight: 650; cursor: pointer; }
.grid-toggle:has(input:checked) { background: var(--g-tint); border-color: #879a7f; }
.grid-toggle:has(input:focus-visible) { outline: 3px solid #92631c; outline-offset: 2px; }
.grid-toggle input { position: absolute; cursor: pointer; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; }
.grid-toggle .icon { width: 16px; height: 16px; }
.garden-stage { position: relative; width: 100%; aspect-ratio: 3/2; overflow: hidden; border-block: 1px solid var(--g-divider); background: #f0eee1; }
#garden-canvas { position: absolute; display: block; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#garden-canvas:active { cursor: grabbing; }
#garden-canvas:focus-visible { outline-offset: -4px; }
.canvas-hint { padding: .62rem var(--g-pad); color: var(--g-muted); font-size: .89rem; }
.mobile-link { display: none; }
.section-fold { border-top: 1px solid var(--g-divider); }
main summary { display: flex; align-items: center; gap: 8px; list-style: none; font-weight: 670; }
main summary::-webkit-details-marker { display: none; }
main summary:hover { background: #f3f2e5; }
.section-fold summary { min-height: 48px; padding: .65rem var(--g-pad); font-size: .97rem; }
.summary-value { margin-left: auto; color: var(--g-muted); text-align: right; font-size: .84rem; font-weight: 550; }
.fold-icon { width: 17px; height: 17px; }
.chevron { width: 15px; height: 15px; }
details[open] > summary .chevron { transform: rotate(180deg); }
.fold-body { border-top: 1px solid var(--g-divider); padding: .88rem var(--g-pad) 1.06rem; }
.plot-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto; gap: .7rem; align-items: end; }
.reset-row { display: flex; flex-wrap: wrap; gap: .4rem 1.15rem; margin-top: .6rem; }
.text-btn, .mobile-link { padding: .45rem 0; border: 0; background: transparent; color: var(--g-ink); font-size: .89rem; font-weight: 650; text-decoration: underline; text-underline-offset: .21em; }
.text-btn:hover, .mobile-link:hover { color: #39774d; }
.status { color: var(--g-muted); padding: .5rem var(--g-pad); border-top: 1px solid var(--g-divider); background: #eef1e4; font-size: .87rem; }
.status:empty { display: none; }
.settings { display: grid; gap: 12px; min-width: 0; }
.palette, .editor { padding: clamp(14px,1.45vw,23px); }
.library { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin-top: .87rem; }
.library button { display: flex; align-items: center; gap: clamp(5px,.55vw,10px); min-width: 0; min-height: 51px; padding: 5px 7px; border: 1px solid var(--g-divider); border-radius: 8px; text-align: left; background: var(--g-surface); font-size: .9rem; line-height: 1.15; font-weight: 650; }
.library button:hover { background: var(--g-tint); border-color: #99a991; }
.library button:active { background: #dce6ca; }
.library canvas { display: block; width: clamp(32px,3vw,48px); height: auto; aspect-ratio: 1; flex: 0 0 auto; }
.editor-head { display: flex; align-items: center; gap: .45rem; justify-content: space-between; }
.inspector-title { margin: .6rem 0; color: var(--g-muted); overflow-wrap: anywhere; font-size: .96rem; font-weight: 600; }
.editor:has(#inspector:disabled) .inspector-title { font-weight: 450; margin-bottom: 0; }
#inspector { min-width: 0; margin: 0; padding: 0; border: 0; }
#inspector:disabled .fields, #inspector:disabled .item-actions { display: none; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem .75rem; }
.field { display: grid; gap: 3px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: .87rem; font-weight: 650; }
.field label span { font-weight: 480; color: var(--g-muted); }
.field :is(input, select) { width: 100%; min-width: 0; height: 43px; padding: 5px 9px; border: 1px solid #b8bfaa; border-radius: 6px; outline-offset: 1px; color: var(--g-ink); background-color: #fffcf5; font-size: 1rem; }
.field select { appearance: none; padding-right: 25px; background: #fffcf5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23334939' stroke-width='1.5'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 8px center; }
.item-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: .85rem; }
.item-actions .btn { flex: 1 1 auto; padding-inline: .6rem; }
.item-actions .icon { width: 16px; height: 16px; }
#objects-list { display: flex; flex-wrap: wrap; gap: 6px; }
.object-entry { padding: .45rem .7rem; min-height: 38px; border: 1px solid var(--g-line); border-radius: 6px; background: var(--g-panel); font-size: .88rem; text-align: left; overflow-wrap: anywhere; }
.object-entry:hover, .object-entry[aria-pressed=true] { border-color: #81967a; background: var(--g-tint); }
.object-entry[aria-pressed=true] { box-shadow: inset 0 0 0 1px #81967a; }
.help { max-width: 900px; margin: clamp(18px,2.1vw,35px) 0; }
.help details { border-bottom: 1px solid var(--g-line); }
.help summary { justify-content: space-between; padding: .83rem .15rem; }
.help p { max-width: 78ch; padding: 0 .15rem .9rem; line-height: 1.55; color: var(--g-muted); }
.no-script { padding: .75rem; background-color: var(--g-tint); }
@media (max-width: 970px) {
  .studio { grid-template-columns: minmax(0,1fr) minmax(268px,31%); gap: 12px; }
  .palette, .editor { padding: 14px; }
  .library { gap: 5px; }
  .library button { font-size: .86rem; padding-inline: 5px; }
  .plot-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .studio { grid-template-columns: minmax(0,1fr); }
  .settings { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
  .library canvas { width: 34px; }
  .garden-stage { max-height: 64svh; }
  .mobile-link { display: inline-flex; min-height: 39px; align-items: center; }
  .plan-panel:has(+ .settings #inspector:disabled) .canvas-hint .mobile-link { display: none; }
  .canvas-hint { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: center; justify-content: space-between; }
  .intro p { line-height: 1.4; }
  .history .icon-btn, .grid-toggle { min-height: 44px; }
  .history .icon-btn { width: 44px; }
  .object-entry { min-height: 44px; }
}
@media (max-width: 590px) {
  .settings { grid-template-columns: minmax(0,1fr); }
  .garden-stage { aspect-ratio: 7/5; max-height: none; }
  .palette, .editor { padding: 14px; }
  .library { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
  .library button { flex-direction: column; justify-content: center; padding: 5px 2px; font-size: .84rem; text-align: center; gap: 3px; }
  .library canvas { width: clamp(35px,9vw,44px); }
  .panel { border-radius: 11px; }
  .intro .primary { padding: .57rem .8rem; }
  .section-fold summary { gap: 6px; }
  .summary-value { font-size: .79rem; }
  .plot-form, .fields { gap: 9px; }
  .canvas-hint { font-size: .85rem; }
}
@media (max-width: 425px) {
  .library { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library button { flex-direction: row; justify-content: start; text-align: left; padding: 4px 6px; gap: 4px; min-height: 45px; }
  .library canvas { width: 32px; }
  .plan-tools { gap: 6px; }
  .history { padding-left: 6px; gap: 3px; }
  .plan-head { padding: .42rem 10px; gap: .25rem; }
  .grid-toggle { padding-inline: 7px; gap: 4px; }
  .history .icon-btn { width: 40px; }
}
@media (max-width: 345px) {
  .grid-toggle .icon { display: none; }
  .history { border: 0; padding-left: 0; }
  .section-fold summary { flex-wrap: wrap; }
}
@media (forced-colors: active) {
  .grid-toggle:has(input:checked), .object-entry[aria-pressed=true] { outline: 2px solid ButtonText; }
}

.plan-head { flex-wrap: wrap; justify-content: flex-start; column-gap: .45rem; row-gap: .35rem; }
.plan-head h2 { margin-inline-end: auto; }
.plan-head > .tk-share { flex: none; }
