/* Bamboo Valley — v3: treasury, prize pool, avatars, passports, one valley, reminders. Same art direction. */
.tr-pill { display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px 0 5px; border-radius: 999px; flex: none;
  border: 1px solid rgba(226, 166, 91, .3); background: rgba(226, 166, 91, .1); font-weight: 800; font-size: 13px; color: #f1d7ae; }
.tr-pill .tp-ic { width: 18px; height: 18px; display: grid; place-items: center; color: var(--amber); }
.tr-pill .tp-ic .ic { width: 17px; height: 17px; }
.tr-pill .tp-ic img { width: 20px; height: 20px; object-fit: contain; }
.tr-pill:active { background: rgba(226, 166, 91, .22); }
@media (max-width: 380px) { .hud-row.stats { gap: 7px; } .pts { font-size: 13px; } }
.tr-img { width: 22px; height: 22px; object-fit: contain; display: block; }
.tr-svg { color: var(--amber); display: inline-grid; place-items: center; }
.wheel-head .h2-tr, .wheel-head .h2-tr .ic { width: 22px; height: 22px; }

/* ---- avatars */
.ava { --ah: 140; position: relative; width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, hsl(var(--ah) 32% 38%), hsl(var(--ah) 30% 20%)); border: 1px solid rgba(236, 226, 205, .18); }
.ava b { font-size: 15px; font-weight: 800; color: hsl(var(--ah) 40% 88%); }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ava.md { width: 30px; height: 30px; }
.ava.md b { font-size: 13px; }
.lb li { grid-template-columns: 24px 34px 1fr auto; gap: 10px; }
.lb li.sep { display: block; }
.v-title .v-ava { display: inline-flex; }
.rw-note { font-size: 11.5px; color: var(--text-2); font-weight: 500; margin-top: 8px; line-height: 1.4; }

/* ---- treasury */
.tr-balance { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid rgba(226, 166, 91, .3);
  background: linear-gradient(120deg, rgba(226, 166, 91, .14), rgba(226, 166, 91, .03)); }
