/*
 * The Sets book's own look in the table book (garden.html, garden-main.js): the left page as the layout model types it
 * (the table brief, 0-layout-model-old-energy-page.png), its help state, the garden's name tags and the ghost hand.
 * Everything else is table-book.css. Targets are 44 px or more; reduced motion stills every transition.
 */
#wait { position: fixed; z-index: 4; left: 0; right: 0; top: 64px; }
#failed { position: fixed; z-index: 4; left: 0; right: 0; top: 64px; }
#crumb { margin-right: auto; }

/* The leaf: laid on the left page by a projective transform at the page's own size on screen (garden-main.js
   placeLeaf), or set flat in the flat book. No text on it is under 16 px; its room (`data-room`: tall, mid, short) sets
   how much it holds. Its controls are drawn as part of the page: ink tabs for the flowers and the beds, a ribbon to
   check, and handwritten links. No voice switch: the voice is always on (voice.js). */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.top { padding: 8px 12px; }
.leaf { position: fixed; z-index: 2; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; display: flex; flex-direction: column; box-sizing: border-box; padding: 26px 34px 18px; outline: 1px solid #e3d9bf; outline-offset: -12px; background: transparent; color: var(--ink); font: 400 19px/1.42 var(--serif); }
.leaf[hidden] { display: none; }
body[data-mode="flat"] .leaf { position: relative; transform: none !important; width: auto !important; height: auto !important; min-height: 420px; background: #fffdf6; }
.leaf-reading { display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 0; flex: 1; }
.leaf .kicker { margin: 0 0 8px; padding: 0 112px; font: 600 16px/1.3 var(--sans); font-variant: small-caps; letter-spacing: .08em; color: #8a7a55; }
.leaf-title { margin: 4px 0 12px; font: italic 500 36px/1.12 var(--serif); color: var(--ink); }
.leaf-lines p { margin: 0 0 8px; }
.leaf .equation { margin: 12px 0 6px; font: italic 500 28px/1.25 var(--serif); color: #9b2f2a; }
.leaf .instruction { margin: 6px 0 10px; font: 400 18px/1.4 var(--serif); color: var(--soft); }
.leaf hr { width: 86%; margin: 10px auto; border: 0; border-top: 1px solid var(--rule); }
.leaf .live { margin: 2px 0 12px; font: 500 17px/1.3 var(--mono); color: var(--ink); }
.leaf .said { min-height: 1.4em; margin: 8px 0 0; font: italic 400 17px/1.35 var(--serif); color: var(--leaf); }
.leaf .links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 30px; margin: auto 0 0; }
.leaf .link { min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--leaf); font: 400 21px/1 "Bradley Hand", "Segoe Print", "Marker Felt", "Chalkboard SE", "Comic Sans MS", cursive; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: pointer; }
.leaf .controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; width: 100%; }
.leaf .chips, .leaf .beds { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
/* The flowers: ink tabs, the one picked inked in. The beds: tabs of the garden's soil. */
.leaf .chip, .leaf .bed, .leaf .go, .leaf .link { white-space: nowrap; }
.leaf .chip, .leaf .bed { min-height: 44px; min-width: 44px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 6px 6px 14px 14px / 6px 6px 10px 10px; background: transparent; color: var(--ink); font: italic 500 17px/1 var(--serif); cursor: pointer; }
.leaf .chip[aria-pressed="true"] { background: var(--ink); color: #fbf6e7; }
.leaf .bed { border-style: dashed; border-radius: 22px; background: rgb(214 192 142 / .25); font-style: normal; }
/* Check: a ribbon across the page, its ends cut in a V. */
.leaf .go { min-height: 46px; padding: 0 34px; border: 0; background: #2f5d4a; color: #fbf6e7; font: 600 17px/1 var(--sans); clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%, 14px 50%); cursor: pointer; }
.leaf .go:disabled { opacity: .55; }
.leaf .beds .go { flex-basis: 100%; max-width: max-content; margin: 4px auto 0; }
.leaf .go .brief { display: none; }
.leaf .tab { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--ink); border-radius: 8px; padding-left: 12px; }
.leaf .tab .lab { font: 500 17px/1 var(--sans); }
.leaf .tab output { min-width: 2ch; font: 600 22px/1 var(--mono); text-align: center; }
.leaf .tab button { min-width: 44px; min-height: 44px; border: 0; border-left: 1.5px solid var(--ink); background: none; font: 500 22px/1 var(--sans); cursor: pointer; }

/* A tall page (a desktop's): the letters a size up, the controls lower down the page. */
.leaf[data-room="tall"] { font-size: 21px; }
.leaf[data-room="tall"] .leaf-title { font-size: 40px; }
.leaf[data-room="tall"] .equation { font-size: 31px; }
.leaf[data-room="tall"] .instruction { font-size: 20px; }
.leaf[data-room="tall"] .live { margin-top: 8px; font-size: 19px; }
.leaf[data-room="tall"] .controls { gap: 14px; }
.leaf[data-room="tall"] .chip, .leaf[data-room="tall"] .bed { min-height: 50px; padding: 0 16px; font-size: 20px; }
.leaf[data-room="tall"] .go { min-height: 54px; font-size: 20px; }
.leaf[data-room="tall"] .link { font-size: 24px; }

/* A mid page: a little tighter. */
.leaf[data-room="mid"] { padding: 18px 26px 12px; font-size: 17px; }
.leaf[data-room="mid"] .kicker { display: none; }
.leaf[data-room="mid"] .leaf-title { margin: 2px 0 8px; font-size: 29px; }
.leaf[data-room="mid"] .equation { margin: 8px 0 4px; font-size: 23px; }
.leaf[data-room="mid"] .instruction { margin: 4px 0 6px; font-size: 17px; }
.leaf[data-room="mid"] hr { margin: 6px auto; }
.leaf[data-room="mid"] .live { margin: 0 0 8px; font-size: 16px; }
.leaf[data-room="mid"] .chip, .leaf[data-room="mid"] .bed { padding: 0 10px; font-size: 16px; }
.leaf[data-room="mid"] .controls { gap: 6px; }
.leaf[data-room="mid"] .link { font-size: 19px; }
/* A short page (a phone on its side, a phone's notepad): no kicker, one row a group, the ribbon on the beds' row. */
.leaf[data-room="short"] { padding: 10px 16px 6px; font-size: 16px; line-height: 1.3; outline-offset: -6px; }
.leaf[data-room="short"] .kicker { display: none; }
.leaf[data-room="short"] .leaf-title { margin: 0 0 4px; font-size: 23px; }
.leaf[data-room="short"] .leaf-lines p { margin: 0 0 2px; }
.leaf[data-room="short"] .equation { margin: 2px 0; font-size: 19px; }
.leaf[data-room="short"] .instruction { margin: 0 0 2px; font-size: 16px; }
.leaf[data-room="short"] hr { margin: 2px auto; }
.leaf[data-room="short"] .live { margin: 0 0 4px; font-size: 16px; }
.leaf[data-room="short"] .controls { gap: 4px; }
.leaf[data-room="short"] .chips, .leaf[data-room="short"] .beds { gap: 4px; }
.leaf[data-room="short"] .beds { flex-wrap: nowrap; }
/* A reading page that still runs past its foot (garden-leaf.js `fit`): the heading goes, then the rule. */
.leaf[data-tight] .leaf-reading .leaf-title { display: none; }
.leaf[data-tight] .leaf-reading .leaf-lines { align-self: stretch; }
.leaf[data-tight="2"] .leaf-reading hr { display: none; }
/* With the controls on it, a short page lets the instruction go: the garden names the start and the goal, and the
   ghost hand shows the drag. */
.leaf[data-room="short"] .leaf-reading:has(.controls) .instruction { display: none; }
.leaf[data-room="short"] .chip, .leaf[data-room="short"] .bed { padding: 0 6px; font: 500 16px/1 var(--sans); }
.leaf[data-room="short"] .go { padding: 0 20px; font-size: 16px; }
.leaf[data-room="short"] .chips .go { margin-left: 4px; }
.leaf[data-room="short"] .go .long { display: none; }
.leaf[data-room="short"] .go .brief { display: inline; }
.leaf[data-room="short"] .live { font-family: var(--sans); font-weight: 600; }
.leaf[data-room="short"] .said { margin: 0; min-height: 0; font-size: 16px; }
.leaf[data-room="short"] .links { gap: 0 14px; margin-top: 0; }
.leaf[data-room="short"] .link { font-size: 17px; }

/* Help: Tok's small garden on top, the steps written by hand under it, live as he shows them. */
.leaf[data-state="help"] { padding: 16px 22px 10px; }
.leaf-sim { position: relative; flex: none; height: 42%; border: 1.5px solid #c9b78c; border-radius: 10px; background: #efe5c8; padding: 6px; }
.leaf-sim svg { display: block; width: 100%; height: 100%; }
.leaf-sim .badge { position: absolute; left: 14px; top: -14px; padding: 3px 12px; border-radius: 12px; background: #8f2f2a; color: #fbf6e7; font: 600 16px/1.3 var(--sans); }
.leaf-sim .placed { transition: transform .8s cubic-bezier(.3,.7,.3,1); }
.leaf-sim .gardener { transition: transform .7s ease-in-out; }
.leaf .legend { flex: none; margin: 6px 0 0; font: 500 16px/1.25 var(--sans); text-align: center; }
.leaf .legend span { font-weight: 700; }
.leaf-steps { flex: 1; min-height: 0; margin-top: 10px; padding: 4px 4px 0; overflow: hidden; display: flex; flex-direction: column; }
.leaf-steps h3 { margin: 0 0 4px; font: italic 500 20px/1.2 var(--serif); }
.leaf-steps ol { flex: 1; min-height: 0; margin: 0; padding-left: 1.4em; overflow-y: auto; }
.leaf-steps li { margin: 0 0 6px; }
.leaf-steps li b { display: block; font: 400 17px/1.35 var(--serif); }
.leaf-steps .hand { display: inline-block; margin: 2px 14px 0 0; font: 400 20px/1.3 "Bradley Hand", "Segoe Print", "Marker Felt", "Chalkboard SE", "Comic Sans MS", cursive; color: #9b2f2a; }
.leaf .go-on { align-self: center; margin-top: 2px; }
.leaf[data-room="short"][data-state="help"] { padding: 12px 12px 4px; }
.leaf[data-room="short"] .leaf-sim { height: 38%; }
.leaf[data-room="short"] .leaf-steps { margin-top: 4px; }
.leaf[data-room="short"] .leaf-steps h3 { font-size: 17px; margin: 0 0 2px; }
.leaf[data-room="short"] .leaf-steps li b { font-size: 16px; }
.leaf[data-room="short"] .leaf-steps .hand { font-size: 17px; }
.keep-ask { display: block; margin: 6px 0; font: 500 18px/1.35 var(--serif); }
.leaf .keep-row { display: flex; gap: 8px; width: 100%; }
.leaf .keep-row input { flex: 1; min-height: 46px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: #fff; font: 400 17px/1.2 var(--serif); }

/* The garden's names, the only words on the right page: the things in it, where she starts and what it is for. */
#tags { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#tags[hidden] { display: none; }
#tags .tag { position: absolute; left: 0; top: 0; translate: -50% -100%; padding: 1px 8px; border-radius: 10px; background: rgb(255 253 246 / .92); box-shadow: 0 0 0 1px #203d3455; color: var(--ink); font: 600 16px/1.25 var(--sans); white-space: nowrap; }
#tags .tag.ring { background: #203d34; color: #fbf6e7; }
#tags .tag.bed { background: rgb(243 227 162 / .95); }
#tags .tag.who { background: #4f9a6a; color: #fff; }
#tags .tag.goal { background: #9b2f2a; color: #fbf6e7; }
#tags .tag.start { background: #fffdf6; box-shadow: 0 0 0 1.5px var(--ink); }
.ghost { position: fixed; z-index: 3; left: 0; top: 0; pointer-events: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 14px; background: #fffdf6; box-shadow: 0 0 0 1.5px var(--ink); font: 600 16px/1.2 var(--sans); animation: ghost 2.4s ease-in-out infinite; }
.ghost[hidden] { display: none; }
.ghost .hand { display: inline-block; width: 16px; height: 20px; background: var(--ink); clip-path: polygon(0 0, 100% 62%, 58% 66%, 80% 100%, 62% 100%, 42% 70%, 0 92%); }
@keyframes ghost { 0%, 15% { translate: 0 0; opacity: 1; } 70% { translate: 0 -70px; opacity: 1; } 85% { translate: 0 -70px; opacity: 0; } 100% { translate: 0 0; opacity: 0; } }

@media (prefers-reduced-motion: reduce) { .ghost { animation: none; } .leaf-sim .placed, .leaf-sim .gardener { transition: none; } }
