/* Flocken: a soft pastel meadow. Sky above, hills below, everything round. */

:root {
  --ink: #4a3b52; /* text: a warm plum instead of black */
  --mute: #7b6b85;
  --sky-top: #bfe6ff;
  --sky-low: #fff3e6;
  --hill: #bfeec6;
  --hill-far: #d6f5d0;
  --card: #ffffff;
  --line: #eadff5;
  --pink: #ffa6cb;
  --pink-deep: #e87aa8;
  --butter: #ffe07a;
  --butter-deep: #e9bf45;
  --mint: #e3fbe6;
  --mint-deep: #86d79a;
  --leaf: #2f7d49;
  --lilac: #f1eaff;
  --lilac-deep: #b9a3f0;
  --focus: #6b4dff;

  /* Sheep colours; `.sheep.black` swaps them. */
  --fleece: #ffffff;
  --fleece-edge: #e3d6f0;
  --face: #ffe3d3;
  --hoof: #4a3b52;
  --blush: #ff9ec4;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font:
    500 17px/1.45 "Fredoka",
    ui-rounded,
    "Nunito",
    "Segoe UI",
    system-ui,
    sans-serif;
  background: linear-gradient(var(--sky-top), var(--sky-low) 70%) fixed;
}

/* Two rolling hills along the bottom of the screen, behind everything. */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  bottom: -14vh;
  height: 34vh;
  border-radius: 50%;
}

body::before {
  left: -30vw;
  width: 110vw;
  background: var(--hill-far);
}

body::after {
  right: -35vw;
  width: 120vw;
  bottom: -18vh;
  background: var(--hill);
}

header,
main {
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 6px;
}

main {
  padding-bottom: 56px;
}

/* ---- Text ---- */

h1 {
  font-size: clamp(2.1rem, 9vw, 2.7rem);
  line-height: 1.05;
  font-weight: 700;
  margin: 6px 0;
}

h2 {
  font-size: 1.55rem;
  line-height: 1.15;
  font-weight: 700;
  margin: 4px 0 14px;
  overflow-wrap: anywhere;
}

p {
  margin: 0 0 12px;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lede {
  font-size: 1.12rem;
}

.small {
  font-size: 0.94rem;
  color: var(--mute);
  margin: 10px 0 0;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.55rem;
  color: var(--ink);
  text-decoration: none;
}

.mark img {
  border-radius: 12px;
  box-shadow: 0 3px 0 rgba(74, 59, 82, 0.12);
}

/* ---- Sheep ---- */

.sheep {
  display: inline-block;
  width: 34px;
  flex: none;
}

.sheep svg {
  display: block;
  width: 100%;
  height: auto;
}

.sheep.black {
  --fleece: #54445f;
  --fleece-edge: #3a2d44;
}

.herd {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 14px 0 6px;
}

.herd .sheep {
  width: 18%;
  animation: bob 2.6s ease-in-out infinite;
}

.herd .sheep:nth-child(2) {
  animation-delay: -0.5s;
}

.herd .sheep:nth-child(3) {
  animation-delay: -1.1s;
}

.herd .sheep:nth-child(4) {
  animation-delay: -1.7s;
}

.herd .sheep:nth-child(5) {
  animation-delay: -2.2s;
}

@keyframes bob {
  50% {
    transform: translateY(-7px) rotate(-3deg);
  }
}

/* ---- Top bar ---- */

#top {
  display: flex;
  gap: 10px;
  align-items: center;
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.seg button {
  all: unset;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--mute);
}

.seg button[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--line);
}

/* The invite code, written on a sheep's ear tag. */
.tag {
  --hole: var(--card);
  position: relative;
  display: inline-block;
  background: var(--butter);
  color: var(--ink);
  font-weight: 700;
  font-size: 2.9rem;
  line-height: 1;
  letter-spacing: 0.14em;
  padding: 42px 16px 20px 26px;
  border-radius: 20px 20px 48px 48px;
  box-shadow: 0 6px 0 var(--butter-deep);
  transform: rotate(-2deg);
}

.tag::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--hole);
  box-shadow: inset 0 2px 0 var(--butter-deep);
}

.tag.mini {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.1em;
  border: 0;
  cursor: pointer;
  padding: 17px 7px 8px 10px;
  border-radius: 9px 9px 16px 16px;
  box-shadow: 0 3px 0 var(--butter-deep);
}

.tag.mini::before {
  top: 5px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  box-shadow: inset 0 1px 0 var(--butter-deep);
}

/* ---- Cards, fields and buttons ---- */

#note {
  font-weight: 600;
}

#note:not(:empty) {
  background: var(--card);
  border: 3px solid var(--pink);
  border-radius: 18px;
  padding: 9px 14px;
  margin: 8px 0;
}

.card {
  background: var(--card);
  border-radius: 30px;
  padding: 20px;
  margin: 14px 0;
  box-shadow: 0 7px 0 rgba(74, 59, 82, 0.1);
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 12px 0 6px;
}