.trb-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: rgba(0, 0, 0, .25); flex: none; }
.trb-ic .tr-img { width: 40px; height: 40px; }
.trb-ic .tr-svg .ic { width: 26px; height: 26px; }
.trb-txt { flex: 1; display: grid; gap: 2px; min-width: 0; }
.trb-txt small { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.tr-balance .chip .ic { width: 14px; height: 14px; color: var(--amber); }
.tr-unlock, .tr-admin { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 9px 12px; border-radius: 12px; background: var(--panel-raise); font-size: 12.5px; font-weight: 600; color: var(--text-2); line-height: 1.4; }
.tr-unlock .ic, .tr-admin .ic { width: 16px; height: 16px; flex: none; color: var(--amber); margin-top: 1px; }
.tr-admin { margin: 0 0 8px; }
.donate { padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel-raise); }
.donate.off { opacity: .6; }
.dn-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dn-steps button { height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); font-weight: 800; font-size: 13.5px; color: var(--text); background: rgba(255, 255, 255, .03); }
.dn-steps button:disabled { opacity: .35; }
.dn-steps button:active { background: var(--amber-soft); }
.dn-range { width: 100%; margin: 14px 0 6px; accent-color: var(--amber); height: 24px; }
.dn-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dn-row small { font-size: 12px; font-weight: 600; color: var(--text-2); }
.dn-note { font-size: 11.5px; font-weight: 500; color: var(--text-3); margin-top: 8px; text-align: center; line-height: 1.4; }
.donate .big-btn { margin-top: 10px; }
.tb-list { display: grid; gap: 8px; }
.tb { display: grid; grid-template-columns: 52px 1fr; grid-template-areas: "art txt" "art act"; gap: 4px 12px; padding: 10px; border-radius: 14px; background: var(--panel-raise); border: 1px solid var(--line); }
.tb.built { border-color: rgba(226, 166, 91, .35); }
.tb-art { grid-area: art; width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, rgba(226, 166, 91, .18), #121813 75%); overflow: hidden; }
.tb-art img { width: 100%; height: 100%; object-fit: contain; }
.tb-art .ia-fb { color: var(--amber); width: 26px; height: 26px; display: grid; place-items: center; }
.tb-art .ia-fb .ic { width: 26px; height: 26px; }
.tb-txt { grid-area: txt; display: grid; gap: 2px; min-width: 0; }
.tb-txt b { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tb-txt small { font-size: 12px; font-weight: 600; color: var(--text-2); line-height: 1.35; }
.tb-txt .tb-next { color: var(--text-3); }
.stars { display: inline-flex; gap: 3px; }
.stars i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(226, 166, 91, .55); }
.stars i.on { background: var(--amber); box-shadow: 0 0 6px rgba(226, 166, 91, .6); }
.tb-act { grid-area: act; display: flex; justify-content: flex-start; margin-top: 4px; }
.tb-act .tk-btn { min-width: 0; height: 32px; font-size: 12.5px; gap: 6px; }
.tb-act .tk-btn .jade-amt { color: inherit; }
.tb-lock, .tb-max { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.tb-max { color: var(--sage); }
.tb-lock .ic, .tb-max .ic { width: 14px; height: 14px; }
.td-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.td { min-width: 0; }
.td { display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border-radius: 14px; background: var(--panel-raise); border: 1px solid var(--line); text-align: center; }
.td b { font-size: 12px; font-weight: 700; line-height: 1.25; min-height: 2.5em; display: grid; place-items: center; }
.td.owned { border-color: rgba(143, 179, 122, .4); }
.td.locked { opacity: .65; }
.td .tk-btn { min-width: 0; height: 30px; font-size: 12px; padding: 0 9px; }
.td .tk-btn .jade-amt { color: inherit; }
.td .tb-lock { font-size: 11px; text-align: center; }
.donor-tabs { margin-bottom: 8px; }
.donors { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.donors li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 12px; background: var(--panel-raise); font-size: 13.5px; font-weight: 600; }
.donors li.me { background: var(--amber-soft); border: 1px solid rgba(226, 166, 91, .45); }
.donors .dr { color: var(--text-3); font-weight: 800; text-align: center; }
.donors .dn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donors .dn small { margin-left: 6px; color: var(--text-3); font-weight: 600; font-size: 11.5px; }
.donors li.v-none { display: block; background: none; text-align: center; }

/* ---- payout forecast (§12.8) */
.payouts { margin-top: 14px; padding: 12px; border-radius: 16px; border: 1px solid rgba(110, 196, 150, .25); background: rgba(73, 176, 127, .06); }
.po-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.po-head span { font-weight: 800; color: var(--amber); }
.po-sum { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.po-hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--clay); line-height: 1.4; }
.po-hint .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.po-scroll { overflow-x: auto; margin: 8px -4px 0; }
.po-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-weight: 600; }
.po-table th { text-align: right; font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 4px; }
.po-table th:first-child, .po-table td:first-child { text-align: left; }
.po-table td { text-align: right; padding: 7px 4px; border-top: 1px solid var(--line); white-space: nowrap; }
.po-table td.pn { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.po-table td.pn small { margin-left: 5px; font-size: 10px; color: var(--amber); font-weight: 800; text-transform: uppercase; }
.po-table tr.me td { background: rgba(226, 166, 91, .12); color: var(--text); }
.po-table .jade-amt { justify-content: flex-end; }
.po-table .jade-svg, .po-table .jade-img { width: 14px; height: 14px; }
.po-note { font-size: 11px; color: var(--text-3); font-weight: 500; margin-top: 8px; line-height: 1.4; }

/* ---- confirmations, leaving */
.confirm, .leave { text-align: center; padding-top: 4px; }
.cf-ic, .lv-ic { width: 58px; height: 58px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); }
.cf-ic .tr-img { width: 44px; height: 44px; }
.cf-ic .ic, .lv-ic .ic { width: 28px; height: 28px; }
.confirm h2, .leave h2 { justify-content: center; text-align: center; }
.leave h2.warn { color: #f0c9b6; }
.leave h2.warn .ic { color: var(--clay); }
.cf-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.cf-actions .big-btn { margin-top: 4px; }
.big-btn.danger { background: linear-gradient(180deg, #df9a80, var(--clay) 60%, #b86f53); color: #1d0f09; box-shadow: 0 6px 18px rgba(212, 138, 108, .25); }
.lv-losses { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; text-align: left; }
.lv-losses li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 12px; background: rgba(212, 138, 108, .08); border: 1px solid rgba(212, 138, 108, .25); font-size: 13.5px; font-weight: 600; }
.lv-losses .ic { width: 15px; height: 15px; color: var(--clay); flex: none; }
.lv-keep { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin: 4px 0 8px; }
.lv-keep .ic { width: 15px; height: 15px; color: var(--sage); }
.leave .namefield input { text-transform: uppercase; letter-spacing: .12em; }
.leave .lv-move .ic { width: 18px; height: 18px; }

/* ---- passport */
.pp-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 12px; font-weight: 700; color: var(--amber); }
.pp-link .ic { width: 14px; height: 14px; }
.pp-head { display: flex; gap: 14px; align-items: center; padding-top: 4px; }
.pp-portrait { position: relative; width: 112px; height: 112px; flex: none; border-radius: 18px; overflow: hidden; border: 1px solid rgba(226, 166, 91, .35);
  background: radial-gradient(90% 80% at 50% 70%, var(--pglow, rgba(226, 166, 91, .3)) 0%, rgba(30, 40, 32, .9) 60%, #121813 100%); }
.pp-id { min-width: 0; flex: 1; padding-right: 34px; }
.pp-kicker { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.pp-id h2 { margin: 2px 0 6px; word-break: break-word; }
.pp-q { display: flex; align-items: baseline; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pp-q b { font-size: 20px; font-weight: 800; color: var(--qc); }
.pp-q small { font-size: 10px; font-weight: 700; color: var(--text-3); letter-spacing: .1em; }
.pp-mini { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--text-2); margin-left: 4px; }
.pp-mini .ic { width: 13px; height: 13px; color: var(--text-3); margin-left: 4px; }
.pp-items { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pp-item { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 12px; background: var(--panel-raise); font-size: 12.5px; font-weight: 600; }
.pp-item .item-art.sm { width: 34px; border-radius: 9px; --iar: 7.5px; }
.pp-keeper { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--panel-raise); border: 1px solid var(--line); }
.ppk-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); flex: none; }
.ppk-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ppk-txt small { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.ppk-txt b { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppk-txt span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pp-keeper .tk-btn { min-width: 0; }
.pp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pp-grid.two { grid-template-columns: 1fr 1fr; }
.pp-stat { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: var(--panel-raise); border: 1px solid var(--line); text-align: center; }
.pp-stat .ic { width: 16px; height: 16px; color: var(--amber); }
.pp-stat b { font-size: 15px; font-weight: 800; display: inline-flex; }
.pp-stat small { font-size: 10.5px; font-weight: 600; color: var(--text-2); line-height: 1.25; }
.pp-line { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.pp-line .ic { width: 15px; height: 15px; color: var(--amber); }

/* ---- valley details v3 */
.v-pool { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(73, 176, 127, .08); border: 1px solid rgba(110, 196, 150, .22); font-size: 13px; font-weight: 600; }
.v-pool span { flex: 1; min-width: 0; }
.v-pool span small { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); margin-top: 1px; }
.v-pool .ic { width: 17px; height: 17px; color: var(--amber); }
.v-treasury { display: grid; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--panel-raise); border: 1px solid var(--line); }
.vt-bal { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.vt-bal span { flex: 1; color: var(--text-2); }
.vt-bal .ic { width: 17px; height: 17px; color: var(--amber); }
.vt-blds { display: flex; flex-wrap: wrap; gap: 6px; }
.vt-blds .chip .ic { width: 14px; height: 14px; color: var(--amber); }
.vt-blds .tier { font-style: normal; color: var(--amber); font-size: 10px; letter-spacing: -.05em; }
.vt-donors { display: grid; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.vt-donors span { display: flex; align-items: center; gap: 5px; }
.v-treasury .big-btn { height: 44px; margin-top: 2px; font-size: 14.5px; }
.v-pandas li.tap { cursor: pointer; }
.v-pandas li.tap:active { background: rgba(255, 255, 255, .08); }

/* ---- reminders toggle */
.notify-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; margin: 10px 0 6px; padding: 11px 12px; border-radius: 14px; border: 1px solid rgba(226, 166, 91, .3); background: rgba(226, 166, 91, .06); }
.notify-row .hi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--amber); background: var(--amber-soft); }
.nr-txt { display: grid; gap: 2px; }
/* v19: language switch in the help sheet */
.lang-seg { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.lang-seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 12px; font-weight: 800; padding: 5px 9px; border-radius: 8px; cursor: pointer; }
.lang-seg button.on { background: var(--amber); color: #1d1a12; }
.lang-seg button:disabled { opacity: .6; }
.nr-txt b { font-size: 13.5px; font-weight: 700; }
.nr-txt small { font-size: 12px; font-weight: 500; color: var(--text-2); line-height: 1.35; }
.notify-row .tk-btn { min-width: 0; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: rgba(236, 226, 205, .16); transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #ece6da; transition: transform .2s var(--ease-out); box-shadow: 0 2px 4px rgba(0, 0, 0, .35); }
.switch input:checked + i { background: var(--amber); }
.switch input:checked + i::after { transform: translateX(18px); }
.help .sheet-scroll { padding-bottom: 6px; }
.wb-label { gap: 6px; }
.wb-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 380px) { .tr-pill, .jade-pill { padding-right: 8px; font-size: 12.5px; } .hud-row.stats .pts { gap: 3px; } }

/* ================================================================ v3.1 (DESIGN_ECONOMY §13, QA FE3-*) */
/* FE3-1: decoration cards are single-column — reset the building grid areas so nothing spills over the card */
.td { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow: hidden; }
.td > * { grid-area: auto; max-width: 100%; }
.td .tb-art { flex: none; }
.td b { min-height: 2.5em; display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere; }
.td .tb-lock, .td .tb-max { flex-wrap: wrap; justify-content: center; line-height: 1.25; margin-top: auto; }
.td .tk-btn { margin-top: auto; max-width: 100%; }
.td .tb-lock .jade-amt { justify-content: center; }
@media (max-width: 360px) { .td-grid { gap: 6px; } .td { padding: 9px 4px; } .td .tb-art { width: 46px; height: 46px; } }
.tb-art img:not([src]) { opacity: 0; }
.tb-art img { transition: opacity .25s; }
.td-grid + .shop-sec, .tr-admin + .td-grid { margin-top: 0; }

/* debt (§13): a negative balance is red everywhere */
.jade-amt.neg b, .jade-pill.debt b, small.debt { color: #e8806a; }
.jade-pill.debt { border-color: rgba(232, 128, 106, .45); background: rgba(232, 128, 106, .12); }
.dn-debt { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 12px; font-weight: 600; color: #f0b3a3; line-height: 1.4; text-align: left; }
.dn-debt .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; color: #e8806a; }
.spin-hint .lack.debt { color: #f0b3a3; display: block; text-align: center; line-height: 1.4; }
.spin-btn.debt { filter: saturate(.4); opacity: .7; }

/* payouts: leaderboard rank vs prize place, days still needed (FE3-3/4) */
.po-ranks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.po-rank { display: grid; gap: 1px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); font-size: 12.5px; }
.po-rank b { font-weight: 800; color: var(--text); }
.po-rank.po-prize { border-color: rgba(226, 166, 91, .4); background: rgba(226, 166, 91, .08); }
.po-rank.po-prize b { color: var(--amber); }
.po-rank small { font-size: 10.5px; font-weight: 600; color: var(--text-3); line-height: 1.3; }
.po-table td.pn { max-width: 130px; white-space: normal; }
.po-table td.pn .pn-name { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.po-table td.pn .pn-need { display: block; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--clay); margin-top: 1px; }
.po-table tr.nodays td:not(.pn) { color: var(--text-3); }

/* prize pool chips scaled by active keepers */
.rw-list:has(.rw.per) { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
.rw.per { justify-items: start; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; row-gap: 1px; padding: 6px 9px; border-radius: 10px; background: rgba(255, 255, 255, .03); min-width: 0; }
.rw.per b { font-size: 12px; color: var(--amber); }
.rw.per small { grid-column: 1 / -1; font-size: 10.5px; font-weight: 600; color: var(--text-3); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* valley details: decorations + up to 10 donors */
.vt-dh { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-top: 2px; }
.vt-donors { list-style: none; margin: 0; padding: 0; }
.vt-donors li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 2px 0; }
.vt-donors li.me { color: var(--amber); }
.vt-donors .vd-r { color: var(--text-3); font-weight: 800; text-align: center; }
.vt-donors .vd-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-decos .chip .ic { color: var(--sage); }

/* passport: a long keeper name / username never runs under the button (FE3-6), no horizontal overflow */
.ppk-txt { grid-template-columns: minmax(0, 1fr); }
.ppk-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.ppk-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pp-keeper .tk-btn { flex: none; }
.pp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pp-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pp-stat small { overflow-wrap: anywhere; }
.pp-id h2 { overflow-wrap: anywhere; }

/* long names wrap (two lines at most) instead of being cut mid-glyph (FE3-11) */
.lb .tt b .tt-name, .tt-name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.v-pt b, .v-pt small { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ident .owner { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v-title .v-name { min-width: 0; overflow-wrap: anywhere; }
.donors .dn { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* a modal sheet (wheel spinning, leaving) shows its ✕ as inactive */
.sheet[data-modal] > .sheet-x { opacity: .3; pointer-events: none; }
/* short screens use 14px sheet padding — the scroller's bleed must match, or every sheet overflows by 4px */
@media (max-height: 720px) { .sheet-scroll { margin: 0 -14px; padding: 0 14px; } }
/* leaderboard stats line wraps by whole items («благополучие 92%» / «3 панды»), never mid-phrase */
.lb .tt > span { flex-wrap: wrap; column-gap: 10px; row-gap: 0; }
.lb .tt > span > span { white-space: nowrap; }
.lb .tt b .tt-name { flex: 0 1 auto; }

/* ---- friends (referral programme) */
/* the wrapper sits between the flex .sheet and .sheet-scroll — it must pass the height limit down, or the sheet runs off-screen */
.friends-sheet > .friends { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.friends-sheet .fr-head { text-align: center; padding-top: 4px; }
.fr-ic { width: 58px; height: 58px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(226, 166, 91, .3); }
.fr-ic .ic { width: 28px; height: 28px; }
.fr-head h2 { justify-content: center; }
.fr-head .lead { margin-bottom: 12px; }
.fr-link { display: flex; align-items: center; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; background: rgba(0, 0, 0, .22); border: 1px dashed var(--line-strong);
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.fr-link span { min-width: 0; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: all; -webkit-user-select: all; }
.friends-sheet .cf-actions { margin: 4px 0 12px; }
.friends-sheet .cf-actions .big-btn { height: 46px; font-size: 14.5px; padding: 0 10px; }
.fr-earned { margin-top: 2px; }
.fr-earned .jade-amt { align-items: center; gap: 4px; }
.fr-earned .jade-svg, .fr-earned .jade-img { width: 15px; height: 15px; }
.po-hint.ok { color: var(--sage); }
.fr-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fr-table th { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 4px; text-align: right; white-space: nowrap; }
.fr-table th:first-child, .fr-table td:first-child { text-align: left; }
.fr-table td { text-align: right; padding: 7px 4px; border-top: 1px solid var(--line); color: var(--text-2); }
.fr-lvl { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-raise); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 800; color: var(--text); }
.fr-table tr:first-child .fr-lvl { background: var(--amber-soft); border-color: rgba(226, 166, 91, .45); color: var(--amber); }
.fr-table td.fr-pct { color: var(--amber); font-weight: 800; }
.fr-rules { margin: 12px 0 0; padding: 12px 12px 12px 28px; border-radius: 14px; background: var(--panel-raise); border: 1px solid var(--line); display: grid; gap: 7px;
  font-size: 12.5px; font-weight: 500; line-height: 1.45; color: var(--text-2); }
.fr-rules li::marker { color: var(--amber); }
.fr-rules b { color: var(--text); font-weight: 700; }
.friends-sheet .pp-line { margin-top: 10px; justify-content: center; }
@media (max-width: 360px) {
  .fr-table { font-size: 12.5px; }
  .fr-table th { font-size: 9.5px; letter-spacing: .02em; padding: 4px 2px; }
  .fr-table td { padding: 6px 2px; }
  .friends-sheet .cf-actions .big-btn { font-size: 13.5px; gap: 6px; }
  .friends-sheet .cf-actions .big-btn .ic { width: 18px; height: 18px; }
}

/* HUD: the extra Friends button must still leave room for the valley name on 320px phones */
@media (max-width: 380px) {
  .hud-row:not(.stats) { gap: 8px; }
  .hud-ic { width: 32px; height: 32px; }
  .hud-ic .ic { width: 17px; height: 17px; }
  .hud-title .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rank { height: 32px; padding: 0 10px 0 8px; gap: 5px; font-size: 13.5px; }
}
@media (max-width: 340px) {
  .hud-row:not(.stats) { gap: 6px; }
  .lvl, .lvl svg { width: 36px; height: 36px; }
  .lvl b { font-size: 15px; }
  .hud-title .title { font-size: 15px; }
}
/* the same wrapper fix for the passport: .passport sits between .sheet and .sheet-scroll */
.passport-sheet > .passport { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
