/* Start screen: blocky sky, spinning sun, drifting clouds */

body {
  margin: 0;
  background: #8fd3ff;
}

.sky {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #8fd3ff;
  font-family: "Nunito", sans-serif;
  color: #12324f;
}

.sun {
  position: absolute;
  right: 70px;
  top: 40px;
  width: 200px;
  height: 200px;
}

.sun__rays {
  position: absolute;
  inset: 0;
  animation: spin 18s linear infinite;
}

.sun__rays span {
  position: absolute;
  left: 92px;
  top: 0;
  width: 16px;
  height: 36px;
  background: #ffb703;
  transform-origin: 8px 100px;
}

.sun__face {
  position: absolute;
  left: 50px;
  top: 50px;
  width: 100px;
  height: 100px;
  background: #ffd23f;
  box-shadow: inset -10px -10px 0 #f4a300;
}

.cloud {
  position: absolute;
  left: 0;
  animation: drift linear infinite;
}

.cloud__top {
  width: calc(80px * var(--size));
  height: calc(32px * var(--size));
  margin-left: calc(48px * var(--size));
  background: #fff;
}

.cloud__bottom {
  width: calc(192px * var(--size));
  height: calc(40px * var(--size));
  background: #fff;
  box-shadow: inset 0 -8px 0 #dcefff;
}

.title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 16px;
  text-align: center;
}

.title h1 {
  margin: 0;
  font-family: "Lilita One", sans-serif;
  font-weight: 400;
  font-size: clamp(48px, 9vw, 96px);
  color: #fff;
  text-shadow: 6px 6px 0 #1d4e89;
  animation: bob 2.4s ease-in-out infinite;
}

.title p {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.start-button {
  padding: 22px 64px;
  border: 0;
  background: #ff6b35;
  color: #fff;
  text-decoration: none;
  font-family: "Lilita One", sans-serif;
  font-size: 44px;
  letter-spacing: 3px;
  cursor: pointer;
  clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0 50%);
  transition: transform 0.15s;
}

.start-button:hover {
  transform: scale(1.06);
}

.title .coming-soon {
  font-size: 16px;
  font-weight: 600;
}

.grass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 170px;
  background:
    linear-gradient(#5ec639 0 44px, #46a52a 44px 56px, transparent 56px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 2px, transparent 2px) 0 56px / 56px 56px,
    linear-gradient(rgba(0, 0, 0, 0.08) 2px, transparent 2px) 0 56px / 56px 56px,
    #8b5a2b;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes drift {
  from { transform: translateX(-300px); }
  to { transform: translateX(110vw); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .sun__rays, .cloud, .title h1 { animation: none; }
}

/* "Who's playing?" buttons */
.players {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.player-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 170px;
  padding: 22px 0 18px;
  border: 0;
  background: var(--colour);
  color: #fff;
  font-family: "Lilita One", sans-serif;
  font-size: 34px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.18), 0 8px 0 rgba(18, 50, 79, 0.25);
  transition: transform 0.15s;
}

.player-button:hover,
.player-button:focus-visible {
  transform: translateY(-4px) scale(1.05);
}

.player-button__icon {
  font-size: 56px;
  line-height: 1;
}

.players__new {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
}

.players__new input[type="text"],
.players__new input[type="password"] {
  width: 180px;
  min-height: 44px;
  padding: 0 12px;
  border: 4px solid #12324f;
  font: 800 20px "Nunito", sans-serif;
}

.players__join {
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  background: #ff6b35;
  color: #fff;
  font: 24px "Lilita One", sans-serif;
  cursor: pointer;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}

.players__alert {
  margin: 0;
  padding: 8px 14px;
  background: #fff;
  border: 3px solid #c92a2a;
  font-weight: 800;
}

/* "Where to?" choices: kept in the sky, above the grass */
.title--above-grass {
  bottom: 120px;
  z-index: 1;
  gap: 18px;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 16px;
}

/* Centred when there's room, but scrolls from the top (not cut off) when there isn't */
.title--above-grass > :first-child { margin-top: auto; }
.title--above-grass > :last-child { margin-bottom: auto; }

.player-button {
  text-decoration: none;
  text-align: center;
}

.player-button--wide {
  width: 300px;
}

.player-button small {
  font: 800 15px "Nunito", sans-serif;
  letter-spacing: 0;
}

.player-button--card {
  cursor: default;
}

.player-button--card:hover {
  transform: none;
}

.player-button--card .players__join {
  width: 240px;
  font-size: 19px;
}

.players__restart {
  max-width: 420px;
  padding: 10px 16px;
  background: #fff;
  border: 3px solid #12324f;
  font-weight: 800;
}

.players__restart summary {
  cursor: pointer;
}

.players__restart form {
  margin-top: 8px;
}

.players__switch {
  color: #12324f;
  font-weight: 800;
}

.players__here {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.2);
}

/* The picture password pad: four yellow slots that fill up, and twelve white bricks to tap */
.pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  --brick: clamp(62px, 19vw, 92px);
}

.pad__slots {
  display: flex;
  gap: 12px;
}

.pad__slot {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  background: rgba(18, 50, 79, 0.3);
  box-shadow: inset 0 6px 0 rgba(18, 50, 79, 0.35);
  font-size: 34px;
  color: #fff;
}

.pad__slot.is-filled {
  background: #f7c52b;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
  animation: pop 0.18s ease-out;
}

