/* Casual home: one strong play action, one coherent game menu. */

.app-content--home {
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  padding-bottom: 0;
  background: transparent;
}

.home-screen {
  position: relative;
  display: grid;
  grid-template-rows: max-content max-content max-content minmax(0, 1fr);
  align-content: start;
  gap: clamp(12px, 1.9dvh, 22px);
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(12px, env(safe-area-inset-top)) var(--mobile-shell-gutter) max(18px, calc(env(safe-area-inset-bottom) + 8px));
  background: transparent;
  color: #172033;
  min-width: 0;
}

.home__sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.home__cloud,
.home__cloud::before,
.home__cloud::after {
  position: absolute;
  display: block;
  content: "";
  background: rgba(255,255,255,.84);
  border-radius: 999px;
}

.home__cloud {
  width: clamp(94px, 11vw, 144px);
  height: clamp(30px, 3.4vw, 46px);
  filter: drop-shadow(0 8px 12px rgba(38, 84, 110, .12));
  animation: homeCloud 16s ease-in-out infinite;
}

.home__cloud::before {
  width: 48%;
  height: 150%;
  left: 16%;
  bottom: 27%;
}

.home__cloud::after {
  width: 62%;
  height: 194%;
  right: 9%;
  bottom: 21%;
}

.home__cloud--one {
  left: max(18px, calc(50vw - var(--mobile-shell-active-width) / 2 - 68px));
  top: clamp(124px, 20vh, 216px);
}

.home__cloud--two {
  right: max(18px, calc(50vw - var(--mobile-shell-active-width) / 2 - 54px));
  top: clamp(216px, 31vh, 286px);
  transform: scale(.88);
  animation-delay: -5s;
}

.home__spark {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #fff3a4;
  transform: rotate(18deg);
  box-shadow: 0 0 18px rgba(255, 232, 105, .76);
  animation: sparkPulse 2.8s ease-in-out infinite;
}

.home__spark--one { right: max(42px, calc(50vw - var(--mobile-shell-active-width) / 2 + 18px)); top: clamp(132px, 18vh, 164px); }
.home__spark--two { left: max(42px, calc(50vw - var(--mobile-shell-active-width) / 2 + 12px)); top: clamp(314px, 45vh, 386px); animation-delay: -1.4s; }

.home__topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: var(--mobile-panel-width);
  justify-self: center;
}

.home__coin-pill,
.home__top-chip,
.home__menu-btn,
.home__quick-action,
.home__mode-summary,
.home-mode-option,
.home__start-btn {
  -webkit-tap-highlight-color: transparent;
}

.home__top-chip {
  min-width: 0;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: var(--radius-icon-badge);
  background: var(--surface-pill);
  box-shadow: var(--shadow-game-control);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  color: #26364f;
  white-space: nowrap;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.home__coin-pill {
  flex: 0 0 auto;
  min-width: 84px;
  color: #5f3b10;
  font-size: 18px;
}

.home__coin-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, #fff6a5 0 16%, transparent 17%),
    linear-gradient(135deg, #ffd96b, #f79a2e);
  box-shadow: inset 0 -3px 0 rgba(146, 84, 20, .22), 0 2px 0 rgba(120, 77, 18, .18);
}

.home__coin-mark .app-icon {
  width: 15px;
  height: 15px;
  color: rgba(129, 80, 17, .55);
}

.home__top-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.home__language-btn {
  width: auto;
  min-width: 58px;
  padding: 0 6px;
  gap: 5px;
  border-radius: 999px;
  background: rgba(255, 244, 173, .9);
  color: #754414;
}

.home__language-flag {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.74);
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 0 rgba(94, 57, 16, .16));
}

.home__language-flag .language-flag {
  width: 30px;
  height: 30px;
}

.home__language-caret {
  width: 0;
  height: 0;
  margin-left: -2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(117, 68, 20, .75);
}

.home__stage {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: clamp(14px, 2dvh, 22px);
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding-top: clamp(10px, 1.7dvh, 20px);
}

.home__profile-identity {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: var(--mobile-panel-width);
  min-height: 2.25em;
  text-align: center;
}

.home__profile-identity--button {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.home__profile-identity--button:active {
  transform: scale(.98);
}

.home__profile-name {
  max-width: 100%;
  color: #1d2a41;
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255,255,255,.42);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1.05rem, 4.5vw, 1.45rem);
}

.home__profile-code {
  max-width: 100%;
  color: rgba(29, 42, 65, .78);
  font-family: var(--font-heading);
  font-size: clamp(.8rem, 3.1vw, .98rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255,255,255,.36);
}

