/* Lightweight homepage styles. Game pages retain their existing stylesheet. */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: #1d1d1f;
  background: #f5f5f7;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overscroll-behavior-x: none; }
body { min-height: 100svh; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
button, a, select { touch-action: manipulation; }
:focus-visible { outline: 3px solid #007aff; outline-offset: 3px; }

.home-shell {
  width: min(100%, 920px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}
.home-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.brand { color: #1d1d1f; font-size: 25px; font-weight: 780; letter-spacing: -.075em; text-decoration: none; white-space: nowrap; }
.brand-mark { display: none; }
.brand-dot { color: #ba939b; }
.topbar-tools { display: flex; align-items: center; justify-content: flex-end; gap: 2px; margin-left: auto; }
.language-control--flag { position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; }
.language-flag { font-size: 24px; line-height: 1; }
.language-control--flag select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.language-control--flag:focus-within { outline: 3px solid #007aff; outline-offset: 2px; }
.language-control--flag:hover { background: rgba(60,60,67,.055); }
.install-header {
  display: grid;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #292d35;
  background: transparent;
  transition: background 150ms ease;
}
.install-header svg { display: block; width: 21px; height: 21px; }
.install-header:hover, .install-header[aria-expanded="true"] { background: rgba(60,60,67,.055); }

.home-main { width: 100%; max-width: 670px; margin: 0 auto; padding: clamp(28px, 6vw, 58px) 0 22px; }
.home-main h1 { margin: 0; font-size: clamp(28px, 4.4vw, 34px); font-weight: 750; line-height: 1.17; letter-spacing: -.052em; }
.game-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.game-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 125px;
  padding: 9px 7px 7px;
  border: 1px solid rgba(60, 60, 67, .065);
  border-radius: 19px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0,0,0,.025);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.game-entry:hover { border-color: rgba(60,60,67,.15); box-shadow: 0 2px 6px rgba(0,0,0,.03), 0 9px 28px rgba(0,0,0,.04); }
.game-entry:active { transform: scale(.984); }
.game-entry:focus-visible { outline-offset: 3px; }
.game-art {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 5px;
  width: 76px;
  height: 76px;
  aspect-ratio: 1;
  overflow: hidden;
}
.game-art img:first-child {
  display: block;
  width: 70px;
  height: 70px;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  transform: none;
}
.game-art img:not(:first-child) { display: none; }
.pair-home-art img:not(:first-child) { display: block; }
.game-art.pair-home-art img {
  display: block;
  width: 35px;
  max-width: 35px;
  height: 35px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
  transform: none;
}
.home-color {
  display: block;
  flex: none;
  width: 21px;
  aspect-ratio: 1;
  border-radius: 50%;
}
.home-color-red { background: #e45557; }
.home-color-blue { background: #4e80db; }
.home-color-yellow { background: #f5ca4d; }
.number-game-art { gap: 5px; }
.home-number {
  width: 22px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #6e6e73;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -.06em;
}
.home-number:nth-child(2) { color: #363639; }
.chameleon-game-art img:first-child {
  width: 70px;
  height: 70px;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 0;
  filter: drop-shadow(0 2px 2px rgba(33,45,31,.08));
  transform: rotate(-7deg);
}
.rule-shape { display: block; flex: none; width: 21px; height: 21px; background: var(--shape-color, #3974c9); }
.rule-shape--daire { border-radius: 50%; }
.rule-shape--kare { border-radius: 15%; }
.rule-shape--ucgen { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.needs-home-art svg { flex: none; width: 23px; height: 23px; }
.surprise-home-icon { width: 52px; height: 52px; color: #b98591; }
.game-entry-copy { display: grid; place-items: center; flex: 1; width: 100%; min-width: 0; min-height: 31px; padding: 4px 1px 1px; text-align: center; }
.game-entry-copy h2 { margin: 0; font-size: clamp(13px, 2vw, 15px); font-weight: 675; line-height: 1.25; letter-spacing: -.023em; overflow-wrap: break-word; }

.home-footer { display: flex; justify-content: flex-end; width: 100%; margin-top: auto; padding: 8px 0 0; }
.footer-links { display: flex; align-items: center; }
.legal-info { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #77777e; text-decoration: none; font-size: 21px; }
.legal-info:hover { color: #1d1d1f; }

.install-banner {
  position: fixed;
  z-index: 30;
  top: max(64px, calc(env(safe-area-inset-top) + 60px));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  gap: 12px;
  align-items: center;
  width: min(410px, calc(100vw - 32px));
  padding: 20px 42px 20px 19px;
  border: 1px solid #e1e1e5;
  border-radius: 20px;
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 12px 45px rgba(0,0,0,.12);
}
.install-copy { flex: 1; min-width: 0; display: grid; gap: 5px; }
.install-copy strong { font-size: 14px; line-height: 1.35; }
.install-copy span, .install-copy p { margin: 0; color: #5f6066; font-size: 12px; line-height: 1.4; }
.install-copy p { color: #9c4561; }
.install-button { min-height: 44px; padding: 10px 15px; border: 0; border-radius: 999px; color: #fff; background: #292d35; font-size: 13px; font-weight: 700; }
.install-dismiss { position: absolute; top: 1px; right: 2px; width: 40px; height: 40px; border: 0; border-radius: 50%; color: #77777e; background: transparent; font-size: 22px; }
@media (min-width: 720px) { .game-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .home-main { padding-top: 30px; }
}
@media (max-width: 360px) {
  .home-topbar { gap: 7px; }
  .game-list { gap: 8px; margin-top: 18px; }
  .game-entry { border-radius: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .game-entry, .install-header { transition: none; }
}
@media (prefers-contrast: more) {
  .game-entry { border-color: #64646c; border-width: 2px; }
}
@media (forced-colors: active) {
  .game-entry, .install-header, .install-button { border: 2px solid ButtonText; }
}

/* Simple, scalable SVG preview for Kule. */
.tower-home-art svg { display:block; width:70px; height:70px; flex:none; }