.pad__grid {
  display: grid;
  grid-template-columns: repeat(4, var(--brick));
  gap: 12px;
}

.pad__picture {
  position: relative;
  height: var(--brick);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #fff;
  font-size: calc(var(--brick) * 0.5);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 -8px 0 #d3e3f1, 0 6px 0 rgba(18, 50, 79, 0.3);
  transition: transform 0.08s, box-shadow 0.08s;
}

.pad__picture:active {
  transform: translateY(4px);
  box-shadow: inset 0 -4px 0 #d3e3f1, 0 2px 0 rgba(18, 50, 79, 0.3);
}

.pad__picture:focus-visible,
.pad__undo:focus-visible {
  outline: 4px solid #12324f;
  outline-offset: 3px;
}

.pad__undo {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  background: #12324f;
  color: #fff;
  font: 20px "Lilita One", sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.pad__undo:disabled {
  opacity: 0.4;
  cursor: default;
}

.pad.is-sending {
  opacity: 0.6;
  pointer-events: none;
}

.title .pad__tip {
  font-size: 16px;
}

/* Grown-ups (MM, Mama) can type a password instead of tapping pictures */
.typed-password {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #12324f;
}

.typed-password label {
  flex-basis: 100%;
  text-align: center;
}

.typed-password input[type="password"] {
  min-height: 44px;
  width: min(220px, 70vw);
  padding: 0 12px;
  border: 0;
  font-size: 18px;
}

.typed-password input[type="submit"] {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  background: #12324f;
  color: #fff;
  font: 18px "Lilita One", sans-serif;
  cursor: pointer;
}

@keyframes pop {
  from { transform: scale(0.6); }
}

/* Pages of names, and search */
.pager {
  display: flex;
  align-items: center;
  gap: 16px;
  font-weight: 800;
}

.pager__step {
  min-width: 96px;
  padding: 10px 14px;
  background: #fff;
  color: #12324f;
  font: 20px "Lilita One", sans-serif;
  text-decoration: none;
}

span.pager__step {
  visibility: hidden;
}

.players__search input[type="search"] {
  width: 180px;
  min-height: 44px;
  padding: 0 12px;
  border: 4px solid #12324f;
  font: 800 20px "Nunito", sans-serif;
}

/* "Who's playing now?" */
.online {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(520px, 100%);
  margin: 0;
  padding: 0;
  list-style: none;
}

.online__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  color: #12324f;
  box-shadow: inset 0 -5px 0 #d3e3f1;
}

.online__name {
  font: 24px "Lilita One", sans-serif;
}

.online__place {
  padding: 4px 10px;
  background: #868e96;
  color: #fff;
  font-weight: 800;
}

.online__place--together { background: #1c7ed6; }
.online__place--own { background: #f06595; }

.players__link {
  padding: 10px 18px;
  background: #fff;
  color: #12324f;
  font: 20px "Lilita One", sans-serif;
  text-decoration: none;
  box-shadow: inset 0 -5px 0 #d3e3f1;
}

@media (prefers-reduced-motion: reduce) {
  .pad__slot.is-filled { animation: none; }
}

.players__switch--button {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

/* New player: how old are you? */
.ages { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 520px; margin: 12px auto; }
.ages__age {
  font-family: "Lilita One", sans-serif; font-size: 1.8rem; width: 72px; height: 72px; display: grid; place-items: center;
  border-radius: 14px; background: #f7c52b; color: #13213f; text-decoration: none; box-shadow: 0 6px 0 #c99a12;
}
.ages__age--wide { width: auto; padding: 0 18px; font-size: 1.4rem; background: #fff; box-shadow: 0 6px 0 #c3d6e6; }
.ages__age:active { transform: translateY(3px); box-shadow: 0 3px 0 #c99a12; }

/* "See you tomorrow": play time is used up */
.timeup__ideas {
  max-width: 34rem;
  margin: 0 auto 1.4rem;
  font-size: 1.1rem;
}

.timeup__grownup {
  margin-top: 1.4rem;
  font-size: 0.95rem;
}

.timeup__grownup a {
  color: #12324f;
}

.players__new-link a {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: #12324f;
  font-weight: 800;
  text-decoration: none;
}

.players__notice {
  margin: 0;
  padding: 8px 14px;
  background: #fff;
  border: 3px solid #2fa636;
  font-weight: 800;
}

/* A child's friends page */
.friends__card {
  width: min(560px, 100%);
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 0 rgba(18, 50, 79, 0.15);
}

.friends__card h2 {
  margin: 0 0 8px;
  font: 400 1.5rem "Lilita One", sans-serif;
}

.friends__card p {
  margin: 6px 0;
}

.friends__code {
  font-size: 3rem;
  letter-spacing: 0.2em;
}

.friends__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.friends__list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 2px solid #eef2f6;
  font-weight: 800;
}

.friends__list small {
  color: #4a6178;
}

.friends__list form {
  margin: 0;
}

.friends__hide {
  padding: 4px 12px;
  border: 0;
  border-radius: 8px;
  background: #eef2f6;
  font: 800 0.9rem "Nunito", sans-serif;
  cursor: pointer;
}

.players__new select {
  padding: 8px 10px;
  border: 3px solid #12324f;
  border-radius: 8px;
  font: 800 16px "Nunito", sans-serif;
}
