:root {
  --bg: #0d1513;
  --bg-2: #13201c;
  --panel: #18282300;
  --card: #1a2b26;
  --card-2: #213731;
  --line: #2c463e;
  --text: #e8f1ee;
  --muted: #94ada5;
  --accent: #35c48a;
  --accent-2: #1f9c69;
  --gold: #f4c64e;
  --danger: #ef5b5b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 20% -10%, #1d3b31 0%, transparent 60%), var(--bg);
}

a { color: inherit; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--card-2);
  color: var(--text);
  transition: transform .08s ease, background .15s ease, opacity .15s;
}
button:hover:not(:disabled) { background: #2a463e; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #062417; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #48d79b; }
button.ghost { background: transparent; border: 1px solid var(--line); }
button.danger { background: transparent; border: 1px solid #6b2f2f; color: #ff9a9a; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  background: rgba(13, 21, 19, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .3px; text-decoration: none; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #2a7bd8); color: #04150d; font-weight: 900;
}
.spacer { flex: 1; }
.coins {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: #2b2610; border: 1px solid #5b4c17; color: var(--gold); font-weight: 700;
}
.coins .coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe68a, #d9a520); box-shadow: inset 0 -2px 0 #b07f12; }
.daily { background: #3b3313; color: var(--gold); border: 1px solid #6e5a1a; }
.daily.ready { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 198, 78, .5); } 50% { box-shadow: 0 0 0 8px rgba(244, 198, 78, 0); } }
.user { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
a.user:hover .name { text-decoration: underline; }
.primary-link { background: var(--accent); color: #062417; font-weight: 800; padding: 7px 14px; border-radius: 10px; text-decoration: none; white-space: nowrap; }
.friends-link { position: relative; font-size: 20px; text-decoration: none; padding: 4px; line-height: 1; }
.friends-badge { position: absolute; top: -4px; right: -6px; min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
  background: #ef5b5b; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.friends-badge.hidden { display: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--card-2);
  display: grid; place-items: center; font-weight: 700;
}

/* ---------- Platform menu ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; }
.hero h1 { margin: 8px 0 6px; font-size: clamp(28px, 4vw, 42px); }
.hero p { margin: 0 0 28px; color: var(--muted); font-size: 17px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.game-card {
  position: relative; overflow: hidden; border-radius: 18px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease, border-color .15s ease;
}
.game-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.game-card .art {
  height: 150px; display: grid; place-items: center; font-size: 72px;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .18), transparent 60%), var(--accent-color, #2f9e6b);
}
.game-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-card h3 { margin: 0; font-size: 20px; }
.game-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; flex: 1; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); }
.game-card .play { margin-top: 6px; }
.game-card.soon { opacity: .55; }

/* Filter chips and the game shelves on the home page */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 24px; }
.chip {
  padding: 7px 14px; border-radius: 999px; background: transparent; border: 1px solid var(--line);
  color: var(--muted); font-weight: 600; font-size: 14px;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #062417; }
.shelf { margin: 0 0 36px; }
.shelf-head { margin: 0 0 14px; }
.shelf-head h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.shelf-head .count {
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted);
}
.shelf-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.game-card.featured { flex-direction: row; margin: 0 0 36px; }
.game-card.featured .art { height: auto; min-height: 210px; flex: 0 0 38%; font-size: 110px; }
.game-card.featured .body { padding: 24px 28px; gap: 10px; }
.game-card.featured h3 { font-size: 28px; }
.game-card.featured p { font-size: 15px; flex: 0; }
.game-card.featured .play { align-self: flex-start; padding-left: 28px; padding-right: 28px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
@media (max-width: 640px) {
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 20px; padding: 0 16px; scrollbar-width: none; }
  .chip { flex: 0 0 auto; }
  .game-card.featured { flex-direction: column; }
  .game-card.featured .art { min-height: 130px; flex-basis: auto; font-size: 72px; }
  .game-card.featured .body { padding: 16px 18px 18px; }
  .game-card.featured h3 { font-size: 22px; }
  /* Each shelf is one row you swipe sideways */
  .shelf-row {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px;
    margin: 0 -16px; padding: 4px 16px 12px; scrollbar-width: none;
  }
  .shelf-row::-webkit-scrollbar, .filters::-webkit-scrollbar { display: none; }
  .shelf-row .game-card { flex: 0 0 78%; scroll-snap-align: start; }
  .shelf-row .game-card:hover { transform: none; }
}


.signin-card {
  max-width: 460px; margin: 0 auto 32px; padding: 24px; border-radius: 18px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center;
}
.signin-card h2 { margin-top: 0; }
.signin-card .muted { color: var(--muted); }
.dev-login { display: flex; gap: 8px; margin-top: 16px; justify-content: center; }
.dev-login input { width: 180px; }
#googleButton { display: flex; justify-content: center; min-height: 44px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100;
  background: #10201b; border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
.toast.error { border-color: #7a3030; color: #ffb4b4; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 8, 6, .65); backdrop-filter: blur(3px);
}
.modal {
  width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; }
.tx { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tx .plus { color: var(--accent); }
.tx .minus { color: var(--danger); }
.hidden { display: none !important; }

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .user .name { display: none; }
  .container { padding: 20px 16px 48px; }
}

.nav-link { color: var(--gold); text-decoration: none; font-weight: 600; padding: 6px 10px; border-radius: 10px; white-space: nowrap; }
.nav-link:hover { background: var(--card-2); }
@media (max-width: 700px) { .nav-label { display: none; } }
@media (max-width: 480px) { .nav-link { display: none; } }