.home__profile-cluster {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(5.1rem, .88fr) auto minmax(5.1rem, .88fr);
  align-items: center;
  justify-items: center;
  gap: clamp(.625rem, 3vw, 1.25rem);
  width: var(--mobile-panel-width);
  max-width: 34rem;
  min-width: 0;
}

.home__profile-stack {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: clamp(.375rem, 1.1dvh, .75rem);
}

.home__profile-btn {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(8rem, min(45vw, 22dvh), 13rem);
  height: clamp(8rem, min(45vw, 22dvh), 13rem);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, #fff9ca 0 42%, #ffd770 43% 64%, #f9a94b 65% 100%);
  border: 4px solid rgba(255,255,255,.86);
  box-shadow:
    0 16px 28px rgba(42, 63, 98, .18),
    inset 0 4px 0 rgba(255,255,255,.45),
    inset 0 -5px 0 rgba(141, 83, 22, .2);
  color: #704315;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.home__quick-action {
  width: clamp(5.1rem, 22vw, 7rem);
  min-height: clamp(4.75rem, 9dvh, 6rem);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: .375rem;
  padding: .625rem .25rem;
  border-radius: var(--radius-control);
  border: 3px solid rgba(255,255,255,.62);
  color: #fff;
  text-align: center;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.26),
    inset 0 -5px 0 rgba(37, 46, 73, .18),
    0 12px 22px rgba(43, 61, 91, .16);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.home__quick-action--leaderboard {
  background: linear-gradient(135deg, #344967 0%, #172033 100%);
  color: #ffffff;
}

.home__quick-action--shop {
  background: linear-gradient(135deg, #f9fdff 0%, #d8f6ff 100%);
  color: #1d2a41;
}

.home__quick-action-icon {
  display: grid;
  place-items: center;
  width: clamp(2.85rem, 10vw, 3.45rem);
  height: clamp(2.85rem, 10vw, 3.45rem);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.home__quick-action-icon .app-icon {
  width: clamp(2.15rem, 7.4vw, 2.55rem);
  height: clamp(2.15rem, 7.4vw, 2.55rem);
  font-size: clamp(2rem, 7vw, 2.45rem);
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.18));
}

.home__quick-action-label {
  max-width: 100%;
  font-family: var(--font-heading);
  font-size: clamp(.7rem, 3vw, .9rem);
  font-weight: 900;
  line-height: 1.04;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.home__profile-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: var(--font-heading);
  font-size: clamp(4.1rem, min(23vw, 13dvh), 7.4rem);
  font-weight: 900;
  line-height: 1;
}

.home__profile-avatar--picture {
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
}

.home__profile-avatar-image {
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.78);
}

.home__logo {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: clamp(7px, 1.1dvh, 12px);
  width: min(100%, var(--mobile-panel-width));
  max-width: 46rem;
  min-width: 0;
  transform: none;
  filter: none;
  animation: logoFloat 3.8s ease-in-out infinite;
}

.home__brand-logo.brand-logo {
  width: 100%;
  max-width: none;
}

.home__brand-logo .brand-logo__tiles {
  gap: clamp(1px, .46vw, 4px);
}

.home__brand-logo .brand-logo__tile {
  border-width: clamp(2px, .7vw, 3px);
  border-radius: clamp(8px, 2.1vw, 14px);
  font-size: clamp(1.45rem, min(7.6vw, 6.4dvh), 3rem);
}

.home__logo-row {
  display: flex;
  justify-content: center;
  gap: clamp(4px, 1.2vw, 7px);
  max-width: 100%;
}

.home__logo-tile,
.home__float-tile {
  display: grid;
  place-items: center;
  background: var(--brand-tile-bg);
  border: 3px solid var(--brand-tile-border);
  box-shadow: var(--brand-tile-shadow);
  color: var(--brand-tile-text);
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 1;
  text-shadow: var(--brand-tile-text-shadow);
}

.home__logo-tile {
  border-radius: clamp(9px, 2.4vw, 14px);
}

.home__logo-row--short .home__logo-tile {
  width: clamp(48px, 13vw, 64px);
  height: clamp(54px, 14.4vw, 70px);
  font-size: clamp(30px, 8vw, 42px);
}

.home__logo-row--long .home__logo-tile {
  width: clamp(31px, calc((var(--mobile-shell-active-width) - 118px) / 7), 46px);
  height: clamp(38px, calc((var(--mobile-shell-active-width) - 76px) / 7), 54px);
  font-size: clamp(20px, calc((var(--mobile-shell-active-width) - 176px) / 7), 30px);
}

.home__logo-row--brand {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: clamp(2px, .9vw, 5px);
  width: 100%;
}

