/* Game materials are sprites; labels remain live text for localization. */
body[data-screen="home"] #app { overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; }
html[data-theme] .menu-screen.home-menu {
  --home-ink: #244b43; --home-muted: #627366;
  width: 100%; max-width: 490px; height: auto; min-height: 100%;
  padding: calc(8px + var(--safe-top)) max(14px, env(safe-area-inset-right, 0px)) calc(12px + var(--safe-bottom)) max(14px, 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-image: var(--home-background, var(--theme-background));
  background-size: cover; background-position: center; opacity: 1;
}
.home-menu .cat-atmosphere:after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #112d3330, #102c2d30 55%, #0b293748); }
.game-ui-art { display: block; position: absolute; inset: 0; z-index: -1; background-image: var(--home-ui-atlas); background-repeat: no-repeat; pointer-events: none; user-select: none; }
.game-ui-art.ui-nine { --ui-corner: 18px; display: grid; grid-template-columns: var(--ui-corner) minmax(0, 1fr) var(--ui-corner); grid-template-rows: var(--ui-corner) minmax(0, 1fr) var(--ui-corner); background: none; }
.game-ui-piece { min-width: 0; min-height: 0; background-image: var(--home-ui-atlas); background-repeat: no-repeat; }
.game-ui-art.ui-secondary { --ui-corner: 14px; }
.game-ui-art.ui-nameplate { --ui-corner: 14px; }
.game-ui-art.ui-primary { --ui-corner: 22px; }
.home-menu .menu-hud, .home-brand, .home-theme-card, .home-party, .home-start, .home-modes, .home-rank { position: relative; z-index: 1; }
html[data-theme] .home-menu .menu-hud { position: relative; width: 100%; max-width: none; margin: 0; height: auto; min-height: 46px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
html[data-theme] .home-menu .currency-pill {
  position: relative; isolation: isolate; display: flex; align-items: center; gap: 7px;
  min-height: 46px; min-width: 142px; padding: 9px 17px;
  border: 0; border-radius: 0; background: none; box-shadow: none; transform: none;
  color: var(--home-hud-ink, #fff1d1); font-size: 21px; text-shadow: 0 1px 2px #1d354844;
}
.home-menu .currency-pill .icon { width: 26px; height: 26px; color: #fcd65e; fill: #f8c646; stroke: #b88024; filter: drop-shadow(0 2px 1px #80562366); }
.home-menu .currency-pill b { font-weight: 900; font-variant-numeric: tabular-nums; }
.home-menu .currency-pill small { color: inherit; font-size: 13px; font-weight: 800; opacity: .92; }
.home-menu .hud-tools { display: flex; gap: 8px; }
html[data-theme] .home-menu .icon-button {
  position: relative; isolation: isolate; width: 48px; height: 48px; min-width: 44px; min-height: 44px;
  padding: 11px; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--home-hud-ink, #fff1d1); transform: none;
}
.home-menu .icon-button .icon { width: 25px; height: 25px; filter: drop-shadow(0 1px 1px #1b302c77); }
.home-menu .icon-button:before, .home-menu .currency-pill:before { display: none; }
.home-brand { text-align: center; padding: 0; margin: 3px 0 2px; }
.home-brand h1 {
  position: relative; isolation: isolate; width: min(84%, 282px); height: 84px;
  margin: 0 auto; padding: 0; font-family: "Yuanti SC", "Hiragino Sans GB", "PingFang SC", system-ui, sans-serif;
  font-size: clamp(32px, 9vw, 38px); line-height: 1.08; font-weight: 900; letter-spacing: .045em;
}
.home-title-text {
  position: absolute; left: 7%; right: 7%; top: 50%; translate: 0 -50%;
  color: #244b43; -webkit-text-stroke: 0;
  text-shadow: 0 1px #fff7e0, 0 2px 1px #66713b22; overflow-wrap: anywhere;
}
.home-brand p { position: relative; margin: 8px 0 0; color: var(--home-hud-ink, #fff5df); font-size: 13px; font-weight: 650; text-shadow: 0 1px 2px #16332955; }
.home-theme-card {
  isolation: isolate; display: grid; grid-template-columns: 65px minmax(0, 1fr) auto; align-items: center; gap: 9px;
  min-width: 0; min-height: 64px; padding: 7px 13px; border: 0; border-radius: 0; background: none; box-shadow: none;
  color: var(--home-ink); text-align: left;
}
.home-theme-preview { display: block; width: 65px; height: 48px; overflow: hidden; border-radius: 10px; border: 2px solid #e0c79b; box-shadow: 0 2px 2px #5b503633; }
.home-theme-preview img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
html[data-theme="felt-garden"] .home-theme-preview img { object-position: center 52%; }
.home-theme-copy { min-width: 0; }
.home-theme-copy small { display: block; color: var(--home-muted); font-size: 10px; font-weight: 800; line-height: 1.4; }
.home-theme-copy b { display: block; margin-top: 3px; font-size: 17px; line-height: 1.2; }
.home-theme-change {
  position: relative; isolation: isolate; display: flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 40px; padding: 8px 13px; color: #295044; font-size: 11px; font-weight: 800; line-height: 1.2;
}
.home-theme-change .icon { width: 14px; height: 14px; flex: none; }
.home-party { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.home-party-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 8px; }
.home-party-heading-copy { position: relative; min-width: 0; padding: 0 4px; flex: 1; text-align: left; color: var(--home-hud-ink); text-shadow: 0 1px 2px #16332955; }
.home-party-heading h2 { position: relative; margin: 0; color: inherit; font-size: 17px; line-height: 1.25; font-weight: 800; }
.home-party-heading p { position: relative; margin: 5px 0 0; color: inherit; opacity: .85; font-size: 11px; font-weight: 550; line-height: 1.3; }
.home-collection {
  position: relative; isolation: isolate; display: flex; align-items: center; justify-content: center; flex: none;
  gap: 4px; min-height: 46px; padding: 10px 12px; border: 0; border-radius: 0; background: none;
  color: #295044; font-size: 12px; font-weight: 900; line-height: 1.25;
}
.home-collection .icon { width: 17px; height: 17px; flex: none; }
.home-collection .icon:last-child { width: 14px; }
.home-party-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; row-gap: 12px; }
.home-cat-card {
  position: relative; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto; align-items: center; justify-items: center; gap: 0;
  padding: 0 1px; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--home-ink); text-align: center;
}
.home-cat-change { grid-area: change; display: flex; align-items: center; justify-content: flex-end; gap: 2px; color: #557164; font-size: 10px; font-weight: 650; }
.home-cat-change .icon { width: 12px; height: 12px; flex: none; }
.home-cat-art { position: relative; isolation: isolate; display: block; width: min(100%, 150px); aspect-ratio: 1; margin-top: 3px; }
.home-party[data-party-size="2"] .home-cat-art { width: min(112%, 210px); }
.home-cat-art:before { content: ''; position: absolute; left: 15%; right: 15%; bottom: 3%; height: 8%; background: #0b251b4d; border-radius: 50%; filter: blur(4px); }
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 5px 3px #183b2850);
}
.home-cat-caption {
  position: relative; isolation: isolate; width: 100%; min-height: 54px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name change' 'breed change'; align-items: center; gap: 2px 5px;
  margin: 0; padding: 9px 13px 10px; line-height: 1.2; text-align: left;
}
.home-cat-caption b { grid-area: name; font-size: 17px; font-weight: 850; }
.home-cat-caption small { grid-area: breed; width: 100%; color: #657465; font-size: 10px; overflow-wrap: anywhere; }
html[data-theme] .home-menu .button.home-start {
  position: relative; isolation: isolate; display: flex; align-items: center; justify-content: space-between;
  gap: 9px; width: 100%; min-height: 74px; padding: 10px 22px; border: 0; border-radius: 0;
  background: none; box-shadow: none; color: #593711; text-shadow: none; -webkit-text-stroke: 0; font-size: 26px; transform: none;
}
.home-menu .home-start:before, .home-menu .home-start:after { display: none; }
.home-start-copy { flex: 1; text-align: left; line-height: 1.2; font-weight: 900; text-shadow: none; -webkit-text-stroke: 0; }
html[data-theme] .home-menu .home-start small { display: block; margin-top: 5px; color: #785128; font-size: 12px; font-weight: 800; line-height: 1.3; }
.home-start > .icon { width: 25px; height: 25px; flex: none; }
.home-start-icon {
  position: relative; display: grid; place-items: center; width: 38px; height: 38px;
  flex: none; border: 0; border-radius: 0; background: none; color: #694111;
}
.home-start-icon .icon { width: 24px; height: 24px; margin-left: 3px; fill: currentColor; filter: drop-shadow(0 2px 1px #4f332744); }
.home-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding-top: 2px; }
.home-modes > button {
  position: relative; isolation: isolate; min-width: 0; min-height: 94px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 7px 13px; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--home-ink);
}
.home-modes .icon { width: 28px; height: 28px; color: #477e61; filter: drop-shadow(0 1px 0 #fff8e3); }
.home-modes > button:nth-child(2) .icon { color: #dc983b; }
.home-modes > button:nth-child(3) .icon { color: #ac7836; }
.home-modes b { font-size: 14px; line-height: 1.15; font-weight: 900; overflow-wrap: anywhere; }
.home-modes small { font-size: 10px; line-height: 1.2; color: var(--home-muted); overflow-wrap: anywhere; }
.home-daily-icon { position: relative; display: flex; }
.home-daily-dot { position: absolute; top: -2px; right: -3px; width: 9px; height: 9px; border: 1px solid #fffaf0; border-radius: 50%; background: #f46d49; box-shadow: 0 1px 2px #8e3c3670; }
.home-daily-dot.complete { background: #75a58b; }
.home-rank { isolation: isolate; justify-self: center; width: max-content; min-height: 32px; padding: 5px 13px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--home-hud-ink, #fff1d2); font-size: 12px; font-weight: 800; text-shadow: none; }
.home-rank > .game-ui-art { --ui-corner: 10px; }
.home-rank .icon { width: 21px; height: 21px; color: #ffcf62; fill: #e8ab3b55; filter: drop-shadow(0 2px 1px #60412366); }
.home-rank i { width: 4px; height: 4px; border-radius: 50%; background: #ffda8b; }
.home-menu button { -webkit-tap-highlight-color: transparent; }
.home-menu button:focus-visible { outline: 3px solid #ffe3a0; outline-offset: 4px; }
.home-menu button:active { translate: 0 2px; }
.home-menu button:active > .game-ui-art { filter: brightness(.96); }
@media (hover: hover) {
  .home-menu button:hover > .game-ui-art { filter: brightness(1.06); }
  .home-cat-card:hover .home-cat-caption > .game-ui-art { filter: brightness(1.06); }
}
@media (max-width: 350px) {
  html[data-theme] .menu-screen.home-menu { padding-left: 10px; padding-right: 10px; gap: 10px; }
  .home-brand h1 { width: 84%; height: 76px; }
  .home-theme-card { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 6px; padding: 10px; }
  .home-theme-preview { width: 52px; height: 43px; }
  .home-theme-change { font-size: 10px; padding: 8px 9px; }
  .home-theme-copy b { font-size: 15px; }
  .home-party-heading h2 { font-size: 15px; }
  .home-collection { padding: 10px 9px; font-size: 11px; }
  .home-collection .icon:first-of-type { display: none; }
  .home-cat-caption { padding: 9px 11px; }
  .home-cat-change { font-size: 9px; }
  .home-modes { gap: 6px; }
  .home-modes > button { min-height: 94px; padding-left: 5px; padding-right: 5px; }
  .home-modes b { font-size: 12px; }
  html[data-theme] .home-menu .button.home-start { font-size: 23px; padding: 12px 18px; }
}
@media (min-width: 700px) {
  html[data-theme] .menu-screen.home-menu {
    max-width: 940px; padding: calc(24px + var(--safe-top)) 28px calc(24px + var(--safe-bottom));
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-areas: "hud hud" "brand party" "theme party" "start party" "modes modes" "rank rank"; gap: 20px 28px;
  }
  .home-menu .menu-hud { grid-area: hud; }
  .home-brand { grid-area: brand; align-self: end; }
  .home-theme-card { grid-area: theme; align-self: center; }
  .home-party { grid-area: party; align-self: center; }
  .home-start { grid-area: start; align-self: start; }
  .home-modes { grid-area: modes; justify-self: center; width: min(100%, 620px); gap: 20px; }
  .home-modes > button { min-height: 112px; }
  .home-rank { grid-area: rank; }
  .home-party[data-party-size="2"] .home-cat-art { width: min(110%, 250px); }
  .home-party-heading h2 { font-size: 17px; }
  .home-brand h1 { width: min(95%, 330px); height: 98px; font-size: 43px; }
}
@media (min-height: 920px) and (max-width: 699px) {
  html[data-theme] .menu-screen.home-menu { gap: 10px; }
  .home-brand h1 { width: min(84%, 300px); height: 92px; font-size: 38px; }
  .home-party[data-party-size="2"] .home-cat-art { width: min(112%, 220px); }
}
@media (prefers-reduced-motion: reduce) { .home-menu button, .home-menu .game-ui-art { transition: none; } }
