/* One look, soft and bright like a picture book at dawn, in both system themes. */
:root {
  --bg: #fff4e8;
  --panel: #ffffff;
  --ink: #4b2e52;
  --mute: #9a7fa0;
  --line: #f0dbe6;
  --accent: #ff7fa6;
  --gold: #f5b83d;
  --hero: #ffd86b;
  --display: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: linear-gradient(var(--bg), #ffe7ef);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  height: 100%;
  max-width: 460px;
  margin: 0 auto;
}

/* One screen shows at a time: the start, the map, the stories, the shop, or a level. */
.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: env(safe-area-inset-top, 0px) 16px calc(14px + env(safe-area-inset-bottom, 0px));
  animation: screen-in 0.24s ease-out;
}

/* For what a screen reader should be told and nobody needs to see. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding-top: 8px;
}

/* Everything you can press looks like a sticker: a dark outline and a little step under it. */
.chip,
.hero,
.skill,
.btn,
.back,
.tab,
.pick {
  border: 2.5px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
}

/* The round button at the top left of every screen but the first: back to where you came from. */
.back {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--panel);
  border-radius: 50%;
  cursor: pointer;
}

.back svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-left: -2px;
}

.chip {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  background: var(--panel);
  border-radius: 999px;
  padding: 5px 16px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tally {
  margin-left: auto;
  display: flex;
  align-items: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.tally .star {
  width: 20px;
  height: 20px;
  margin-right: 3px;
}

.tally .coin {
  margin-left: 10px;
}

/* The start. A picture of the hour before sunrise with the game's name over it, the two ways to play, and the shop and the menu underneath. */
#home .top {
  justify-content: flex-end;
}

.home-art {
  flex: 1;
  min-height: 150px;
  position: relative;
  overflow: hidden;
  background: #b9b2f0;
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 5px 0 var(--ink);
}

.home-art canvas,
.map-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ways {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 6px;
}

/* The opening (see homeScene): until the first frame is drawn the ways in wait out of sight, and then they come up one after another, after the sun. */
#home:not(.opening) .ways,
#home:not(.opening) .actions,
#home:not(.opening) .top .tally {
  visibility: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  #home.opening .way,
  #home.opening .actions .btn,
  #home.opening .top .tally {
    animation: arrive 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  }
  #home.opening .way.story {
    animation-delay: 0.85s;
  }
  #home.opening .way.journey {
    animation-delay: 0.97s;
  }
  #home.opening .actions .btn {
    animation-delay: 1.09s;
  }
  #home.opening .top .tally {
    animation-delay: 1.5s;
  }
}

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

.way {
  display: flex;
  align-items: center;
  gap: 14px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 26px;
  box-shadow: 0 5px 0 var(--ink);
  padding: 9px 16px 11px 11px;
  cursor: pointer;
}

.way.story {
  background: #e3d8ff;
}

.way.journey {
  background: #ffe7a0;
}

.way canvas {
  flex: none;
  width: 62px;
  height: 62px;
  background: rgb(255 255 255 / 0.7);
  border: 2.5px solid var(--ink);
  border-radius: 20px;
}

.way span {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.way b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 28px;
}

.way small {
  font-size: 13.5px;
  font-weight: 700;
  color: #7a5c80;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* An arrow at the end of each, to say it leads somewhere. */
.way::after {
  content: '';
  flex: none;
  width: 11px;
  height: 11px;
  margin-right: 4px;
  border-top: 4px solid var(--ink);
  border-right: 4px solid var(--ink);
  border-radius: 2px;
  transform: rotate(45deg);
}

.way:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}

/* The journey. The map is drawn on a canvas that stays where it is; the strip over it scrolls, and carries a see-through button for every stop. */
.map-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  margin-bottom: 5px;
  background: #8a94e6;
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 5px 0 var(--ink);
}

.map-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.map-scroll::-webkit-scrollbar {
  display: none;
}

.map-track {
  position: relative;
}

