/* Approved home composition. Loaded last to isolate it from legacy lobby rules. */

.device.is-home .scene { z-index: 0; }
.device.is-home .godrays,
.device.is-home .dust,
.device.is-home .tiger { z-index: 10; }

.home-screen.is-on {
  grid-template-columns: clamp(100px, 21vw, 350px) minmax(340px, 1fr) clamp(280px, 28vw, 470px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "top top top"
    ". brand menu"
    ". center menu"
    "foot foot foot";
  column-gap: clamp(10px, 1.5vw, 24px);
  row-gap: 0;
  width: 100vw;
  height: var(--app-h, 100dvh);
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: hidden;
}

.home-topbar {
  z-index: 50;
  min-height: clamp(50px, 7.5vh, 72px);
}

.home-gear,
.home-balance,
.home-alert {
  min-height: clamp(48px, 7vh, 66px);
}

.home-gear {
  min-width: clamp(150px, 12.5vw, 210px);
  padding: 8px 22px 8px 9px;
  border-radius: 999px;
  gap: 12px;
  font-size: clamp(0.78rem, 1.8vh, 1.05rem);
}

.home-gear-icon {
  width: clamp(34px, 4.8vh, 46px);
  font-size: clamp(20px, 3.2vh, 28px);
}

.home-balance {
  min-width: clamp(190px, 15vw, 250px);
  justify-content: center;
  padding: 8px 22px 8px 11px;
  border-radius: 999px;
  font-size: clamp(0.78rem, 1.8vh, 1rem);
}

.home-balance img {
  width: clamp(30px, 4.8vh, 44px);
  height: clamp(30px, 4.8vh, 44px);
}

.home-balance b {
  font-size: clamp(1.05rem, 2.7vh, 1.55rem);
}

.home-alert {
  width: clamp(48px, 7vh, 66px);
  border-radius: 50%;
}

.home-brand {
  z-index: 40;
  align-self: start;
  width: min(100%, 620px);
  padding-top: clamp(0px, 0.8vh, 8px);
  padding-bottom: 14px;
}

.home-crest {
  position: relative;
  top: -32px;
  width: min(70%, 360px);
  max-height: clamp(62px, 9.5vh, 92px);
  margin-bottom: -34px;
}

.home-title-km {
  font-size: clamp(2.8rem, 8.4vh, 5.3rem);
  line-height: 0.92;
}

.home-title-en {
  margin-top: 8px;
  font-size: clamp(0.9rem, 2.4vh, 1.35rem);
  letter-spacing: 0.14em;
}

.home-tag {
  margin-top: 18px;
  padding: 6px 32px 0;
  font-size: clamp(0.72rem, 1.8vh, 0.98rem);
}

.home-center {
  z-index: 20;
  position: relative;
  display: grid;
  grid-template: 1fr / 1fr;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.home-bowl,
.home-play {
  grid-area: 1 / 1;
}

.home-bowl {
  position: relative;
  align-self: stretch;
  justify-self: center;
  width: min(100%, 820px);
  min-height: 0;
}

.home-bowl-aura {
  z-index: 0;
  bottom: 15%;
  width: 80%;
}

.home-pedestal,
.home-plate,
.home-cover {
  position: absolute;
  left: 50%;
  height: auto;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  transform: translateX(-50%);
}

.home-pedestal {
  z-index: 20;
  bottom: 5%;
  width: min(106%, 820px);
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.58));
}

.home-plate {
  z-index: 22;
  bottom: 21%;
  width: min(82%, 650px);
  max-height: none;
}

.home-cover {
  z-index: 24;
  bottom: 40%;
  width: min(59%, 470px);
  max-height: none;
}

.home-play {
  z-index: 40;
  align-self: end;
  justify-self: center;
  width: min(76%, 550px);
  min-height: clamp(76px, 11vh, 108px);
  margin-bottom: clamp(10px, 3vh, 28px);
}

.home-play-km {
  font-size: clamp(1.2rem, 3.5vh, 2rem);
}

.home-menu {
  z-index: 30;
  align-self: center;
  gap: clamp(9px, 1.5vh, 15px);
  transform: translateY(30px);
}

.menu-row {
  min-height: clamp(68px, 11.5vh, 110px);
  grid-template-columns: clamp(44px, 5vw, 66px) minmax(0, 1fr);
  padding: 9px clamp(18px, 2vw, 30px);
}

.menu-row .menu-ico {
  width: clamp(40px, 4.8vw, 62px);
  height: clamp(40px, 4.8vw, 62px);
}

.menu-row b {
  font-size: clamp(0.95rem, 2.4vh, 1.35rem);
}

.menu-row small {
  font-size: clamp(0.62rem, 1.45vh, 0.82rem);
}

.home-foot {
  z-index: 50;
  grid-template-columns: minmax(260px, 1fr) auto minmax(230px, 1fr);
  align-items: end;
  gap: 14px;
}

.fun-only {
  max-width: 350px;
  padding: 10px 14px;
}

.fun-only img {
  width: clamp(40px, 5.5vh, 54px);
  height: clamp(40px, 5.5vh, 54px);
}

.fun-only b {
  font-size: clamp(0.65rem, 1.45vh, 0.85rem);
}

.fun-only small {
  font-size: clamp(0.52rem, 1.1vh, 0.68rem);
}

.home-controls {
  gap: clamp(8px, 1.1vw, 14px);
}

.home-control {
  width: clamp(72px, 11.8vh, 112px);
  gap: 4px;
}

.home-control img {
  width: clamp(26px, 3.8vh, 38px);
  height: clamp(26px, 3.8vh, 38px);
}