.home__logo-row--brand .home__logo-tile {
  width: 100%;
  min-width: 0;
  height: clamp(32px, 10vw, 52px);
  border-radius: clamp(8px, 2vw, 13px);
  font-size: clamp(17px, 5.4vw, 29px);
}

.home__floating-tiles {
  display: none;
}

.home__float-tile {
  position: absolute;
  width: clamp(34px, 4.6vw, 48px);
  height: clamp(34px, 4.6vw, 48px);
  border-radius: 10px;
  font-size: clamp(19px, 2.6vw, 27px);
  opacity: .62;
  animation: tileDrift 3.2s ease-in-out infinite;
}

.home__float-tile--1 { left: max(12px, calc(50vw - var(--mobile-shell-active-width) / 2 - 56px)); top: 30%; transform: rotate(-14deg); }
.home__float-tile--2 { right: max(14px, calc(50vw - var(--mobile-shell-active-width) / 2 - 46px)); top: 25%; transform: rotate(11deg); animation-delay: 140ms; }
.home__float-tile--3 { left: max(18px, calc(50vw - var(--mobile-shell-active-width) / 2 - 34px)); top: 61%; transform: rotate(9deg); animation-delay: 280ms; }
.home__float-tile--4 { right: max(18px, calc(50vw - var(--mobile-shell-active-width) / 2 - 34px)); top: 67%; transform: rotate(-10deg); animation-delay: 420ms; }

.home__play-panel {
  position: relative;
  z-index: 3;
  display: grid;
  align-self: start;
  gap: clamp(12px, 1.9dvh, 18px);
  width: var(--mobile-panel-width);
  justify-self: center;
  margin-top: clamp(0px, .8dvh, 8px);
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.home__ad-reserve {
  position: relative;
  z-index: 1;
  width: var(--mobile-panel-width);
  min-height: 0;
  justify-self: center;
}

.home__start-btn {
  position: relative;
  width: 100%;
  height: clamp(76px, 9dvh, 96px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: var(--radius-control);
  background: var(--gradient-action);
  border: 4px solid rgba(255,255,255,.82);
  color: white;
  box-shadow:
    inset 0 5px 0 rgba(255,255,255,.42),
    inset 0 -7px 0 rgba(124, 27, 44, .28),
    0 10px 0 #b9a37f,
    0 19px 24px rgba(44, 50, 78, .28);
  transform: translateY(0);
  transition: transform 140ms ease, box-shadow 140ms ease;
  animation: startPulse 2.8s ease-in-out infinite;
}

.home__start-btn:active {
  transform: translateY(6px);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.35),
    inset 0 -4px 0 rgba(124, 27, 44, .22),
    0 4px 0 #b9a37f,
    0 11px 16px rgba(44, 50, 78, .24);
  animation: none;
}

.home__start-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-icon-badge);
  background: var(--gradient-icon-blue);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(14, 101, 130, .32);
}

.home__start-icon .app-icon {
  width: 25px;
  height: 25px;
  color: #fff;
  filter: drop-shadow(0 2px 0 rgba(8, 89, 116, .25));
}

.home__start-copy {
  display: grid;
  gap: 4px;
  justify-items: start;
  min-width: 0;
}

.home__start-label {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 3px 0 rgba(115, 28, 42, .28);
}

.home__start-mode {
  max-width: 100%;
  overflow: hidden;
  color: rgba(255,255,255,.9);
  font-family: var(--font-heading);
  font-size: clamp(.9rem, 3.6vw, 1.08rem);
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(115, 28, 42, .2);
}

.home__mode-summary {
  width: 100%;
  min-height: clamp(76px, 8.5dvh, 92px);
  display: grid;
  grid-template-columns: clamp(3rem, 11vw, 3.6rem) minmax(0, 1fr) auto clamp(1.25rem, 5vw, 1.5rem);
  align-items: center;
  gap: clamp(.625rem, 2.6vw, .875rem);
  padding: clamp(.625rem, 2.5vw, .875rem);
  border-radius: var(--radius-control);
  border: 3px solid rgba(255,255,255,.6);
  color: #fff;
  text-align: left;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.26),
    inset 0 -5px 0 rgba(37, 46, 73, .18),
    0 12px 22px rgba(43, 61, 91, .16);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.home__mode-summary--classic { background: var(--gradient-primary); }