.stop {
  position: absolute;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.stop[aria-disabled='true'] {
  cursor: default;
}

/* The stories. The friends along the top, and under them the book of whichever one is chosen. */
.tabs,
.picker {
  display: flex;
  gap: 8px;
}

/* There is a tab for every story that has been told. A tab is as wide as its name needs and never narrower than its face, so with six of them the strip is wider than a phone: it is slid along with a finger, the tab at the edge is cut off to show there are more, and whoever is chosen is brought into view. */
.tabs {
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  /* It runs out to both edges of the screen, past the screen's own margin, so that a tab cut off at the edge is cut off by the edge. */
  padding: 0 16px 7px;
  margin: 0 -16px -7px;
  scroll-padding-inline: 16px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 0 auto;
  scroll-snap-align: center;
  min-width: 50px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  font: inherit;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.1;
  color: var(--ink);
  background: var(--panel);
  border-radius: 18px;
  padding: 3px 3px 6px;
  cursor: pointer;
}

.tab canvas {
  width: 44px;
  height: 44px;
}

.tab[aria-pressed='true'],
.pick[aria-checked='true'] {
  background: #ffe9a8;
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

/* A locked friend's story cannot be opened: the tab is shown, greyed, and does nothing. */
.tab.locked {
  cursor: default;
}

.tab.locked canvas,
.pick.locked canvas,
canvas.asleep {
  filter: grayscale(0.75) opacity(0.5);
}

.lock {
  position: absolute;
  top: -7px;
  right: -6px;
  width: 22px;
  height: 22px;
  padding: 2px;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.lock path,
.lock rect {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.lock rect {
  fill: var(--gold);
}

.shop {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  /* Room for the outlines, which would otherwise be cut off at the edge of what scrolls. */
  margin: 0 -4px;
  padding: 4px 4px 12px;
  scrollbar-width: none;
}

.shop::-webkit-scrollbar {
  display: none;
}

.perk h3 {
  font-family: var(--display);
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
}

.shop p,
.perk p {
  margin: 0;
  color: #7a5c80;
}

.perk {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 22px;
  padding: 12px 14px 15px;
}

.perk h3 {
  font-size: 20px;
  line-height: 1.15;
}

.eyebrow {
  display: block;
  margin: 0;
  font-family: var(--body);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent) !important;
}

/* The shop. */
.perk {
  background: #fff0c9;
}

.perk .actions {
  padding-top: 2px;
}

/* The stars a level was won with, on the sheet at its end: they land one after another. */
.big-stars {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
}

.big-stars .star {
  width: 52px;
  height: 52px;
}

.big-stars .star:nth-child(2) {
  width: 64px;
  height: 64px;
}

.big-stars .star.on {
  animation: big-star 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  animation-delay: calc(var(--i) * 0.28s + 0.15s);
}

.coin {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin: 0 0.3em 0 0;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: inset 0 0 0 0.13em #d9942a, 0 0 0 0.11em var(--ink);
  vertical-align: -0.05em;
}

.menu-btn {
  background: none;
  border: 0;
  padding: 8px 0 8px 6px;
  cursor: pointer;
  color: var(--ink);
  display: flex;
}

.menu-btn svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* Keep score above play and lift the thumb controls clear of the bottom edge. */
#play {
  padding-bottom: calc(14px + clamp(10px, 2.5dvh, 24px) + env(safe-area-inset-bottom, 0px));
}

#play > .top,
#play > .sunmeter,
#play > .crew {
  flex-shrink: 0;
}

.board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
  position: relative;
  /* Extra height belongs below the controls, rather than between them and the canvas. */
  max-height: calc((min(100vw, 460px) - 32px) * 560 / 360);
}

#board {
  width: min(100cqw, calc(100cqh * 360 / 560));
  aspect-ratio: 360 / 560;
  touch-action: none;
  background: #b9b2f0;
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 5px 0 var(--ink);
}

/* The sun meter: points so far, filling towards another go. */
/* The meter: the level's points filling towards its three stars, with the next go marked along the way. */
.sunmeter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
}

.sunmeter .caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 3px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sunmeter .caption span {
  font-size: 12.5px;
  color: var(--mute);
}