input,
select {
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fffafd;
  border: 3px solid var(--line);
  border-radius: 20px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--pink-deep);
}

.btn {
  display: block;
  width: 100%;
  min-height: 54px;
  margin-top: 14px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--ink);
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: var(--pink);
  box-shadow: 0 6px 0 var(--pink-deep);
  transition:
    transform 0.08s,
    box-shadow 0.08s;
}

.btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--pink-deep);
}

/* The quieter choice next to a pink button. */
.btn.alt,
.btn.ghost {
  background: var(--card);
  box-shadow:
    0 6px 0 var(--line),
    inset 0 0 0 3px var(--line);
}

.btn.alt:active:not(:disabled),
.btn.ghost:active:not(:disabled) {
  box-shadow:
    0 2px 0 var(--line),
    inset 0 0 0 3px var(--line);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link {
  all: unset;
  cursor: pointer;
  font-weight: 600;
  color: var(--mute);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 12px 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.row > * {
  flex: 1;
  min-width: 0;
}

.row .btn {
  flex: 0 0 auto;
  width: auto;
  margin-bottom: 6px; /* room for the button's shadow, so it lines up with the field */
}

.two {
  display: flex;
  gap: 10px;
}

.two .btn {
  flex: 1;
  padding-left: 8px;
  padding-right: 8px;
}

.or {
  margin: 22px 0 0;
  font-weight: 600;
}

/* ---- Home ---- */

.rules li {
  position: relative;
  padding: 7px 0 7px 26px;
}

.rules li::before {
  content: "♥";
  position: absolute;
  left: 2px;
  color: var(--pink-deep);
}

/* ---- Scoreboard ---- */

#side:not(:empty) {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  padding: 6px 16px 4px;
  margin-top: 16px;
}

#side li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  font-weight: 600;
  border-bottom: 2px dashed var(--line);
}

#side li:last-child {
  border-bottom: 0;
}

#side li.off {
  opacity: 0.5;
}

#side .sheep {
  width: 40px;
}

.nm {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.nm small {
  font-weight: 400;
  color: var(--mute);
  margin-left: 6px;
}

.pts {
  min-width: 2.1em;
  padding: 2px 8px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--butter);
  border-radius: 999px;
}

.tick {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 700;
  color: var(--leaf);
  background: var(--mint);
  box-shadow: inset 0 0 0 2px var(--mint-deep);
}

.x {
  all: unset;
  cursor: pointer;
  width: 34px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--mute);
}

/* ---- Answering ---- */

.tm {
  float: right;
  padding: 3px 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--butter);
  border-radius: 999px;
}

.mine {
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

/* ---- Reveal ---- */

.q {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 16px 0 6px;
}

/* One group of matching answers: a little pen with the sheep that gave it. */
.pen {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 14px 16px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--card);
  border-radius: 26px;
  box-shadow: 0 6px 0 rgba(74, 59, 82, 0.1);
}

button.pen {
  cursor: pointer;
}

.pen.flock {
  background: var(--mint);
  border-color: var(--mint-deep);
}

.pen.lone {
  background: var(--lilac);
  border-color: var(--lilac-deep);
}

.pen.sel {
  border-color: var(--pink-deep);
  box-shadow:
    0 0 0 4px var(--pink),
    0 6px 0 4px var(--pink-deep);
}

.ph {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

/* The host's tick box on each group. */
.ck {
  flex: none;
  align-self: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--card);
  text-align: center;
  line-height: 22px;
  font-size: 0.95rem;
  font-weight: 700;
}

.sel .ck {
  background: var(--pink);
  border-color: var(--pink-deep);
}

.ans {
  flex: 1;
  min-width: 0;
  font-size: 1.45rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.cnt {
  padding: 1px 10px;
  font-weight: 700;
  background: var(--card);
  border-radius: 999px;
}

.who {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  padding: 3px 11px;
  font-size: 0.95rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 999px;
}

.verdict {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-weight: 700;
}

.flock .verdict {
  color: var(--leaf);
}

/* The host's buttons stay within reach under a long list of answers. */
.bar {
  position: sticky;
  bottom: 0;
  margin-top: 14px;
  padding: 12px 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 26px;
}

.bar p {
  margin: 0;
}

.bar .btn {
  margin-top: 8px;
}

/* Answers pop in one after another the first time they are shown. */
.rise .pen {
  animation: pop 0.4s cubic-bezier(0.3, 1.5, 0.6, 1) both;
}

.rise .pen:nth-child(2) {
  animation-delay: 0.12s;
}

.rise .pen:nth-child(3) {
  animation-delay: 0.24s;
}

.rise .pen:nth-child(n + 4) {
  animation-delay: 0.36s;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rise .pen,
  .herd .sheep {
    animation: none;
  }

  .btn {
    transition: none;
  }
}