.home-control span {
  font-size: clamp(7px, 1.2vh, 11px);
}

.home-social {
  gap: 10px;
  padding: 9px 11px 9px 16px;
  font-size: clamp(0.65rem, 1.4vh, 0.82rem);
}

.home-social button {
  width: clamp(38px, 5.5vh, 52px);
  height: clamp(38px, 5.5vh, 52px);
}

@media (min-width: 901px) and (max-height: 760px) {
  .home-screen.is-on {
    grid-template-rows: auto auto minmax(0, 1fr) 66px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .home-topbar {
    min-height: 44px;
  }

  .home-gear,
  .home-balance,
  .home-alert {
    min-height: 42px;
  }

  .home-alert {
    width: 42px;
  }

  .home-brand {
    margin-top: -5px;
    padding-bottom: 0;
  }

  .home-crest {
    top: -8px;
    max-height: 48px;
    margin-bottom: -5px;
  }

  .home-title-km {
    font-size: 2.75rem;
  }

  .home-title-en {
    margin-top: 3px;
    font-size: 0.85rem;
  }

  .home-tag {
    margin-top: 4px;
    padding-top: 3px;
    font-size: 0.68rem;
  }

  .menu-row {
    min-height: clamp(54px, 8.6vh, 66px);
  }

  .home-menu {
    transform: none;
  }

  .home-pedestal {
    bottom: 0;
  }

  .home-play {
    min-height: 72px;
    margin-bottom: 8px;
  }

  .home-control {
    width: 58px;
  }
}

@media (max-width: 932px) and (orientation: landscape) {
  .home-screen.is-on {
    grid-template-columns: minmax(0, 1fr) clamp(180px, 29vw, 250px);
    grid-template-rows: 44px auto minmax(0, 1fr) 48px;
    grid-template-areas:
      "top top"
      "brand menu"
      "center menu"
      "foot foot";
    column-gap: 6px;
    padding: max(3px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right))
      max(3px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .home-topbar {
    min-height: 42px;
  }

  .home-gear,
  .home-balance,
  .home-alert {
    min-height: 40px;
  }

  .home-gear {
    min-width: 0;
    padding: 4px 9px 4px 4px;
    gap: 5px;
    font-size: 0.62rem;
  }

  .home-gear-icon {
    width: 30px;
    font-size: 18px;
  }

  .home-balance {
    min-width: 0;
    padding: 4px 8px 4px 5px;
    gap: 4px;
    font-size: 0.58rem;
  }

  .home-balance img {
    width: 26px;
    height: 26px;
  }

  .home-balance b {
    font-size: 0.8rem;
  }

  .home-alert {
    width: 40px;
  }

  .home-brand {
    width: 100%;
    padding: 0;
    margin: 0;
  }

  .home-crest {
    top: 0;
    width: min(52%, 180px);
    max-height: 27px;
    margin-bottom: -3px;
  }

  .home-title-km {
    font-size: clamp(1.45rem, 7vh, 1.8rem);
  }

  .home-title-en {
    margin-top: 2px;
    font-size: 0.52rem;
  }

  .home-tag {
    margin-top: 2px;
    padding: 2px 10px 0;
    font-size: 0.48rem;
  }

  .home-bowl {
    width: min(100%, 430px);
  }

  .home-pedestal {
    bottom: -4%;
    width: min(96%, 420px);
  }

  .home-plate {
    bottom: 21%;
    width: min(76%, 330px);
  }

  .home-cover {
    bottom: 35%;
    width: min(54%, 235px);
  }

  .home-play {
    width: min(76%, 300px);
    min-height: 58px;
    margin-bottom: 4px;
    padding: 5px 18px;
  }

  .home-play-km {
    font-size: clamp(0.88rem, 4.5vh, 1.15rem);
  }

  .home-play-en {
    font-size: 8px;
  }

  .home-menu {
    gap: 4px;
    transform: none;
  }

  .menu-row {
    min-height: 48px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 6px;
    padding: 4px 9px;
  }

  .menu-row .menu-ico {
    width: 30px;
    height: 30px;
  }

  .menu-row b {
    font-size: 0.68rem;
  }

  .menu-row small {
    margin-top: 0;
    font-size: 0.42rem;
  }

  .menu-row em {
    top: -4px;
    right: 7px;
    padding: 1px 5px;
    font-size: 7px;
  }

  .home-foot {
    grid-template-columns: minmax(120px, 1fr) auto minmax(100px, 1fr);
    gap: 5px;
  }

  .fun-only {
    max-width: 170px;
    padding: 4px 6px;
    gap: 5px;
  }

  .fun-only img {
    width: 28px;
    height: 28px;
  }

  .fun-only b {
    display: block;
    font-size: 7px;
  }

  .fun-only small {
    display: none;
  }

  .home-controls {
    gap: 3px;
  }

  .home-control {
    width: 42px;
    gap: 0;
  }

  .home-control img {
    width: 18px;
    height: 18px;
  }

  .home-control span {
    font-size: 5px;
  }

  .home-social {
    gap: 3px;
    padding: 3px 4px;
  }

  .home-social > span {
    display: none;
  }

  .home-social button {
    width: 30px;
    height: 30px;
    font-size: 0.65rem;
  }
}

@media (max-width: 932px) and (orientation: portrait) {
  .device.is-home {
    visibility: hidden;
    pointer-events: none;
  }

  .device.is-home + .orientation-lock {
    display: flex;
  }
}

@media (max-width: 915px) and (max-height: 412px) and (orientation: landscape) {
  .home-tag {
    display: none;
  }

  .home-cover {
    width: min(48%, 190px);
  }

  .home-plate {
    width: min(68%, 290px);
  }
}
