:root {
  --dusk: #1b1612;
  --dusk-2: #2a221c;
  --paper: #f3ead8;
  --ink: #241910;
  --clay: #3f5840;
  --clay-2: #314632;
  --fern: #5c7054;
  --amber: #d5decc;
  --muted: #8d7d6d;
  --line: rgba(36, 25, 16, 0.12);
  color-scheme: dark;
  font-family: "Segoe UI", sans-serif;
  color: var(--paper);
  background: var(--dusk);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
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, 88, 64, 0.28), transparent 58%),
    radial-gradient(700px 380px at 100% 0%, rgba(92, 112, 84, 0.16), transparent 55%),
    var(--dusk);
}
body.home {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(16, 11, 8, 0.9) 0%, rgba(16, 11, 8, 0.78) 52%, rgba(16, 11, 8, 0.7) 100%),
    url("/assets/home-bg.jpg") 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; }
.meadows-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 8px 0 4px;
}
.meadows-head h1 { margin: 0; }
.home-help-btn {
  appearance: none; flex: none;
  width: 44px; height: 44px; padding: 6px; border: 0; border-radius: 14px;
  background: rgba(243, 234, 216, 0.42); cursor: pointer;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}
.home-help-btn img { width: 32px; height: 32px; display: block; }
.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-layer[hidden] { display: none !important; }
.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; }
.meadow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 22px;
}
.meadow-card {
  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: 4 / 3;
  background: #2a221c center / contain no-repeat;
}
.meadow-shot[data-clearing="realistic"] { background-color: #3f5840; }
.meadow-shot[data-clearing="painted-forest"] { background-color: #5c7054; }
.meadow-shot[data-clearing="island"] { background-color: #d7c39a; }
.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-del {
  appearance: none; border: 0; background: transparent; color: #e4c8b4;
  font: inherit; font-size: 13px; font-weight: 650; padding: 6px 0; cursor: pointer;
}
.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(--amber); }
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(36px, 9vw, 56px); margin-top: 8px; }
.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 { display: flex; align-items: center; gap: 12px; letter-spacing: 0.02em; color: #f6efe4; }
.brand-name {
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 20px; font-weight: 500; line-height: 1.15;
}
.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='%23d5decc' 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: #241910; background: #f3ead8; }
.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; }
html[dir="rtl"] .home-back {
  left: auto;
  right: calc(10px + env(safe-area-inset-right, 0px));
}
.brand img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 14px;
  box-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: #3a2e24; 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; }
body.home > .wrap > .card { margin-top: 20px; }
.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: #e7eddf; 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: #2a221c; 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: #140f0c; overscroll-behavior: none; touch-action: none; }
#view { width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
#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;
}
.apps-box h3 {
  font-family: Georgia, Palatino, serif; font-weight: 500; font-size: 20px;
  margin: 0 0 6px;
}
.apps-box .fine { margin: 0 0 12px; }
.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; }
.sheet-pop #clearings,
#clearings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.clearing-card {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #fffaf2;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.clearing-card.picked { box-shadow: inset 0 0 0 3px #241910; }
.clearing-card.is-locked { opacity: 0.72; }
.clearing-shot {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #2a221c center / cover no-repeat;
}
.clearing-shot[data-clearing="realistic"] { background-color: #3f5840; }
.clearing-shot[data-clearing="painted-forest"] { background-color: #5c7054; }
.clearing-shot[data-clearing="island"] { background-color: #d7c39a; }
.clearing-name {
  display: block;
  padding: 8px 12px 10px;
  font-weight: 650;
  font-size: 15px;
}
.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: 84px; height: 84px; object-fit: contain; flex: none;
  padding: 6px; background: #f4eee2; border-radius: 12px;
}
.herd-thumb.is-photo { background: #fff; box-shadow: inset 0 0 0 2px #3f5840; }
.herd-kind {
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  color: #6d675f;
}
.herd-kind.photo { color: #3f5840; }
.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-catalog {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px;
}
.herd-catalog .span { grid-column: 1 / -1; }
.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; padding: 10px;
  background: #f4eee2; border-radius: 12px;
}
.herd-card em {
  font-style: normal; font-size: 11px; font-weight: 700; color: #6d675f;
}
.status {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  color: #fff6e8; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  font-family: Georgia, serif; font-size: 22px; pointer-events: none;
}
.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; gap: 10px; }
.call-row, .tv-box { margin-top: 12px; display: grid; gap: 8px; }
.tv-site {
  margin: 0; text-align: center; user-select: all;
  font-family: Georgia, serif; font-size: 22px;
  background: #fffaf2; border-radius: 14px; padding: 12px 14px;
}
.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); }
.capture-app header .brand { margin-bottom: 12px; }
.capture-app { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.capture-app header, .capture-app footer { padding: 16px; }
video, #shot, #preview {
  width: min(100%, 720px); max-height: 62vh; margin: 0 auto; display: block;
  background: #100d0b; border-radius: 18px; object-fit: contain;
}
#preview { background: repeating-conic-gradient(#2a241e 0% 25%, #1b1714 0% 50%) 0 0 / 28px 28px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.finder { position: relative; }
.finder:before {
  content: ""; position: absolute; inset: 8% 6%;
  border: 2px solid rgba(243, 234, 216, 0.85); border-radius: 12px; pointer-events: none;
}