.sunmeter .bar {
  position: relative;
  height: 22px;
  /* Room for the last star to sit inside the end of the track, and the track's own edge. */
  --end: 15px;
  --edge: 2.5px;
}

.sunmeter .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--panel);
  border: var(--edge) solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  overflow: hidden;
}

.sunmeter .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc((100% - var(--end)) * var(--p, 0));
  background: linear-gradient(90deg, #ffe27a, #ffb84d);
  border-right: 2px solid rgb(255 255 255 / 0.7);
}

.sunmeter .fill.full {
  width: 100%;
  border-right: 0;
}

/* Things that sit along the track at so many points: the stars, the next go, and the sparkles a star throws off. */
.sunmeter .gate,
.sunmeter .go,
.sunmeter .twinkle {
  position: absolute;
  left: calc(var(--edge) + (100% - var(--edge) * 2 - var(--end)) * var(--at, 0));
}

.sunmeter .gate {
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
}

.star {
  display: block;
  overflow: visible;
}

.star path {
  fill: #ffffff;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.star.on path,
.gate.on .star path {
  fill: #ffd23f;
}

.gate .star {
  width: 100%;
  height: 100%;
}

.gate.pop {
  animation: star-pop 0.65s cubic-bezier(0.2, 1.5, 0.4, 1);
  z-index: 1;
}

.sunmeter .go {
  top: 100%;
  transform: translate(-50%, -42%);
  min-width: 20px;
  padding: 1px 3px 2px;
  border-radius: 999px;
  background: var(--panel);
  border: 2px solid var(--ink);
  font-family: var(--display);
  font-style: normal;
  font-weight: 600;
  font-size: 9.5px;
  line-height: 1;
  text-align: center;
  color: var(--ink);
}

.sunmeter .go.pop {
  animation: go-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.sunmeter .twinkle {
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px;
  background: var(--c, #ffd23f);
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
  pointer-events: none;
  animation: twinkle 0.75s ease-out forwards;
  z-index: 2;
}

/* Under the board: who is in the flower, its skill, and how many goes are left. */
.crew {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding-bottom: 4px;
}

/* Who is playing. They are chosen before the level, not here. */
.hero {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  background: var(--panel);
  border-radius: 20px;
  padding: 4px 13px 4px 6px;
}

.hero canvas {
  width: 46px;
  height: 46px;
}

.hero b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.1;
}

.hero-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* The errand of a story level, under the name of whoever is playing it: a picture of what it is about, and how far along it is. */
.errand {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: -3px;
  padding: 0 7px 0 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
  background: #fff0c9;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.errand canvas {
  width: 22px;
  height: 22px;
  margin: -2px 0;
}

.errand i {
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.errand.done {
  background: #ffe27a;
}

.errand.pop {
  animation: errand-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* A thing on its way from the board to whoever is playing. */
.errand-flyer {
  position: fixed;
  z-index: 11;
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.finish-hint {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 6px 12px;
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #ffe9a3;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

/* The skill: one big button in the character's own colour, with a dot for each use left. */
.skill {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font: inherit;
  color: var(--ink);
  background: var(--hero);
  border-radius: 20px;
  padding: 4px 8px;
  cursor: pointer;
  line-height: 1.15;
}

.skill b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.skill i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ink);
}

.skill i.spent {
  background: none;
  box-shadow: inset 0 0 0 2px var(--ink);
  opacity: 0.45;
}

.skill small {
  font-size: 11.5px;
  font-weight: 700;
}

.skill.live {
  animation: ready 0.45s ease-in-out infinite alternate;
}

.skill.spent {
  background: var(--panel);
}

/* A new player is shown the skill: a hand taps the button (see coach in main.ts for the one on the board). */
.skill {
  position: relative;
}

.skill.coach::after {
  content: '';
  position: absolute;
  right: 18%;
  top: 52%;
  width: 34px;
  height: 44px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-16 -4 40 52'%3E%3Cg fill='%23fff' stroke='%234b2e52' stroke-width='2.2' stroke-linejoin='round' transform='rotate(-18)'%3E%3Crect x='-5.5' y='0' width='11' height='30' rx='5.5'/%3E%3Crect x='-8' y='20' width='26' height='24' rx='9'/%3E%3Crect x='-13' y='22' width='9' height='15' rx='4.5'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
  pointer-events: none;
  animation: tap 0.9s ease-in-out infinite;
}

@keyframes tap {
  0%, 100% { transform: translate(0, 8px); }
  45% { transform: translate(-4px, -2px) scale(0.92); }
}

.skill.spent small {
  color: var(--mute);
}

.skill.nope {
  animation: nope 0.3s;
}

/* The goes left are drawn on the board, along its top. This says them for a screen reader and shows nothing. */
.balls {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 10px;
  padding-bottom: 5px;
}

.btn {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  background: var(--panel);
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
}

/* A link that looks like a button (the privacy policy in the menu). */
a.btn {
  display: block;
  text-align: center;
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.big {
  font-size: 20px;
  padding: 12px;
}

.btn:active,
.back:active,
.skill:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: 0 4px 0 var(--ink);
}

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

.link {
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--mute);
  background: none;
  border: 0;
  padding: 6px 12px;
  text-decoration: underline;
  cursor: pointer;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  width: min(calc(100% - 24px), 460px);
  max-width: 100%;
  max-height: calc(100dvh - 24px);
  margin: auto;
}

dialog::backdrop {
  background: var(--bg);
}

.sheet {
  background: var(--bg);
  border: 3px solid var(--ink);
  border-radius: 30px;
  padding: 22px 20px calc(26px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(100dvh - 24px);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 25px;
  margin: 0;
  text-wrap: balance;
}

.sheet h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  margin: 0 0 6px;
}

.sheet section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet p {
  margin: 0;
  color: #7a5c80;
}

.hint {
  font-size: 14px;
}

.gift {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  color: #d98a1c !important;
}

/* Under the buttons on the sheet at the end of a level: the quieter ways on. */
.more {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: -8px;
}

.more:empty {
  display: none;
}

/* The sheet before a level: a small picture of the board, how the player has done on it, and who is to play. */
.brief {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brief canvas {
  flex: none;
  width: 96px;
  aspect-ratio: 360 / 560;
  background: #b9b2f0;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
}

.facts {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.facts .big-stars {
  justify-content: flex-start;
  gap: 5px;
}

.facts .big-stars .star {
  width: 38px;
  height: 38px;
}

.facts .big-stars .star:nth-child(2) {
  width: 46px;
  height: 46px;
}

.facts p {
  font-size: 14.5px;
  line-height: 1.45;
}

.facts b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}

/* On the sheet before a level of a story: what the friend is sent to do there. */
.sheet .errand-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 7px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.2;
  text-wrap: balance;
  color: var(--ink);
  background: #fff0c9;
  border: 2.5px solid var(--ink);
  border-radius: 18px;
}

.errand-line canvas {
  flex: none;
  width: 44px;
  height: 44px;
}

.pick {
  flex: 0 0 calc((100% - 40px) / 6);
  min-width: 0;
  max-width: 68px;
  aspect-ratio: 1;
  position: relative;
  padding: 0;
  background: var(--panel);
  border-radius: 18px;
  cursor: pointer;
}

.pick canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pick.looking {
  outline: 3px dashed var(--mute);
  outline-offset: 2px;
}

/* The friends the player has, six to a row, and after them one quiet way to the rest. */
.picker {
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 4px;
}

.pick.more {
  align-self: center;
  display: grid;
  place-items: center;
  font: inherit;
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  line-height: 0;
  color: var(--mute);
  background: none;
  border: 2px dashed var(--mute);
  box-shadow: none;
}

/* In a story there is nobody to choose: the friend is simply shown. */
.picker.fixed canvas {
  width: 84px;
  height: 84px;
  margin: -6px 0 -8px;
}

.who {
  min-height: 4.2em;
  font-size: 14.5px;
}

.who b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
}

.who span {
  display: inline-block;
  margin: 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

/* What finishing a story brought, on its last page. */
.prize {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff0c9;
  border: 2.5px solid var(--ink);
  border-radius: 20px;
  padding: 8px 14px 10px;
}

.prize canvas {
  flex: none;
  width: 52px;
  height: 52px;
}

.prize p {
  font-size: 14.5px;
}

.prize b {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  color: #d98a1c;
}

.hero-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 4px;
}

.hero-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  gap: 6px 12px;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 22px;
  padding: 10px 14px 14px;
}

.hero-row .pic {
  position: relative;
  width: 60px;
  height: 60px;
}

.hero-row .pic .lock {
  top: auto;
  bottom: -3px;
  right: -5px;
}

/* Under a friend: where things stand with them, and the one thing to press. */
.hero-row .deal {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-row canvas {
  display: block;
  width: 60px;
  height: 60px;
}

.hero-row.locked canvas {
  filter: grayscale(0.75) opacity(0.5);
}

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

.hero-row b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
}

.hero-row b span {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-left: 8px;
}

.hero-row small {
  font-size: 12.5px;
  line-height: 1.3;
  color: #7a5c80;
}

.hero-row .way-line {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--mute);
}

