/* ═══════════════════════════════════════════════
   🐑 WOOL FARM — cartoon wood + slate-blue UI
   ═══════════════════════════════════════════════ */
@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url(assets/fonts/fredoka-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url(assets/fonts/fredoka-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url(assets/fonts/fredoka-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap; src: url(assets/fonts/fredoka-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'FarmCyr'; font-weight: 800; font-display: swap; src: url(assets/fonts/nunito-cyrillic-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'FarmAr'; font-weight: 700; font-display: swap; src: url(assets/fonts/noto-sans-arabic-arabic-700-normal.woff2) format('woff2'); }

:root {
  --vh: 1vh;
  --safe-top: 0px;
  --blue: #3c6b8d; --blue-2: #325c7a; --blue-d: #22465f; --blue-dd: #173347; --blue-line: #1a3a52;
  --wood-d: #4a2a12; --wood-dd: #2e1808;
  --green: #6cc13a; --green-d: #3f8a1f;
  --gold: #ffcf3a; --cream: #fff4d6;
  --red: #e53935;
  --txt-shadow: 0 2px 0 rgba(30,15,5,.85), 0 -1px 0 rgba(30,15,5,.6), 1px 0 0 rgba(30,15,5,.6), -1px 0 0 rgba(30,15,5,.6);
  --radius: 20px;
  font-family: 'Fredoka', 'FarmCyr', 'FarmAr', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3a200e url(assets/img/wood_dark.jpg) center/280px repeat; color: #fff; }
body { overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input { font: inherit; user-select: text; -webkit-user-select: text; }
img { -webkit-user-drag: none; user-select: none; }
b, strong { font-weight: 700; }
html[dir=rtl] body { direction: rtl; }

#app { height: calc(var(--vh) * 100); display: flex; flex-direction: column; position: relative; padding-top: var(--safe-top); }

/* ═════ LOADING ═════ */
.loading { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 38%, rgba(255,210,120,.25), transparent 60%), url(assets/img/wood_dark.jpg) center/280px; }
.loading-logo { text-align: center; }
.loading-logo img { width: 150px; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
.logo-text { font-size: 44px; font-weight: 700; letter-spacing: 1px; color: #fff; text-shadow: 0 4px 0 #2e1808, 0 -2px 0 #2e1808, 2px 0 0 #2e1808, -2px 0 0 #2e1808, 0 8px 12px rgba(0,0,0,.4); line-height: 1; }
.logo-text span { color: var(--gold); margin-left: 6px; }
.loading-bar { width: 230px; height: 22px; border-radius: 12px; background: var(--blue-dd); border: 3px solid #120a04; overflow: hidden; box-shadow: inset 0 3px 0 rgba(0,0,0,.35); }
#loadingFill { height: 100%; width: 8%; border-radius: 10px; background: linear-gradient(#9be25e, #4fa52a); box-shadow: inset 0 3px 0 rgba(255,255,255,.35); transition: width .4s; }
.loading-text { font-size: 16px; text-shadow: var(--txt-shadow); text-align: center; padding: 0 30px; min-height: 22px; }
.bounce { animation: bounce 1.1s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-14px) } }

/* ═════ TOP BAR (profile + balances + menu) ═════ */
.topbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 10px;
  background: url(assets/img/wood_light.jpg) center/420px; border-bottom: 4px solid var(--wood-dd); box-shadow: 0 6px 12px rgba(0,0,0,.35); position: relative; z-index: 5; }
.profile { display: flex; align-items: center; flex: 1; min-width: 0; max-width: 330px; padding: 5px 8px 5px 5px; gap: 6px; border-radius: 26px;
  background: url(assets/img/wood_card.jpg) center/300px; border: 3px solid var(--wood-dd); box-shadow: inset 0 2px 0 rgba(255,220,170,.35), 0 3px 0 rgba(0,0,0,.35); }
.avatar { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%; position: relative; background: radial-gradient(circle at 50% 70%, #9ad65c, #4f9a2f);
  border: 4px solid #f0c27a; box-shadow: 0 0 0 3px var(--wood-dd), inset 0 3px 6px rgba(0,0,0,.35); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .lvl { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); min-width: 30px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: #2e1808; border: 2px solid #f0c27a; font-size: 14px; display: grid; place-items: center; }
.bal { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.res { width: 100%; min-width: 0; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 6px 0 2px; border-radius: 12px; background: rgba(40,20,8,.6);
  box-shadow: inset 0 3px 4px rgba(0,0,0,.45); position: relative; }
.res img { width: 30px; height: 30px; margin: -4px 0 -4px -4px; flex: 0 0 auto; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.res span { flex: 1; min-width: 0; text-align: start; font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#resCash span { color: #9be86a; text-shadow: 0 2px 0 #1a3d0a; }
#resCoins span { color: var(--gold); text-shadow: 0 2px 0 #5a3a00; }
.res .res-plus { width: 28px; height: 28px; margin: 0 -8px 0 0; }
.menu-btn { width: 62px; height: 58px; flex: 0 0 auto; border-radius: 16px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: url(assets/img/wood_card.jpg) center/200px; border: 3px solid var(--wood-dd); box-shadow: inset 0 2px 0 rgba(255,220,170,.35), 0 4px 0 rgba(0,0,0,.35); }
.menu-btn i { width: 36px; height: 7px; border-radius: 4px; background: linear-gradient(#ffe7a6, #e9b85c); box-shadow: 0 2px 0 #6b3d14; }
.menu-btn:active { transform: translateY(2px); }
.dot { position: absolute; top: 2px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }

/* ═════ FOOTER NAV ═════ */
.footnav { flex: 0 0 auto; position: relative; z-index: 6; display: flex; align-items: flex-end; justify-content: space-around; gap: 4px; padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  background: url(assets/img/wood_light.jpg) center/420px; border-top: 4px solid var(--wood-dd); box-shadow: 0 -6px 12px rgba(0,0,0,.35); }
.fnav { flex: 1; min-width: 0; height: 62px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border-radius: 16px; padding-bottom: 2px; }
.fnav img { width: 46px; height: 46px; position: absolute; top: -6px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); transition: transform .15s; }
.fnav span { position: relative; font-size: 14px; font-weight: 700; color: #fff3c9; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 0 #2e1808, 0 -1px 0 #2e1808, 1px 0 0 #2e1808, -1px 0 0 #2e1808, 2px 2px 0 #2e1808, -2px 2px 0 #2e1808; }
.fnav.active { background: rgba(40,20,8,.35); box-shadow: inset 0 3px 6px rgba(0,0,0,.35); }
.fnav.active img { transform: translateY(-4px) scale(1.08); }
.fnav.active span { color: var(--gold); }
.fnav.center { flex: 1.15; }
.fnav.center img { width: 70px; height: 70px; top: -30px; background: radial-gradient(circle at 50% 65%, #9ad65c, #4f9a2f); border-radius: 50%;
  border: 4px solid #f0c27a; box-shadow: 0 0 0 3px var(--wood-dd), 0 5px 0 3px rgba(0,0,0,.3); padding: 2px; }
.fnav .dot { top: -2px; right: 18%; }

/* ═════ MAIN / PAGES ═════ */
.main { flex: 1; position: relative; overflow: hidden; }
.page { isolation: isolate; position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; visibility: hidden; opacity: 0; transition: opacity .18s; }
.page.active { visibility: visible; opacity: 1; }
.wood-page { padding: 12px 12px 90px; }
.page-title { text-align: center; font-size: 32px; font-weight: 700; margin: 2px 0 12px; text-shadow: 0 3px 0 #1c0e04, 0 -1px 0 #1c0e04, 2px 0 0 #1c0e04, -2px 0 0 #1c0e04; letter-spacing: .5px; }
.section-title { font-size: 20px; margin: 22px 4px 10px; text-shadow: var(--txt-shadow); }
.list { display: flex; flex-direction: column; gap: 12px; }
small { font-weight: 500; }

/* ═════ SURFACES ═════ */
.panel { background: linear-gradient(180deg, #4478a0, var(--blue) 30%, var(--blue-2)); border: 3px solid var(--blue-line); border-radius: var(--radius);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.15), 0 5px 0 rgba(0,0,0,.35); padding: 12px; }
.slot { background: var(--blue-d); border-radius: 14px; box-shadow: inset 0 3px 5px rgba(0,0,0,.35); }
.wood-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 12px; border-radius: var(--radius);
  background: url(assets/img/wood_card.jpg) center/420px; border: 3px solid var(--wood-d);
  box-shadow: inset 0 3px 0 rgba(255,220,170,.35), inset 0 -3px 0 rgba(0,0,0,.2), 0 5px 0 var(--wood-dd), 0 8px 12px rgba(0,0,0,.25); position: relative; }
.card-icon { width: 70px; height: 70px; flex: 0 0 auto; border-radius: 16px; background: rgba(40,20,8,.6); box-shadow: inset 0 3px 6px rgba(0,0,0,.5); display: grid; place-items: center; }
.card-icon img { width: 58px; height: 58px; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card-body b { font-size: 19px; text-shadow: var(--txt-shadow); line-height: 1.15; }
.card-body small { font-size: 14px; color: #ffe8c2; text-shadow: 0 1px 0 rgba(0,0,0,.6); }
.chev { font-size: 34px; text-shadow: var(--txt-shadow); padding: 0 4px; }
.info-panel p { margin: 0; font-size: 15px; text-align: center; font-weight: 500; line-height: 1.35; text-shadow: 0 1px 0 rgba(0,0,0,.4); }

/* ═════ BUTTONS ═════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 18px; border-radius: 16px; font-size: 19px; font-weight: 700;
  letter-spacing: .3px; text-shadow: 0 2px 0 rgba(0,0,0,.45); position: relative; transition: transform .08s, filter .15s; line-height: 1.05; }
.btn:active:not(:disabled) { transform: translateY(3px); }
.btn:disabled { filter: grayscale(.8) brightness(.8); cursor: not-allowed; }
.btn-green { background: linear-gradient(180deg, #a2e065 0%, #6cc13a 45%, #4d9a26 100%); border: 3px solid #dff7c4; box-shadow: 0 0 0 3px #26540f, 0 5px 0 3px #26540f, inset 0 -3px 0 rgba(0,0,0,.15); }
.btn-blue  { background: linear-gradient(180deg, #7fc0ff 0%, #4a92e0 45%, #2f6ec0 100%); border: 3px solid #d4eaff; box-shadow: 0 0 0 3px #173b6b, 0 5px 0 3px #173b6b, inset 0 -3px 0 rgba(0,0,0,.15); }
.btn-gold  { background: linear-gradient(180deg, #ffe58a 0%, #ffc928 45%, #e59b00 100%); border: 3px solid #fff4c4; box-shadow: 0 0 0 3px #6b4200, 0 5px 0 3px #6b4200; color: #fff; }
.btn-red   { background: linear-gradient(180deg, #ff8a80, #e53935 55%, #b71c1c); border: 3px solid #ffd0cc; box-shadow: 0 0 0 3px #5a0d0d, 0 5px 0 3px #5a0d0d; }
.btn-ghost { background: rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.25); min-height: 40px; font-size: 16px; }
.btn-wide { width: 100%; }
.btn-tall { min-height: 62px; font-size: 24px; margin: 16px 0; }
.btn-big { flex: 1; min-height: 60px; flex-direction: column; gap: 0; font-size: 22px; }
.btn-big small { font-size: 14px; opacity: .95; }
.btn-sq { width: 60px; min-height: 60px; padding: 0; flex: 0 0 auto; }
.btn-sq img { width: 44px; }
.btn-sm { min-height: 40px; font-size: 16px; padding: 6px 14px; border-radius: 13px; }
.btn.loading { pointer-events: none; }
.btn.loading::after { content: ''; width: 16px; height: 16px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═════ FARM ═════ */
.page-farm { display: block; padding-bottom: 16px; }
.scene { height: clamp(190px, 36vh, 330px); position: relative; overflow: hidden; isolation: isolate; z-index: 0; }
.scene-bg { position: absolute; inset: 0; background: url(assets/img/farm_bg.svg) center 52%/cover no-repeat; }
.field { position: absolute; left: 0; right: 0; top: 46%; bottom: 30px; }
.sprite { position: absolute; left: 0; top: 0; width: 80px; height: 80px; margin: -73px 0 0 -40px; transition-property: transform; transition-timing-function: linear; will-change: transform; cursor: pointer; }
.sprite .flip { width: 100%; height: 100%; transition: transform .2s; }
.sprite.left .flip { transform: scaleX(-1); }
.sprite img { width: 100%; height: 100%; display: block; }
.sprite.walking img { animation: waddle .45s ease-in-out infinite; }
.sprite.grazing img { animation: graze 2.6s ease-in-out infinite; }
.sprite.small { width: 58px; height: 58px; margin: -53px 0 0 -29px; }
.sprite.big { width: 96px; height: 96px; margin: -88px 0 0 -48px; }
@keyframes waddle { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
@keyframes graze { 0%,70%,100% { transform: rotate(0); } 80%,90% { transform: rotate(4deg) translateY(2px); } }
.sprite .badge { position: absolute; top: 2px; right: 6px; background: var(--red); color: #fff; font-size: 13px; min-width: 24px; height: 24px; border-radius: 12px; padding: 0 6px;
  display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.scene-empty { position: absolute; left: 12px; right: 12px; top: 18%; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.scene-empty .panel { width: 100%; max-width: 320px; }
.scene-empty h3 { margin: 0 0 6px; font-size: 22px; text-shadow: var(--txt-shadow); }
.scene-empty p { margin: 0 0 12px; font-size: 15px; font-weight: 500; line-height: 1.3; }
.scene-empty img.lamb { width: 110px; animation: bounce 1.4s ease-in-out infinite; }
.farm-hud { flex: 0 0 auto; padding: 0 10px 10px; margin-top: -26px; position: relative; z-index: 3; }
.hud-panel { padding: 10px 12px 12px; }
.hud-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.hud-stat { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hud-stat.right { text-align: end; }
.hud-stat img { width: 40px; height: 40px; }
.hud-label { font-size: 13px; color: #cfe6ff; font-weight: 500; }
.hud-value { font-size: 22px; font-weight: 700; text-shadow: var(--txt-shadow); white-space: nowrap; }
.hud-value small { font-size: 15px; color: #cfe6ff; }
.bar { height: 26px; border-radius: 13px; background: var(--blue-dd); border: 3px solid #0d2233; position: relative; overflow: hidden; box-shadow: inset 0 3px 0 rgba(0,0,0,.35); }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 10px; background: linear-gradient(#9be25e, #5bb52f 55%, #3f8f1c); box-shadow: inset 0 3px 0 rgba(255,255,255,.35); transition: width .6s ease; }
html[dir=rtl] .bar-fill { inset: 0 0 0 auto; }
.bar-fill.full { background: linear-gradient(#ff9e80, #f4511e 55%, #bf360c); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { filter: brightness(1.2); } }
.bar-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.7); }
.barn-full { margin-top: 8px; font-size: 14px; text-align: center; color: #ffd6c9; text-shadow: 0 1px 0 rgba(0,0,0,.6); }
.hud-actions { display: flex; gap: 10px; margin-top: 12px; align-items: stretch; }
img.ic { width: 1.15em !important; height: 1.15em !important; vertical-align: -0.2em; display: inline-block; margin: 0 !important; position: static !important; filter: none !important; }
.float-txt { position: absolute; pointer-events: none; font-size: 17px; font-weight: 700; color: #fff; text-shadow: var(--txt-shadow); animation: floatUp 1.4s ease-out forwards; white-space: nowrap; z-index: 2; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }

/* ═════ SHOP ═════ */
.deposit-banner { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px; border-radius: var(--radius); text-align: start;
  background: linear-gradient(180deg, #ffe07a, #ffc01e 55%, #e59400); border: 3px solid #fff3c0; box-shadow: 0 0 0 3px #6b4200, 0 6px 0 3px #6b4200; }
.deposit-banner img { width: 50px; }
.deposit-banner div { flex: 1; display: flex; flex-direction: column; }
.deposit-banner b { font-size: 21px; text-shadow: 0 2px 0 #7a4b00; }
.deposit-banner small { font-size: 13px; color: #5a3500; }
.deposit-banner .banner-plus { width: 44px; }
.sheep-card { align-items: stretch; flex-direction: column; gap: 8px; }
.sheep-top { display: flex; gap: 12px; align-items: center; }
.sheep-pic { width: 96px; height: 96px; flex: 0 0 auto; border-radius: 18px; background: radial-gradient(circle at 50% 70%, #9ad65c, #5a9e2c); box-shadow: inset 0 3px 6px rgba(0,0,0,.35); border: 3px solid rgba(40,20,8,.6); position: relative; overflow: hidden; }
.sheep-pic img { width: 112%; margin: -2px 0 0 -6%; }
.sheep-pic .tier { position: absolute; left: 4px; top: 4px; font-size: 12px; background: rgba(0,0,0,.45); padding: 1px 7px; border-radius: 8px; }
.sheep-info { flex: 1; min-width: 0; }
.sheep-info h3 { margin: 0 0 4px; font-size: 21px; text-shadow: var(--txt-shadow); line-height: 1.1; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 13px; padding: 3px 8px; border-radius: 10px; background: rgba(40,20,8,.55); box-shadow: inset 0 2px 3px rgba(0,0,0,.4); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.chip img { width: 16px; height: 16px; }
.chip.g { color: #b9f58f; } .chip.y { color: #ffe27a; } .chip.b { color: #bfe0ff; }
.sheep-bottom { display: flex; gap: 10px; align-items: center; }
.price-tag { flex: 1; display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 12px; border-radius: 14px; background: rgba(40,20,8,.6); box-shadow: inset 0 3px 5px rgba(0,0,0,.45); font-size: 21px; color: var(--gold); text-shadow: 0 2px 0 #5a3a00; }
.price-tag img { width: 28px; }
.sheep-bottom .btn { min-width: 120px; }
.owned { font-size: 13px; color: #ffe8c2; text-align: end; }

/* ═════ BARN ═════ */
.lvl-card { gap: 10px; }
.lvl-card .card-icon { width: 60px; height: 60px; font-size: 24px; font-weight: 700; text-shadow: var(--txt-shadow); }
.lvl-card.current { outline: 4px solid var(--gold); outline-offset: 2px; }
.lvl-card.done { opacity: .75; }
.lvl-card .btn { min-width: 110px; }
.herd-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.herd-row img { width: 56px; height: 56px; }
.herd-row .card-body b { font-size: 17px; }
.herd-row .qty { font-size: 20px; color: var(--gold); text-shadow: var(--txt-shadow); }
.empty { text-align: center; padding: 18px; font-size: 16px; color: #ffe8c2; text-shadow: var(--txt-shadow); }

/* ═════ TASKS ═════ */
.ach-entry { margin-bottom: 14px; }
.task-card { padding: 10px; gap: 10px; }
.task-card .card-icon { width: 52px; height: 52px; font-size: 28px; }
.task-card .card-body b { font-size: 17px; }
.task-card .reward { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-size: 18px; text-shadow: 0 2px 0 #5a3a00; }
.task-card .reward img { width: 22px; }
.task-card .btn { min-width: 84px; padding: 6px 10px; }
.task-card.claimed { filter: saturate(.6) brightness(.85); }

/* ═════ FRIENDS ═════ */
.link-card { flex-direction: column; align-items: stretch; gap: 12px; }
.link-row { display: flex; gap: 10px; align-items: center; }
.link-text { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 14px; background: rgba(40,20,8,.6); box-shadow: inset 0 3px 5px rgba(0,0,0,.45); font-size: 16px; word-break: break-all; line-height: 1.25; user-select: text; -webkit-user-select: text; }
.copy-btn { width: 56px; height: 56px; border-radius: 14px; background: #5a3419; border: 3px solid var(--wood-dd); font-size: 28px; box-shadow: inset 0 2px 0 rgba(255,220,170,.25); }
.refs-panel { padding: 12px 10px; }
.refs-head { text-align: center; font-size: 24px; text-shadow: var(--txt-shadow); margin-bottom: 4px; }
.ref-stats { text-align: center; font-size: 14px; color: #cfe6ff; margin-bottom: 10px; }
.ref-stats b { color: #9be86a; display: inline-flex; align-items: center; gap: 3px; }
.ref-stats img { width: 20px; }
.tabs { display: flex; background: var(--blue-d); border-radius: 16px; padding: 4px; gap: 4px; box-shadow: inset 0 3px 5px rgba(0,0,0,.35); margin-bottom: 10px; }
.tab { flex: 1; height: 46px; border-radius: 13px; font-size: 20px; text-shadow: var(--txt-shadow); }
.tab.active { background: linear-gradient(#4f86b0, #3b6a8c); box-shadow: 0 3px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.2); }
.tab small { font-size: 13px; opacity: .8; }
.refs-cols { display: flex; justify-content: space-between; font-size: 18px; padding: 0 6px 8px; text-shadow: var(--txt-shadow); }
.ref-row { display: flex; gap: 8px; margin-bottom: 8px; }
.ref-name { flex: 1; min-width: 0; min-height: 60px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 14px; background: var(--blue-d); box-shadow: inset 0 3px 5px rgba(0,0,0,.3); font-size: 18px; }
.ref-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-name i { font-style: normal; width: 10px; height: 10px; border-radius: 50%; background: #7d8b97; flex: 0 0 auto; }
.ref-name i.on { background: #6be34a; box-shadow: 0 0 6px #6be34a; }
.ref-earn { width: 42%; display: flex; flex-direction: column; gap: 4px; }
.ref-earn div { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 0 8px; border-radius: 10px; background: var(--blue-d); box-shadow: inset 0 3px 5px rgba(0,0,0,.3); font-size: 16px; }
.ref-earn div:first-child { color: #9be86a; } .ref-earn div:last-child { color: var(--gold); }
.ref-earn img { width: 20px; }

/* ═════ PAYOUT ═════ */
.method-card .card-icon { width: 64px; height: 64px; border-radius: 50%; }
.method-card .card-icon svg { width: 50px; height: 50px; }
.method-card .card-body b { font-size: 20px; }
.method-card .card-body small { font-size: 16px; color: #fff; }
.method-card .card-body small em { font-style: normal; color: #9be86a; }
.method-card .auto { position: absolute; top: 8px; right: 10px; font-size: 11px; background: #2e7d32; border-radius: 8px; padding: 2px 7px; }
html[dir=rtl] .method-card .auto { right: auto; left: 10px; }
.reinvest-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; margin-top: 12px; border-radius: var(--radius); text-align: start;
  background: linear-gradient(180deg, #4caf50, #2e7d32); border: 3px solid #1b4d1e; box-shadow: inset 0 3px 0 rgba(255,255,255,.25), 0 5px 0 #133816; }
.reinvest-card .card-icon { background: rgba(0,40,0,.35); }
.reinvest-card b { font-size: 24px; }
.wd-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(34,70,95,.92); border: 2px solid var(--blue-line); }
.wd-row .card-body b { font-size: 16px; }
.st { font-size: 13px; padding: 3px 9px; border-radius: 9px; white-space: nowrap; }
.st.pending { background: #f9a825; color: #3e2700; text-shadow: none; }
.st.approved { background: #43a047; }
.st.rejected { background: #c62828; }

/* ═════ MODAL ═════ */
.modal-wrap { position: absolute; inset: 0; z-index: 30; background: rgba(15,8,2,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: calc(34px + var(--safe-top)) 12px 16px; animation: fadeIn .18s; }
@keyframes fadeIn { from { opacity: 0 } }
.modal { width: 100%; max-width: 440px; max-height: 100%; display: flex; flex-direction: column; position: relative; border-radius: 26px; padding: 34px 12px 14px;
  background: linear-gradient(180deg, #4d82ab, var(--blue) 25%, var(--blue-2)); border: 3px solid var(--blue-line);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.25), 0 8px 0 rgba(0,0,0,.35), 0 20px 40px rgba(0,0,0,.4); animation: pop .22s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal-plaque { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); max-width: 80%; padding: 11px 22px; border-radius: 16px; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: url(assets/img/wood_card.jpg) center/300px; border: 3px solid var(--wood-dd); box-shadow: inset 0 2px 0 rgba(255,220,170,.35), 0 4px 0 rgba(0,0,0,.4); text-shadow: var(--txt-shadow); }
.modal-close { position: absolute; top: -18px; right: -6px; width: 54px; height: 54px; border-radius: 50%; font-size: 26px; font-weight: 700;
  background: radial-gradient(circle at 40% 35%, #ff6b6b, #d32f2f 70%); border: 4px solid #fff; box-shadow: 0 0 0 3px #7a0f0f, 0 4px 0 3px #7a0f0f; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
html[dir=rtl] .modal-close { right: auto; left: -6px; }
.modal-body { overflow-y: auto; padding: 4px 2px; -webkit-overflow-scrolling: touch; }
.modal-body p { font-weight: 500; line-height: 1.4; margin: 6px 0; text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.modal-body ul { margin: 6px 0; padding-inline-start: 22px; font-weight: 500; }
.modal-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.field-label { font-size: 14px; color: #cfe6ff; margin: 10px 2px 6px; display: flex; justify-content: space-between; gap: 8px; }
.input-row { display: flex; gap: 8px; }
.input { flex: 1; min-width: 0; height: 52px; border-radius: 14px; border: 3px solid #0d2233; background: var(--blue-dd); color: #fff; padding: 0 14px; font-size: 19px; font-weight: 600; outline: none; box-shadow: inset 0 3px 5px rgba(0,0,0,.35); }
.input:focus { border-color: #7fc0ff; }
.input.addr { font-size: 14px; width: 100%; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick { flex-wrap: nowrap; }
.quick button { flex: 1 1 0; min-width: 0; height: 40px; border-radius: 12px; background: var(--blue-d); box-shadow: inset 0 2px 4px rgba(0,0,0,.35); font-size: 16px; }
.quick button.on { background: #4a92e0; box-shadow: 0 3px 0 #173b6b; }
.summary { margin-top: 12px; border-radius: 14px; background: var(--blue-d); padding: 10px 12px; box-shadow: inset 0 3px 5px rgba(0,0,0,.3); }
.summary div { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; padding: 3px 0; }
.summary div b { color: #9be86a; }
.summary div.big { font-size: 19px; border-top: 1px dashed rgba(255,255,255,.2); margin-top: 4px; padding-top: 7px; }
.note { font-size: 13.5px; font-weight: 500; line-height: 1.35; background: rgba(0,0,0,.22); border-radius: 12px; padding: 8px 10px; margin-top: 8px; }
.note.warn { background: rgba(255,152,0,.25); border: 1px solid rgba(255,193,7,.5); }
.seg { display: flex; background: var(--blue-dd); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 44px; border-radius: 11px; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: linear-gradient(#5aa7ef, #2f6fc0); box-shadow: 0 3px 0 #173b6b; }
.seg svg { width: 22px; height: 22px; }
.copy-field { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.copy-field code { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--blue-dd); font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; user-select: all; -webkit-user-select: all; }
.copy-field button { width: 46px; height: 46px; border-radius: 12px; background: #4a92e0; font-size: 20px; box-shadow: 0 3px 0 #173b6b; flex: 0 0 auto; }
.waiting { text-align: center; padding: 10px; }
.waiting .spinner { width: 48px; height: 48px; margin: 8px auto; border: 6px solid rgba(255,255,255,.25); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 10px 0; }
.stepper button { width: 52px; height: 52px; border-radius: 50%; font-size: 30px; background: linear-gradient(#5aa7ef, #2f6fc0); box-shadow: 0 4px 0 #173b6b; }
.stepper span { font-size: 34px; min-width: 60px; text-align: center; text-shadow: var(--txt-shadow); }
.buy-preview { display: flex; align-items: center; gap: 12px; }
.buy-preview img { width: 110px; }

/* achievements (Jack-style) */
.ach-list { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.ach-item { flex-direction: column; align-items: stretch; gap: 8px; }
.ach-item .row { display: flex; gap: 12px; align-items: center; }
.ach-item .card-icon { width: 64px; height: 64px; }
.ach-item .card-icon img { width: 52px; }
.ach-item b { font-size: 19px; text-shadow: var(--txt-shadow); }
.ach-item .rw { display: flex; align-items: center; gap: 5px; font-size: 20px; color: var(--gold); text-shadow: 0 2px 0 #5a3a00; }
.ach-item .rw img { width: 24px; }
.ach-item.claimed { filter: saturate(.5) brightness(.8); }
.ach-item .tick { position: absolute; top: 8px; right: 10px; font-size: 22px; }
.pbar { height: 24px; border-radius: 12px; background: var(--blue-dd); border: 3px solid #120a04; position: relative; overflow: hidden; }
.pbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#8de04e, #4fa52a); border-radius: 9px; box-shadow: inset 0 3px 0 rgba(255,255,255,.3); }
.pbar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; text-shadow: 0 2px 0 rgba(0,0,0,.7); }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--blue-d); margin-bottom: 8px; font-size: 18px; box-shadow: inset 0 3px 5px rgba(0,0,0,.3); }
.toggle { width: 74px; height: 38px; border-radius: 19px; background: #6d7a86; position: relative; box-shadow: inset 0 3px 5px rgba(0,0,0,.4); transition: background .2s; font-size: 12px; }
.toggle::after { content: ''; position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.3); transition: transform .2s; }
.toggle.on { background: #4caf50; }
.toggle.on::after { transform: translateX(36px); }
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.lang-grid button { height: 46px; border-radius: 12px; background: var(--blue-d); font-size: 15px; box-shadow: inset 0 2px 4px rgba(0,0,0,.3); }
.lang-grid button.on { background: linear-gradient(#5aa7ef, #2f6fc0); box-shadow: 0 3px 0 #173b6b; }
.set-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.uid { text-align: center; font-size: 13px; color: #cfe6ff; margin-top: 10px; }

/* FAQ (Jack-style) */
.faq-q { text-align: center; font-size: 22px; margin: 14px 4px 8px; text-shadow: var(--txt-shadow); line-height: 1.15; }
.faq-a { background: var(--blue-d); border-radius: 16px; padding: 12px 14px; font-size: 16px; text-align: center; line-height: 1.35; font-weight: 500; box-shadow: inset 0 3px 5px rgba(0,0,0,.3); }

/* history */
.h-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: var(--blue-d); margin-bottom: 6px; }
.h-row .h-ico { font-size: 22px; width: 32px; text-align: center; }
.h-row .card-body b { font-size: 15px; text-shadow: none; }
.h-row .card-body small { font-size: 12px; color: #9fc3e0; }
.h-amt { text-align: end; font-size: 15px; white-space: nowrap; }
.h-amt .p { color: #9be86a; } .h-amt .n { color: #ff9e80; } .h-amt .c { color: var(--gold); }

/* ═════ TOASTS / FX ═════ */
.toast-wrap { position: absolute; left: 0; right: 0; top: calc(96px + var(--safe-top)); z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 100%; padding: 10px 16px; border-radius: 14px; font-size: 16px; background: url(assets/img/wood_card.jpg) center/300px; border: 3px solid var(--wood-dd);
  box-shadow: 0 4px 0 rgba(0,0,0,.4); text-shadow: var(--txt-shadow); animation: toastIn .25s cubic-bezier(.2,1.4,.4,1); text-align: center; }
.toast.err { background: linear-gradient(#e57373, #c62828); border-color: #5a0d0d; }
.toast.ok { background: linear-gradient(#81c784, #388e3c); border-color: #1b4d1e; }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { transform: translateY(-20px) scale(.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.fly { position: absolute; width: 34px; height: 34px; z-index: 45; transition: transform .75s cubic-bezier(.5,-0.3,.7,1), opacity .75s; }
.confetti { position: absolute; width: 9px; height: 14px; border-radius: 2px; animation: conf 1.4s ease-out forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }
.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.18); } }

@media (max-width: 360px) {
  .res span { font-size: 16px; }
  .avatar { width: 54px; height: 54px; }
  .menu-btn { width: 54px; height: 52px; } .menu-btn i { width: 30px; }
  .page-title { font-size: 28px; }
  .sheep-pic { width: 82px; height: 82px; }
  .fnav span { font-size: 12.5px; } .fnav img { width: 40px; height: 40px; }
  .htile .spd { font-size: 11px; }
}


/* ═════ HERD BOARD (farm) ═════ */
.herd-board { margin: 14px 10px 0; padding: 12px 10px 14px; border-radius: 24px; background: url(assets/img/wood_card.jpg) center/420px; border: 4px solid var(--wood-dd);
  box-shadow: inset 0 3px 0 rgba(255,220,170,.35), 0 6px 0 rgba(0,0,0,.35); }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px 10px; }
.board-head b { font-size: 20px; text-shadow: var(--txt-shadow); }
.board-head small { font-size: 12.5px; color: #ffe8c2; text-shadow: 0 1px 0 rgba(0,0,0,.6); text-align: end; }
.herd-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; padding: 6px 4px 0; }
.htile { min-width: 0; position: relative; aspect-ratio: 1 / 1.08; border-radius: 16px; background: rgba(40,20,8,.72); box-shadow: inset 0 4px 8px rgba(0,0,0,.55); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4px; }
.htile img.sp { width: 86%; height: auto; margin-top: -2px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); transition: transform .15s; }
.htile:active img.sp { transform: scale(.94); }
.htile.none img.sp { filter: grayscale(.85) brightness(.55); }
.htile .cnt { position: absolute; top: 3px; left: 4px; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--gold); color: #4a2a00; font-size: 14px; display: grid; place-items: center; text-shadow: none; box-shadow: 0 2px 0 rgba(0,0,0,.35); }
html[dir=rtl] .htile .cnt { left: auto; right: 4px; }
.htile .add { position: absolute; top: -5px; right: -4px; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(#a2e065, #4d9a26); border: 2px solid #fff; box-shadow: 0 2px 0 #26540f;
  font-size: 22px; line-height: 22px; font-weight: 700; display: grid; place-items: center; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
html[dir=rtl] .htile .add { right: auto; left: -4px; }
.htile .spd { position: absolute; left: 4px; right: 4px; bottom: 5px; height: 22px; border-radius: 11px; font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 2px;
  white-space: nowrap; text-shadow: 0 1px 0 rgba(0,0,0,.5); box-shadow: inset 0 2px 0 rgba(255,255,255,.3), 0 2px 0 rgba(0,0,0,.35); }
.htile.none .spd { opacity: .75; }
.t-lamb { background: #e75b8e; } .t-white { background: #43a047; } .t-brown { background: #8d5a3b; } .t-black { background: #455a64; }
.t-merino { background: #1e88e5; } .t-highland { background: #3949ab; } .t-royal { background: #9c27b0; } .t-golden { background: #f29900; }

/* gift (daily) */
.gift-btn { position: absolute; top: 10px; left: 10px; z-index: 900; width: 56px; height: 56px; border-radius: 16px; font-size: 32px; display: grid; place-items: center;
  background: url(assets/img/wood_card.jpg) center/200px; border: 3px solid var(--wood-dd); box-shadow: inset 0 2px 0 rgba(255,220,170,.35), 0 4px 0 rgba(0,0,0,.35); }
.gift-btn.ready span { animation: wiggle 1.6s ease-in-out infinite; }
html[dir=rtl] .gift-btn { left: auto; right: 10px; }
@keyframes wiggle { 0%,60%,100% { transform: rotate(0); } 70% { transform: rotate(-14deg) scale(1.1); } 80% { transform: rotate(12deg) scale(1.1); } 90% { transform: rotate(-6deg); } }

/* daily modal */
.daily-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dday { border-radius: 14px; background: var(--blue-d); box-shadow: inset 0 3px 5px rgba(0,0,0,.3); padding: 8px 4px; text-align: center; position: relative; }
.dday small { display: block; font-size: 12px; color: #cfe6ff; }
.dday b { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 17px; color: var(--gold); margin-top: 3px; }
.dday.done { opacity: .55; } .dday.done::after { content: '✓'; position: absolute; top: 2px; right: 6px; color: #9be86a; }
.dday.today { background: linear-gradient(#5aa7ef, #2f6fc0); box-shadow: 0 0 0 3px var(--gold); }
.dday.big { grid-column: span 2; }

/* menu modal */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.mtile { border-radius: 16px; padding: 10px 4px 8px; background: url(assets/img/wood_card.jpg) center/300px; border: 3px solid var(--wood-dd); box-shadow: inset 0 2px 0 rgba(255,220,170,.35), 0 4px 0 rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13.5px; text-shadow: var(--txt-shadow); position: relative; }
.mtile .ico { font-size: 30px; line-height: 40px; height: 40px; }
.mtile img { width: 40px; height: 40px; }
.shop-focus { animation: focusGlow 1.6s ease-out 2; }
@keyframes focusGlow { 0%,100% { box-shadow: inset 0 3px 0 rgba(255,220,170,.35), 0 5px 0 var(--wood-dd); } 40% { box-shadow: 0 0 0 5px var(--gold), 0 0 22px var(--gold); } }

/* ═════ SPINE HERD CANVAS ═════ */
.herd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; display: block; }
.scene-empty { z-index: 3; }
.bp-art { width: 118px; height: 118px; flex: 0 0 auto; object-fit: contain; }
.htile img.sp { width: 88%; height: auto; margin-top: 2px; }
.fnav.center img { object-fit: contain; padding: 6px; }