.toolbar { width: min(920px, calc(100% - 24px)); margin: 20px auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .brand { flex-basis: 100%; margin-bottom: 4px; }
.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: 720px) {
  .wrap { width: calc(100% - 24px); padding-top: 20px; }
  body.home h1 { font-size: 42px; line-height: 1.05; }
  body.home .lead { font-size: 17px; }
  .grid.two { grid-template-columns: 1fr; }
  .toolbar h1 { font-size: 28px; }
}

@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);
  }
  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;
  }
}

.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;
}
.pay-page .wrap { width: min(680px, calc(100% - 20px)); }
.pay-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 16px; color: #f6efe4; font-weight: 650; text-decoration: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}
.pay-sheet {
  background: var(--paper); color: var(--ink);
  border-radius: 32px; padding: 28px 24px 26px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}
.pay-page h1 {
  font-family: Georgia, Palatino, serif; font-weight: 500;
  font-size: 40px; line-height: 1.05; margin: 0 0 10px;
  color: var(--ink); text-shadow: none;
}
.pay-page .lead {
  max-width: none; margin: 0 0 8px; font-size: 18px; line-height: 1.45;
  color: #3f352c; text-shadow: none;
}
.pay-note {
  margin: 16px 0 0; font-size: 15px; line-height: 1.45; color: #6d675f;
}
.pay-card {
  margin: 0 0 12px; padding: 18px 18px 16px;
  background: #fffaf2; border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(36, 25, 16, 0.08);
}
.pay-card.is-best {
  background: #eef3e8;
  box-shadow: inset 0 0 0 2px var(--clay);
}
.pay-best {
  display: inline-block; margin: 0 0 10px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--clay); color: #f6efe4;
  font-size: 13px; font-weight: 700;
}
.pay-plan { display: grid; gap: 12px; }
.pay-card h2 {
  font-family: Georgia, Palatino, serif; font-weight: 500;
  font-size: 24px; margin: 0 0 2px;
}
.pay-card p { margin: 0; }
.pay-card .pay-price {
  font-family: Georgia, serif;
  font-size: 34px; line-height: 1.1;
  color: var(--ink);
}
.pay-card .btn { width: 100%; margin-top: 0; min-height: 52px; }
.pay-sheet .error { margin: 4px 0 0; }
@media (max-width: 640px) {
  .pay-sheet { padding: 22px 16px 20px; border-radius: 26px; }
  .pay-page h1 { font-size: 32px; }
  .pay-card { padding: 16px 14px 14px; }
  .pay-card .pay-price { font-size: 28px; }
}

.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; }