.hero-row .way-line.yours {
  color: #d98a1c;
}

.hero-row .btn {
  flex: none;
  min-width: 112px;
  font-size: 15px;
  padding: 7px 16px;
  white-space: nowrap;
}

.shop > .link {
  align-self: center;
}

/* A few words at the bottom of a screen, for a press that could not do anything. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  z-index: 12;
  transform: translateX(-50%);
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  pointer-events: none;
  padding: 8px 18px;
  color: var(--ink);
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

/* What is called out over the board. */
.cheer {
  position: absolute;
  top: 36%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  padding: 12px 26px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.cheer.small {
  top: 12%;
  font-size: 19px;
  padding: 8px 18px;
  border-width: 2.5px;
  box-shadow: 0 4px 0 var(--ink);
}

.cheer.big {
  font-size: 40px;
  background: #ffe27a;
  animation:
    pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both,
    sway 0.9s ease-in-out 0.5s infinite alternate;
}

.cheer.bad {
  background: #e9e3f5;
  font-size: 26px;
}

.confetti,
.flash,
.rays {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9;
}

.flash,
.rays {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9;
}

.rays {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9;
}

.flyer {
  position: fixed;
  z-index: 11;
  pointer-events: none;
}

.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
}

.ad-overlay p {
  margin: 0;
}

