

.home-body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

header.home-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.home-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.home-header-right { display: flex; align-items: center; gap: 8px; }
.home-wordmark { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }

.home-wordmark.title-stack { display: flex; flex-direction: column; line-height: 1.08; min-width: 0; }
.home-wordmark.title-stack > span { white-space: nowrap; }

.home-wordmark.title-stack .store-tag { font-size: 13px; font-weight: 400; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; padding-bottom: 1px; }
.home-wordmark.title-stack .store-tag:empty { display: none; }

.name-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.name-chip:hover { background: var(--surface-hover); }

.home-main {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 38px 20px 48px;
  box-sizing: border-box;
}
.home-greeting {
  margin: 0 0 6px;
  font-size: clamp(24px, 5.2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.home-greeting-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14.5px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 14px;
}

.app-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: var(--raised);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(16, 18, 28, .05);
  transition: transform .16s cubic-bezier(.2, .7, .3, 1),
              border-color .16s ease,
              box-shadow .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.app-tile:hover {
  transform: translateY(-3px);
  border-color: var(--blue);
  box-shadow: 0 10px 24px -6px rgba(76, 29, 149, .28), 0 2px 6px rgba(16, 18, 28, .06);
}

.app-tile:active {
  transform: translateY(1px) scale(.988);
  box-shadow: 0 1px 2px rgba(16, 18, 28, .06);
  transition-duration: .07s;
}
.app-tile:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.app-tile-icon { flex: 0 0 auto; line-height: 0; }
.app-tile-icon svg,
.app-tile-icon img {
  width: 52px;
  height: 52px;
  display: block;
  border-radius: 13px;
  box-shadow: 0 2px 5px rgba(55, 48, 163, .25);
  transition: transform .16s cubic-bezier(.2, .7, .3, 1), box-shadow .16s ease;
}
.app-tile:hover .app-tile-icon svg,
.app-tile:hover .app-tile-icon img {
  transform: scale(1.055) rotate(-1.2deg);
  box-shadow: 0 5px 12px rgba(55, 48, 163, .32);
}
.app-tile:active .app-tile-icon svg,
.app-tile:active .app-tile-icon img { transform: scale(1); }

@keyframes tileIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}
.app-grid .app-tile { animation: tileIn .32s cubic-bezier(.2, .7, .3, 1) backwards; }
.app-grid .app-tile:nth-child(1) { animation-delay: .02s; }
.app-grid .app-tile:nth-child(2) { animation-delay: .07s; }
.app-grid .app-tile:nth-child(3) { animation-delay: .12s; }

.app-grid .app-tile:nth-child(4) { animation-delay: .17s; }

.app-tile-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.app-tile-name { font-size: 15.5px; font-weight: 650; }

.app-tile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}
.meta-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-tile-meta.live { color: var(--blue); font-weight: 650; }
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--muted);
}
.app-tile-meta.is-live .live-dot {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .55);
  animation: livePulse 2.4s ease-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); }
  70%  { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.signin-card input { display: block; width: 100%; box-sizing: border-box; }
.signin-card #signInPw { margin-top: 10px; }
.signin-hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 6px 0 0;
}
.signin-error {
  color: var(--red);
  font-size: 13px;
  margin: 10px 0 0;
  min-height: 1em;
}

.home-body.awaiting-name .home-main,
.home-body.awaiting-name .home-header-right .name-chip { visibility: hidden; }

.hidden { display: none !important; }

@media (max-width: 520px) {
  .home-main { padding: 26px 16px 40px; }
  .app-grid { grid-template-columns: 1fr; }
  
  .app-tile-icon svg,
  .app-tile-icon img { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-grid .app-tile { animation: none; }
  .app-tile,
  .app-tile-icon svg,
  .app-tile-icon img { transition: none; }
  .app-tile:hover { transform: none; }
  .app-tile:hover .app-tile-icon svg,
  .app-tile:hover .app-tile-icon img { transform: none; }
  .app-tile-meta.is-live .live-dot { animation: none; }
}

.theme-toggle {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-hover); }

.name-chip, .theme-toggle { touch-action: manipulation; min-height: 38px; }

@media (pointer: coarse) {
  .theme-toggle, .name-chip { min-width: 44px; min-height: 44px; }
  .signin-card input { font-size: 16px; }
}