.home__mode-summary--blitz { background: var(--gradient-secondary); }
.home__mode-summary--survival { background: linear-gradient(135deg, #D9557D, #8E55D9); }
.home__mode-summary--eternal { background: linear-gradient(135deg, #1A9A8B, #2E6BCB); }
.home__mode-summary--daily { background: var(--gradient-menu-blue); }

.home__mode-summary-icon,
.home__mode-summary-badge,
.home__mode-summary-arrow {
  display: grid;
  place-items: center;
  border-radius: var(--radius-icon-badge);
  background: rgba(255,255,255,.26);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.32);
}

.home__mode-summary-icon {
  width: clamp(3rem, 11vw, 3.6rem);
  height: clamp(3rem, 11vw, 3.6rem);
}

.home__mode-summary-icon .app-icon {
  width: clamp(1.55rem, 6vw, 1.95rem);
  height: clamp(1.55rem, 6vw, 1.95rem);
}

.home__mode-summary-copy {
  min-width: 0;
  display: grid;
  gap: .18rem;
}

.home__mode-summary-kicker,
.home__mode-summary-desc {
  font-family: var(--font-heading);
  font-size: clamp(.72rem, 3vw, .86rem);
  font-weight: 900;
  line-height: 1.05;
  opacity: .88;
}

.home__mode-summary-title {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 5vw, 1.42rem);
  font-weight: 900;
  line-height: 1.02;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home__mode-summary-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home__mode-summary-badge {
  min-width: clamp(2.85rem, 11vw, 3.6rem);
  height: clamp(2.35rem, 8vw, 2.75rem);
  padding-inline: .5rem;
  color: inherit;
  font-family: var(--font-heading);
  font-size: clamp(.82rem, 3.7vw, 1rem);
  font-weight: 900;
}

.home__mode-summary-arrow {
  width: clamp(1.25rem, 5vw, 1.5rem);
  height: clamp(1.25rem, 5vw, 1.5rem);
  background: transparent;
  box-shadow: none;
}

.home__mode-summary-arrow .app-icon {
  width: 100%;
  height: 100%;
}

@media (max-width: 360px) {
  .home__mode-summary {
    grid-template-columns: 3rem minmax(0, 1fr) 1.25rem;
  }

  .home__mode-summary-badge {
    display: none;
  }
}

/* ═══ Word difficulty row (below the mode card) ═══ */
.home__difficulty-row {
  width: 100%;
  min-height: clamp(52px, 6dvh, 62px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto clamp(1.1rem, 4.5vw, 1.35rem);
  align-items: center;
  gap: clamp(.55rem, 2.4vw, .8rem);
  padding: clamp(.5rem, 2.2vw, .75rem) clamp(.625rem, 2.5vw, .875rem);
  border-radius: var(--radius-control);
  border: 3px solid rgba(255,255,255,.72);
  background: rgba(255,255,255,.42);
  color: #26364f;
  text-align: left;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.4),
    0 8px 16px rgba(43, 61, 91, .12);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.home__difficulty-row:active {
  transform: translateY(2px);
}

.home__difficulty-row--disabled {
  opacity: .5;
  pointer-events: none;
}

.home__difficulty-kicker {
  font-family: var(--font-heading);
  font-size: clamp(.7rem, 2.9vw, .82rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .02em;
  opacity: .72;
}

.home__difficulty-title {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-heading);
  font-size: clamp(.95rem, 4.2vw, 1.15rem);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home__difficulty-badge {
  display: grid;
  place-items: center;
  min-width: clamp(2.6rem, 10vw, 3.2rem);
  height: clamp(1.9rem, 7vw, 2.3rem);
  padding-inline: .5rem;
  border-radius: var(--radius-icon-badge);
  background: rgba(255, 244, 173, .92);
  color: #754414;
  font-family: var(--font-heading);
  font-size: clamp(.78rem, 3.4vw, .95rem);
  font-weight: 900;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5);
}

.home__difficulty-row .home__mode-summary-arrow {
  color: #26364f;
}

.home-popup__hint {
  margin: 10px 4px 2px;
  color: #526079;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.home__menu-list {
  display: grid;
  gap: clamp(.75rem, 2.6vw, 1rem);
}

.home__menu-btn {
  min-height: clamp(68px, 7.6dvh, 84px);
  display: grid;
  grid-template-columns: clamp(2.5rem, 10vw, 3rem) minmax(0, 1fr) clamp(1.25rem, 5vw, 1.5rem);
  align-items: center;
  gap: clamp(.625rem, 2.5vw, .875rem);
  padding: clamp(.625rem, 2.8vw, .875rem);
  border-radius: var(--radius-control);
  color: #ffffff;
  text-align: left;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.24),
    inset 0 -5px 0 rgba(37, 46, 73, .18),
    0 12px 22px rgba(43, 61, 91, .14);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.home__menu-icon {
  display: grid;
  place-items: center;
  width: clamp(2.5rem, 10vw, 3rem);
  height: clamp(2.5rem, 10vw, 3rem);
  border-radius: var(--radius-icon-badge);
  background: rgba(255,255,255,.25);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3);
}

.home__menu-icon .app-icon {
  width: clamp(1.35rem, 5.5vw, 1.7rem);
  height: clamp(1.35rem, 5.5vw, 1.7rem);
}

.home__menu-label {
  min-width: 0;
  font-family: var(--font-heading);
  font-size: clamp(1rem, 4.5vw, 1.2rem);
  font-weight: 900;
  line-height: 1.04;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: balance;
}

.home__menu-arrow {
  display: grid;
  place-items: center;
  width: clamp(1.25rem, 5vw, 1.5rem);
  height: clamp(1.25rem, 5vw, 1.5rem);
  opacity: .9;
}

.home__menu-arrow .app-icon {
  width: 100%;
  height: 100%;
}

.home__menu-btn--rank { background: var(--gradient-menu-gold); color: #4f3611; }
.home__menu-btn--shop { background: var(--gradient-menu-blue); }
.home__menu-btn--profile { background: var(--gradient-menu-green); color: #103e36; }
.home__menu-btn--bonus { background: var(--gradient-secondary); }
.home__menu-btn--settings { background: linear-gradient(135deg, #62728b, #354259); }
.home__menu-btn--highlight {
  box-shadow:
    0 0 0 4px rgba(255, 245, 168, .36),
    inset 0 4px 0 rgba(255,255,255,.28),
    inset 0 -5px 0 rgba(37, 46, 73, .18),
    0 14px 24px rgba(43, 61, 91, .18);
}

.home-menu-overlay {
  align-items: flex-start;
  justify-content: center;
  padding: max(82px, calc(env(safe-area-inset-top) + 82px)) var(--mobile-shell-gutter) max(18px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  touch-action: none;
}

.home-mode-overlay {
  align-items: center;
  padding: max(16px, env(safe-area-inset-top)) var(--mobile-shell-gutter) max(16px, calc(env(safe-area-inset-bottom) + 16px));
}

.home-menu-overlay > .home-popup {
  touch-action: auto;
}

.home-popup {
  width: min(100%, var(--mobile-panel-width));
  padding: 16px;
  border-radius: var(--radius-panel);
  background: var(--surface-card-strong);
  box-shadow: var(--shadow-game-panel);
  animation: popIn 180ms ease;
}

.home-popup--mode {
  display: flex;
  flex-direction: column;
  max-height: min(calc(var(--modal-viewport-height, 100dvh) - 48px), 40rem);
  overflow: hidden;
  padding-top: 16px;
  padding-bottom: 16px;
  border-radius: var(--radius-panel);
  transform-origin: center center;
  animation: modeDialogIn 180ms ease;
}

.home-popup--mode .home-mode-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  margin: -4px;
}

.home-popup--mode .home-popup__header,
.home-popup--mode .home-popup__hint {
  flex-shrink: 0;
}

.home-popup--mode .home-popup__handle {
  display: none;
}

.home-popup__handle {
  width: 46px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(39, 58, 85, .18);
}

.home-popup__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.home-popup__title {
  margin-bottom: 12px;
  color: #1d2a41;
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.home-popup__header .home-popup__title {
  margin-bottom: 0;
  text-align: left;
}

.home-popup__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-icon-badge);
  background: #eef4fb;
  color: #60718a;
  box-shadow: inset 0 -3px 0 rgba(36, 51, 70, .07);
}

.home-popup__close .app-icon {
  width: 21px;
  height: 21px;
}

.daily-challenge-intro {
  display: grid;
  gap: 10px;
  text-align: center;
}

.daily-challenge-intro__text {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text-primary);
}

.daily-challenge-intro__hint,
.daily-challenge-intro__done {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.home-language-list,
.home-profile-actions {
  display: grid;
  gap: 10px;
}

.home-mode-list {
  display: grid;
  gap: 12px;
}

.home-mode-option {
  min-height: 86px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-control);
  border: 3px solid rgba(255,255,255,.62);
  color: #fff;
  text-align: left;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.26),
    inset 0 -5px 0 rgba(37, 46, 73, .16),
    0 10px 18px rgba(43, 61, 91, .12);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.home-mode-option--classic { background: var(--gradient-primary); }
.home-mode-option--blitz { background: var(--gradient-secondary); }
.home-mode-option--survival { background: linear-gradient(135deg, #D9557D, #8E55D9); }
.home-mode-option--eternal { background: linear-gradient(135deg, #1A9A8B, #2E6BCB); }
.home-mode-option--daily { background: var(--gradient-menu-blue); }
.home-mode-option--difficulty {
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto 22px;
  background: linear-gradient(135deg, #7657c9, #4e72c9);
  color: #fff;
}

.home-mode-option--difficulty .home-mode-option__badge {
  background: rgba(255, 244, 173, .94);
  color: #694719;
}

.home-mode-option--active {
  border-color: #fff5a8;
  box-shadow:
    0 0 0 4px rgba(255, 245, 168, .42),
    inset 0 4px 0 rgba(255,255,255,.32),
    inset 0 -5px 0 rgba(37, 46, 73, .16),
    0 14px 24px rgba(43, 61, 91, .18);
}

.home-mode-option__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-icon-badge);
  background: rgba(255,255,255,.26);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.32);
}

.home-mode-option__icon .app-icon {
  width: 27px;
  height: 27px;
}

.home-mode-option__copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.home-mode-option__name {
  overflow: hidden;
  font-family: var(--font-heading);
  font-size: clamp(1.02rem, 4.6vw, 1.25rem);
  font-weight: 900;
  line-height: 1.02;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-mode-option__desc {
  overflow: hidden;
  font-family: var(--font-heading);
  font-size: clamp(.74rem, 3.2vw, .88rem);
  font-weight: 900;
  line-height: 1.08;
  opacity: .88;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-mode-option__badge {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 38px;
  padding-inline: 8px;
  border-radius: var(--radius-icon-badge);
  background: rgba(255,255,255,.26);
  color: inherit;
  font-family: var(--font-heading);
  font-size: .92rem;
  font-weight: 900;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3);
}

.home-mode-option__arrow {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.home-mode-option__arrow .app-icon {
  width: 100%;
  height: 100%;
}

.home-language-option,
.home-profile-action {
  min-height: 58px;
  display: grid;
  align-items: center;
  border-radius: var(--radius-control);
  background: #f2f7fb;
  box-shadow: inset 0 -3px 0 rgba(36, 51, 70, .07);
  color: #273a55;
  font-family: var(--font-heading);
  font-weight: 900;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.home-language-option {
  grid-template-columns: 48px 1fr;
  gap: 10px;
  padding: 8px 14px;
  text-align: left;
}

.home-language-option--active {
  background: var(--gradient-action-alt);
  color: #5b3712;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.36),
    inset 0 -4px 0 rgba(132, 80, 22, .16);
}

.home-language-option__flag {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.72);
}

.home-language-option__flag .language-flag {
  width: 34px;
  height: 34px;
}

.home-profile-action {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0 16px;
  background: var(--gradient-primary);
  color: #fff;
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.24),
    inset 0 -4px 0 rgba(12, 93, 112, .22);
}

.home-profile-action--secondary {
  background: var(--gradient-action-alt);
  color: #5b3712;
}

@keyframes homeCloud {
  0%, 100% { transform: translateX(0) scale(1); }
  50% { transform: translateX(14px) scale(1); }
}

@keyframes sparkPulse {
  0%, 100% { opacity: .55; transform: rotate(18deg) scale(.82); }
  50% { opacity: 1; transform: rotate(18deg) scale(1.15); }
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(3px) rotate(-2deg); }
  50% { transform: translateY(-2px) rotate(-1deg); }
}

@keyframes tileDrift {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

@keyframes startPulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.03; }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modeDialogIn {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-height: 740px) {
  .home-screen {
    grid-template-rows: max-content max-content max-content minmax(0, 1fr);
    gap: 10px;
  }

  .home__stage {
    min-height: 0;
    gap: 12px;
    padding-top: 8px;
  }

  .home__profile-btn {
    width: clamp(7.9rem, min(48vw, 25dvh), 11.5rem);
    height: clamp(7.9rem, min(48vw, 25dvh), 11.5rem);
  }

  .home__profile-avatar {
    font-size: clamp(3.7rem, min(20vw, 11dvh), 5.4rem);
  }

  .home__logo {
    gap: 6px;
  }

  .home__brand-logo .brand-logo__tile {
    font-size: clamp(1.33rem, min(7vw, 5.8dvh), 2.55rem);
  }

  .home__logo-row--short .home__logo-tile {
    width: clamp(42px, 12vw, 56px);
    height: clamp(48px, 13vw, 62px);
    font-size: clamp(26px, 7.2vw, 36px);
  }

  .home__logo-row--long .home__logo-tile {
    width: clamp(30px, calc((var(--mobile-shell-active-width) - 126px) / 7), 42px);
    height: clamp(35px, calc((var(--mobile-shell-active-width) - 90px) / 7), 49px);
    font-size: clamp(19px, calc((var(--mobile-shell-active-width) - 190px) / 7), 27px);
  }

  .home__logo-row--brand .home__logo-tile {
    width: 100%;
    height: clamp(30px, 8.8vw, 46px);
    font-size: clamp(16px, 4.8vw, 25px);
  }

  .home__play-panel {
    gap: 16px;
    padding: 0;
  }

  .home__start-btn {
    height: 82px;
  }

  .home__menu-btn {
    min-height: 80px;
  }

  .home__ad-reserve {
    min-height: 0;
  }
}

@media (max-height: 620px) {
  .home-screen {
    grid-template-rows: max-content max-content max-content minmax(0, 1fr);
    gap: 8px;
    overflow-y: auto;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .home__top-chip {
    height: 38px;
  }

  .home__coin-pill {
    min-width: 78px;
    font-size: 16px;
  }

  .home__coin-mark {
    width: 22px;
    height: 22px;
  }

  .home__stage {
    min-height: 0;
    gap: 8px;
    padding-top: 5px;
  }

  .home__profile-btn {
    width: clamp(6.75rem, min(40vw, 23dvh), 9rem);
    height: clamp(6.75rem, min(40vw, 23dvh), 9rem);
  }

  .home__profile-avatar {
    font-size: clamp(3.1rem, min(17vw, 10dvh), 4.2rem);
  }

  .home__brand-logo .brand-logo__tile {
    font-size: clamp(1.1rem, min(6.25vw, 5dvh), 2.05rem);
  }

  .home__logo-row--short .home__logo-tile {
    width: clamp(39px, 12vw, 48px);
    height: clamp(44px, 13vw, 53px);
    font-size: clamp(24px, 7vw, 31px);
  }

  .home__logo-row--long .home__logo-tile {
    width: clamp(27px, calc((var(--mobile-shell-active-width) - 130px) / 7), 36px);
    height: clamp(32px, calc((var(--mobile-shell-active-width) - 94px) / 7), 42px);
    font-size: clamp(17px, calc((var(--mobile-shell-active-width) - 196px) / 7), 24px);
  }

  .home__logo-row--brand .home__logo-tile {
    width: 100%;
    height: clamp(27px, 8vw, 39px);
    font-size: clamp(14px, 4.4vw, 21px);
  }

  .home__play-panel {
    gap: 13px;
    padding: 0;
  }

  .home__start-btn {
    height: 72px;
    border-radius: 21px;
  }

  .home__start-icon {
    width: 42px;
    height: 42px;
  }

  .home__start-icon .app-icon {
    width: 22px;
    height: 22px;
  }

  .home__start-label {
    font-size: 31px;
  }

  .home__menu-btn {
    min-height: 68px;
    padding: 8px;
  }

  .home__ad-reserve {
    min-height: 0;
  }
}

@media (max-width: 24.375rem) {
  .home__menu-btn {
    min-height: 72px;
    grid-template-columns: 38px minmax(0, 1fr) 20px;
    justify-items: stretch;
    gap: 5px;
    padding: 8px 7px;
    text-align: left;
  }

  .home__menu-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }

  .home__menu-label {
    font-size: clamp(.9rem, 4.2vw, 1rem);
    line-height: 1.04;
  }
}

@media (max-height: 620px) and (max-width: 24.375rem) {
  .home__menu-btn {
    min-height: 72px;
  }
}

@media (max-width: 24.375rem), (max-width: 48rem) and (max-height: 860px) {
  .home-screen {
    grid-template-rows: max-content max-content max-content minmax(0, 1fr);
    align-content: start;
    gap: clamp(8px, 1.25dvh, 12px);
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .home__top-chip {
    height: 38px;
    padding-inline: 10px;
  }

  .home__coin-pill {
    min-width: 76px;
    font-size: 16px;
  }

  .home__language-btn {
    width: auto;
    min-width: 58px;
    padding-inline: 6px;
  }

  .home__stage {
    gap: clamp(10px, 1.7dvh, 14px);
    padding-top: clamp(8px, 1.4dvh, 12px);
  }

  .home__logo {
    width: min(100%, var(--mobile-panel-width));
  }

  .home__brand-logo .brand-logo__tile {
    border-radius: clamp(7px, 1.8vw, 11px);
    font-size: clamp(1.18rem, min(6.6vw, 4.8dvh), 2.35rem);
  }

  .home__profile-btn {
    width: clamp(6.75rem, min(40vw, 16dvh), 8.8rem);
    height: clamp(6.75rem, min(40vw, 16dvh), 8.8rem);
    border-width: 3px;
  }

  .home__profile-avatar {
    font-size: clamp(3rem, min(17vw, 8.5dvh), 4.4rem);
  }

  .home__profile-name {
    font-size: clamp(.9rem, 3.6vw, 1.08rem);
  }

  .home__profile-code {
    font-size: clamp(.74rem, 3vw, .9rem);
  }

  .home__play-panel {
    gap: 16px;
    margin-top: 0;
    padding: 0;
    border-radius: 0;
  }

  .home__start-btn {
    height: 76px;
    gap: 10px;
    border-width: 3px;
    box-shadow:
      inset 0 4px 0 rgba(255,255,255,.38),
      inset 0 -5px 0 rgba(124, 27, 44, .24),
      0 7px 0 #b9a37f,
      0 13px 18px rgba(44, 50, 78, .22);
  }

  .home__start-icon {
    width: 40px;
    height: 40px;
  }

  .home__start-label {
    font-size: 32px;
  }

  .home__start-mode {
    font-size: .82rem;
  }

  .home__menu-btn {
    min-height: 78px;
    padding: 10px;
    gap: 7px;
  }

  .home__menu-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .home__menu-icon .app-icon {
    width: 20px;
    height: 20px;
  }

  .home__menu-label {
    font-size: clamp(.9rem, 4vw, 1.05rem);
  }

  .home__ad-reserve {
    min-height: 0;
  }
}

@media (min-width: 640px) {
  .home__floating-tiles {
    display: block;
  }

  .home-screen {
    padding-inline: var(--mobile-shell-gutter);
  }

  .home__stage {
    min-height: 0;
    padding-top: clamp(12px, 1.7dvh, 20px);
  }

  .home__profile-btn {
    width: clamp(9.5rem, min(34vw, 27dvh), 15.5rem);
    height: clamp(9.5rem, min(34vw, 27dvh), 15.5rem);
  }

  .home__play-panel {
    width: var(--mobile-panel-width);
  }

  .home__start-btn {
    height: clamp(86px, 9.4dvh, 104px);
  }

  .home__start-label {
    font-size: 38px;
  }
}

@media (min-width: 1024px) {
  .home-screen {
    grid-template-rows: max-content max-content max-content minmax(0, 1fr);
    padding: clamp(18px, 2.8dvh, 34px) var(--mobile-shell-gutter) clamp(30px, 4dvh, 48px);
    gap: clamp(12px, 1.9dvh, 24px);
  }

  .home__stage {
    gap: clamp(16px, 2dvh, 24px);
    padding-top: clamp(12px, 1.8dvh, 22px);
  }

  .home__logo {
    max-width: 46rem;
  }

  .home__profile-btn {
    width: clamp(11.5rem, min(24vw, 24dvh), 16rem);
    height: clamp(11.5rem, min(24vw, 24dvh), 16rem);
  }

  .home__profile-avatar {
    font-size: clamp(5.6rem, min(12vw, 13dvh), 8.8rem);
  }

  .home__brand-logo .brand-logo__tile {
    font-size: clamp(1.9rem, min(4.5vw, 5.2dvh), 3.25rem);
  }

  .home__play-panel {
    gap: 14px;
    padding: 0;
  }

  .home__menu-btn {
    min-height: 88px;
    grid-template-columns: 52px minmax(0, 1fr) 24px;
    justify-items: stretch;
    text-align: left;
  }

  .home__menu-icon {
    width: 52px;
    height: 52px;
  }

  .home__menu-icon .app-icon {
    width: 29px;
    height: 29px;
  }

  .home__menu-label {
    font-size: 1.12rem;
  }

  .home__ad-reserve {
    min-height: 0;
  }

  .home__top-chip:hover,
  .home__profile-btn:hover,
  .home__quick-action:hover,
  .home__start-btn:hover,
  .home__mode-summary:hover,
  .home__menu-btn:hover,
  .home-mode-option:hover,
  .home-language-option:hover,
  .home-profile-action:hover {
    transform: translateY(-2px);
  }

  .home__menu-btn:hover {
    filter: saturate(1.06);
  }
}

@media (max-height: 620px) {
  .home-screen {
    gap: 7px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .home__stage {
    gap: 14px;
    padding-top: 4px;
  }

  .home__profile-btn {
    width: clamp(5.5rem, min(36vw, 18dvh), 7rem);
    height: clamp(5.5rem, min(36vw, 18dvh), 7rem);
  }

  .home__profile-avatar {
    font-size: clamp(2.7rem, min(15vw, 8.5dvh), 3.7rem);
  }

  .home__brand-logo .brand-logo__tile {
    font-size: clamp(1rem, min(5.8vw, 4.4dvh), 1.75rem);
  }

  .home__play-panel {
    gap: 9px;
    padding: 0;
  }

  .home__start-btn {
    height: 64px;
  }

  .home__start-icon {
    width: 36px;
    height: 36px;
  }

  .home__start-label {
    font-size: 28px;
  }

  .home__menu-btn {
    min-height: 58px;
    padding: 7px;
  }
}
