/*
  🏠 The look of the home page.
*/

.home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.home-main { display: flex; flex-direction: column; gap: 22px; }
.home-nav { display: flex; align-items: center; gap: 16px; }
.home-nav .brand { font-size: 22px; }
.home-nav .tag { font-size: 14px; padding: 6px 14px; }
.spacer { flex: 1; }

/* who is logged in */
.account { display: flex; align-items: center; gap: 10px; }
.account .btn { height: 36px; padding: 0 16px; text-decoration: none; }
.account .avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px;
  background: var(--color-accent-800);
  color: var(--color-accent-100);
}
.account .who { display: flex; flex-direction: column; line-height: 1.2; }
.account .who-name { font-size: 14px; font-weight: 500; }
.account .who-class { font-size: 11px; color: color-mix(in srgb, var(--color-text) var(--muted), transparent); }
.account .logout { font-size: 12px; padding: 4px 6px; height: auto; white-space: nowrap; }
.home-nav .brand { white-space: nowrap; }
.small-p { font-size: 14px; margin: 0; }

/* ---------- while we check who is logged in ---------- */

.side-skeleton { display: none; }
body.loading-account .side-skeleton { display: flex; gap: 12px; }
body.loading-account #trophy-card, body.loading-account #rank-card { display: none; }
body.loading-account #total-pts,
body.loading-account .hero-card .card-kicker,
body.loading-account .game-card .tag {
  color: transparent;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 50%, var(--skel-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
body.loading-account .hero-card .card-kicker { align-self: flex-start; }
body.loading-account #account > * { visibility: hidden; }
body.loading-account #account {
  width: 120px; height: 36px; border-radius: 18px;
  background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 50%, var(--skel-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

/* ---------- "log in so your points count" banner ---------- */

.login-banner {
  animation: fade-up 0.3s ease-out;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 13%, var(--color-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 60%, transparent);
}
.login-banner > .ic { flex: none; width: 30px; height: 30px; color: var(--warn); }
.login-banner-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.login-banner-text b { font-size: 17px; font-weight: 600; }
.login-banner-text span { font-size: 14px; color: color-mix(in srgb, var(--color-text) 75%, transparent); }
.login-banner .banner-btn { border-color: color-mix(in srgb, var(--warn) 70%, transparent); font-weight: 600; }
.login-banner .banner-btn:hover { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.login-banner .btn { flex: none; height: 42px; padding: 0 24px; font-size: 15px; text-decoration: none; }

/* ---------- welcome row ---------- */

.hero-pip { flex: none; margin: -12px 0 -18px -6px; }

.hero-row { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }

.hero-card {
  flex-direction: row;
  align-items: center;
  gap: 24px;
  padding: 26px 30px;
  box-shadow: var(--shadow-sm);
  background: radial-gradient(ellipse 500px 260px at 100% 50%, var(--glow), var(--color-surface) 75%);
}
.hero-text { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.hero-title { font-size: 34px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.hero-buttons { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.hero-buttons .btn { height: 44px; padding: 0 22px; font-size: 15px; text-decoration: none; }

/* the progress ring */
.ring {
  --pct: 0%;
  width: 120px; height: 120px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--color-accent) 0 var(--pct), var(--color-neutral-700) var(--pct) 100%);
}
.ring-inner {
  width: 104px; height: 104px;
  border-radius: 50%;
  background: var(--color-surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-big { font-size: 26px; font-weight: 500; }
.ring-small { font-size: 11px; color: color-mix(in srgb, var(--color-text) var(--muted), transparent); }
.hero-emoji { font-size: 72px; line-height: 1; color: var(--color-accent-300); }

.trophy-card { padding: 22px; gap: 8px; box-shadow: var(--shadow-sm); }
.trophy-big { font-size: 40px; font-weight: 500; line-height: 1.1; }
.trophy-big .text-muted { font-size: 16px; font-weight: 400; }
.rank-link { align-self: flex-start; margin-top: auto; text-decoration: none; }
.account .lb-btn { font-size: 18px; padding: 0 8px; text-decoration: none; }

/* one little bar per game */
.trophy-bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: auto; padding-top: 8px; }
.trophy-bar { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; color: var(--color-accent-300); }
.trophy-bar .track { width: 100%; height: 34px; border-radius: 4px; background: var(--color-neutral-800); position: relative; overflow: hidden; }
.trophy-bar .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--color-accent); border-radius: 4px; }

/* ---------- all games ---------- */

.games-section { display: flex; flex-direction: column; gap: 14px; }
.games-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.games-head h2 { margin: 0 auto 0 0; font-size: 22px; }

.filters .seg-opt { border: none; background: transparent; color: var(--color-text); font: inherit; font-size: 13px; }
.filters .seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.filters .seg-opt.on { color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.filters .seg-opt:not(.on):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }

.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.game-card {
  padding: 18px;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.game-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.game-card:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.game-top { display: flex; align-items: center; justify-content: space-between; }
.game-emoji {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 24px;
  color: var(--color-accent-300);
  background: var(--color-accent-900);
  box-shadow: inset 0 0 0 1px var(--color-accent-800);
}
.game-card .card-kicker { margin-top: 6px; }
.game-name-big { font-size: 18px; font-weight: 500; line-height: 1.2; }
.game-desc { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.game-meta { font-size: 12px; color: color-mix(in srgb, var(--color-text) var(--muted), transparent); }
.game-meta.played { color: var(--color-accent-300); }
.hero-title .ic { color: var(--color-accent-300); }
#rank-place { margin-top: 4px; }

.home-foot { font-size: 12px; text-align: center; margin-top: 8px; }

/* ---------- tablets ---------- */

@media (max-width: 1000px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-row { grid-template-columns: 1fr; }
}

/* ---------- phones ---------- */

@media (max-width: 640px) {
  .home { padding: 14px 14px 28px; gap: 16px; }
  .home-main { gap: 16px; }
  .home-nav .brand { font-size: 18px; }
  .home-nav { gap: 10px; }
  .home-nav .tag { padding: 6px 10px; }
  .account .who { display: none; }   /* on phones, just the circle with your initials */
  .account .btn { padding: 0 12px; }
  .hero-card { padding: 20px; gap: 14px; }
  .hero-title { font-size: 26px; }
  .ring { width: 88px; height: 88px; }
  .ring-inner { width: 74px; height: 74px; }
  .ring-big { font-size: 20px; }
  .hero-emoji { font-size: 44px; }
  .hero-pip { margin: -6px 0 -10px -4px; }
  .hero-pip .pip { width: 76px; }
  .hero-card .ring { display: none; }   /* on phones Pip takes the ring's spot; game cards still show your level */
  .account { gap: 6px; }
  .account .lb-btn { padding: 0 6px; }
  .account .logout { padding: 4px 2px; }
  .home-nav { gap: 6px; }
  .home-nav .theme-btn { width: 34px; }
}
/* Very narrow phones: the rank card already has a leaderboard link, so drop the small trophy button */
@media (max-width: 420px) {
  .account .lb-btn { display: none; }
}
@media (max-width: 360px) {
  .home-nav .brand { font-size: 16px; gap: 7px; }
  .home-nav .tag { padding: 5px 8px; font-size: 13px; }
  .home-nav .theme-btn { width: 30px; }
  .account .avatar { width: 32px; height: 32px; }
  .home { padding-left: 10px; padding-right: 10px; }
  .home-nav { gap: 4px; }
  .login-banner { flex-wrap: wrap; padding: 14px 16px; gap: 10px 12px; }
  .login-banner-text { flex-basis: calc(100% - 46px); }
  .login-banner .btn { flex: 1; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .game-card { padding: 14px; }
  .game-desc { display: none; }
  .filters { width: 100%; display: flex; }
  .filters .seg-opt { flex: 1; justify-content: center; padding: 7px 4px; }
}
