.app {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(160deg, var(--canada-red), var(--canada-red-dark));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: var(--ink);
}

.card {
  background: var(--snow);
  width: 100%;
  max-width: 460px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
  animation: pop-in 0.3s ease both;
}

/* Persistent "leave the game" button, pinned bottom-right on the phone. */
.exit-btn {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 60;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}
.exit-btn:active {
  background: rgba(0, 0, 0, 0.55);
}

.brand {
  text-align: center;
  color: #fff;
  margin-bottom: 14px;
}
.brand .logo-img {
  max-height: 27vh;
  max-width: 86%;
}
.brand h1 {
  margin: 0;
  font-size: 2rem;
  text-shadow: 0 3px 0 var(--canada-red-dark);
}

h2 {
  margin: 0 0 14px;
  font-size: 1.5rem;
  color: var(--canada-red);
}

label {
  display: block;
  font-weight: 700;
  margin: 14px 0 6px;
}

input[type='text'] {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1rem;
  border: 2px solid #e5cfcf;
  border-radius: 12px;
  font-family: inherit;
}
input[type='text']:focus {
  outline: none;
  border-color: var(--canada-red);
}
input.code-input {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  text-align: center;
  font-weight: 800;
}

.full {
  width: 100%;
  margin-top: 18px;
}

.msg {
  text-align: center;
  font-size: 1.2rem;
  padding: 10px 0;
}
.err {
  color: var(--canada-red);
  font-weight: 700;
  text-align: center;
  min-height: 1.4em;
}

.big-status {
  text-align: center;
}

/* Easter egg: the lobby avatar is a hidden button — no label, just a tappable
   critter that bounces and plays a sound. */
.avatar-egg {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}
.avatar-egg .avatar {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.1s ease;
}
.avatar-egg:active .avatar {
  transform: scale(0.92);
}
.avatar-egg.boing .avatar {
  animation: avatar-boing 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.6);
}
@keyframes avatar-boing {
  30% {
    transform: scale(1.15) rotate(-5deg);
  }
  60% {
    transform: scale(0.95) rotate(4deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-egg.boing .avatar {
    animation: none;
  }
}
.big-status .emoji {
  font-size: 5.25rem;
  display: block;
  margin-bottom: 10px;
}
/* Status art (replaces the emoji when the PNG is present). */
.emoji .art.status {
  height: 5.1rem;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

.prompt {
  font-size: 1.3rem;
  font-weight: 800;
  background: #fff0ec;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.charcount {
  text-align: right;
  font-size: 0.85rem;
  color: #a08a8a;
}
.submitted-tag {
  color: var(--good);
  font-weight: 800;
  text-align: center;
  margin-top: 8px;
}

.vote-btn {
  display: block;
  width: 100%;
  background: #fff;
  border: 3px solid var(--canada-red);
  color: var(--ink);
  padding: 18px;
  font-size: 1.2rem;
  margin-top: 14px;
  border-radius: 14px;
  text-align: left;
  font-weight: 700;
}
.vote-btn:hover {
  background: #fff0ec;
}
.vote-btn.chosen {
  background: var(--canada-red);
  color: #fff;
}

.timer {
  height: 10px;
  background: #e5cfcf;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}
.timer > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--maple), var(--canada-red));
  transform-origin: left;
}

.vip-note {
  text-align: center;
  margin-top: 10px;
  color: var(--good);
  font-weight: 700;
}

/* ---- race-lane leaderboard ---- */
.board-title {
  text-align: center;
  margin: 0 0 14px;
}
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lane {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #fbeeea;
  animation: lane-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.lane.lead {
  background: linear-gradient(90deg, #fff4d6, #ffe7b0);
  box-shadow: inset 0 0 0 2px var(--gold);
}
.lane.me {
  outline: 2px dashed var(--canada-red);
  outline-offset: 1px;
}
.rank {
  flex: 0 0 auto;
  width: 44px;
  text-align: center;
  font-weight: 900;
}
.rank .medal {
  font-size: 2.4rem;
}
.rank .num {
  color: #b48a8a;
  font-size: 1.5rem;
}
.lane-body {
  flex: 1 1 auto;
  min-width: 0;
}
.lane-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lane-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lane-name .you {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--canada-red);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.lane-score {
  flex: 0 0 auto;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--canada-red);
}
.lane.lead .lane-score {
  color: #a06a00;
}
.track {
  height: 8px;
  margin-top: 6px;
  background: #ecdada;
  border-radius: 999px;
  overflow: hidden;
}
.fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--maple), var(--canada-red));
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.lane.lead .fill {
  background: linear-gradient(90deg, #ffd76a, #f5a623);
}

/* ---- final hero ---- */
.final-hero {
  text-align: center;
  margin-bottom: 16px;
}
.final-hero .emoji {
  font-size: 5.1rem;
  display: block;
  margin-bottom: 6px;
}
.final-hero.won .emoji {
  animation: trophy-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

/* Winning-phone maple-leaf burst. */
.leaf {
  position: fixed;
  top: -8vh;
  font-size: 2.7rem;
  pointer-events: none;
  z-index: 80;
  animation: leaf-fall linear forwards;
}

@keyframes lane-in {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
}
@keyframes trophy-pop {
  0% {
    transform: scale(0.3) rotate(-12deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
@keyframes leaf-fall {
  to {
    transform: translateY(115vh) rotate(360deg);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lane,
  .final-hero.won .emoji {
    animation: none;
  }
  .fill {
    transition: none;
  }
}
