:root {
  --bg: #1a0b2e;
  --bg-deep: #10061f;
  --surface: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --text: #fff6fb;
  --muted: #c9b6dd;
  --pink: #ff4fa3;
  --yellow: #ffd23f;
  --ink: #2a1140;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Fredoka', 'Trebuchet MS', sans-serif;
  color: var(--text);
  background:
    radial-gradient(60rem 30rem at 10% -10%, rgba(255, 79, 163, 0.28), transparent 60%),
    radial-gradient(50rem 30rem at 110% 10%, rgba(80, 200, 255, 0.18), transparent 60%),
    var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: var(--pink);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  transform: rotate(-6deg);
  box-shadow: 4px 4px 0 var(--yellow);
}

.word {
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.install {
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  transition: transform 120ms ease-out;
}

.install:active {
  transform: scale(0.95);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px 24px;
}

h1 {
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 700;
  margin: 22px 0 18px;
}

.empty {
  color: var(--muted);
  font-size: 18px;
}

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.games li {
  animation: pop-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

.card {
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-rows: 1fr auto;
  gap: 4px 14px;
  padding: 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--tint);
  color: inherit;
  text-decoration: none;
  transition: transform 120ms ease-out;
}

.card:active {
  transform: scale(0.97);
}

.thumb {
  grid-row: span 2;
  width: 96px;
  height: 96px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--tint);
}

.info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.title {
  font-weight: 700;
  font-size: 20px;
  line-height: 1.15;
}

.desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.play {
  justify-self: start;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--tint);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 6px 18px;
}

.card:hover .play {
  box-shadow: 0 0 12px var(--tint);
}

.ios-tip {
  margin-top: 24px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.ios-tip b {
  color: var(--text);
}

footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  color: var(--muted);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .games li {
    animation: none;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.actions form {
  margin: 0;
}

.ghost {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  transition: transform 120ms ease-out;
}

.ghost:active {
  transform: scale(0.95);
}

.showing-all {
  margin: -8px 0 18px;
  color: var(--yellow);
}

.tag {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 4px;
  padding: 2px 6px;
}

.gate {
  width: min(92vw, 380px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.gate::backdrop {
  background: rgba(10, 4, 20, 0.7);
  backdrop-filter: blur(4px);
}

.gate form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.gate h2 {
  margin: 0;
  font-size: 24px;
}

.gate p {
  margin: 0;
  color: var(--muted);
}

.password {
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 48px;
}

.password:focus {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
}

.gate .wrong {
  color: #ff8fb8;
  font-weight: 600;
}

.gate-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 520px) {
  .top {
    flex-wrap: wrap;
  }

  .actions {
    justify-content: flex-start;
  }
}
