/* ============================================================
   Tile Pharos - home screen (rebuild)
   Loaded after style.css so it owns the home layout.
   Everything is hand-drawn SVG + CSS. No images.
   ============================================================ */

#sHome {
  --gold-l: #fff3c4;
  --gold-1: #ffe08a;
  --gold-2: #f2c25a;
  --gold-3: #d69a24;
  --gold-d: #8a5c10;
  --wood-l: #c8873f;
  --wood-m: #a2652f;
  --wood-d: #6b3c1a;
  --lapis-l: #3f7cc0;
  --lapis-m: #1f4f8f;
  --lapis-d: #102f5c;
  --green-l: #8ce87a;
  --green-m: #34b64a;
  --green-d: #157a26;
  --green-x: #0c5717;
  --r: 16px;
}

.hm {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  gap: 8px;
  overflow: hidden;
}

/* ---------------------------------------------- top HUD */
.hm-hud {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  animation: hmRise .5s var(--ease) both;
}

.hm-avatar {
  width: 46px; height: 46px;
  border-radius: 15px;
  padding: 0; border: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #ffd79a, #d99b52);
  box-shadow: inset 0 0 0 2px rgba(255, 240, 205, .85), 0 0 0 2px #6b3c1a, 0 4px 0 #4a2709, 0 8px 14px rgba(40, 20, 0, .3);
  transition: transform .12s var(--ease);
}
.hm-avatar svg { width: 100%; height: 100%; display: block; }
.hm-avatar:active { transform: translateY(2px) scale(.97); }

.hm-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 6px 0 8px;
  border-radius: 15px;
  background-image:
    repeating-linear-gradient(90deg, rgba(52, 26, 4, .18) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 26px),
    linear-gradient(180deg, #b87940 0%, #96551f 46%, #6b3c1a 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 238, 200, .55),
    inset 0 -4px 0 rgba(0, 0, 0, .28),
    inset 0 0 0 1.5px rgba(255, 214, 138, .35),
    0 0 0 2px #4a2709,
    0 4px 0 #3a1d06,
    0 8px 14px rgba(40, 20, 0, .28);
}
.hm-pill::after {
  content: '';
  position: absolute;
  inset: 3px 3px auto;
  height: 42%;
  border-radius: 12px 12px 60% 60% / 12px 12px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.hm-pill b {
  font-size: 16px;
  font-weight: 900;
  color: #fff8e6;
  letter-spacing: -.2px;
  text-shadow: 0 1.5px 0 rgba(60, 28, 4, .8), 0 0 8px rgba(255, 214, 138, .25);
  font-variant-numeric: tabular-nums;
  flex: 1;
  text-align: start;
  min-width: 0;
}
.hm-ico { display: grid; place-items: center; width: 24px; height: 24px; }
.hm-ico svg { width: 24px; height: 24px; }

/* gold star */
.hm-star .hm-ico svg { fill: url(#hmStarGrad); stroke: #7a4c06; stroke-width: 1.2; }
.hm-star .hm-ico {
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .5)) drop-shadow(0 2px 3px rgba(80, 40, 0, .45));
}

/* gold coin */
.hm-coinart {
  width: 24px; height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #fff6c8 0%, #ffd96b 38%, #e8a72c 68%, #a9691a 100%);
  box-shadow: inset 0 -2px 3px rgba(120, 70, 10, .55), inset 0 2px 2px rgba(255, 250, 220, .8), 0 2px 3px rgba(80, 40, 0, .45);
  position: relative;
  flex: 0 0 auto;
}
.hm-coinart::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1.5px solid rgba(150, 95, 15, .55);
  background: radial-gradient(circle at 40% 34%, rgba(255, 250, 210, .9), rgba(255, 255, 255, 0) 70%);
}

