/* Home uses natural content height. Only the current four partners are shown. */
body[data-screen="home"] #app {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}
html[data-theme] .menu-screen.home-menu {
  --home-ink: #253e48;
  --home-muted: #60717a;
  width: 100%;
  max-width: 480px;
  height: auto;
  min-height: 100%;
  padding: calc(16px + var(--safe-top)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + var(--safe-bottom)) max(16px, env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  align-content: center;
  gap: 12px;
  color: var(--home-ink);
}
html[data-theme] .home-menu .cat-atmosphere {
  position: fixed;
  inset: 0;
  background-size: cover;
}
.home-menu .cat-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #142b3d50, #142b3d12 35%, #142b3d50);
}
html[data-theme] .home-menu .menu-hud {
  position: static;
  height: auto;
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
html[data-theme] .home-menu .currency-pill {
  min-height: 40px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #ffffff70;
  border-radius: 24px;
  background: #173a4be6;
  box-shadow: 0 3px 10px #09253120;
  color: #fff7e5;
  font-size: 18px;
  text-shadow: none;
  transform: none;
}
.home-menu .currency-pill .icon { width: 21px; height: 21px; color: #ffd478; }
.home-menu .currency-pill small { color: #e0d5b9; font-size: 12px; }
.home-menu .hud-tools { display: flex; gap: 8px; }
html[data-theme] .home-menu .icon-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #ffffff70;
  background: #173a4bd9;
  box-shadow: 0 3px 10px #09253120;
  color: #fff7e5;
  transform: none;
}
.home-menu .icon-button::before,
.home-menu .currency-pill::before { display: none; }
.home-brand { text-align: center; padding: 0; }
.home-brand h1 {
  margin: 0;
  font-family: "Yuanti SC", "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: clamp(34px, 9vw, 42px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .06em;
  color: #fff8e8;
  text-shadow: 0 2px 8px #09253170;
}
.home-brand p { margin: 6px 0 0; font-size: 13px; color: #fff8e8; text-shadow: 0 1px 5px #092531; }
.home-theme-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 64px;
  padding: 8px 12px 8px 8px;
  border: 1px solid #ffffffe6;
  border-radius: 18px;
  background: #fffbf0f5;
  box-shadow: 0 4px 12px #09253124;
  color: var(--home-ink);
  text-align: left;
}
.home-theme-card img { display: block; flex: 0 0 60px; width: 60px; height: 48px; border-radius: 11px; object-fit: cover; }
.home-theme-copy { flex: 1; min-width: 0; }
.home-theme-copy small { display: block; color: var(--home-muted); font-size: 10px; line-height: 1.4; }
.home-theme-copy b { display: block; margin-top: 2px; font-size: 15px; }
.home-theme-change { display: flex; align-items: center; gap: 5px; flex-shrink: 0; color: #356872; font-size: 12px; font-weight: 800; }
.home-theme-change .icon { width: 16px; height: 16px; }
.home-party {
  padding: 12px;
  border: 1px solid #ffffffb3;
  border-radius: 24px;
  background: #fffaf0f2;
  box-shadow: 0 6px 18px #09253126;
}
.home-party-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.home-party-heading h2 { margin: 0; color: var(--home-ink); font-size: 15px; line-height: 1.4; }
.home-party-heading p { margin: 3px 0 0; color: var(--home-muted); font-size: 11px; }
.home-collection {
  flex-shrink: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid #aac1ba;
  border-radius: 12px;
  background: #e6efdf;
  color: #35625c;
  font-size: 11px;
  font-weight: 800;
}
.home-collection .icon { width: 14px; height: 14px; }
.home-collection .icon:last-child { width: 12px; }
.home-party-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home-cat-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 10px 8px 9px;
  border: 1px solid color-mix(in srgb, var(--cat-accent) 45%, #9eaaa4);
  border-radius: 17px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--cat-accent) 17%, #fffdf5), color-mix(in srgb, var(--cat-accent) 31%, #fff8e9));
  box-shadow: 0 2px 0 color-mix(in srgb, var(--cat-accent) 35%, #c7cdc3);
  color: var(--home-ink);
  text-align: center;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.home-cat-slot { position: absolute; top: 9px; left: 10px; color: #62716b; font-size: 9px; }
.home-cat-change { position: absolute; top: 7px; right: 8px; display: flex; align-items: center; gap: 2px; padding: 3px 5px; border-radius: 7px; background: #ffffffbf; color: #42645c; font-size: 9px; font-weight: 800; }
.home-cat-change .icon { width: 10px; height: 10px; }
.home-cat-art { position: relative; display: block; width: clamp(72px, 10dvh, 88px); aspect-ratio: 1; margin-top: 7px; flex: none; }
.home-party[data-party-size="2"] .home-cat-art { width: clamp(88px, 15dvh, 128px); }
html[data-theme] .home-cat-art .cat-sprite { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-height: none; aspect-ratio: 1; transform: none; animation: none; filter: drop-shadow(0 3px 2px #3847331a); }
.home-cat-caption { width: 100%; display: flex; align-items: baseline; justify-content: center; gap: 5px; line-height: 20px; }
.home-cat-caption b { flex-shrink: 0; font-size: 14px; }
.home-cat-caption small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #60716b; font-size: 9px; }
html[data-theme] .home-menu .button.home-start {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  padding: 12px 18px;
  border: 1px solid #ffe2a7;
  border-radius: 20px;
  background: linear-gradient(130deg, #ffe1a0, #ffc785);
  color: #594127;
  box-shadow: 0 4px 0 #bc8c56, 0 7px 15px #09253130;
  text-shadow: none;
  font-size: 22px;
  transform: none;
}
.home-menu .home-start::before, .home-menu .home-start::after { display: none; }
.home-start > span:not(.home-start-icon) { flex: 1; text-align: left; line-height: 1.2; }
html[data-theme] .home-menu .home-start small { display: block; margin-top: 5px; color: #745538; font-size: 11px; font-weight: 600; line-height: 1.4; }
.home-start > .icon { width: 23px; height: 23px; }
.home-start-icon { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border: 1px solid #9c744d45; border-radius: 50%; background: #fff2cf80; }
.home-start-icon .icon { width: 20px; height: 20px; margin-left: 2px; }
.home-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 3px; }
.home-modes > button { min-width: 0; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 9px 4px; border: 1px solid #ffffffc9; border-radius: 16px; background: #fffaf0f2; box-shadow: 0 3px 8px #09253120; color: var(--home-ink); }
.home-modes .icon { width: 23px; height: 23px; color: #5c8475; }
.home-modes > button:nth-child(2) .icon { color: #bd8460; }
.home-modes > button:nth-child(3) .icon { color: #ad9160; }
.home-modes b { font-size: 12px; line-height: 1.3; }
.home-modes small { font-size: 10px; line-height: 1.3; color: var(--home-muted); }
.home-daily-icon { position: relative; display: flex; }
.home-daily-dot { position: absolute; top: -3px; right: -4px; width: 7px; height: 7px; border: 1px solid #fffaf0; border-radius: 50%; background: #ed8961; }
.home-daily-dot.complete { background: #75a58b; }
.home-rank { min-height: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff5df; font-size: 11px; text-shadow: 0 1px 4px #092531; }
.home-rank .icon { width: 16px; height: 16px; color: #ffda8b; }
.home-rank i { width: 3px; height: 3px; border-radius: 50%; background: #ffda8b; }
.home-menu button:focus-visible { outline: 3px solid #f1a352; outline-offset: 3px; }
@media (hover: hover) {
  .home-cat-card:hover { border-color: #527d70; box-shadow: 0 0 0 2px #527d7033; }
  .home-theme-card:hover, .home-modes > button:hover { background: #fffdf6; }
}
@media (max-width: 350px) {
  html[data-theme] .menu-screen.home-menu { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); gap: 10px; }
  .home-party { padding: 10px; }
  .home-party-heading h2 { font-size: 13px; }
  .home-collection { padding: 5px; font-size: 10px; }
  .home-collection .icon:first-child { display: none; }
  .home-theme-card { gap: 8px; padding-right: 10px; }
  .home-theme-change { font-size: 11px; }
  .home-theme-card img { width: 50px; flex-basis: 50px; }
  .home-cat-caption small { display: none; }
}
@media (min-width: 700px) {
  html[data-theme] .menu-screen.home-menu {
    max-width: 880px;
    padding: calc(24px + var(--safe-top)) max(24px, env(safe-area-inset-right, 0px)) calc(24px + var(--safe-bottom)) max(24px, env(safe-area-inset-left, 0px));
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-rows: auto auto auto auto auto auto;
    grid-template-areas: "hud hud" "brand party" "theme party" "start party" "modes modes" "rank rank";
    gap: 18px 24px;
  }
  .home-menu .menu-hud { grid-area: hud; }
  .home-brand { grid-area: brand; align-self: end; text-align: left; }
  .home-theme-card { grid-area: theme; align-self: center; }
  .home-party { grid-area: party; }
  .home-start { grid-area: start; align-self: start; }
  .home-modes { grid-area: modes; }
  .home-rank { grid-area: rank; }
  .home-cat-art { width: clamp(72px, 14dvh, 112px); }
  .home-modes > button { min-height: 72px; display: grid; grid-template-columns: 28px auto; grid-template-rows: auto auto; justify-content: center; column-gap: 10px; }
  .home-modes > button > .icon, .home-daily-icon { grid-column: 1; grid-row: 1 / 3; }
  .home-modes b, .home-modes small { grid-column: 2; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .home-cat-card { transition: none; }
}
