:root {
  /* Morning garden: cool dusk, morpho / hydrangea blue, soft leaf */
  --dusk: #141c22;
  --dusk-2: #1e2a32;
  --paper: #f4f0e8;
  --ink: #1c2428;
  --clay: #3f6f8f;
  --clay-2: #335a75;
  --fern: #6e8f72;
  --amber: #e8d5a8;
  --muted: #7a8890;
  --line: rgba(28, 36, 40, 0.12);
  --petal: #f0dde6;
  --sky: #9ec5e0;
  color-scheme: dark;
  font-family: "Segoe UI", sans-serif;
  color: var(--paper);
  background: var(--dusk);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html.i18n-wait [data-i18n],
html.i18n-wait [data-i18n-html] { visibility: hidden; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
button, input { font: inherit; }
a { color: inherit; }

body.sheet-page, body.capture {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(63, 111, 143, 0.22), transparent 58%),
    radial-gradient(700px 380px at 100% 0%, rgba(110, 143, 114, 0.14), transparent 55%),
    var(--dusk);
}
body.home {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(14, 24, 32, 0.58) 0%, rgba(12, 20, 26, 0.78) 100%),
    url("/assets/home-bg.jpg?v=garden163") center / cover no-repeat fixed,
    var(--dusk);
}
body.home h1, body.home .lead, body.home .steps li {
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}
body.home .home-note {
  margin-top: 28px;
  padding: 16px 18px;
  background: rgba(16, 11, 8, 0.78);
  border-radius: 18px;
  color: #f6efe4;
}
body.home .home-note p {
  margin: 0 0 10px;
  color: #f6efe4;
  font-size: 15px;
  line-height: 1.45;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.wrap { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 calc(64px + env(safe-area-inset-bottom, 0px)); }
.home-bar { padding-bottom: 0; }
.home-bar + .wrap { padding-top: 12px; }
.home-help-btn {
  appearance: none; flex: none;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 999px;
  background: rgba(243, 234, 216, 0.16); color: #f6efe4;
  font: 700 22px/1 Georgia, serif; cursor: pointer;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.home-help-btn img { width: 22px; height: 22px; display: block; margin: 0 auto; }
.home-help-layer {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(16, 11, 8, 0.45);
}
.home-help-panel {
  width: min(560px, 100%);
  max-height: min(78vh, 720px);
  overflow: auto;
  background: var(--paper); color: var(--ink);
  border-radius: 24px; padding: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}
.home-help-panel h2, .home-help-panel h3 {
  font-family: Georgia, Palatino, serif; font-weight: 500; margin: 16px 0 6px;
}
.home-help-panel h2 { margin-top: 0; }
.home-help-panel p, .home-help-panel li { margin: 0 0 8px; line-height: 1.4; }
.home-help-panel ol, .home-help-panel ul { margin: 0 0 8px; padding-left: 1.2em; }
.home-help-panel .fine { color: #6d675f; }
.home-help-panel .btn { margin-top: 8px; }
.home-help-panel label { display: block; margin: 8px 0 6px; font-weight: 650; }
.home-help-panel input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fffaf2; color: var(--ink);
}
.home-name-actions { display: grid; gap: 8px; margin-top: 14px; }
.home-name-actions .btn { margin-top: 0; }
/* Until head script marks is-app / is-web — show nothing (kills phone flash of TV/marketing shell). */
html:not(.is-app):not(.is-web) .home-bar,
html:not(.is-app):not(.is-web) #app-home,
html:not(.is-app):not(.is-web) #web-home { display: none !important; }
html.is-app .home-bar,
body.is-app .home-bar,
html.is-app #web-home,
body.is-app #web-home { display: none !important; }
html.is-app #app-home,
body.is-app #app-home,
html.is-app #app-home[hidden],
body.is-app #app-home[hidden] { display: block !important; }
html.is-web .home-bar,
html.is-web #web-home,
html.is-web #web-home[hidden] { display: block !important; }
html.is-web #app-home { display: none !important; }
body.is-app .app-shell {
  padding-top: calc(56px + env(safe-area-inset-top, 0px));
}
.meadows-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.meadows-head h1 {
  margin: 0; min-width: 0; flex: 1 1 auto;
  font-size: clamp(26px, 7vw, 36px); line-height: 1.1;
}
.app-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.app-tools .langs select {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  padding: 0 20px 0 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  text-align-last: center;
  background-position: right 8px center;
}
.app-lead {
  margin: 0 0 12px; max-width: 34rem;
  color: #d8cfc3; font-size: 16px; line-height: 1.45;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}
.app-sheets { margin: 0 0 16px; }
.app-sheets .btn { display: inline-flex; }
.meadow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 22px;
}
.meadow-card {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(16, 11, 8, 0.78);
  color: #f6efe4;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  text-align: left;
}
.meadow-open {
  display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.meadow-shot {
  display: block; width: 100%; aspect-ratio: 16 / 10;
  background: #1a2830 center / cover no-repeat;
}
.meadow-shot[data-clearing="isle"] { background-color: #4a6b78; }
.meadow-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px 12px;
}
.meadow-name { font-size: 15px; font-weight: 650; line-height: 1.2; }
.meadow-count { font-size: 13px; color: #c9bfb2; }
.meadow-del {
  appearance: none; position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; padding: 6px; border: 0; border-radius: 999px;
  background: rgba(10, 16, 22, 0.55); color: #f6efe4; cursor: pointer;
}
.meadow-del svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.meadow-add {
  min-height: 188px; align-items: center; justify-content: center; gap: 8px;
  background: rgba(16, 11, 8, 0.48);
  outline: 2px dashed rgba(246, 239, 228, 0.28); outline-offset: -8px;
  cursor: pointer; font-weight: 650; font-size: 15px;
}
.meadow-add-plus { font-size: 36px; line-height: 1; color: var(--sky); }
body.is-tv-portal .play-wrap,
body.is-tv-portal .steps,
body.is-tv-portal #create,
body.is-tv-portal .play-valley,
body.is-tv-portal #web-home > p:not(.lead) { display: none; }
body.is-tv-portal .home-tv { display: block; background: transparent; padding: 0; }
body.is-tv-portal .home-tv summary { display: none; }
body.is-tv-portal .home-tv .card {
  margin-top: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
}
body.is-tv-portal .home-note,
body.is-tv-portal #tv-join h2,
body.is-tv-portal #tv-join > p:not(.error) { display: none; }
body.is-app .app-shell h1 { font-size: clamp(28px, 8vw, 40px); margin-top: 4px; }
.play-wrap { margin: 8px 0 6px; }
.play-valley { display: inline-flex; align-items: center; justify-content: center; min-height: 58px; padding: 0 28px; font-size: 20px; width: min(100%, 420px); }
.home-tv { margin-top: 28px; background: rgba(16, 11, 8, 0.78); border-radius: 18px; padding: 4px 16px 8px; }
.home-tv summary {
  cursor: pointer; min-height: 48px; display: flex; align-items: center;
  color: #f6efe4; font-weight: 650;
}
.home-tv .card, .home-tv .home-note { margin-top: 8px; background: transparent; box-shadow: none; }
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand-name {
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 20px; font-weight: 500; line-height: 1.15;
}
.brand { display: flex; align-items: center; gap: 12px; letter-spacing: 0.04em; font-size: 14px; font-weight: 650; color: var(--amber); }
.langs { margin: 0; }
.langs select {
  appearance: none;
  min-height: 38px;
  min-width: 168px;
  padding: 0 36px 0 14px;
  border: 0;
  border-radius: 999px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23e8d5a8' d='M1 1.2 6 6.2 11 1.2'/%3E%3C/svg%3E") no-repeat right 14px center,
    rgba(246, 239, 228, 0.12);
  color: #f6efe4;
  font-size: 14px;
  cursor: pointer;
}
.langs select:hover { background-color: rgba(246, 239, 228, 0.18); }
.langs select:focus { outline: 2px solid var(--amber); outline-offset: 2px; }
.langs select option { color: #1c2428; background: #f4f0e8; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
html[dir="rtl"] .steps li { grid-template-columns: 1fr 32px; }
html[dir="rtl"] .steps li .num { grid-column: 2; }
html[dir="rtl"] .langs select { padding: 0 14px 0 36px; background-position: left 14px center; }
.brand img { width: 80px; height: 80px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35)); }
h1 { font-family: Palatino, "Palatino Linotype", Georgia, serif; font-weight: 500; font-size: clamp(46px, 8vw, 76px); line-height: 0.92; margin: 18px 0 12px; }
.lead { font-size: 20px; line-height: 1.45; max-width: 36rem; color: #f6efe4; }
.steps { display: grid; gap: 10px; margin: 28px 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; color: #efe4d4; }
.num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #2a3a44; color: var(--amber); font-family: Georgia, serif; }
.grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.card { background: var(--paper); color: var(--ink); border-radius: 22px; padding: 22px; }
.card h2 { font-family: Georgia, serif; font-weight: 500; font-size: 28px; margin: 0 0 8px; }
.card p { margin: 0 0 14px; color: #5c5148; }
label { display: block; font-size: 14px; margin: 12px 0 6px; }
input[type="text"], input[type="password"] {
  width: 100%; border: 0; background: #fffaf2; color: var(--ink);
  border-radius: 14px; padding: 14px 16px; outline: 2px solid transparent;
}
input:focus { outline-color: var(--clay); }
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: 16px;
  background: var(--clay); color: #f6f3ea; font-weight: 650;
}
.btn:hover { background: var(--clay-2); }
.btn.fern { background: var(--petal); color: var(--ink); }
.btn.picked { box-shadow: inset 0 0 0 3px #241910; }
.btn.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.btn.ghost { background: transparent; color: var(--ink); outline: 1px solid rgba(36, 25, 16, 0.2); }
.btn.wide { width: 100%; margin-top: 16px; }
.fine { color: var(--muted); font-size: 14px; line-height: 1.45; }
.urls { display: grid; gap: 6px; margin-top: 8px; }
.urls code { display: block; background: var(--dusk-2); color: var(--paper); border-radius: 10px; padding: 8px 10px; overflow-wrap: anywhere; }
.home-host {
  font-family: Georgia, serif; font-size: 22px; letter-spacing: 0.03em;
  text-align: center; user-select: all;
}
#tv-pin {
  font-family: Georgia, serif; font-size: 40px; letter-spacing: 0.28em;
  text-align: center;
}
.error { color: #6a3d32; min-height: 1.2em; margin: 8px 0 0; }
body.sheet-page .btn.fern,
body.capture .btn.fern,
body.remote .btn.fern {
  background: rgba(213, 222, 204, 0.16);
  color: #f3ead8;
}
body.sheet-page .btn.ghost,
body.capture .btn.ghost {
  color: #f3ead8;
  outline-color: rgba(243, 234, 216, 0.28);
}

body.stage { overflow: hidden; background: #101820; }
#view { width: 100vw; height: 100vh; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui button, #ui a, #ui .panel, #ui .backdrop, #ui .coach, #ui iframe, #ui .dock, #ui .sheet-pop, #ui .home-back { pointer-events: auto; }
.home-back {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(243, 234, 216, 0.42); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  text-decoration: none; font-size: 18px; font-weight: 700; line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  z-index: 6;
}
html[dir="rtl"] .home-back {
  left: auto;
  right: calc(10px + env(safe-area-inset-right, 0px));
}
.apps-box h3 {
  font-family: Georgia, Palatino, serif; font-weight: 500; font-size: 20px;
  margin: 0 0 6px;
}
.apps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.app-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin: 0; padding: 14px 10px 12px;
  background: #fffaf2; border-radius: 18px; color: inherit;
  text-align: center; text-decoration: none;
}
.app-card img {
  width: 96px; height: 96px; object-fit: cover; border-radius: 24px;
  background: #fff; flex: none;
}
.app-card div { display: grid; gap: 4px; }
.app-card strong { font-size: 14px; line-height: 1.2; }
.app-card span { font-size: 12px; color: #6d675f; line-height: 1.3; }
.app-card em { font-style: normal; font-size: 11px; font-weight: 700; color: #8a847c; }
.app-card.on { box-shadow: inset 0 0 0 2px rgba(36, 25, 16, 0.16); }
.app-card.soon { opacity: 0.92; }
.float {
  position: absolute; border: 0; cursor: pointer; border-radius: 999px;
  min-height: 46px; padding: 0 16px; background: rgba(243, 234, 216, 0.92); color: var(--ink);
}
.dock {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 2px;
  width: min(720px, calc(100% - 16px));
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(243, 234, 216, 0.42); color: var(--ink);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: 22px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 6;
}
.dock-btn {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 62px; padding: 6px 2px; border: 0; border-radius: 16px;
  background: transparent; color: inherit; text-decoration: none; cursor: pointer;
  font-size: 11px; font-weight: 650; line-height: 1.15;
}
.dock-btn:hover, .dock-btn.on { background: rgba(36, 25, 16, 0.08); }
.dock-ico { display: grid; place-items: center; width: 32px; height: 32px; }
.dock-ico img, .dock-ico svg { width: 32px; height: 32px; object-fit: contain; display: block; }
.dock-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-pop {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  max-height: min(74vh, 640px); overflow: auto;
  background: var(--paper); color: var(--ink); border-radius: 20px; padding: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  z-index: 5;
}
.help-box h3 {
  font-family: Georgia, Palatino, serif; font-weight: 500; font-size: 20px;
  margin: 0 0 8px;
}
.help-box h3 + ol, .help-box h3 + ul { margin-top: 0; }
.help-box h3:not(:first-child) { margin-top: 14px; }
.help-box ol, .help-box ul { margin: 0 0 8px; padding-left: 1.2em; color: #5c5148; }
.help-box li { margin: 0 0 8px; line-height: 1.45; }
.help-box p { margin: 0 0 10px; color: #5c5148; line-height: 1.45; }
.help-box .fine { margin: 8px 0 0; }
.home-help-layer.is-how {
  align-items: start;
  background:
    linear-gradient(180deg, rgba(8, 12, 16, 0.82), rgba(8, 12, 16, 0.88)),
    url("/assets/home-bg.jpg") center / cover no-repeat,
    #0b1210;
}
.home-help-panel.is-how {
  position: relative;
  width: min(440px, 100%);
  max-height: none;
  margin: 12px auto 0;
  background: transparent;
  color: #f6efe4;
  box-shadow: none;
  padding: 8px 4px 24px;
}
.home-help-panel.is-how h2 {
  font-size: clamp(28px, 8vw, 36px);
  color: #f6efe4;
  margin: 8px 36px 10px 0;
}
.how-close {
  appearance: none; position: absolute; top: 8px; right: 4px;
  width: 36px; height: 36px; border: 0; border-radius: 999px;
  background: rgba(246, 239, 228, 0.12); color: #f6efe4;
  font-size: 26px; line-height: 1; cursor: pointer;
}
.how-lead, .how-done { color: #d2c8ba; font-size: 16px; line-height: 1.45; }
.how-list { list-style: none; margin: 20px 0; padding: 0; display: grid; gap: 18px; }
.how-list li {
  display: grid; grid-template-columns: 28px 64px 1fr; gap: 12px; align-items: center;
}
.how-n {
  width: 28px; height: 28px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(246, 239, 228, 0.12); color: #f6efe4;
  font-weight: 700; font-size: 14px;
}
.how-pic {
  width: 64px; height: 64px; border-radius: 16px;
  background: #1a2830 center / 42px 42px no-repeat;
}
.how-phone { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='22' y='8' width='20' height='48' rx='4' fill='%23d7e6ef'/%3E%3Crect x='25' y='14' width='14' height='24' fill='%237ad4ff'/%3E%3Ccircle cx='32' cy='48' r='2.2' fill='%23101820'/%3E%3C/svg%3E"); }
.how-print { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='12' y='24' width='40' height='22' rx='4' fill='%239bb4c4'/%3E%3Crect x='20' y='12' width='24' height='14' fill='%23f3ead8'/%3E%3Crect x='18' y='38' width='28' height='14' fill='%23f3ead8'/%3E%3Ccircle cx='44' cy='32' r='2' fill='%233dd68c'/%3E%3C/svg%3E"); }
.how-color { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='16' y='14' width='32' height='36' rx='3' fill='%23f3ead8'/%3E%3Cpath d='M22 40c6-10 14-10 20 0' fill='%23e2b84f'/%3E%3Ccircle cx='28' cy='28' r='3' fill='%237ad4ff'/%3E%3Crect x='10' y='42' width='10' height='4' rx='1' fill='%23e07a4a'/%3E%3Crect x='44' y='42' width='10' height='4' rx='1' fill='%233dd68c'/%3E%3C/svg%3E"); }
.how-shot { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='10' y='20' width='44' height='28' rx='6' fill='%23101820'/%3E%3Ccircle cx='32' cy='34' r='8' fill='%237ad4ff'/%3E%3Ccircle cx='32' cy='34' r='3.5' fill='%23101820'/%3E%3Crect x='26' y='16' width='12' height='6' rx='2' fill='%239bb4c4'/%3E%3C/svg%3E"); }
.how-list strong { display: block; font-size: 16px; margin-bottom: 2px; }
.how-list span { color: #c9bfb2; font-size: 14px; line-height: 1.35; }
.help-box .how-list { color: inherit; padding: 0; }
.help-box .how-list li { margin: 0; color: inherit; }
.help-box .how-n { background: rgba(36, 25, 16, 0.1); color: var(--ink); }
.help-box .how-list span { color: #5c5148; }
.help-box .how-lead { color: #5c5148; }
.help-box .how-done { color: var(--ink); font-weight: 650; }
.sheet-pop #clearings { display: grid; grid-template-columns: 1fr; gap: 8px; }
.sheet-pop #clearings .view-hint { margin: 6px 0 0; }
#clearings .backdrop-lbl,
.sheet-pop #clearings .backdrop-lbl {
  grid-column: 1 / -1;
  margin: 8px 0 0;
}
.herd-box h3 {
  font-family: Georgia, Palatino, serif; font-weight: 500; font-size: 20px;
  margin: 0 0 6px;
}
.herd-box .fine { margin: 0 0 10px; }
.herd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #fffaf2; border-radius: 14px; padding: 6px 10px; margin-bottom: 6px;
}
.herd-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.herd-meta { display: grid; gap: 2px; min-width: 0; }
.herd-thumb {
  width: 72px; height: 72px; object-fit: contain; flex: none;
  background: #f4eee2; border-radius: 12px;
}
.herd-thumb.is-photo { background: #fff; box-shadow: inset 0 0 0 2px var(--clay); }
.herd-kind {
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  color: #6d675f;
}
.herd-kind.photo { color: var(--clay); }
.herd-row strong { font-size: 15px; }
.herd-row .btn { min-height: 36px; padding: 0 12px; }
.herd-add { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 12px; }
.herd-add .span { grid-column: 1 / -1; }
.herd-heading {
  grid-column: 1 / -1;
  font-family: Georgia, Palatino, serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--clay);
  margin: 10px 2px 4px;
}
.herd-heading:first-child { margin-top: 2px; }
.herd-catalog {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px;
}
.herd-catalog .span { grid-column: 1 / -1; }
.herd-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: rgba(63, 111, 143, 0.1);
}
.herd-tab {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 11px;
  background: transparent;
  color: #4a5f6c;
  font: inherit;
  font-weight: 650;
  font-size: 14px;
}
.herd-tab.on {
  background: #fffaf2;
  color: #1c2428;
  box-shadow: 0 1px 0 rgba(28, 36, 40, 0.08);
}
.herd-card {
  appearance: none; border: 0; cursor: pointer; color: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px 12px; border-radius: 16px; background: #fffaf2;
  font-weight: 650; font-size: 13px;
}
.herd-card img {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  background: #f4eee2; border-radius: 12px;
}
.herd-card em {
  font-style: normal; font-size: 11px; font-weight: 700; color: #6d675f;
}
.note {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  max-width: min(560px, calc(100% - 24px)); text-align: center;
  background: rgba(28, 23, 19, 0.72); color: var(--paper);
  border-radius: 999px; padding: 8px 14px; font-size: 14px;
}
.status {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 7; max-width: min(520px, calc(100% - 28px));
  margin: 0; padding: 10px 16px;
  background: rgba(28, 23, 19, 0.88); color: #fff6e8;
  border-radius: 999px; text-align: center;
  font-family: Georgia, serif; font-size: 18px; line-height: 1.3;
  pointer-events: none; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.status:empty { display: none; padding: 0; }
.backdrop { position: absolute; inset: 0; background: rgba(16, 11, 8, 0.35); z-index: 4; }
.panel {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(560px, calc(100% - 24px)); max-height: min(78vh, 720px); overflow: auto;
  background: var(--paper); color: var(--ink); border-radius: 24px; padding: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}
.panel h2 { font-family: Georgia, serif; font-weight: 500; margin: 0 0 4px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.actions .span { grid-column: 1 / -1; }
#clearings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.call-row, .tv-box { margin-top: 12px; display: grid; gap: 8px; }
.tv-site {
  display: block; margin: 0; text-align: center; user-select: all;
  font-family: Georgia, serif; font-size: 22px; line-height: 1.3;
  background: #fffaf2; border-radius: 14px; padding: 12px 14px;
  color: var(--clay); text-decoration: underline; text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.tv-site:hover { color: var(--clay-2); }
.tv-site.is-plain {
  color: var(--ink); text-decoration: none; pointer-events: none;
}
.tv-box .tv-code { text-align: center; font-size: 52px; letter-spacing: 0.22em; margin: 4px 0 0; }
.call-row { grid-template-columns: 64px 1fr auto; align-items: center; }
.call-row img, .call-row canvas { width: 64px; height: 72px; object-fit: contain; background: #efe4d2; border-radius: 10px; }
.tv-code { font-family: Georgia, serif; font-size: 42px; letter-spacing: 0.18em; margin: 0; }
.coach {
  position: absolute; inset: 0; z-index: 8;
  display: grid; place-items: center; padding: 16px;
  background: rgba(16, 11, 8, 0.45);
}
.coach .panel {
  position: relative; left: auto; bottom: auto; transform: none;
}
#capture-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--dusk); z-index: 9; }

body.capture {
  color: var(--paper);
  height: 100dvh;
  overflow: hidden;
  padding: 0;
}
.capture-app {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.capture-app header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 16px 12px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
}
.capture-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.capture-app header .brand {
  margin: 0;
  min-width: 0;
  gap: 8px;
  display: flex;
  align-items: center;
}
.capture-app header .brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: none;
}
.capture-app header .brand-name {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.capture-app header #back {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  color: #f3ead8;
  outline-color: rgba(243, 234, 216, 0.35);
}
.capture-app footer {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.capture-app footer #actions,
.capture-app footer #review {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.capture-shutter {
  width: 100%;
  min-height: 64px;
  padding: 0 20px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0.02em;
  border-radius: 22px;
  background: var(--sky);
  color: #141c22;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
.capture-shutter:hover { background: #c5dff0; color: #141c22; }
.capture-more {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.capture-more .btn {
  min-height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: #f3ead8;
  outline: 1px solid rgba(243, 234, 216, 0.28);
}
.capture-app header h1 {
  font-family: Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}
.capture-app header .fine {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.capture-stage {
  min-height: 0;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.capture-app footer .btn { min-height: 40px; padding: 0 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.finder {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 100%;
  margin: 0 auto;
  aspect-ratio: 297 / 210;
  background: #101820;
  border-radius: 18px;
  overflow: hidden;
}
.finder video,
.finder canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  display: block;
  border: 0;
  background: #101820;
  object-fit: contain;
}
.finder.is-live video { object-fit: cover; }
.finder.is-shot video,
.finder.is-preview video,
.finder.is-live canvas,
.finder.is-shot #preview,
.finder.is-preview #shot {
  visibility: hidden;
  pointer-events: none;
}
.finder:before {
  content: ""; position: absolute; inset: 5%;
  border: 2px solid rgba(243, 234, 216, 0.85); border-radius: 10px; pointer-events: none;
  z-index: 1;
}
.finder.is-shot:before,
.finder.is-preview:before { display: none; }

.toolbar { width: min(920px, calc(100% - 24px)); margin: 20px auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar h1 { flex-basis: 100%; font-family: Georgia, serif; font-weight: 500; font-size: 42px; margin: 0 0 4px; }
.toolbar p { flex-basis: 100%; color: #efe4d4; }
.sheet-wrap { width: min(297mm, calc(100vw - 24px)); margin: 0 auto 28px; }
.sheet-wrap.off { display: none; }
.sheet { background: white; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); }
.sheet svg, .sheet canvas { width: 100%; height: auto; display: block; }
.sheet-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 12px 0 0; }
.sheet-actions .btn { min-width: 160px; }
@media print {
  body { background: white !important; }
  .noprint { display: none !important; }
  .sheet-wrap { width: 297mm; margin: 0; }
  .sheet { width: 297mm; height: 210mm; margin: 0; break-after: page; page-break-after: always; box-shadow: none; }
  .sheet svg, .sheet canvas { width: 297mm; height: 210mm; }
}
@page { size: A4 landscape; margin: 0; }

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .dock {
    left: calc(8px + env(safe-area-inset-left, 0px));
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    translate: 0;
    flex-direction: column;
    align-items: stretch;
    width: 80px;
    height: auto;
    padding: 8px 6px;
    border-radius: 22px;
    gap: 4px;
    overflow: visible;
    transition: translate 0.2s ease, opacity 0.2s ease;
    z-index: 6;
  }
  .dock:not(.is-open) {
    translate: calc(-100% - 20px) 0;
    opacity: 0;
    pointer-events: none;
  }
  .dock-btn {
    flex: none;
    width: auto;
    height: auto;
    min-height: 58px;
    padding: 6px 2px 5px;
    border-radius: 14px;
    background: rgba(255, 250, 242, 0.38);
    box-shadow: inset 0 0 0 1px rgba(36, 25, 16, 0.08);
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
  }
  .dock-btn.on { background: rgba(239, 230, 212, 0.55); }
  .dock-lbl {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
  }
  .dock-ico, .dock-ico img, .dock-ico svg { width: 30px; height: 30px; }
  .sheet-pop {
    left: 50%;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100% - 24px));
    max-height: min(78vh, 640px);
  }
  .status {
    top: calc(14px + env(safe-area-inset-top, 0px));
    bottom: auto;
    left: 50%;
    width: max-content;
  }
  html[dir="rtl"] .home-back {
    left: auto;
    right: calc(10px + env(safe-area-inset-right, 0px));
  }
  html[dir="rtl"] .dock {
    left: auto;
    right: calc(8px + env(safe-area-inset-right, 0px));
  }
  html[dir="rtl"] .dock:not(.is-open) {
    translate: calc(100% + 20px) 0;
  }
}

.meadow-lock {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; padding: 6px;
  border-radius: 999px; background: rgba(10, 16, 22, 0.55); color: #f6efe4;
}
.meadow-lock svg { display: block; width: 100%; height: 100%; fill: currentColor; }

.is-locked { position: relative; }
.sheet-wrap.is-locked .sheet { filter: grayscale(0.35) brightness(0.86); }
.herd-card.is-locked, .meadow-add.is-locked, .btn.is-locked {
  opacity: 0.62;
}
.adult-mark {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(36, 25, 16, 0.12);
  color: #5c5148;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.adult-panel .btn.fern {
  background: var(--clay);
  color: #f6f3ea;
  min-height: 52px;
  font-weight: 700;
}
.adult-layer {
  place-items: center;
  align-items: center;
  justify-items: center;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    16px
    calc(16px + env(safe-area-inset-bottom, 0px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
body.pay-page {
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
  background:
    radial-gradient(720px 380px at 50% -8%, rgba(63, 111, 143, 0.32), transparent 58%),
    linear-gradient(180deg, rgba(14, 24, 32, 0.52), rgba(12, 20, 26, 0.78)),
    url("/assets/home-bg.jpg?v=garden163") center top / cover no-repeat,
    var(--dusk);
  background-attachment: scroll;
}
.pay-hero {
  width: 88px; height: 88px; margin: 4px auto 14px;
  border-radius: 24px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  flex: none;
}
.pay-close {
  position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 4;
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(246, 239, 228, 0.12); color: #f6efe4;
  text-decoration: none; font-size: 28px; line-height: 1;
}
.pay-stage {
  width: min(430px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 calc(28px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  box-sizing: border-box;
}
.pay-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pay-page h1 {
  font-family: Georgia, Palatino, serif; font-weight: 500;
  font-size: clamp(28px, 8vw, 36px); line-height: 1.1; margin: 0 0 10px;
  color: #f6efe4; text-shadow: none;
}
.pay-lead {
  margin: 0 0 20px; font-size: 16px; line-height: 1.45;
  color: #d2c8ba; text-shadow: none;
}
.pay-gets {
  list-style: none; margin: 0 0 16px; padding: 10px 14px;
  background: rgba(10, 16, 22, 0.55);
  border: 1px solid rgba(246, 239, 228, 0.08);
  border-radius: 22px;
  text-align: left;
}
.pay-gets li {
  display: grid; grid-template-columns: 22px 1fr 28px; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 0;
  color: #f3ead8; font-size: 15px; line-height: 1.3;
}
.pay-gets li + li { border-top: 1px solid rgba(246, 239, 228, 0.08); }
.pay-gets img { width: 26px; height: 26px; object-fit: contain; }
.pay-ok {
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--clay); position: relative;
}
.pay-ok::after {
  content: "";
  position: absolute; left: 6px; top: 4px;
  width: 5px; height: 9px;
  border: solid #f3ead8; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pay-plans { display: grid; gap: 10px; margin: 0 0 16px; }
.pay-pick {
  appearance: none; width: 100%; padding: 0; border: 0; border-radius: 22px;
  background: rgba(10, 16, 22, 0.55);
  box-shadow: inset 0 0 0 1px rgba(246, 239, 228, 0.1);
  color: #f6efe4; text-align: left; cursor: pointer;
}
.pay-pick.is-on { box-shadow: inset 0 0 0 2px var(--amber); }
.pay-best {
  display: inline-block; margin: 10px 0 0 14px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(63, 111, 143, 0.45); color: var(--amber);
  font-size: 12px; font-weight: 700;
}
.pay-pick-body {
  display: grid; grid-template-columns: 1fr auto 22px; gap: 12px; align-items: center;
  padding: 12px 14px 14px;
}
.pay-pick-body strong { display: block; font-size: 16px; }
.pay-pick-body em { display: block; margin-top: 2px; font-style: normal; font-size: 13px; color: #c9bfb2; }
.pay-price { font-size: 22px; font-weight: 750; }
.pay-radio {
  width: 20px; height: 20px; border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(246, 239, 228, 0.35);
}
.pay-pick.is-on .pay-radio {
  box-shadow: inset 0 0 0 6px var(--clay);
}
.pay-go {
  width: 100%; min-height: 56px; margin: 0; border-radius: 18px;
  background: var(--clay); color: #f6f3ea; font-size: 18px;
}
.pay-go:hover { background: var(--clay-2); }
.pay-page .error { color: #ffb4a8; min-height: 1.2em; }
.pay-legal {
  margin: 16px 0 0; font-size: 12px; line-height: 1.45; color: #9a9186;
}
.pay-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 14px;
  font-size: 13px; color: #c9bfb2;
}
.pay-links a,
.pay-links button {
  appearance: none; background: none; border: 0; padding: 0;
  color: inherit; font: inherit; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.pay-links #restore {
  flex: 1 0 100%;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; margin-bottom: 4px; padding: 0 14px; border-radius: 999px;
  background: rgba(246, 239, 228, 0.12); color: #f6efe4;
  text-decoration: none; font-weight: 700;
}
@media (max-width: 640px) {
  .pay-stage { width: min(100% - 20px, 430px); }
  body.pay-page h1 { font-size: clamp(24px, 7vw, 32px); }
}

.legal-page .brand { text-decoration: none; }
.legal-page h1 {
  font-size: clamp(32px, 7vw, 44px);
  line-height: 1.05;
  margin: 0 0 16px;
  color: var(--ink);
  text-shadow: none;
}
.legal-card { margin-top: 18px; }
.legal-card h2 { font-size: 22px; margin: 22px 0 8px; }
.legal-card ol { margin: 0 0 14px; padding-left: 1.2em; color: #5c5148; }
.legal-card li { margin: 0 0 8px; line-height: 1.4; }
.legal-card a { color: var(--clay); font-weight: 650; }
.legal-kicker {
  margin: 0 0 8px;
  color: #6d675f;
  font-size: 14px;
  letter-spacing: 0.04em;
}

body.remote { background: var(--dusk); }
.remote { width: min(520px, calc(100% - 24px)); margin: 0 auto; padding: 20px 0 40px; }
.remote h1 { font-size: 42px; }
.remote .actions { grid-template-columns: 1fr; }
.remote .actions button { min-height: 64px; font-size: 20px; }