.ad-title {
  font-family: var(--display);
  font-size: 22px;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes beat {
  to {
    transform: scale(1.07);
  }
}

@keyframes pop {
  from {
    transform: translateX(-50%) scale(0.3);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

@keyframes sway {
  from {
    transform: translateX(-50%) rotate(-3deg);
  }
  to {
    transform: translateX(-50%) rotate(3deg);
  }
}

@keyframes ready {
  to {
    transform: scale(1.06) rotate(-1.5deg);
    filter: brightness(1.08);
  }
}

@keyframes nope {
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes star-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.5) rotate(-35deg);
  }
  45% {
    transform: translate(-50%, -50%) scale(2) rotate(14deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
}

@keyframes go-pop {
  40% {
    transform: translate(-50%, -42%) scale(1.6);
    background: #ffe27a;
  }
}

@keyframes twinkle {
  from {
    transform: translate(0, 0) scale(1.5) rotate(0);
    opacity: 1;
  }
  to {
    transform: translate(var(--dx), var(--dy)) scale(0.3) rotate(120deg);
    opacity: 0;
  }
}

@keyframes big-star {
  from {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@keyframes errand-pop {
  40% {
    transform: scale(1.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .toast,
  .cheer,
  .skill.live,
  .skill.coach::after,
  .skill.nope,
  .errand.pop,
  .gate.pop,
  .sunmeter .go.pop,
  .big-stars .star.on {
    animation: none !important;
  }
}

/* A direct way into play, and a small collection on the existing Friends screen. */
#home { overflow-y: auto; scrollbar-width: none; }
#home .home-art { flex: 1 0 220px; min-height: 220px; max-height: 49dvh; }
#home #continue { flex: none; width: 100%; margin-top: 4px; min-height: 54px; background: #ffe27a; }
#home .ways { flex-direction: row; gap: 12px; margin-top: 0; }
#home .way { flex: 1; min-width: 0; gap: 8px; padding: 10px 9px; border-radius: 20px; }
#home .way canvas { width: 42px; height: 42px; border-radius: 14px; }
#home .way b { font-size: 21px; }
#home .way small { font-size: 10px; white-space: normal; min-height: 25px; }
#home .way::after { display: none; }
.morning-note { margin: 0; text-align: center; color: #705078; font-size: 12px; flex: none; }
.quiet-prompt { padding: 12px; border: 2px solid #cdb8ce; border-radius: 18px; background: #fffaf0; flex: none; }
.quiet-prompt p { margin: 0 0 8px; font-weight: 600; }
.quiet-prompt small { display: block; margin-bottom: 8px; }
.quiet-prompt .actions { flex-wrap: wrap; }
.quiet-prompt .btn { min-height: 44px; font-size: 14px; }
.hero-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.hero-row { display: flex; flex-direction: column; align-items: stretch; gap: 7px; padding: 12px 10px; border-radius: 23px; }
.hero-row .pic { align-self: center; }
.hero-row .pic canvas { width: 70px; height: 70px; }
.hero-row.locked canvas { filter: none; }
.hero-row .info { text-align: center; }
.hero-row .info b { font-size: 18px; }
.hero-row .info b span { display: block; font-size: 12px; }
.hero-row .info small { display: block; font-size: 12px; min-height: 49px; }
.hero-row .deal { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; }
.hero-row .way-line { min-height: 31px; text-align: center; font-size: 11px; }
.hero-row .btn { max-width: 100%; min-height: 42px; white-space: normal; font-size: 13px; }
.hero-row .try-friend { padding: 7px 0; min-height: 44px; font-size: 13px; text-align: center; }
#wardrobe-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 12px; }
.look-card { display: flex; flex-direction: column; gap: 9px; padding: 10px; border: 2.5px solid var(--ink); border-radius: 22px; background: #fffaf4; overflow: hidden; }
.look-card.bundle { grid-column: 1 / -1; }
.look-card canvas { display: block; width: 100%; height: auto; border-radius: 14px; }
.look-card.bundle canvas { max-height: 190px; object-fit: contain; background: #ece4f5; }
.look-card h3 { font: 600 19px/1.1 var(--display); margin: 0; }
.look-card p { font-size: 13px; flex: 1; }
.look-card .btn { font-size: 14px; min-height: 46px; padding: 9px; }
#purchase-art { width: 100%; height: auto; max-height: 34dvh; object-fit: contain; border-radius: 20px; background: #eee6f5; }
.volume-control { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 10px 0; }
.volume-control input { flex: 1; min-width: 100px; accent-color: #af7cc0; min-height: 44px; }
#stats-consent .btn { flex: 1; }
#menu .actions { flex-wrap: wrap; }
#menu .btn { min-height: 44px; }
@media (max-height: 650px) { #home .home-art { min-height: 160px; flex-basis: 160px; } #home .way canvas { width: 32px; height: 32px; } #home .way b { font-size: 18px; } }
#home #continue { color: var(--ink); }
.cheer.small { max-width: calc(100% - 24px); white-space: normal; overflow-wrap: break-word; text-align: center; font-size: clamp(14px, 4.5vw, 20px); }
@media (max-width: 350px) { #play .top { gap: 6px; } #play .top .chip { flex-shrink: 0; padding-inline: 10px; } #play .top .tally { font-size: 16px; } }
@media (max-height: 650px) { #purchase-art { max-height: 125px; object-fit: contain; } #purchase-preview .sheet { padding: 18px; } #purchase-preview .sheet p { font-size: 14px; line-height: 1.35; margin-block: 12px; } }
.btn.primary { color: var(--ink); }
.hero-row .try-friend { color: #653c76; font-weight: 700; text-decoration: none; background: #f0e8f8; border-radius: 12px; }
.hero-row .info b span { color: #a1446b; }
.hero-row .way-line, .hero-row .way-line.yours { color: #705078; }