.hm-plus {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 9px;
  border: 0;
  display: grid;
  place-items: center;
  font: 900 17px/1 'Cairo', system-ui, sans-serif;
  color: #f2fff0;
  padding: 0 0 2px;
  background: linear-gradient(180deg, #86e874 0%, #3fbb4f 48%, #1c8a2c 100%);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .7), inset 0 -2.5px 0 rgba(0, 0, 0, .3), 0 0 0 1.5px #0f5c1c, 0 0 10px rgba(90, 220, 100, .55);
  text-shadow: 0 1px 1px rgba(0, 60, 10, .7);
  transition: transform .12s var(--ease), box-shadow .12s;
}
.hm-plus:active { transform: translateY(1px) scale(.94); box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .7), inset 0 -1px 0 rgba(0, 0, 0, .3), 0 0 0 1.5px #0f5c1c, 0 0 6px rgba(90, 220, 100, .45); }

.hm-gear {
  width: 46px; height: 46px;
  border-radius: 15px;
  border: 0;
  display: grid; place-items: center;
  background-image: linear-gradient(180deg, #b87940 0%, #96551f 46%, #6b3c1a 100%);
  box-shadow: inset 0 2px 0 rgba(255, 238, 200, .5), inset 0 -4px 0 rgba(0, 0, 0, .28), 0 0 0 2px #4a2709, 0 4px 0 #3a1d06, 0 8px 14px rgba(40, 20, 0, .28);
  transition: transform .12s var(--ease);
}
.hm-gear svg { width: 23px; height: 23px; stroke: #ffe9bf; stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35)); }
.hm-gear:active { transform: translateY(2px) scale(.97); }

/* ---------------------------------------------- logo plaque */
.hm-logo {
  display: flex;
  justify-content: center;
  padding-top: 2px;
  animation: hmRise .55s .05s var(--ease) both;
}

.hm-plaque {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 26px 10px;
  border-radius: 18px;
  background-image:
    repeating-linear-gradient(90deg, rgba(52, 26, 4, .22) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 40px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, rgba(0, 0, 0, 0) 1px 7px),
    linear-gradient(180deg, var(--wood-l), var(--wood-m) 54%, var(--wood-d));
  box-shadow:
    inset 0 2px 0 rgba(255, 236, 196, .45),
    inset 0 -6px 0 rgba(0, 0, 0, .28),
    0 0 0 2px #4a2709,
    0 0 0 4px #d69a24,
    0 0 0 5.5px #7a4c06,
    0 8px 0 #3a1d06,
    0 14px 22px rgba(40, 20, 0, .38);
}
/* gold corner trims */
.plq-corner {
  position: absolute;
  width: 16px; height: 16px;
  border: 3px solid;
  border-image: linear-gradient(135deg, #ffe9a8, #d69a24) 1;
  pointer-events: none;
}
.plq-corner.tl { top: 5px; inset-inline-start: 5px; border-inline-end: 0; border-bottom: 0; border-start-start-radius: 8px; }
.plq-corner.tr { top: 5px; inset-inline-end: 5px; border-inline-start: 0; border-bottom: 0; border-start-end-radius: 8px; }
.plq-corner.bl { bottom: 5px; inset-inline-start: 5px; border-inline-end: 0; border-top: 0; border-end-start-radius: 8px; }
.plq-corner.br { bottom: 5px; inset-inline-end: 5px; border-inline-start: 0; border-top: 0; border-end-end-radius: 8px; }
/* rivets */
.plq-rivet {
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6cf, #e8b44a 55%, #9a6412);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .5);
}
.plq-rivet.r1 { top: 8px; inset-inline-start: 26px; }
.plq-rivet.r2 { top: 8px; inset-inline-end: 26px; }
.plq-rivet.r3 { bottom: 8px; inset-inline-start: 26px; }
.plq-rivet.r4 { bottom: 8px; inset-inline-end: 26px; }

/* eye of horus ornament */
.hm-orn {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  margin: -18px 0 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #2f6aa8, #12305c 78%);
  box-shadow: 0 0 0 2px #d69a24, 0 0 0 3.5px #7a4c06, 0 3px 6px rgba(0, 0, 0, .4);
}
.hm-orn svg { width: 20px; height: 20px; }

.hm-title {
  position: relative;
  margin: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}
.hm-logo-svg {
  display: block;
  width: clamp(196px, 58vw, 250px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 3px 0 #4a2408) drop-shadow(0 6px 8px rgba(0, 0, 0, .4));
}
.hm-logo-svg text {
  font-family: 'Cairo', system-ui, sans-serif;
  font-weight: 900;
  font-size: 46px;
  letter-spacing: .5px;
  direction: ltr;
}
.logo-stroke { fill: #4a2408; stroke: #3a1c05; stroke-width: 11; stroke-linejoin: round; paint-order: stroke fill; }
.logo-fill { fill: url(#logoGold); }
.logo-shine { fill: url(#logoShine); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.hm-sub {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  color: #ffe6b0;
  text-shadow: 0 1.5px 0 rgba(70, 34, 6, .85);
}

/* ---------------------------------------------- middle: side buttons, hero, level */
.hm-mid {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  animation: hmRise .6s .1s var(--ease) both;
}

.hm-col {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  width: 66px;
}
.hm-col.right { width: 76px; align-items: center; justify-content: center; }

/* daily / rewards: beveled wood panels */
.hm-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border: 0;
  border-radius: 16px;
  background-image:
    repeating-linear-gradient(90deg, rgba(52, 26, 4, .2) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 24px),
    linear-gradient(180deg, #c1853f 0%, #9c5c25 50%, #6f3f19 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 240, 200, .5),
    inset 0 -5px 0 rgba(0, 0, 0, .3),
    0 0 0 2px #4a2709,
    0 0 0 3.5px #d69a24,
    0 0 0 5px #7a4c06,
    0 6px 0 #3a1d06,
    0 10px 16px rgba(40, 20, 0, .32);
  transition: transform .12s var(--ease), box-shadow .12s;
}
.hm-side::after {
  content: '';
  position: absolute;
  inset: 3px 3px auto;
  height: 38%;
  border-radius: 13px 13px 60% 60% / 13px 13px 30% 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.hm-side:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 240, 200, .5), inset 0 -2px 0 rgba(0, 0, 0, .3), 0 0 0 2px #4a2709, 0 0 0 3.5px #d69a24, 0 0 0 5px #7a4c06, 0 2px 0 #3a1d06, 0 5px 10px rgba(40, 20, 0, .3); }

.hs-face {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: radial-gradient(circle at 50% 30%, #fff6dc, #f2dfb6 70%, #e0c793);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .9), inset 0 -3px 5px rgba(140, 100, 50, .35), 0 2px 0 rgba(0, 0, 0, .28);
}
.hs-ico { display: grid; place-items: center; }
.hs-ico svg { width: 27px; height: 27px; stroke: #7d3d10; stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hs-lbl {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #fff2d6;
  text-shadow: 0 1.5px 0 rgba(60, 28, 4, .8);
  line-height: 1.1;
}

/* notification badge */
.hm-dot {
  position: absolute;
  top: -7px;
  inset-inline-end: -7px;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #ff7a6a, #d62b2b 60%, #9c1414);
  box-shadow: 0 0 0 2px #fff6e2, 0 2px 4px rgba(120, 0, 0, .45);
  text-shadow: 0 1px 1px rgba(90, 0, 0, .7);
  animation: hmPulse 1.8s var(--ease) infinite;
}
.hm-dot[hidden] { display: none; }

/* hero: three tiles in a fan */
.hm-hero {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: grid;
  place-items: center;
}
.hp-slot {
  position: absolute;
  width: clamp(54px, 16vw, 66px);
  aspect-ratio: 1 / 1;
  top: 50%;
  left: 50%;
}
.hp-slot.s0 { transform: translate(-50%, -50%) translate(-74%, 14%) rotate(-17deg); }
.hp-slot.s1 { transform: translate(-50%, -50%) translateY(-9%) rotate(-1deg); z-index: 2; }
.hp-slot.s2 { transform: translate(-50%, -50%) translate(74%, 16%) rotate(16deg); }
.hp-card {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  border-radius: 16px;
  border: 2px solid #9d7a48;
  background:
    radial-gradient(circle at 50% 26%, #fffdf5, #fdf3dd 62%, #efdfba 100%);
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -4px 0 rgba(160, 130, 80, .35),
    0 5px 0 #b8935c,
    0 10px 16px rgba(60, 30, 0, .35);
  animation: hpFloat 4.4s var(--ease) infinite;
}
.hp-slot.s0 .hp-card { animation-delay: -.6s; }
.hp-slot.s2 .hp-card { animation-delay: -1.4s; }
.hp-card svg { width: 74%; height: 74%; display: block; }

/* level cartouche */
.hm-lvl {
  position: relative;
  width: 100%;
  aspect-ratio: 88 / 112;
  border: 0;
  padding: 0;
  background: none;
  display: grid;
  place-items: center;
  transition: transform .12s var(--ease);
  filter: drop-shadow(0 8px 12px rgba(20, 20, 40, .38));
}
.hm-lvl:active { transform: translateY(3px) scale(.97); }
.hm-cart { position: absolute; inset: 0; width: 100%; height: 100%; }
.hm-lvl-txt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding-bottom: 4px;
}
.hm-lvl-k {
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #bfe0ff;
  text-shadow: 0 1px 0 rgba(0, 20, 50, .8);
}
.hm-lvl-txt b {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  color: #fff8e0;
  text-shadow: 0 2px 0 #0a2140, 0 0 10px rgba(120, 200, 255, .45);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------- bottom */
.hm-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  animation: hmRise .6s .16s var(--ease) both;
}

.hm-play {
  position: relative;
  width: 100%;
  height: clamp(60px, 16vw, 74px);
  border: 0;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-image:
    linear-gradient(180deg, #a7f08e 0%, #57cf60 34%, #23a338 68%, #167d27 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .75),
    inset 0 -6px 0 rgba(0, 0, 0, .28),
    0 0 0 3px #d69a24,
    0 0 0 5px #7a4c06,
    0 9px 0 #0c5717,
    0 16px 22px rgba(20, 70, 20, .45);
  animation: hmBreathe 2.8s var(--ease) infinite;
  transition: transform .1s var(--ease), box-shadow .1s;
}
.hm-play::before {
  content: '';
  position: absolute;
  inset: 4px 4px auto;
  height: 44%;
  border-radius: 18px 18px 70% 70% / 18px 18px 46% 46%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .04));
  pointer-events: none;
}
.hp-shine {
  position: absolute;
  top: -30%;
  bottom: -30%;
  width: 46px;
  left: -30%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .65), rgba(255, 255, 255, 0));
  transform: rotate(14deg);
  animation: hpSweep 3.6s 1s var(--ease) infinite;
  pointer-events: none;
}
.hp-txt {
  position: relative;
  font-size: clamp(22px, 6.4vw, 27px);
  font-weight: 900;
  letter-spacing: .6px;
  color: #fffdf0;
  text-shadow: 0 2px 0 #0f5c1c, 0 4px 8px rgba(0, 50, 0, .55);
}
.hp-chev {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
}
[dir="rtl"] .hp-chev svg { transform: scaleX(-1); }
.hp-chev svg { width: 26px; height: 26px; stroke: #fffdf0; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1.5px 0 #0f5c1c); animation: hpChev 1.5s var(--ease) infinite; }
.hm-play:active { transform: translateY(6px); animation: none; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .7), inset 0 -3px 0 rgba(0, 0, 0, .25), 0 0 0 3px #d69a24, 0 0 0 5px #7a4c06, 0 3px 0 #0c5717, 0 8px 12px rgba(20, 70, 20, .4); }

.hm-meta {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: #4a2c0c;
  text-shadow: 0 1px 0 rgba(255, 246, 226, .9), 0 2px 4px rgba(255, 240, 200, .5);
}

.hm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.hm-prog {
  font-size: 11.5px;
  font-weight: 800;
  color: #5c3d18;
  text-shadow: 0 1px 0 rgba(255, 246, 226, .85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hm-shop {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 8px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  font: 900 12.5px/1 'Cairo', system-ui, sans-serif;
  color: #fff2d6;
  text-shadow: 0 1.5px 0 rgba(60, 28, 4, .8);
  background-image: linear-gradient(180deg, #b87940, #8a4d1c 55%, #6b3c1a);
  box-shadow: inset 0 2px 0 rgba(255, 238, 200, .5), inset 0 -3px 0 rgba(0, 0, 0, .3), 0 0 0 1.5px #4a2709, 0 0 0 3px #d69a24, 0 4px 0 #3a1d06, 0 7px 12px rgba(40, 20, 0, .3);
  transition: transform .12s var(--ease);
}
.hm-shop .hs-ico svg { width: 17px; height: 17px; stroke: #ffe9bf; }
.hm-shop:active { transform: translateY(3px); }

/* ---------------------------------------------- animations */
@keyframes hmRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes hmShine {
  0%, 72% { background-position: 140% 0; }
  100% { background-position: -60% 0; }
}
@keyframes hmPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.16); }
}
@keyframes hmBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}
@keyframes hpFloat {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(3px); }
}
@keyframes hpSweep {
  0%, 55% { left: -40%; }
  100% { left: 120%; }
}
@keyframes hpChev {
  0%, 100% { transform: translateX(-2px); }
  50% { transform: translateX(3px); }
}

/* ---------------------------------------------- scene motion */
.scene-svg .sc-rays { transform-box: fill-box; transform-origin: 50% 50%; animation: scSpin 90s linear infinite; }
.scene-svg .sc-cloud { animation: scDrift 46s linear infinite; }
.scene-svg .sc-cloud.c2 { animation-duration: 62s; animation-delay: -18s; }
.scene-svg .sc-cloud.c3 { animation-duration: 78s; animation-delay: -40s; }
.scene-svg .sc-waves.w1 { animation: scWave 9s linear infinite; }
.scene-svg .sc-waves.w2 { animation: scWave 14s linear infinite reverse; }
.scene-svg .sc-spark { animation: scTwinkle 3.4s ease-in-out infinite; }
.scene-svg .sc-spark.s2 { animation-delay: .7s; }
.scene-svg .sc-spark.s3 { animation-delay: 1.4s; }
.scene-svg .sc-spark.s4 { animation-delay: 2.1s; }
.scene-svg .sc-spark.s5 { animation-delay: 2.7s; }
.scene-svg .sc-felucca { transform-box: fill-box; transform-origin: 50% 90%; animation: scBob 7s ease-in-out infinite; }
.scene-svg .sc-palm.p1 { transform-box: fill-box; transform-origin: 50% 100%; animation: scSway 8s ease-in-out infinite; }
.scene-svg .sc-palm.p2 { transform-box: fill-box; transform-origin: 50% 100%; animation: scSway 10s ease-in-out infinite reverse; }
.scene-svg .sc-lant-glow { animation: scGlow 3.2s ease-in-out infinite; }
.scene-svg .cm-head { transform-box: fill-box; transform-origin: 20% 90%; animation: cmBob 5.5s ease-in-out infinite; }
.scene-svg .cm-tail { transform-box: fill-box; transform-origin: 90% 10%; animation: cmTail 4.2s ease-in-out infinite; }
.scene-svg .cm-lid { animation: cmBlink 6.5s steps(1, end) infinite; }
.scene-svg .sc-bird.b1 { animation: scFly 26s linear infinite; }
.scene-svg .sc-bird.b2 { animation: scFly 34s linear infinite; animation-delay: -8s; }
.scene-svg .sc-bird.b3 { animation: scFly 44s linear infinite; animation-delay: -20s; }
.scene-svg .sc-dust { animation: scDust 7s ease-in-out infinite; }
.scene-svg .sc-dust.d2 { animation-delay: 1.1s; }
.scene-svg .sc-dust.d3 { animation-delay: 2.3s; }
.scene-svg .sc-dust.d4 { animation-delay: 3.4s; }
.scene-svg .sc-dust.d5 { animation-delay: 4.5s; }
.scene-svg .sc-dust.d6 { animation-delay: 5.6s; }

@keyframes scSpin { to { transform: rotate(360deg); } }
@keyframes scFly {
  0% { transform: translate(70px, 240px) scale(.85); opacity: 0; }
  12% { opacity: .75; }
  88% { opacity: .75; }
  100% { transform: translate(320px, 226px) scale(1.05); opacity: 0; }
}
@keyframes scDrift {
  0% { transform: translateX(-16px); }
  50% { transform: translateX(16px); }
  100% { transform: translateX(-16px); }
}
@keyframes scWave {
  0% { transform: translateX(0); }
  100% { transform: translateX(-60px); }
}
@keyframes scTwinkle {
  0%, 100% { opacity: .25; transform: scale(.8); }
  50% { opacity: .95; transform: scale(1.25); }
}
@keyframes scBob {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50% { transform: translateY(-3px) rotate(1.2deg); }
}
@keyframes scSway {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(1.6deg); }
}
@keyframes scGlow {
  0%, 100% { opacity: .22; transform: scale(.9); }
  50% { opacity: .48; transform: scale(1.08); }
}
@keyframes cmBob {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(-2.2deg) translateY(-1px); }
}
@keyframes cmTail {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(8deg); }
}
@keyframes cmBlink {
  0%, 92%, 100% { opacity: 0; }
  94%, 97% { opacity: 1; }
}
@keyframes scDust {
  0% { transform: translate(0, 0); opacity: .1; }
  40% { opacity: .8; }
  100% { transform: translate(14px, -22px); opacity: 0; }
}

/* parallax depth: far layers move against the near ones */
#sHome .scene-svg .sc-far { transform: translate3d(calc(var(--px, 0) * 5px), calc(var(--py, 0) * 3px), 0); }
#sHome .scene-svg .sc-nile { transform: translate3d(calc(var(--px, 0) * 2px), calc(var(--py, 0) * 1px), 0); }
#sHome .scene-svg .sc-sand { transform: translate3d(calc(var(--px, 0) * -7px), calc(var(--py, 0) * -4px), 0); }

/* ---------------------------------------------- responsive */
@media (max-height: 720px) {
  .hm { gap: 6px; padding-top: 6px; }
  .hm-hud { grid-template-columns: 42px 1fr 1fr 42px; }
  .hm-avatar, .hm-gear { width: 42px; height: 42px; }
  .hm-pill { height: 42px; }
  .hm-plaque { padding: 9px 20px 8px; }
  .hm-title { font-size: clamp(22px, 7vw, 28px); }
  .hm-side { padding: 6px 3px 5px; }
  .hs-face { width: 36px; height: 36px; }
  .hs-ico svg { width: 22px; height: 22px; }
  .hs-lbl { font-size: 10px; }
  .hm-play { height: clamp(54px, 14vw, 62px); }
  .hm-col { width: 70px; }
  .hm-col.right { width: 80px; }
}
@media (max-height: 640px) {
  .hm-logo { padding-top: 0; }
  .hm-plaque { padding: 7px 16px 6px; }
  .hm-sub { display: none; }
  .hm-orn { margin-top: -22px; width: 26px; height: 26px; }
  .hm-play { height: 52px; }
  .hp-slot { width: clamp(48px, 14vw, 62px); }
  .hm-meta { font-size: 11px; }
}
@media (min-width: 520px) {
  .hm { max-width: 460px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  #sHome *, .scene-svg * { animation: none !important; }
}

/* ================= hero: real stacked tiles + mini rack ================= */
.hm-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.hp-stack {
  position: relative;
  /* 3 columns of tiles; never wider than the band between the side buttons */
  --tw: clamp(40px, calc(33.3vw - 67px), 100px);
  width: calc(var(--tw) * 3);
  height: calc(var(--tw) * 2.24);
  flex: 0 0 auto;
}
.hp-tile3 {
  position: absolute;
  width: var(--tw);
  height: var(--tw);
  left: calc(var(--c) * var(--tw));
  top: calc((var(--r) + 1.2) * var(--tw));
  border-radius: 15%;
  border: 2.5px solid #6b4520;
  background:
    radial-gradient(90% 70% at 30% 12%, rgba(255, 255, 255, .8), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #fffcf4, color-mix(in srgb, var(--tc, #d9cbb2) 13%, #f3e5c4));
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(150, 110, 60, .3), 0 3px 0 #a87c42, 0 5px 9px rgba(50, 24, 0, .26);
  display: grid;
  place-items: center;
  animation: hpFloat 4.2s var(--ease) infinite;
}
.hp-tile3 svg { width: 76%; height: 76%; display: block; filter: saturate(1.2) contrast(1.1); }

.hp-rack {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 5px 7px;
  width: 100%;
  border-radius: 11px;
  background-image:
    repeating-linear-gradient(90deg, rgba(30, 14, 2, .28) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 26px),
    linear-gradient(180deg, #7d4519, #5a3010);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .5), 0 0 0 1.5px rgba(40, 20, 4, .55), 0 4px 10px rgba(40, 20, 0, .3);
}
.hp-slot3 {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .38), rgba(0, 0, 0, .2));
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5);
  display: grid;
  place-items: center;
}
.hp-slot3.on {
  background: linear-gradient(180deg, #fffdf6, color-mix(in srgb, var(--tc, #d9cbb2) 13%, #f2e2c0));
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b8935c;
}
.hp-slot3 svg { width: 80%; height: 80%; display: block; }

/* ================= purple daily / rewards ================= */
.hm-side {
  background-image:
    radial-gradient(90% 60% at 30% 10%, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #a06ce0 0%, #7b45c4 46%, #4e2785 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .5),
    inset 0 -5px 0 rgba(0, 0, 0, .3),
    0 0 0 2px #3a1c66,
    0 0 0 3.5px #c9a4f0,
    0 0 0 5px #3a1c66,
    0 6px 0 #2b1450,
    0 10px 16px rgba(30, 10, 60, .38);
}
.hm-side:active {
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), inset 0 -2px 0 rgba(0, 0, 0, .3), 0 0 0 2px #3a1c66, 0 0 0 3.5px #c9a4f0, 0 0 0 5px #3a1c66, 0 2px 0 #2b1450, 0 5px 10px rgba(30, 10, 60, .34);
}
.hm-side .hs-face { background: radial-gradient(circle at 50% 28%, #fdfaff, #e6d6f7 72%, #cdb4ea); }
.hm-side .hs-ico svg { stroke: #5b2f96; }
.hm-side .hs-lbl { color: #fff2ff; text-shadow: 0 1.5px 0 rgba(40, 12, 70, .85); }

/* ================= plaque pattern band ================= */
.plq-band {
  width: 86%;
  height: 9px;
  margin: 5px 0 2px;
  border-radius: 2px;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255, 236, 170, .95) 0 2px, rgba(0, 0, 0, 0) 2.4px),
    linear-gradient(90deg, rgba(242, 194, 90, .35), rgba(242, 194, 90, .55), rgba(242, 194, 90, .35));
  background-size: 10px 9px, 100% 100%;
  background-repeat: repeat-x, no-repeat;
  opacity: .9;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}

/* gold star on the blue shield */
.hm-lvl-star { display: grid; place-items: center; width: 20px; height: 20px; margin-bottom: 1px; filter: drop-shadow(0 1px 0 rgba(60, 30, 0, .5)); }
.hm-lvl-star svg { width: 20px; height: 20px; fill: url(#hmStarGrad); stroke: #7a4c06; stroke-width: 1.2; }
.hm-lvl-txt { gap: 0; }

/* ================= painted faces in the home hero ================= */
.hp-tile3 {
  border: 0;
  background: linear-gradient(180deg, #fffcf0 0%, #f8edd6 62%, #f2e3c4 100%);
  box-shadow: inset 0 0 0 1.5px rgba(158, 124, 72, .32), inset 0 2px 0 rgba(255, 255, 255, .85),
    0 3px 0 rgba(110, 74, 32, .42), 0 6px 11px rgba(50, 24, 0, .3);
}
.hp-tile3 .tf { width: 78%; height: 78%; object-fit: contain; display: block; }
.hp-slot3.on { background: linear-gradient(180deg, #fffcf0, #f6e9cd); box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b8935c; }
.hp-slot3 .tf { width: 78%; height: 78%; object-fit: contain; display: block; }

/* ---------------------------------------------- real logo art (painted sign) */
.hm-logo { padding-top: 2px; flex-direction: column; align-items: center; }
.hm-logo-img {
  display: block;
  width: 68vw;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 10px 16px rgba(48, 28, 6, .42)) drop-shadow(0 2px 3px rgba(48, 28, 6, .3));
  user-select: none;
  -webkit-user-drag: none;
}
.hm-logo .hm-sub {
  display: block;
  margin-top: 2px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #5a3712;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}

/* short phones: the side buttons are wider there, so the pyramid gets less room */
@media (max-height: 700px) {
  .hp-stack { --tw: clamp(36px, calc(33.3vw - 76px), 90px); }
}
