/* Who's playing, in Floral Valley's golden-hour valley: creamy paper, lavender sky, teal and coral,
   warm outlines (the same tokens as floral-valley/styles.css). Words here are for grown-ups; the
   faces, the keypad's numbers and the big ▶ card need no reading. */
:root {
  --ink: #2d2342;
  --ink-soft: #796d7c;
  --paper: #fff9ed;
  --cream: #f4eddd;
  --line: #6c5c6d;
  --teal: #3c8f85;
  --coral: #d78e79;
  --lavender: #d7c8e3;
  --card: rgba(255, 249, 237, 0.92);
  --shadow: 0 5px 0 #77627533, 0 14px 28px #5a3f6a22;
  --font: Nunito, ui-rounded, system-ui, sans-serif;
  --display: Fraunces, Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(#e5d7e8 0%, #f4eddd 55%, #d0dcb5 100%) fixed;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button { font: inherit; touch-action: manipulation; }
button:focus { outline: none; }
button:focus-visible { outline: 4px solid var(--teal); outline-offset: 3px; }

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(24px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
body.has-player main { padding-top: calc(78px + env(safe-area-inset-top, 0px)); }
.logo { width: clamp(72px, 14vw, 110px); height: auto; animation: bob 3.2s ease-in-out infinite; }
h1 {
  margin: 8px 0 0;
  font: 700 clamp(34px, 7vw, 56px) / 1.1 var(--display);
  text-align: center;
}
.lead {
  margin: 6px 0 26px;
  font-size: clamp(20px, 4.5vw, 26px);
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}
footer { margin-top: auto; padding-top: 24px; font-size: 14px; color: var(--ink-soft); }
.noscript { text-align: center; }

/* ---------- the players ---------- */
.picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(18px, 5vw, 40px);
}
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  font: 800 26px var(--font);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.player:hover { transform: translateY(-4px); }
.player:active { transform: scale(0.94); }
.player:focus-visible { outline: none; }
.player:focus-visible .face { outline: 5px solid var(--teal); outline-offset: 4px; }
.face {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.95) 0 9%, rgba(var(--c), 0.3) 45%, rgba(var(--c), 0.9) 100%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.75), var(--shadow);
}
.player .face {
  width: clamp(112px, 26vw, 150px);
  aspect-ratio: 1;
  font-size: clamp(56px, 13vw, 78px);
  animation: bob 2.6s ease-in-out infinite;
}
.player:nth-child(2) .face { animation-delay: -0.9s; }
.player:nth-child(3) .face { animation-delay: -1.7s; }
.player:nth-child(4) .face { animation-delay: -0.4s; }
.player:nth-child(5) .face { animation-delay: -2.1s; }

/* The current player, top right, a log out button. */
.who {
  position: fixed;
  z-index: 1;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 5px 16px 5px 5px;
  border: 0;
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  font: 700 18px var(--font);
  color: var(--ink);
}
button.who { cursor: pointer; }
button.who:active { transform: scale(0.95); }
.who .face { width: 46px; height: 46px; font-size: 26px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75); }

/* ---------- the one card ---------- */
.shelf { width: min(100%, 560px); }
.game {
  display: block;
  overflow: hidden;
  border-radius: 32px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease;
}
.game:active { transform: scale(0.97); }
.game:focus-visible { outline: 5px solid var(--teal); outline-offset: 4px; }
.game .art {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: linear-gradient(#e5d7e8, #d0dcb5);
}
.game .art img { width: 70%; height: 86%; object-fit: contain; animation: bob 3.2s ease-in-out infinite; }
.game .info { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.game h2 { margin: 0; font: 700 clamp(24px, 5vw, 30px) var(--display); }
.game p { margin: 4px 0 0; color: var(--ink-soft); font-weight: 600; }
.game .play {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 28px;
  box-shadow: 0 4px 0 #2a6a62;
}

/* ---------- the passcode keypad ----------
   Ashwin, Tess and Abigail open with a 4-digit code: a card over the picker with the player's
   face, four dots and big number keys. */
.pass {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
    calc(12px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  overflow: auto;
  background: rgba(45, 35, 66, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pass-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(100%, 360px);
  padding: 22px 20px 20px;
  border-radius: 32px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}
.pass-card.shake { animation: shake 0.45s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}
.pass-card .face { width: 84px; height: 84px; font-size: 44px; }
.pass-card h2 { margin: 0; font: 700 clamp(24px, 6vw, 30px) var(--display); color: var(--ink); }
.pass-hint, .pass-msg { margin: 0; min-height: 1.4em; font-size: 16px; font-weight: 700; color: var(--ink-soft); }
.pass-msg.is-wrong { color: #b8566f; }
.dots { display: flex; gap: 14px; margin: 4px 0; }
.dots span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--ink-soft);
  transition: background 0.12s ease, transform 0.12s ease;
}
.dots span.on { background: var(--ink); border-color: var(--ink); transform: scale(1.12); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.key {
  height: 64px;
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 4px 0 #77627533;
  font: 800 30px var(--font);
  color: var(--ink);
  cursor: pointer;
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #77627533; }
.key:disabled { opacity: 0.6; cursor: default; }
.key.back { font-size: 26px; }
.pass-notme {
  margin-top: 4px;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 28px;
  background: none;
  font: 700 18px var(--font);
  color: var(--ink-soft);
  cursor: pointer;
}

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

@media (prefers-reduced-motion: reduce) {
  .logo, .player .face, .game .art img { animation: none; }
  .pass-card.shake { animation: none; }
}
